From b838f310fc45d9ff02f6e939f04073dc04648d20 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Wed, 10 Aug 2022 18:03:19 -0400 Subject: [PATCH] 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 --- .gitignore | 2 ++ llhttp.spec | 56 ++++++++++++++++++++++++++--------------------------- sources | 4 ++-- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/.gitignore b/.gitignore index a937daa..07a8e95 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /llhttp-6.0.6-nm-dev.tgz /llhttp-6.0.6.tar.gz +/llhttp-6.0.9.tar.gz +/llhttp-6.0.9-nm-dev.tgz diff --git a/llhttp.spec b/llhttp.spec index 40ee0e1..17950fc 100644 --- a/llhttp.spec +++ b/llhttp.spec @@ -17,18 +17,21 @@ # 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 # into any of the usual patterns or templates. - -# Upstream has been asked to provide a proper .so version: -# https://github.com/nodejs/llhttp/issues/140 -# …but for now, we must version the shared library downstream. -%global downstream_soversion 0.1 +# +# Note that there is now a “release” tarball, e.g. +# https://github.com/nodejs/llhttp/archive/refs/tags/release/v%%{version}tar.gz, +# that allows this package to be built without the NodeJS/TypeScript machinery. +# 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 -Version: 6.0.6 +Version: 6.0.9 +%global so_version 6.0 Release: %autorelease 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 # RPMs, and we do not need a file llhttp-%%{version}-bundled-licenses.txt. License: MIT @@ -64,7 +67,7 @@ BuildRequires: cmake BuildRequires: gcc # For tests -BuildRequires: clang +BuildRequires: gcc-c++ # For check-null-licenses BuildRequires: python3-devel @@ -92,6 +95,15 @@ developing applications that use llhttp. %prep %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. Don’t 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 # TypeScript sources. tar -xzf '%{SOURCE2}' @@ -109,35 +121,20 @@ sed -r -i 's@\bnpx[[:blank:]](ts-node)\b@node_modules/.bin/\1@' Makefile %build # Generate the C source “release” from TypeScript using the “node_modules_dev” # bundle. -%make_build release -# 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 +%make_build release TAG='%{version}' -# To help prove that nothing from the bundled NodeJS dependencies is included -# in the binary packages, remove the “node_modules” symlinks. +# To help prove that nothing from the bundled NodeJS dev dependencies is +# included in the binary packages, remove the “node_modules” symlinks. rm -rvf node_modules cd release -%cmake -DBUILD_SHARED_LIBS:BOOL=ON +%cmake %cmake_build %install cd release %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 @@ -154,20 +151,21 @@ popd %{python3} '%{SOURCE3}' --exceptions '%{SOURCE4}' --with dev node_modules_dev # 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 \ test/*-test.ts %files %license release/LICENSE-MIT -%{_libdir}/libllhttp.so.%{downstream_soversion} +%{_libdir}/libllhttp.so.%{so_version}{,.*} %files devel %doc release/README.md %{_includedir}/llhttp.h %{_libdir}/libllhttp.so +%{_libdir}/pkgconfig/libllhttp.pc %{_libdir}/cmake/llhttp diff --git a/sources b/sources index b6d65e0..882aae3 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (llhttp-6.0.6-nm-dev.tgz) = ea8905b57f51ad2d870d17dc579ec5fe2175b3bb898f304af4f1e3bd52782488dfb9bb38281f1a826d1745fa608e0200e52239ea5bd525392ad7150461d03448 -SHA512 (llhttp-6.0.6.tar.gz) = 6d621aafcf8b0fcddfb8ceb04b69caa4c79f4b955c9548ee8616290a538fcbdd3b2f1f1d35c6609e03d49de01db2b771a60e38fd7f277dd89b5f1a0abc0c31ae +SHA512 (llhttp-6.0.9.tar.gz) = e3c090d6479a76d05698954bb7dee5f20139d67d52a355bd1948219b7646937c5c05d4739c5001803647523a56e4a4fbe4b15498b159a7b15a21a8edbd76916a +SHA512 (llhttp-6.0.9-nm-dev.tgz) = ca68aaba666aa3b3a4ccd24473a55a937975de720a5b88b905d86ad193af43fda8d9c6a4f533d6021343e9c6af45fb651baaddc2d59970344969e78c17c18433