diff options
Diffstat (limited to 'nixpkgs/pkgs/development/interpreters/python/cpython/default.nix')
-rw-r--r-- | nixpkgs/pkgs/development/interpreters/python/cpython/default.nix | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix index 37b9d19fe88d..ab5960b5ea61 100644 --- a/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix @@ -121,6 +121,9 @@ let versionOlder ; + # mixes libc and libxcrypt headers and libs and causes segfaults on importing crypt + libxcrypt = if stdenv.hostPlatform.isFreeBSD then null else inputs.libxcrypt; + buildPackages = pkgsBuildHost; inherit (passthru) pythonOnBuildForHost; @@ -261,6 +264,7 @@ let multiarch = if isDarwin then "darwin" + else if isFreeBSD then "" else if isWindows then "" else "${multiarchCpu}-${machdep}-${pythonAbiName}"; @@ -303,10 +307,15 @@ in with passthru; stdenv.mkDerivation (finalAttrs: { # (since it will do a futile invocation of gcc (!) to find # libuuid, slowing down program startup a lot). noldconfigPatch + ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform && stdenv.isFreeBSD) [ + # Cross compilation only supports a limited number of "known good" + # configurations. If you're reading this and it's been a long time + # since this diff, consider submitting this patch upstream! + ./freebsd-cross.patch + ] ++ optionals (pythonOlder "3.13") [ # Make sure that the virtualenv activation scripts are # owner-writable, so venvs can be recreated without permission # errors. - ] ++ optionals (pythonOlder "3.13") [ ./virtualenv-permissions.patch ] ++ optionals (pythonAtLeast "3.13") [ ./3.13/virtualenv-permissions.patch @@ -445,7 +454,11 @@ in with passthru; stdenv.mkDerivation (finalAttrs: { "LDFLAGS=-static" ]; - preConfigure = optionalString (pythonOlder "3.12") '' + preConfigure = '' + # Attempt to purify some of the host info collection + sed -E -i -e 's/uname -r/echo/g' -e 's/uname -n/echo nixpkgs/g' config.guess + sed -E -i -e 's/uname -r/echo/g' -e 's/uname -n/echo nixpkgs/g' configure + '' + optionalString (pythonOlder "3.12") '' # Improve purity for path in /usr /sw /opt /pkg; do substituteInPlace ./setup.py --replace-warn $path /no-such-path @@ -453,6 +466,8 @@ in with passthru; stdenv.mkDerivation (finalAttrs: { '' + optionalString stdenv.isDarwin '' # Override the auto-detection in setup.py, which assumes a universal build export PYTHON_DECIMAL_WITH_MACHINE=${if stdenv.isAarch64 then "uint128" else "x64"} + # Ensure that modern platform features are enabled on Darwin in spite of having no version suffix. + sed -E -i -e 's|Darwin/\[12\]\[0-9\]\.\*|Darwin/*|' configure '' + optionalString (stdenv.isDarwin && x11Support && pythonAtLeast "3.11") '' export TCLTK_LIBS="-L${tcl}/lib -L${tk}/lib -l${tcl.libPrefix} -l${tk.libPrefix}" export TCLTK_CFLAGS="-I${tcl}/include -I${tk}/include" @@ -476,10 +491,10 @@ in with passthru; stdenv.mkDerivation (finalAttrs: { postInstall = let # References *not* to nuke from (sys)config files keep-references = concatMapStringsSep " " (val: "-e ${val}") ([ - (placeholder "out") libxcrypt - ] ++ optionals tzdataSupport [ - tzdata - ]); + (placeholder "out") + ] ++ lib.optional (libxcrypt != null) libxcrypt + ++ lib.optional tzdataSupport tzdata + ); in lib.optionalString enableFramework '' for dir in include lib share; do ln -s $out/Library/Frameworks/Python.framework/Versions/Current/$dir $out/$dir @@ -643,13 +658,13 @@ in with passthru; stdenv.mkDerivation (finalAttrs: { homepage = "https://www.python.org"; changelog = let majorMinor = versions.majorMinor version; - dashedVersion = replaceStrings [ "." "a" ] [ "-" "-alpha-" ] version; + dashedVersion = replaceStrings [ "." "a" "b" ] [ "-" "-alpha-" "-beta-" ] version; in if sourceVersion.suffix == "" then "https://docs.python.org/release/${version}/whatsnew/changelog.html" else "https://docs.python.org/${majorMinor}/whatsnew/changelog.html#python-${dashedVersion}"; - description = "A high-level dynamically-typed programming language"; + description = "High-level dynamically-typed programming language"; longDescription = '' Python is a remarkably powerful dynamic programming language that is used in a wide variety of application domains. Some of its key @@ -661,7 +676,7 @@ in with passthru; stdenv.mkDerivation (finalAttrs: { ''; license = licenses.psfl; pkgConfigModules = [ "python3" ]; - platforms = platforms.linux ++ platforms.darwin ++ platforms.windows; + platforms = platforms.linux ++ platforms.darwin ++ platforms.windows ++ platforms.freebsd; mainProgram = executable; }; }) |