diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2021-01-04 20:52:16 +0100 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2021-01-04 20:52:16 +0100 |
commit | 4582af606e293d93760eddc0b19fcdb662a6ac44 (patch) | |
tree | 8cba229fb569673431d1f0ac465a2320bb8dfe79 /pkgs/development/interpreters | |
parent | 59ede499ae7f0355df96e954697a4df119342775 (diff) | |
parent | b20838eb4a04560dfe4bd7d2fae42a9ad54dba0f (diff) | |
download | nixlib-4582af606e293d93760eddc0b19fcdb662a6ac44.tar nixlib-4582af606e293d93760eddc0b19fcdb662a6ac44.tar.gz nixlib-4582af606e293d93760eddc0b19fcdb662a6ac44.tar.bz2 nixlib-4582af606e293d93760eddc0b19fcdb662a6ac44.tar.lz nixlib-4582af606e293d93760eddc0b19fcdb662a6ac44.tar.xz nixlib-4582af606e293d93760eddc0b19fcdb662a6ac44.tar.zst nixlib-4582af606e293d93760eddc0b19fcdb662a6ac44.zip |
Merge staging into staging-next
Diffstat (limited to 'pkgs/development/interpreters')
7 files changed, 202 insertions, 26 deletions
diff --git a/pkgs/development/interpreters/proglodyte-wasm/default.nix b/pkgs/development/interpreters/proglodyte-wasm/default.nix index 8ebbf6cf5012..3569f66aed0a 100644 --- a/pkgs/development/interpreters/proglodyte-wasm/default.nix +++ b/pkgs/development/interpreters/proglodyte-wasm/default.nix @@ -14,7 +14,8 @@ let # set this to nonempty string to disable default cmake configure ''; - buildInputs = [ cmake clang python ]; + nativeBuildInputs = [ cmake ]; + buildInputs = [ clang python ]; buildPhase = "make clang-debug-no-tests"; diff --git a/pkgs/development/interpreters/python/cpython/3.6/fix-finding-headers-when-cross-compiling.patch b/pkgs/development/interpreters/python/cpython/3.6/fix-finding-headers-when-cross-compiling.patch new file mode 100644 index 000000000000..d324d10b39fc --- /dev/null +++ b/pkgs/development/interpreters/python/cpython/3.6/fix-finding-headers-when-cross-compiling.patch @@ -0,0 +1,54 @@ +From 45dfbbb4f5b67ab83e4365564ea569334e979f8e Mon Sep 17 00:00:00 2001 +From: Ben Wolsieffer <benwolsieffer@gmail.com> +Date: Fri, 25 Sep 2020 16:49:16 -0400 +Subject: [PATCH] Fix finding headers when cross compiling + +When cross-compiling third-party extensions, get_python_inc() may be called to +return the path to Python's headers. However, it uses the sys.prefix or +sys.exec_prefix of the build Python, which returns incorrect paths when +cross-compiling (paths pointing to build system headers). + +To fix this, we use the INCLUDEPY and CONFINCLUDEPY conf variables, which can +be configured to point at host Python by setting _PYTHON_SYSCONFIGDATA_NAME. +The existing behavior is maintained on non-POSIX platforms or if a prefix is +manually specified. +--- + Lib/distutils/sysconfig.py | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py +index 2bcd1dd288..567375e488 100644 +--- a/Lib/distutils/sysconfig.py ++++ b/Lib/distutils/sysconfig.py +@@ -84,8 +84,6 @@ def get_python_inc(plat_specific=0, prefix=None): + If 'prefix' is supplied, use it instead of sys.base_prefix or + sys.base_exec_prefix -- i.e., ignore 'plat_specific'. + """ +- if prefix is None: +- prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX + if os.name == "posix": + if python_build: + # Assume the executable is in the build directory. The +@@ -98,9 +96,17 @@ def get_python_inc(plat_specific=0, prefix=None): + else: + incdir = os.path.join(get_config_var('srcdir'), 'Include') + return os.path.normpath(incdir) +- python_dir = 'python' + get_python_version() + build_flags +- return os.path.join(prefix, "include", python_dir) ++ if prefix is None: ++ if plat_specific: ++ return get_config_var('CONFINCLUDEPY') ++ else: ++ return get_config_var('INCLUDEPY') ++ else: ++ python_dir = 'python' + get_python_version() + build_flags ++ return os.path.join(prefix, "include", python_dir) + elif os.name == "nt": ++ if prefix is None: ++ prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX + return os.path.join(prefix, "include") + else: + raise DistutilsPlatformError( +-- +2.28.0 + diff --git a/pkgs/development/interpreters/python/cpython/3.7/fix-finding-headers-when-cross-compiling.patch b/pkgs/development/interpreters/python/cpython/3.7/fix-finding-headers-when-cross-compiling.patch new file mode 100644 index 000000000000..543e267e94bf --- /dev/null +++ b/pkgs/development/interpreters/python/cpython/3.7/fix-finding-headers-when-cross-compiling.patch @@ -0,0 +1,54 @@ +From debccd4be0a8d619770f63622d9de1b451dd02ac Mon Sep 17 00:00:00 2001 +From: Ben Wolsieffer <benwolsieffer@gmail.com> +Date: Fri, 25 Sep 2020 16:49:16 -0400 +Subject: [PATCH] Fix finding headers when cross compiling + +When cross-compiling third-party extensions, get_python_inc() may be called to +return the path to Python's headers. However, it uses the sys.prefix or +sys.exec_prefix of the build Python, which returns incorrect paths when +cross-compiling (paths pointing to build system headers). + +To fix this, we use the INCLUDEPY and CONFINCLUDEPY conf variables, which can +be configured to point at host Python by setting _PYTHON_SYSCONFIGDATA_NAME. +The existing behavior is maintained on non-POSIX platforms or if a prefix is +manually specified. +--- + Lib/distutils/sysconfig.py | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py +index 37feae5df7..6d4ad06696 100644 +--- a/Lib/distutils/sysconfig.py ++++ b/Lib/distutils/sysconfig.py +@@ -95,8 +95,6 @@ def get_python_inc(plat_specific=0, prefix=None): + If 'prefix' is supplied, use it instead of sys.base_prefix or + sys.base_exec_prefix -- i.e., ignore 'plat_specific'. + """ +- if prefix is None: +- prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX + if os.name == "posix": + if python_build: + # Assume the executable is in the build directory. The +@@ -109,9 +107,17 @@ def get_python_inc(plat_specific=0, prefix=None): + else: + incdir = os.path.join(get_config_var('srcdir'), 'Include') + return os.path.normpath(incdir) +- python_dir = 'python' + get_python_version() + build_flags +- return os.path.join(prefix, "include", python_dir) ++ if prefix is None: ++ if plat_specific: ++ return get_config_var('CONFINCLUDEPY') ++ else: ++ return get_config_var('INCLUDEPY') ++ else: ++ python_dir = 'python' + get_python_version() + build_flags ++ return os.path.join(prefix, "include", python_dir) + elif os.name == "nt": ++ if prefix is None: ++ prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX + if python_build: + # Include both the include and PC dir to ensure we can find + # pyconfig.h +-- +2.28.0 + diff --git a/pkgs/development/interpreters/python/cpython/3.8/no-ldconfig.patch b/pkgs/development/interpreters/python/cpython/3.8/no-ldconfig.patch index a1f9d68eb166..41d3ab52345b 100644 --- a/pkgs/development/interpreters/python/cpython/3.8/no-ldconfig.patch +++ b/pkgs/development/interpreters/python/cpython/3.8/no-ldconfig.patch @@ -1,19 +1,19 @@ -From 597e73f2a4b2f0b508127931b36d5540d6941823 Mon Sep 17 00:00:00 2001 -From: Frederik Rietdijk <fridh@fridh.nl> -Date: Mon, 28 Aug 2017 09:24:06 +0200 +From 66f492d2eda94bd64db833839a325caf6ba0fed5 Mon Sep 17 00:00:00 2001 +From: Greg Roodt <greg@canva.com> +Date: Wed, 9 Dec 2020 17:59:24 +1100 Subject: [PATCH] Don't use ldconfig --- - Lib/ctypes/util.py | 70 ++---------------------------------------------------- - 1 file changed, 2 insertions(+), 68 deletions(-) + Lib/ctypes/util.py | 77 ++-------------------------------------------- + 1 file changed, 2 insertions(+), 75 deletions(-) diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py -index 5e8b31a854..7b45ce6c15 100644 +index 0c2510e161..7fb98af308 100644 --- a/Lib/ctypes/util.py +++ b/Lib/ctypes/util.py -@@ -94,46 +94,7 @@ elif os.name == "posix": - import re, tempfile - +@@ -100,53 +100,7 @@ elif os.name == "posix": + return thefile.read(4) == elf_header + def _findLib_gcc(name): - # Run GCC's linker with the -t (aka --trace) option and examine the - # library name it prints out. The GCC command will fail because we @@ -51,17 +51,24 @@ index 5e8b31a854..7b45ce6c15 100644 - # Raised if the file was already removed, which is the normal - # behaviour of GCC if linking fails - pass -- res = re.search(expr, trace) +- res = re.findall(expr, trace) - if not res: - return None -- return os.fsdecode(res.group(0)) +- +- for file in res: +- # Check if the given file is an elf file: gcc can report +- # some files that are linker scripts and not actual +- # shared objects. See bpo-41976 for more details +- if not _is_elf(file): +- continue +- return os.fsdecode(file) + return None - - + + if sys.platform == "sunos5": -@@ -255,34 +216,7 @@ elif os.name == "posix": +@@ -268,34 +222,7 @@ elif os.name == "posix": else: - + def _findSoname_ldconfig(name): - import struct - if struct.calcsize('l') == 4: @@ -92,9 +99,8 @@ index 5e8b31a854..7b45ce6c15 100644 - except OSError: - pass + return None - + def _findLib_ld(name): # See issue #9998 for why this is needed --- -2.15.0 - +-- +2.24.3 (Apple Git-128) diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index c67ede82003a..2394e0e259e5 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -100,6 +100,50 @@ let "$out/bin/python" else pythonForBuild.interpreter; + # The CPython interpreter contains a _sysconfigdata_<platform specific suffix> + # module that is imported by the sysconfig and distutils.sysconfig modules. + # The sysconfigdata module is generated at build time and contains settings + # required for building Python extension modules, such as include paths and + # other compiler flags. By default, the sysconfigdata module is loaded from + # the currently running interpreter (ie. the build platform interpreter), but + # when cross-compiling we want to load it from the host platform interpreter. + # This can be done using the _PYTHON_SYSCONFIGDATA_NAME environment variable. + # The _PYTHON_HOST_PLATFORM variable also needs to be set to get the correct + # platform suffix on extension modules. The correct values for these variables + # are not documented, and must be derived from the configure script (see links + # below). + sysconfigdataHook = with stdenv.hostPlatform; with passthru; let + # https://github.com/python/cpython/blob/e488e300f5c01289c10906c2e53a8e43d6de32d8/configure.ac#L428 + # The configure script uses "arm" as the CPU name for all 32-bit ARM + # variants when cross-compiling, but native builds include the version + # suffix, so we do the same. + pythonHostPlatform = "${parsed.kernel.name}-${parsed.cpu.name}"; + + # https://github.com/python/cpython/blob/e488e300f5c01289c10906c2e53a8e43d6de32d8/configure.ac#L724 + multiarchCpu = + if isAarch32 then + if parsed.cpu.significantByte.name == "littleEndian" then "arm" else "armeb" + else if isx86_32 then "i386" + else parsed.cpu.name; + multiarch = + if isDarwin then "darwin" + else "${multiarchCpu}-${parsed.kernel.name}-${parsed.abi.name}"; + + abiFlags = optionalString (isPy36 || isPy37) "m"; + + # https://github.com/python/cpython/blob/e488e300f5c01289c10906c2e53a8e43d6de32d8/configure.ac#L78 + pythonSysconfigdataName = "_sysconfigdata_${abiFlags}_${parsed.kernel.name}_${multiarch}"; + in '' + sysconfigdataHook() { + if [ "$1" = '${placeholder "out"}' ]; then + export _PYTHON_HOST_PLATFORM='${pythonHostPlatform}' + export _PYTHON_SYSCONFIGDATA_NAME='${pythonSysconfigdataName}' + fi + } + + addEnvHooks "$hostOffset" sysconfigdataHook + ''; + in with passthru; stdenv.mkDerivation { pname = "python3"; inherit version; @@ -165,6 +209,13 @@ in with passthru; stdenv.mkDerivation { ] ++ [ # LDSHARED now uses $CC instead of gcc. Fixes cross-compilation of extension modules. ./3.8/0001-On-all-posix-systems-not-just-Darwin-set-LDSHARED-if.patch + # Use sysconfigdata to find headers. Fixes cross-compilation of extension modules. + ( + if isPy36 then + ./3.6/fix-finding-headers-when-cross-compiling.patch + else + ./3.7/fix-finding-headers-when-cross-compiling.patch + ) ] ++ optionals (isPy37 || isPy38) [ # Backport a fix for ctypes.util.find_library. ./3.7/find_library.patch @@ -281,6 +332,10 @@ in with passthru; stdenv.mkDerivation { find $out/lib/python*/config-* -type f -print -exec nuke-refs -e $out '{}' + find $out/lib -name '_sysconfigdata*.py*' -print -exec nuke-refs -e $out '{}' + + # Make the sysconfigdata module accessible on PYTHONPATH + # This allows build Python to import host Python's sysconfigdata + mkdir -p "$out/${sitePackages}" + ln -s "$out/lib/${libPrefix}/"_sysconfigdata*.py "$out/${sitePackages}/" '' + optionalString stripConfig '' rm -R $out/bin/python*-config $out/lib/python*/config-* '' + optionalString stripIdlelib '' @@ -313,6 +368,14 @@ in with passthru; stdenv.mkDerivation { export PATH=${stdenv.lib.makeBinPath [ "$out" bash ]}:$PATH ''; + # Add CPython specific setup-hook that configures distutils.sysconfig to + # always load sysconfigdata from host Python. + postFixup = '' + cat << "EOF" >> "$out/nix-support/setup-hook" + ${sysconfigdataHook} + EOF + ''; + # Enforce that we don't have references to the OpenSSL -dev package, which we # explicitly specify in our configure flags above. disallowedReferences = diff --git a/pkgs/development/interpreters/python/default.nix b/pkgs/development/interpreters/python/default.nix index a217f62986db..70a4731ea6d6 100644 --- a/pkgs/development/interpreters/python/default.nix +++ b/pkgs/development/interpreters/python/default.nix @@ -154,10 +154,10 @@ in { sourceVersion = { major = "3"; minor = "8"; - patch = "6"; + patch = "7"; suffix = ""; }; - sha256 = "qeC3nSeqBW65zOjWOkJ7X5urFGXe4/lC3P2yWoL0q4o="; + sha256 = "sha256-3cwd8Wu1uHqkLsXSCluQLy0IjKommyjgFZD5enmOxQo="; inherit (darwin) configd; inherit passthruFun; }; diff --git a/pkgs/development/interpreters/supercollider/default.nix b/pkgs/development/interpreters/supercollider/default.nix index acdffba8d72b..113eb54a00ba 100644 --- a/pkgs/development/interpreters/supercollider/default.nix +++ b/pkgs/development/interpreters/supercollider/default.nix @@ -1,4 +1,4 @@ -{ stdenv, mkDerivation, fetchurl, cmake, pkgconfig, alsaLib +{ stdenv, fetchurl, cmake, pkgconfig, alsaLib , libjack2, libsndfile, fftw, curl, gcc , libXt, qtbase, qttools, qtwebengine , readline, qtwebsockets, useSCEL ? false, emacs @@ -7,7 +7,7 @@ let optional = stdenv.lib.optional; in -mkDerivation rec { +stdenv.mkDerivation rec { pname = "supercollider"; version = "3.11.2"; @@ -26,8 +26,6 @@ mkDerivation rec { nativeBuildInputs = [ cmake pkgconfig qttools ]; - enableParallelBuilding = true; - buildInputs = [ gcc libjack2 libsndfile fftw curl libXt qtbase qtwebengine qtwebsockets readline ] ++ optional (!stdenv.isDarwin) alsaLib |