diff --git a/508.patch b/508.patch new file mode 100644 index 0000000..79705df --- /dev/null +++ b/508.patch @@ -0,0 +1,34 @@ +From c9c450135a1adee6223ae3a342fc90bd7eaf5120 Mon Sep 17 00:00:00 2001 +From: "Benjamin A. Beasley" +Date: Wed, 16 Feb 2022 13:19:43 -0500 +Subject: [PATCH] Add env vars to build with system double-conversion + +This fixes #376 and is useful to Linux distribution packagers. + +New environment variables UJSON_BUILD_DC_INCLUDES and UJSON_BUILD_DC_LIBS allow overriding the include path for double-conversion and adding linker flags for an external double-conversion library. They should generally be used together. +--- + setup.py | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/setup.py b/setup.py +index 3a6c581..167b7df 100644 +--- a/setup.py ++++ b/setup.py +@@ -25,9 +25,15 @@ + "./lib/ultrajsonenc.c", + "./lib/ultrajsondec.c", + ], +- include_dirs=["./python", "./lib", "./deps/double-conversion/double-conversion"], ++ include_dirs=["./python", "./lib"] ++ + environ.get( ++ "UJSON_BUILD_DC_INCLUDES", ++ "./deps/double-conversion/double-conversion", ++ ).split(), + extra_compile_args=["-D_GNU_SOURCE"], +- extra_link_args=["-lstdc++", "-lm"] + strip_flags, ++ extra_link_args=["-lstdc++", "-lm"] ++ + environ.get("UJSON_BUILD_DC_LIBS", "").split() ++ + strip_flags, + ) + + with open("python/version_template.h") as f: diff --git a/python-ujson.spec b/python-ujson.spec index 4e8b97d..c8d254d 100644 --- a/python-ujson.spec +++ b/python-ujson.spec @@ -15,12 +15,8 @@ BuildRequires: gcc-c++ BuildRequires: double-conversion-devel %patchlist -# This patch is unconditional, so it is not suitable for offering upstream -# since upstream usually wants to bundle double-conversion. See: -# -# “build against system double-conversion” -# https://github.com/ultrajson/ultrajson/issues/375 -ujson-5.1.0-system-double-conversion.patch +# Add env vars to build with system double-conversion +https://github.com/ultrajson/ultrajson/pull/508.patch # Add env var to control stripping debuginfo https://github.com/ultrajson/ultrajson/pull/507.patch @@ -45,12 +41,13 @@ Python 3 version. %autosetup -n %{modname}-%{version} -p1 # Remove bundled double-conversion rm -vrf deps -# The patch to unbundle double-conversion uses a hard-coded /usr/include. Make -# sure this matches the corresponding RPM macro. -sed -r -i 's@/usr/include@%{_includedir}@g' setup.py %build -UJSON_BUILD_NO_STRIP=1 %py3_build +env \ + UJSON_BUILD_NO_STRIP=1 \ + UJSON_BUILD_DC_INCLUDES='%{_includedir}/double-conversion' \ + UJSON_BUILD_DC_LIBS='-ldouble-conversion' \ + %py3_build %install %py3_install @@ -66,8 +63,8 @@ PYTHONPATH=%{buildroot}%{python3_sitearch} %python3 -m pytest -v %changelog * Mon Feb 14 2022 Benjamin A. Beasley - 5.1.0-1 - Update to 5.1.0 (close RHBZ#1862763) -- Rebase and simplify patch for using system double-conversion; patch stripping - debug symbols separately +- Unbundle double-conversion and prevent debug symbol stripping with separate + patches, both offered upstream - Drop obsolete %%python_provide macro * Fri Jan 21 2022 Fedora Release Engineering - 4.0.2-2 diff --git a/ujson-5.1.0-system-double-conversion.patch b/ujson-5.1.0-system-double-conversion.patch deleted file mode 100644 index b81620a..0000000 --- a/ujson-5.1.0-system-double-conversion.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff -Naur ujson-5.1.0-original/setup.py ujson-5.1.0/setup.py ---- ujson-5.1.0-original/setup.py 2021-12-20 08:07:30.000000000 -0500 -+++ ujson-5.1.0/setup.py 2022-02-14 11:49:58.791418901 -0500 -@@ -18,9 +18,9 @@ - "./lib/ultrajsonenc.c", - "./lib/ultrajsondec.c", - ], -- include_dirs=["./python", "./lib", "./deps/double-conversion/double-conversion"], -+ include_dirs=["./python", "./lib", "/usr/include/double-conversion"], - extra_compile_args=["-D_GNU_SOURCE"], -- extra_link_args=["-lstdc++", "-lm"] + strip_flags, -+ extra_link_args=["-lstdc++", "-lm", '-ldouble-conversion'] + strip_flags, - ) - - with open("python/version_template.h") as f: