[packages/http-parser] Rel 2

arekm arekm at pld-linux.org
Sun Aug 23 14:43:56 CEST 2026


commit d9fef37e5af1701dd757ca6c4dd4696194fa1a4b
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sun Aug 23 14:43:46 2026 +0200

    Rel 2

 http-parser-gyp-sharedlib.patch | 40 -----------------------
 http-parser.spec                | 71 ++++++++++++++++++++++++-----------------
 2 files changed, 42 insertions(+), 69 deletions(-)
---
diff --git a/http-parser.spec b/http-parser.spec
index 5dfd1ae..a51f7e4 100644
--- a/http-parser.spec
+++ b/http-parser.spec
@@ -1,25 +1,25 @@
+#
+# Conditional build:
+%bcond_without	tests		# unit tests
+#
 Summary:	HTTP request/response parser for C
 Summary(pl.UTF-8):	Analizator żądań/odpowiedzi HTTP dla C
 Name:		http-parser
 Version:	2.9.4
-Release:	1
+Release:	2
 License:	MIT
 Group:		Libraries
 #Source0Download: https://github.com/nodejs/http-parser/releases
+# upstream archived in 2020, 2.9.4 is the final release
 Source0:	https://github.com/nodejs/http-parser/archive/v%{version}/%{name}-%{version}.tar.gz
 # Source0-md5:	1b0f2371aabacbadaa03cc532cedcf92
-# Build shared library with SONAME using gyp and remove -O flags so optflags take over
-# TODO: do this nicely upstream
-Patch0:		%{name}-gyp-sharedlib.patch
-URL:		http://github.com/nodejs/http-parser
-BuildRequires:	libstdc++-devel
-BuildRequires:	gyp
+URL:		https://github.com/nodejs/http-parser
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
-# we use the upstream version from http_parser.h as the SONAME
-%define somajor 2
-%define sominor 9
-%define somicro 4
+# version taken from http_parser.h; SONAME is .so.%{somajor}, not upstream Makefile's .so.%{somajor}.%{sominor}
+%define		somajor	2
+%define		sominor	9
+%define		somicro	4
 
 %description
 This is a parser for HTTP messages written in C. It parses both
@@ -53,21 +53,36 @@ Pliki nagłówkowe biblioteki http-parser.
 
 %prep
 %setup -q
-%patch -P0
 
 %build
-# TODO: fix -fPIC upstream
-export CFLAGS='%{rpmcflags} -fPIC'
-gyp -f make --depth=. http_parser.gyp
-%{__make} V=1 \
+export CPPFLAGS="%{rpmcppflags}"
+export LDFLAGS="%{rpmldflags}"
+# upstream hardcodes -O3/-O0 into its own CFLAGS_* variables, override them so optflags take over
+cflags="%{rpmcflags} -Wall -Wextra -Werror"
+
+# regular variant
+%{__make} library \
 	CC="%{__cc}" \
-	CXX="%{__cxx}" \
-	BUILDTYPE=Release
+	CFLAGS_FAST="$cflags" \
+	SONAME=libhttp_parser.so.%{somajor} \
+	LIBNAME=libhttp_parser.so.%{somajor}.%{sominor}.%{somicro}
+
+# upstream hardcodes the object file name, the strict build would reuse the regular object
+rm libhttp_parser.o
+
+# strict variant
+%{__make} library \
+	CC="%{__cc}" \
+	CFLAGS_FAST="$cflags" \
+	CPPFLAGS_FAST="$CPPFLAGS -I. -DHTTP_PARSER_STRICT=1" \
+	SONAME=libhttp_parser_strict.so.%{somajor} \
+	LIBNAME=libhttp_parser_strict.so.%{somajor}.%{sominor}.%{somicro}
 
 %if %{with tests}
-export LD_LIBRARY_PATH='./out/Release/lib.target'
-./out/Release/test-nonstrict
-./out/Release/test-strict
+%{__make} test \
+	CC="%{__cc}" \
+	CFLAGS_FAST="$cflags" \
+	CFLAGS_DEBUG="$cflags -g"
 %endif
 
 %install
@@ -76,16 +91,14 @@ install -d $RPM_BUILD_ROOT{%{_libdir},%{_includedir}}
 cp -p http_parser.h $RPM_BUILD_ROOT%{_includedir}
 
 # install regular variant
-install -p out/Release/lib.target/libhttp_parser.so.%{somajor} $RPM_BUILD_ROOT%{_libdir}/libhttp_parser.so.%{somajor}.%{sominor}.%{somicro}
-lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libhttp_parser.so.*.*.*)
-ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libhttp_parser.so.%{somajor}
-ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libhttp_parser.so
+install -p libhttp_parser.so.%{somajor}.%{sominor}.%{somicro} $RPM_BUILD_ROOT%{_libdir}
+ln -s libhttp_parser.so.%{somajor}.%{sominor}.%{somicro} $RPM_BUILD_ROOT%{_libdir}/libhttp_parser.so.%{somajor}
+ln -s libhttp_parser.so.%{somajor}.%{sominor}.%{somicro} $RPM_BUILD_ROOT%{_libdir}/libhttp_parser.so
 
 # install strict variant
-install -p out/Release/lib.target/libhttp_parser_strict.so.%{somajor} $RPM_BUILD_ROOT%{_libdir}/libhttp_parser_strict.so.%{somajor}.%{sominor}.%{somicro}
-lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libhttp_parser_strict.so.*.*.*)
-ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libhttp_parser_strict.so.%{somajor}
-ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libhttp_parser_strict.so
+install -p libhttp_parser_strict.so.%{somajor}.%{sominor}.%{somicro} $RPM_BUILD_ROOT%{_libdir}
+ln -s libhttp_parser_strict.so.%{somajor}.%{sominor}.%{somicro} $RPM_BUILD_ROOT%{_libdir}/libhttp_parser_strict.so.%{somajor}
+ln -s libhttp_parser_strict.so.%{somajor}.%{sominor}.%{somicro} $RPM_BUILD_ROOT%{_libdir}/libhttp_parser_strict.so
 
 %clean
 rm -rf $RPM_BUILD_ROOT
diff --git a/http-parser-gyp-sharedlib.patch b/http-parser-gyp-sharedlib.patch
deleted file mode 100644
index 3687b67..0000000
--- a/http-parser-gyp-sharedlib.patch
+++ /dev/null
@@ -1,40 +0,0 @@
---- http_parser.gyp~	2012-11-27 15:40:11.721398004 -0700
-+++ http_parser.gyp	2012-11-27 15:40:11.721398004 -0700
-@@ -12,7 +12,7 @@
-       #       RuntimeLibrary MUST MATCH across the entire project
-       'Debug': {
-         'defines': [ 'DEBUG', '_DEBUG' ],
--        'cflags': [ '-Wall', '-Wextra', '-O0', '-g', '-ftrapv' ],
-+        'cflags': [ '-Wall', '-Wextra', '-g', '-ftrapv' ],
-         'msvs_settings': {
-           'VCCLCompilerTool': {
-             'RuntimeLibrary': 1, # static debug
-@@ -21,7 +21,7 @@
-       },
-       'Release': {
-         'defines': [ 'NDEBUG' ],
--        'cflags': [ '-Wall', '-Wextra', '-O3' ],
-+        'cflags': [ '-Wall', '-Wextra' ],
-         'msvs_settings': {
-           'VCCLCompilerTool': {
-             'RuntimeLibrary': 0, # static release
-@@ -50,7 +50,8 @@
-   'targets': [
-     {
-       'target_name': 'http_parser',
--      'type': 'static_library',
-+      'type': 'shared_library',
-+      'product_extension': 'so.2', 
-       'include_dirs': [ '.' ],
-       'direct_dependent_settings': {
-         'defines': [ 'HTTP_PARSER_STRICT=0' ],
-@@ -73,7 +74,8 @@
- 
-     {
-       'target_name': 'http_parser_strict',
--      'type': 'static_library',
-+      'type': 'shared_library',
-+      'product_extension': 'so.2',
-       'include_dirs': [ '.' ],
-       'direct_dependent_settings': {
-         'defines': [ 'HTTP_PARSER_STRICT=1' ],
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/http-parser.git/commitdiff/d9fef37e5af1701dd757ca6c4dd4696194fa1a4b



More information about the pld-cvs-commit mailing list