From 8449402f77556af669063726e55a7e65c3809da6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 2 Jan 2019 18:15:20 +0100 Subject: [PATCH] Reduced default build flags used to build extension modules Utilize extension_...flags for extension builds. See https://fedoraproject.org/wiki/Changes/Python_Extension_Flags Depends on https://src.fedoraproject.org/rpms/redhat-rpm-config/c/e80fa1344a49662fec08d650debf793048c87429 --- python38.spec | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/python38.spec b/python38.spec index 942b233..b06ab0f 100644 --- a/python38.spec +++ b/python38.spec @@ -17,7 +17,7 @@ URL: https://www.python.org/ %global prerel a1 %global upstream_version %{general_version}%{?prerel} Version: %{general_version}%{?prerel:~%{prerel}} -Release: 2%{?dist} +Release: 3%{?dist} License: Python @@ -170,6 +170,7 @@ BuildRequires: ncurses-devel BuildRequires: openssl-devel BuildRequires: pkgconfig BuildRequires: readline-devel +BuildRequires: redhat-rpm-config >= 127 BuildRequires: sqlite-devel BuildRequires: gdb @@ -406,12 +407,6 @@ Requires: python3-rpm-generators # See https://fedoraproject.org/wiki/Packaging:Directory_Replacement Requires: python3-setuptools -# https://bugzilla.redhat.com/show_bug.cgi?id=1217376 -# https://bugzilla.redhat.com/show_bug.cgi?id=1496757 -# https://bugzilla.redhat.com/show_bug.cgi?id=1218294 -# TODO change to a specific subpackage once available (#1218294) -Requires: redhat-rpm-config - Provides: %{name}-2to3 = %{version}-%{release} Provides: 2to3 = %{version}-%{release} @@ -507,8 +502,6 @@ so extensions for both versions can co-exist in the same directory. %else # with flatpackage -Requires: redhat-rpm-config - # We'll not provide this, on purpose # No package in Fedora shall ever depend on flatpackage via this %global __requires_exclude ^python\\(abi\\) = 3\\..$ @@ -605,13 +598,21 @@ topdir=$(pwd) %endif # Set common compiler/linker flags -export CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIC -fwrapv" -export CXXFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIC -fwrapv" +# We utilize the %%extension_...flags macros here so users building C/C++ +# extensions with our python won't get all the compiler/linker flags used +# in Fedora RPMs. +# Standard library built here will still use the %%build_...flags, +# Fedora packages utilizing %%py3_build will use them as well +# https://fedoraproject.org/wiki/Changes/Python_Extension_Flags +export CFLAGS="%{extension_cflags} -D_GNU_SOURCE -fPIC -fwrapv" +export CFLAGS_NODIST="%{build_cflags} -D_GNU_SOURCE -fPIC -fwrapv" +export CXXFLAGS="%{extension_cxxflags} -D_GNU_SOURCE -fPIC -fwrapv" export CPPFLAGS="$(pkg-config --cflags-only-I libffi)" -export OPT="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIC -fwrapv" +export OPT="%{extension_cflags} -D_GNU_SOURCE -fPIC -fwrapv" export LINKCC="gcc" export CFLAGS="$CFLAGS $(pkg-config --cflags openssl)" -export LDFLAGS="$RPM_LD_FLAGS -g $(pkg-config --libs-only-L openssl)" +export LDFLAGS="%{extension_ldflags} -g $(pkg-config --libs-only-L openssl)" +export LDFLAGS_NODIST="%{build_ldflags} -g $(pkg-config --libs-only-L openssl)" # We can build several different configurations of Python: regular and debug. # Define a common function that does one build: @@ -1478,6 +1479,10 @@ CheckPython optimized # ====================================================== %changelog +* Mon Feb 18 2019 Miro HronĨok - 3.8.0~a1-3 +- Reduced default build flags used to build extension modules + https://fedoraproject.org/wiki/Changes/Python_Extension_Flags + * Sun Feb 17 2019 Igor Gnatenko - 3.8.0~a1-2 - Rebuild for readline 8.0