From 4904408b2f97c614e1ba642e88524dde5e69e4f4 Mon Sep 17 00:00:00 2001 From: Jan Pokorný Date: Mar 23 2018 12:33:48 +0000 Subject: macros.python*: make LDFLAGS propagated whenever CFLAGS are This is to ensure the right linker flags get propagated into binaries accompanying python packages whenever distutils (or similar, env. variables provided build flags aware) module is delegated to build them (e.g. https://bugzilla.redhat.com/show_bug.cgi?id=1541106). Instead of using "%{__global_ldflags}" as the seed for the respective env. variable one-off application, which would be a direct parallel to "%{optflags}" seeding CFLAGS, use rather "${RPM_LD_FLAGS}" and "${RPM_OPT_FLAGS}", as these are not directly bound to macros out of rpm proper (like it would have been, e.g., on redhat-rpm-config package otherwise). Signed-off-by: Jan Pokorný --- diff --git a/macros.python b/macros.python index 7c0f058..f0039c8 100644 --- a/macros.python +++ b/macros.python @@ -4,22 +4,26 @@ # Use the slashes after expand so that the command starts on the same line as # the macro %py_build() %{expand:\\\ - CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} build --executable="%{__python2} %{py_shbang_opts}" %{?*} + CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ + %{__python} %{py_setup} %{?py_setup_args} build --executable="%{__python2} %{py_shbang_opts}" %{?*} sleep 1 } %py_build_egg() %{expand:\\\ - CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} bdist_egg %{?*} + CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ + %{__python} %{py_setup} %{?py_setup_args} bdist_egg %{?*} sleep 1 } %py_build_wheel() %{expand:\\\ - CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} bdist_wheel %{?*} + CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ + %{__python} %{py_setup} %{?py_setup_args} bdist_wheel %{?*} sleep 1 } %py_install() %{expand:\\\ - CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*} + CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ + %{__python} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*} } %py_install_egg() %{expand:\\\ diff --git a/macros.python2 b/macros.python2 index fc514c2..d6c74c2 100644 --- a/macros.python2 +++ b/macros.python2 @@ -9,22 +9,26 @@ # Use the slashes after expand so that the command starts on the same line as # the macro %py2_build() %{expand:\\\ - CFLAGS="%{optflags}" %{__python2} %{py_setup} %{?py_setup_args} build --executable="%{__python2} %{py2_shbang_opts}" %{?*} + CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ + %{__python2} %{py_setup} %{?py_setup_args} build --executable="%{__python2} %{py2_shbang_opts}" %{?*} sleep 1 } %py2_build_egg() %{expand:\\\ - CFLAGS="%{optflags}" %{__python2} %{py_setup} %{?py_setup_args} bdist_egg %{?*} + CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ + %{__python2} %{py_setup} %{?py_setup_args} bdist_egg %{?*} sleep 1 } %py2_build_wheel() %{expand:\\\ - CFLAGS="%{optflags}" %{__python2} %{py_setup} %{?py_setup_args} bdist_wheel %{?*} + CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ + %{__python2} %{py_setup} %{?py_setup_args} bdist_wheel %{?*} sleep 1 } %py2_install() %{expand:\\\ - CFLAGS="%{optflags}" %{__python2} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*} + CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ + %{__python2} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*} } %py2_install_egg() %{expand:\\\ diff --git a/macros.python3 b/macros.python3 index dc15710..79c33f1 100644 --- a/macros.python3 +++ b/macros.python3 @@ -10,22 +10,26 @@ # Use the slashes after expand so that the command starts on the same line as # the macro %py3_build() %{expand:\\\ - CFLAGS="%{optflags}" %{__python3} %{py_setup} %{?py_setup_args} build --executable="%{__python3} %{py3_shbang_opts}" %{?*} + CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ + %{__python3} %{py_setup} %{?py_setup_args} build --executable="%{__python3} %{py3_shbang_opts}" %{?*} sleep 1 } %py3_build_egg() %{expand:\\\ - CFLAGS="%{optflags}" %{__python3} %{py_setup} %{?py_setup_args} bdist_egg %{?*} + CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ + %{__python3} %{py_setup} %{?py_setup_args} bdist_egg %{?*} sleep 1 } %py3_build_wheel() %{expand:\\\ - CFLAGS="%{optflags}" %{__python3} %{py_setup} %{?py_setup_args} bdist_wheel %{?*} + CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ + %{__python3} %{py_setup} %{?py_setup_args} bdist_wheel %{?*} sleep 1 } %py3_install() %{expand:\\\ - CFLAGS="%{optflags}" %{__python3} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*} + CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ + %{__python3} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*} } %py3_install_egg() %{expand:\\\ diff --git a/python-rpm-macros.spec b/python-rpm-macros.spec index e7868bf..8c095d9 100644 --- a/python-rpm-macros.spec +++ b/python-rpm-macros.spec @@ -1,6 +1,6 @@ Name: python-rpm-macros Version: 3 -Release: 26%{?dist} +Release: 27%{?dist} Summary: The unversioned Python RPM macros License: MIT @@ -69,6 +69,9 @@ install -m 644 %{SOURCE0} %{SOURCE1} %{SOURCE2} %{SOURCE3} \ %changelog +* Fri Mar 23 2018 Miro Hrončok - 3-27 +- make LDFLAGS propagated whenever CFLAGS are + * Fri Feb 09 2018 Fedora Release Engineering - 3-26 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild