vstinner / rpms / python3

Forked from rpms/python3 a year ago
Clone
Matej Stuchlik 062472
diff --git a/Makefile.pre.in b/Makefile.pre.in
Matej Stuchlik 062472
--- a/Makefile.pre.in
Matej Stuchlik 062472
+++ b/Makefile.pre.in
Matej Stuchlik 062472
@@ -71,12 +71,17 @@
Matej Stuchlik 062472
 BASECFLAGS=	@BASECFLAGS@
Matej Stuchlik 062472
 BASECPPFLAGS=	@BASECPPFLAGS@
Matej Stuchlik 062472
 CONFIGURE_CFLAGS=	@CFLAGS@
Matej Stuchlik 062472
+# CFLAGS_NODIST is used for building the interpreter and stdlib C extensions.
Matej Stuchlik 062472
+# Use it when a compiler flag should _not_ be part of the distutils CFLAGS
Matej Stuchlik 062472
+# once Python is installed (Issue #21121).
Matej Stuchlik 062472
+CONFIGURE_CFLAGS_NODIST=@CFLAGS_NODIST@
Matej Stuchlik 062472
 CONFIGURE_CPPFLAGS=	@CPPFLAGS@
Matej Stuchlik 062472
 CONFIGURE_LDFLAGS=	@LDFLAGS@
Matej Stuchlik 062472
 # Avoid assigning CFLAGS, LDFLAGS, etc. so users can use them on the
Matej Stuchlik 062472
 # command line to append to these values without stomping the pre-set
Matej Stuchlik 062472
 # values.
Matej Stuchlik 062472
 PY_CFLAGS=	$(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)
Matej Stuchlik 062472
+PY_CFLAGS_NODIST=$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST)
Matej Stuchlik 062472
 # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
Matej Stuchlik 062472
 # be able to build extension modules using the directories specified in the
Matej Stuchlik 062472
 # environment variables
Matej Stuchlik 062472
@@ -91,7 +96,7 @@
Matej Stuchlik 062472
 # Extra C flags added for building the interpreter object files.
Matej Stuchlik 062472
 CFLAGSFORSHARED=@CFLAGSFORSHARED@
Matej Stuchlik 062472
 # C flags used for building the interpreter object files
Matej Stuchlik 062472
-PY_CORE_CFLAGS=	$(PY_CFLAGS) $(PY_CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
Matej Stuchlik 062472
+PY_CORE_CFLAGS=	$(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
Matej Stuchlik 062472
 
Matej Stuchlik 062472
 
Matej Stuchlik 062472
 # Machine-dependent subdirectories
Matej Stuchlik 062472
diff --git a/configure b/configure
Matej Stuchlik 062472
--- a/configure
Matej Stuchlik 062472
+++ b/configure
Matej Stuchlik 062472
@@ -662,6 +662,7 @@
Matej Stuchlik 062472
 LIBTOOL_CRUFT
Matej Stuchlik 062472
 OTHER_LIBTOOL_OPT
Matej Stuchlik 062472
 UNIVERSAL_ARCH_FLAGS
Matej Stuchlik 062472
+CFLAGS_NODIST
Matej Stuchlik 062472
 BASECFLAGS
Matej Stuchlik 062472
 OPT
Matej Stuchlik 062472
 ABIFLAGS
Matej Stuchlik 062472
@@ -6504,7 +6505,7 @@
Matej Stuchlik 062472
 
Matej Stuchlik 062472
     if test $ac_cv_declaration_after_statement_warning = yes
Matej Stuchlik 062472
     then
Matej Stuchlik 062472
-      BASECFLAGS="$BASECFLAGS -Werror=declaration-after-statement"
Matej Stuchlik 062472
+      CFLAGS_NODIST="$CFLAGS_NODIST -Werror=declaration-after-statement"
Matej Stuchlik 062472
     fi
Matej Stuchlik 062472
 
Matej Stuchlik 062472
     # if using gcc on alpha, use -mieee to get (near) full IEEE 754
Matej Stuchlik 062472
diff --git a/configure.ac b/configure.ac
Matej Stuchlik 062472
--- a/configure.ac
Matej Stuchlik 062472
+++ b/configure.ac
Matej Stuchlik 062472
@@ -1147,6 +1147,7 @@
Matej Stuchlik 062472
 fi
Matej Stuchlik 062472
 
Matej Stuchlik 062472
 AC_SUBST(BASECFLAGS)
Matej Stuchlik 062472
+AC_SUBST(CFLAGS_NODIST)
Matej Stuchlik 062472
 
Matej Stuchlik 062472
 # The -arch flags for universal builds on OSX
Matej Stuchlik 062472
 UNIVERSAL_ARCH_FLAGS=
Matej Stuchlik 062472
@@ -1231,7 +1232,7 @@
Matej Stuchlik 062472
 
Matej Stuchlik 062472
     if test $ac_cv_declaration_after_statement_warning = yes
Matej Stuchlik 062472
     then
Matej Stuchlik 062472
-      BASECFLAGS="$BASECFLAGS -Werror=declaration-after-statement"
Matej Stuchlik 062472
+      CFLAGS_NODIST="$CFLAGS_NODIST -Werror=declaration-after-statement"
Matej Stuchlik 062472
     fi
Matej Stuchlik 062472
 
Matej Stuchlik 062472
     # if using gcc on alpha, use -mieee to get (near) full IEEE 754
Matej Stuchlik 062472
diff --git a/setup.py b/setup.py
Matej Stuchlik 062472
--- a/setup.py
Matej Stuchlik 062472
+++ b/setup.py
Matej Stuchlik 062472
@@ -19,6 +19,12 @@
Matej Stuchlik 062472
 
Matej Stuchlik 062472
 cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ
Matej Stuchlik 062472
 
Matej Stuchlik 062472
+# Add special CFLAGS reserved for building the interpreter and the stdlib
Matej Stuchlik 062472
+# modules (Issue #21121).
Matej Stuchlik 062472
+cflags = sysconfig.get_config_var('CFLAGS')
Matej Stuchlik 062472
+py_cflags_nodist = sysconfig.get_config_var('PY_CFLAGS_NODIST')
Matej Stuchlik 062472
+sysconfig.get_config_vars()['CFLAGS'] = cflags + ' ' + py_cflags_nodist
Matej Stuchlik 062472
+
Matej Stuchlik 062472
 def get_platform():
Matej Stuchlik 062472
     # cross build
Matej Stuchlik 062472
     if "_PYTHON_HOST_PLATFORM" in os.environ: