Add http-parser

This commit is contained in:
2023-05-06 08:23:45 +02:00
committed by Olivier van der Toorn
parent 362a4016d2
commit 3f9e64801b
4 changed files with 81 additions and 0 deletions

View File

@ -0,0 +1,4 @@
AUX http-parser-2.9.4-non-x86-test.patch 645 BLAKE2B c96cb4bbdd4560b738012b0c6a4e527a5d7b1e7253ec69ee65710b2afcd4162680b6835c20144e5baeed8e9dce253a60dbb240943adad91ec5b642cd981e7538 SHA512 4bd68020912ed43e07f2abaf7425e57ab855a3d04086a4b06d3bdb8fb4a30887a6094d0aebbf2fcd67757eda7c9dc2ae0a1c4e9cbcd2242f50fc4f0b38b764c0
DIST http-parser-2.9.4.tar.gz 52056 BLAKE2B 988ebc3f3e1a7d53ed4147dac2e09c4d6021bb1a287990d83130c24e9fee01a3123b4c5ad9e1b86c0f123248484dae272010aa1f3ebd3bd4574d8407ede94e62 SHA512 b45df7b94d1c51079d44687d0a7f901f44faae51df4e84c7e3fe38f130c2d809d0e7c2a146c57b3723e60732aededc246bf44eadb10a95b710963d641f9fe7cd
EBUILD http-parser-2.9.4-r2.ebuild 1235 BLAKE2B 0f97b26ce4c23ffc6bd3b339b3ff158177fb8fdc8d9bbdc2e063b139d25fb107016d1ba9e74b767f74676d29d1a90b339dd81392c162622bdd21347419364e32 SHA512 95fd101fb7faed739b3ee16c3346b05efe372d4c031960ebfe430cbc4020c8af824983cb059634b4694891de39e4cb957dd0dc55a215f489129f1b5b4cf96657
MISC metadata.xml 331 BLAKE2B d6e20b95ae54b8219010abf671695481ae680496170f863526517cbc5dadc226f62c1c9f4df6bc914007c564d8e7e4086854bcc1733219a1839e055d8888528e SHA512 0dcc220dc9e1e3a5ecfc773575b67c94808ce2dd7c573d4f102828b7ecf7f1f209b93a25ed0e0637904342f76d4c036584ccbab1c716d25be1e37fae5ffabf47

View File

@ -0,0 +1,20 @@
diff --git a/test.c b/test.c
index 53a3163..49c4b7a 100644
--- a/test.c
+++ b/test.c
@@ -4343,7 +4343,13 @@ main (void)
printf("http_parser v%u.%u.%u (0x%06lx)\n", major, minor, patch, version);
printf("sizeof(http_parser) = %u\n", (unsigned int)sizeof(http_parser));
- assert(sizeof(http_parser) == 4 + 4 + 8 + 2 + 2 + 4 + sizeof(void *));
+
+#if defined(__i386__) || defined(__x86_64__)
+ /* Should be 32 on both 32 bits and 64 bits x86 because of struct padding,
+ * see https://github.com/nodejs/http-parser/issues/507.
+ */
+ assert(sizeof(http_parser) == 24 + sizeof(void*));
+#endif
//// API
test_preserve_data();

View File

@ -0,0 +1,46 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit toolchain-funcs
DESCRIPTION="HTTP request/response parser for C"
HOMEPAGE="https://github.com/nodejs/http-parser"
SRC_URI="https://github.com/nodejs/http-parser/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="MIT"
# 2.9.4 restored ABI compatibility with 2.9.0 but since we failed
# to set subslot in 2.9.3, we want to provoke another rebuild
SLOT="0/2.9.4"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x64-macos ~x64-solaris"
IUSE="static"
PATCHES=(
"${FILESDIR}"/${P}-non-x86-test.patch
)
src_configure() {
tc-export CC AR
}
src_compile() {
if use static; then
emake PREFIX="${EPREFIX}/usr" LIBDIR="${EPREFIX}/usr/$(get_libdir)" CFLAGS_FAST="${CFLAGS}" package
else
emake PREFIX="${EPREFIX}/usr" LIBDIR="${EPREFIX}/usr/$(get_libdir)" CFLAGS_FAST="${CFLAGS}" library
fi
}
src_test() {
emake CFLAGS_DEBUG="${CFLAGS}" CFLAGS_FAST="${CFLAGS}" test
}
src_install() {
emake DESTDIR="${D}" PREFIX="${EPREFIX}/usr" LIBDIR="${EPREFIX}/usr/$(get_libdir)" install
insinto "${EPREFIX}/usr/$(get_libdir)"
doins libhttp_parser.a
einstalldocs
}

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>mgorny@gentoo.org</email>
<name>Michał Górny</name>
</maintainer>
<upstream>
<remote-id type="github">nodejs/http-parser</remote-id>
</upstream>
</pkgmetadata>