From 33949a413c4f4ae773876ccba9036db8a694cae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Sat, 30 Aug 2014 20:43:31 +0200 Subject: [PATCH] python34: include a patch to fix http://bugs.python.org/issue21121 --- .../interpreters/python/3.4/default.nix | 2 + .../python/3.4/issue21121-3.patch | 86 +++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 pkgs/development/interpreters/python/3.4/issue21121-3.patch diff --git a/pkgs/development/interpreters/python/3.4/default.nix b/pkgs/development/interpreters/python/3.4/default.nix index 3477cedf4b74..312bf247de7c 100644 --- a/pkgs/development/interpreters/python/3.4/default.nix +++ b/pkgs/development/interpreters/python/3.4/default.nix @@ -36,6 +36,8 @@ stdenv.mkDerivation { NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isLinux "-lgcc_s"; + patches = [ ./issue21121-3.patch ]; + preConfigure = '' for i in /usr /sw /opt /pkg; do # improve purity substituteInPlace ./setup.py --replace $i /no-such-path diff --git a/pkgs/development/interpreters/python/3.4/issue21121-3.patch b/pkgs/development/interpreters/python/3.4/issue21121-3.patch new file mode 100644 index 000000000000..506d9ea9b3d9 --- /dev/null +++ b/pkgs/development/interpreters/python/3.4/issue21121-3.patch @@ -0,0 +1,86 @@ +diff --git a/Makefile.pre.in b/Makefile.pre.in +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -71,12 +71,17 @@ + BASECFLAGS= @BASECFLAGS@ + BASECPPFLAGS= @BASECPPFLAGS@ + CONFIGURE_CFLAGS= @CFLAGS@ ++# CFLAGS_NODIST is used for building the interpreter and stdlib C extensions. ++# Use it when a compiler flag should _not_ be part of the distutils CFLAGS ++# once Python is installed (Issue #21121). ++CONFIGURE_CFLAGS_NODIST=@CFLAGS_NODIST@ + CONFIGURE_CPPFLAGS= @CPPFLAGS@ + CONFIGURE_LDFLAGS= @LDFLAGS@ + # Avoid assigning CFLAGS, LDFLAGS, etc. so users can use them on the + # command line to append to these values without stomping the pre-set + # values. + PY_CFLAGS= $(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) ++PY_CFLAGS_NODIST=$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) + # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to + # be able to build extension modules using the directories specified in the + # environment variables +@@ -91,7 +96,7 @@ + # Extra C flags added for building the interpreter object files. + CFLAGSFORSHARED=@CFLAGSFORSHARED@ + # C flags used for building the interpreter object files +-PY_CORE_CFLAGS= $(PY_CFLAGS) $(PY_CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE ++PY_CORE_CFLAGS= $(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE + + + # Machine-dependent subdirectories +diff --git a/configure b/configure +--- a/configure ++++ b/configure +@@ -662,6 +662,7 @@ + LIBTOOL_CRUFT + OTHER_LIBTOOL_OPT + UNIVERSAL_ARCH_FLAGS ++CFLAGS_NODIST + BASECFLAGS + OPT + ABIFLAGS +@@ -6504,7 +6505,7 @@ + + if test $ac_cv_declaration_after_statement_warning = yes + then +- BASECFLAGS="$BASECFLAGS -Werror=declaration-after-statement" ++ CFLAGS_NODIST="$CFLAGS_NODIST -Werror=declaration-after-statement" + fi + + # if using gcc on alpha, use -mieee to get (near) full IEEE 754 +diff --git a/configure.ac b/configure.ac +--- a/configure.ac ++++ b/configure.ac +@@ -1147,6 +1147,7 @@ + fi + + AC_SUBST(BASECFLAGS) ++AC_SUBST(CFLAGS_NODIST) + + # The -arch flags for universal builds on OSX + UNIVERSAL_ARCH_FLAGS= +@@ -1231,7 +1232,7 @@ + + if test $ac_cv_declaration_after_statement_warning = yes + then +- BASECFLAGS="$BASECFLAGS -Werror=declaration-after-statement" ++ CFLAGS_NODIST="$CFLAGS_NODIST -Werror=declaration-after-statement" + fi + + # if using gcc on alpha, use -mieee to get (near) full IEEE 754 +diff --git a/setup.py b/setup.py +--- a/setup.py ++++ b/setup.py +@@ -19,6 +19,12 @@ + + cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ + ++# Add special CFLAGS reserved for building the interpreter and the stdlib ++# modules (Issue #21121). ++cflags = sysconfig.get_config_var('CFLAGS') ++py_cflags_nodist = sysconfig.get_config_var('PY_CFLAGS_NODIST') ++sysconfig.get_config_vars()['CFLAGS'] = cflags + ' ' + py_cflags_nodist ++ + def get_platform(): + # cross build + if "_PYTHON_HOST_PLATFORM" in os.environ: