From 3f9e64801bc4a7176d31df9226850082505a9228 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 6 May 2023 08:23:45 +0200 Subject: [PATCH] Add http-parser --- net-libs/http-parser/Manifest | 4 ++ .../http-parser-2.9.4-non-x86-test.patch | 20 ++++++++ .../http-parser/http-parser-2.9.4-r2.ebuild | 46 +++++++++++++++++++ net-libs/http-parser/metadata.xml | 11 +++++ 4 files changed, 81 insertions(+) create mode 100644 net-libs/http-parser/Manifest create mode 100644 net-libs/http-parser/files/http-parser-2.9.4-non-x86-test.patch create mode 100644 net-libs/http-parser/http-parser-2.9.4-r2.ebuild create mode 100644 net-libs/http-parser/metadata.xml diff --git a/net-libs/http-parser/Manifest b/net-libs/http-parser/Manifest new file mode 100644 index 0000000..ee1f5d6 --- /dev/null +++ b/net-libs/http-parser/Manifest @@ -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 diff --git a/net-libs/http-parser/files/http-parser-2.9.4-non-x86-test.patch b/net-libs/http-parser/files/http-parser-2.9.4-non-x86-test.patch new file mode 100644 index 0000000..8bcbbf3 --- /dev/null +++ b/net-libs/http-parser/files/http-parser-2.9.4-non-x86-test.patch @@ -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(); + diff --git a/net-libs/http-parser/http-parser-2.9.4-r2.ebuild b/net-libs/http-parser/http-parser-2.9.4-r2.ebuild new file mode 100644 index 0000000..16c6361 --- /dev/null +++ b/net-libs/http-parser/http-parser-2.9.4-r2.ebuild @@ -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 +} diff --git a/net-libs/http-parser/metadata.xml b/net-libs/http-parser/metadata.xml new file mode 100644 index 0000000..8210ad8 --- /dev/null +++ b/net-libs/http-parser/metadata.xml @@ -0,0 +1,11 @@ + + + + + mgorny@gentoo.org + Michał Górny + + + nodejs/http-parser + +