Merge pull request #208636 from wegank/python-framework
python3: allow enabling framework on darwin
This commit is contained in:
commit
b3b4bc0052
|
@ -17,6 +17,7 @@
|
|||
, libxcrypt
|
||||
, self
|
||||
, configd
|
||||
, darwin
|
||||
, autoreconfHook
|
||||
, autoconf-archive
|
||||
, pkg-config
|
||||
|
@ -41,6 +42,7 @@
|
|||
, stripBytecode ? true
|
||||
, includeSiteCustomize ? true
|
||||
, static ? stdenv.hostPlatform.isStatic
|
||||
, enableFramework ? false
|
||||
, enableOptimizations ? false
|
||||
# enableNoSemanticInterposition is a subset of the enableOptimizations flag that doesn't harm reproducibility.
|
||||
# clang starts supporting `-fno-sematic-interposition` with version 10
|
||||
|
@ -65,6 +67,8 @@ assert x11Support -> tcl != null
|
|||
|
||||
assert bluezSupport -> bluez != null;
|
||||
|
||||
assert enableFramework -> stdenv.isDarwin;
|
||||
|
||||
assert lib.assertMsg (reproducibleBuild -> stripBytecode)
|
||||
"Deterministic builds require stripping bytecode.";
|
||||
|
||||
|
@ -84,6 +88,8 @@ let
|
|||
buildPackages = pkgsBuildHost;
|
||||
inherit (passthru) pythonForBuild;
|
||||
|
||||
inherit (darwin.apple_sdk.frameworks) Cocoa;
|
||||
|
||||
tzdataSupport = tzdata != null && passthru.pythonAtLeast "3.9";
|
||||
|
||||
passthru = let
|
||||
|
@ -125,6 +131,8 @@ let
|
|||
++ optionals x11Support [ tcl tk libX11 xorgproto ]
|
||||
++ optionals (bluezSupport && stdenv.isLinux) [ bluez ]
|
||||
++ optionals stdenv.isDarwin [ configd ])
|
||||
|
||||
++ optionals enableFramework [ Cocoa ]
|
||||
++ optionals tzdataSupport [ tzdata ]; # `zoneinfo` module
|
||||
|
||||
hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false);
|
||||
|
@ -308,8 +316,10 @@ in with passthru; stdenv.mkDerivation {
|
|||
"--without-ensurepip"
|
||||
"--with-system-expat"
|
||||
"--with-system-ffi"
|
||||
] ++ optionals (!static) [
|
||||
] ++ optionals (!static && !enableFramework) [
|
||||
"--enable-shared"
|
||||
] ++ optionals enableFramework [
|
||||
"--enable-framework=${placeholder "out"}/Library/Frameworks"
|
||||
] ++ optionals enableOptimizations [
|
||||
"--enable-optimizations"
|
||||
] ++ optionals enableLTO [
|
||||
|
@ -390,7 +400,11 @@ in with passthru; stdenv.mkDerivation {
|
|||
] ++ optionals tzdataSupport [
|
||||
tzdata
|
||||
]);
|
||||
in ''
|
||||
in lib.optionalString enableFramework ''
|
||||
for dir in include lib share; do
|
||||
ln -s $out/Library/Frameworks/Python.framework/Versions/Current/$dir $out/$dir
|
||||
done
|
||||
'' + ''
|
||||
# needed for some packages, especially packages that backport functionality
|
||||
# to 2.x from 3.x
|
||||
for item in $out/lib/${libPrefix}/test/*; do
|
||||
|
@ -487,7 +501,7 @@ in with passthru; stdenv.mkDerivation {
|
|||
# Enforce that we don't have references to the OpenSSL -dev package, which we
|
||||
# explicitly specify in our configure flags above.
|
||||
disallowedReferences =
|
||||
lib.optionals (openssl' != null && !static) [ openssl'.dev ]
|
||||
lib.optionals (openssl' != null && !static && !enableFramework) [ openssl'.dev ]
|
||||
++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||
# Ensure we don't have references to build-time packages.
|
||||
# These typically end up in shebangs.
|
||||
|
@ -521,7 +535,7 @@ in with passthru; stdenv.mkDerivation {
|
|||
high level dynamic data types.
|
||||
'';
|
||||
license = licenses.psfl;
|
||||
platforms = with platforms; linux ++ darwin;
|
||||
platforms = platforms.linux ++ platforms.darwin;
|
||||
maintainers = with maintainers; [ fridh ];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue