Update to 6.0.9 (close RHBZ#2116231)

- Bumped .so version from downstream 0.1 to upstream 6.0
- Better upstream support for building and installing a shared library
- The -devel package now contains a .pc file
- Tests are now built with gcc and fully respect distro flags
This commit is contained in:
Benjamin A. Beasley 2022-08-10 18:03:19 -04:00
parent 3c9caa5f73
commit b838f310fc
3 changed files with 31 additions and 31 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
/llhttp-6.0.6-nm-dev.tgz /llhttp-6.0.6-nm-dev.tgz
/llhttp-6.0.6.tar.gz /llhttp-6.0.6.tar.gz
/llhttp-6.0.9.tar.gz
/llhttp-6.0.9-nm-dev.tgz

View File

@ -17,18 +17,21 @@
# Overall, we cherry-pick from the standard and NodeJS packaging guidelines as # Overall, we cherry-pick from the standard and NodeJS packaging guidelines as
# each seems to best apply, understanding that this package does not fit well # each seems to best apply, understanding that this package does not fit well
# into any of the usual patterns or templates. # into any of the usual patterns or templates.
#
# Upstream has been asked to provide a proper .so version: # Note that there is now a “release” tarball, e.g.
# https://github.com/nodejs/llhttp/issues/140 # https://github.com/nodejs/llhttp/archive/refs/tags/release/v%%{version}tar.gz,
# …but for now, we must version the shared library downstream. # that allows this package to be built without the NodeJS/TypeScript machinery.
%global downstream_soversion 0.1 # However, the release archive lacks the original TypeScript source code for
# the generated C code, which we would need to include in the source RPM as an
# additional source even if we do not do the re-generation ourselves.
Name: llhttp Name: llhttp
Version: 6.0.6 Version: 6.0.9
%global so_version 6.0
Release: %autorelease Release: %autorelease
Summary: Port of http_parser to llparse Summary: Port of http_parser to llparse
# License of llhttp is MIT; nothing from the NodeJS dependency bundle is # License of llhttp is (SPDX) MIT; nothing from the NodeJS dependency bundle is
# installed, so its contents do not contribute to the license of the binary # installed, so its contents do not contribute to the license of the binary
# RPMs, and we do not need a file llhttp-%%{version}-bundled-licenses.txt. # RPMs, and we do not need a file llhttp-%%{version}-bundled-licenses.txt.
License: MIT License: MIT
@ -64,7 +67,7 @@ BuildRequires: cmake
BuildRequires: gcc BuildRequires: gcc
# For tests # For tests
BuildRequires: clang BuildRequires: gcc-c++
# For check-null-licenses # For check-null-licenses
BuildRequires: python3-devel BuildRequires: python3-devel
@ -92,6 +95,15 @@ developing applications that use llhttp.
%prep %prep
%autosetup %autosetup
# Remove build flags specifying ISA extensions not in the architectural
# baseline from the test fixture setup.
sed -r -i 's@([[:blank:]]*)(.*-m(sse4))@\1// \2@' test/fixtures/index.ts
# We build the library that we install via release/CMakeLists.txt, but the
# tests are built via Makefile targets. Dont apply non-default optimization or
# debug flags to the test executables.
sed -r -i 's@ -[Og].\b@@g' Makefile
# Set up bundled (dev) node modules required to generate the C sources from the # Set up bundled (dev) node modules required to generate the C sources from the
# TypeScript sources. # TypeScript sources.
tar -xzf '%{SOURCE2}' tar -xzf '%{SOURCE2}'
@ -109,35 +121,20 @@ sed -r -i 's@\bnpx[[:blank:]](ts-node)\b@node_modules/.bin/\1@' Makefile
%build %build
# Generate the C source “release” from TypeScript using the “node_modules_dev” # Generate the C source “release” from TypeScript using the “node_modules_dev”
# bundle. # bundle.
%make_build release %make_build release TAG='%{version}'
# Apply downstream .so versioning
cat >> release/CMakeLists.txt <<'EOF'
set_target_properties(llhttp PROPERTIES SOVERSION %{downstream_soversion})
EOF
# Fix multilib install paths. We hoped this change would be sufficient, but it
# seems to fix the install paths of the CMake files only, so we still need to
# move the libraries after they are installed.
sed -r -i 's@\b(DESTINATION[[:blank:]]+)lib($|/)@\1%{_libdir}\2@' \
release/CMakeLists.txt
# To help prove that nothing from the bundled NodeJS dependencies is included # To help prove that nothing from the bundled NodeJS dev dependencies is
# in the binary packages, remove the “node_modules” symlinks. # included in the binary packages, remove the “node_modules” symlinks.
rm -rvf node_modules rm -rvf node_modules
cd release cd release
%cmake -DBUILD_SHARED_LIBS:BOOL=ON %cmake
%cmake_build %cmake_build
%install %install
cd release cd release
%cmake_install %cmake_install
if [ '%{_prefix}/lib' != '%{_libdir}' ]
then
mv -v %{buildroot}%{_prefix}/lib/libllhttp.so* '%{buildroot}/%{_libdir}'
# Document the expectation that this directory is now empty:
rmdir '%{buildroot}%{_prefix}/lib'
fi
%check %check
@ -154,20 +151,21 @@ popd
%{python3} '%{SOURCE3}' --exceptions '%{SOURCE4}' --with dev node_modules_dev %{python3} '%{SOURCE3}' --exceptions '%{SOURCE4}' --with dev node_modules_dev
# See scripts.mocha in package.json: # See scripts.mocha in package.json:
NODE_ENV=test ./node_modules/.bin/mocha \ NODE_ENV=test CLANG=gcc ./node_modules/.bin/mocha \
-r ts-node/register/type-check \ -r ts-node/register/type-check \
test/*-test.ts test/*-test.ts
%files %files
%license release/LICENSE-MIT %license release/LICENSE-MIT
%{_libdir}/libllhttp.so.%{downstream_soversion} %{_libdir}/libllhttp.so.%{so_version}{,.*}
%files devel %files devel
%doc release/README.md %doc release/README.md
%{_includedir}/llhttp.h %{_includedir}/llhttp.h
%{_libdir}/libllhttp.so %{_libdir}/libllhttp.so
%{_libdir}/pkgconfig/libllhttp.pc
%{_libdir}/cmake/llhttp %{_libdir}/cmake/llhttp

View File

@ -1,2 +1,2 @@
SHA512 (llhttp-6.0.6-nm-dev.tgz) = ea8905b57f51ad2d870d17dc579ec5fe2175b3bb898f304af4f1e3bd52782488dfb9bb38281f1a826d1745fa608e0200e52239ea5bd525392ad7150461d03448 SHA512 (llhttp-6.0.9.tar.gz) = e3c090d6479a76d05698954bb7dee5f20139d67d52a355bd1948219b7646937c5c05d4739c5001803647523a56e4a4fbe4b15498b159a7b15a21a8edbd76916a
SHA512 (llhttp-6.0.6.tar.gz) = 6d621aafcf8b0fcddfb8ceb04b69caa4c79f4b955c9548ee8616290a538fcbdd3b2f1f1d35c6609e03d49de01db2b771a60e38fd7f277dd89b5f1a0abc0c31ae SHA512 (llhttp-6.0.9-nm-dev.tgz) = ca68aaba666aa3b3a4ccd24473a55a937975de720a5b88b905d86ad193af43fda8d9c6a4f533d6021343e9c6af45fb651baaddc2d59970344969e78c17c18433