forked from mirrors/nixpkgs
stdenv: bootstrap darwin with python3
- Replaced python override from the final stdenv, instead we propagate our bootstrap python to stage4 and override both CF and xnu to use it. - Removed CF argument from python interpreters, this is redundant since it's not overidden anymore. - Inherit CF from stage4, making it the same as the stdenv.
This commit is contained in:
parent
73db5d8c38
commit
6328518e98
|
@ -1,103 +0,0 @@
|
|||
{ stdenv, fetchurl, configd, CF, coreutils }:
|
||||
|
||||
with stdenv.lib;
|
||||
|
||||
let
|
||||
|
||||
mkPaths = paths: {
|
||||
C_INCLUDE_PATH = makeSearchPathOutput "dev" "include" paths;
|
||||
LIBRARY_PATH = makeLibraryPath paths;
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "python-boot";
|
||||
version = "2.7.12";
|
||||
libPrefix = "python2.7";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://www.python.org/ftp/python/2.7.12/Python-${version}.tar.xz";
|
||||
sha256 = "0y7rl603vmwlxm6ilkhc51rx2mfj14ckcz40xxgs0ljnvlhp30yp";
|
||||
};
|
||||
|
||||
inherit (mkPaths buildInputs) C_INCLUDE_PATH LIBRARY_PATH;
|
||||
|
||||
LDFLAGS = optionalString (!stdenv.isDarwin) "-lgcc_s";
|
||||
NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin "-msse2";
|
||||
|
||||
buildInputs = optionals stdenv.isDarwin [ CF configd ];
|
||||
|
||||
patches =
|
||||
[ # Look in C_INCLUDE_PATH and LIBRARY_PATH for stuff.
|
||||
./search-path.patch
|
||||
|
||||
# Python recompiles a Python if the mtime stored *in* the
|
||||
# pyc/pyo file differs from the mtime of the source file. This
|
||||
# doesn't work in Nix because Nix changes the mtime of files in
|
||||
# the Nix store to 1. So treat that as a special case.
|
||||
./nix-store-mtime.patch
|
||||
|
||||
# patch python to put zero timestamp into pyc
|
||||
# if DETERMINISTIC_BUILD env var is set
|
||||
./deterministic-build.patch
|
||||
];
|
||||
|
||||
# Hack hack hack to stop shit from failing from a missing _scproxy on Darwin. Since
|
||||
# we only use this python for bootstrappy things, it doesn't really matter if it
|
||||
# doesn't have perfect proxy support in urllib :) this just makes it fall back on env
|
||||
# vars instead of attempting to read the proxy configuration automatically, so not a
|
||||
# huge loss even if for whatever reason we did want proxy support.
|
||||
postPatch = ''
|
||||
substituteInPlace Lib/urllib.py --replace "if sys.platform == 'darwin'" "if False"
|
||||
'';
|
||||
|
||||
DETERMINISTIC_BUILD = 1;
|
||||
|
||||
preConfigure = ''
|
||||
# Purity.
|
||||
for i in /usr /sw /opt /pkg; do
|
||||
substituteInPlace ./setup.py --replace $i /no-such-path
|
||||
done
|
||||
'' + optionalString (stdenv ? cc && stdenv.cc.libc != null) ''
|
||||
for i in Lib/plat-*/regen; do
|
||||
substituteInPlace $i --replace /usr/include/ ${stdenv.cc.libc}/include/
|
||||
done
|
||||
'' + optionalString stdenv.isDarwin ''
|
||||
substituteInPlace configure --replace '`/usr/bin/arch`' '"i386"'
|
||||
substituteInPlace Lib/multiprocessing/__init__.py \
|
||||
--replace 'os.popen(comm)' 'os.popen("${coreutils}/bin/nproc")'
|
||||
'';
|
||||
|
||||
configureFlags = [ "--enable-shared" "--with-threads" "--enable-unicode=ucs4" ]
|
||||
++ optionals stdenv.isCygwin [ "ac_cv_func_bind_textdomain_codeset=yes" ]
|
||||
++ optionals stdenv.isDarwin [ "--disable-toolbox-glue" ];
|
||||
|
||||
postInstall =
|
||||
''
|
||||
ln -s $out/share/man/man1/{python2.7.1.gz,python.1.gz}
|
||||
|
||||
rm "$out"/lib/python*/plat-*/regen # refers to glibc.dev
|
||||
'';
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
passthru.pkgs = builtins.throw "python-boot does not support packages, this package is only intended for bootstrapping." {};
|
||||
|
||||
meta = {
|
||||
homepage = http://python.org;
|
||||
description = "A 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
|
||||
distinguishing features include: clear, readable syntax; strong
|
||||
introspection capabilities; intuitive object orientation; natural
|
||||
expression of procedural code; full modularity, supporting
|
||||
hierarchical packages; exception-based error handling; and very
|
||||
high level dynamic data types.
|
||||
'';
|
||||
license = stdenv.lib.licenses.psfl;
|
||||
platforms = stdenv.lib.platforms.all;
|
||||
maintainers = with stdenv.lib.maintainers; [ lnl7 domenkozar ];
|
||||
};
|
||||
}
|
|
@ -11,7 +11,7 @@
|
|||
, tcl ? null, tk ? null, tix ? null, xlibsWrapper ? null, libX11 ? null, x11Support ? false
|
||||
, zlib
|
||||
, self
|
||||
, CF, configd, coreutils
|
||||
, configd, coreutils
|
||||
, python-setup-hook
|
||||
# Some proprietary libs assume UCS2 unicode, especially on darwin :(
|
||||
, ucsEncoding ? 4
|
||||
|
@ -180,7 +180,7 @@ let
|
|||
++ optional stdenv.hostPlatform.isCygwin expat
|
||||
++ [ db gdbm ncurses sqlite readline ]
|
||||
++ optionals x11Support [ tcl tk xlibsWrapper libX11 ]
|
||||
++ optionals stdenv.isDarwin ([ CF ] ++ optional (configd != null) configd);
|
||||
++ optional (stdenv.isDarwin && configd != null) configd;
|
||||
nativeBuildInputs =
|
||||
optionals (stdenv.hostPlatform != stdenv.buildPlatform)
|
||||
[ buildPackages.stdenv.cc buildPackages.python ];
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
, tcl ? null, tk ? null, tix ? null, libX11 ? null, xorgproto ? null, x11Support ? false
|
||||
, zlib
|
||||
, self
|
||||
, CF, configd
|
||||
, configd
|
||||
, python-setup-hook
|
||||
, nukeReferences
|
||||
# For the Python package set
|
||||
|
@ -57,10 +57,10 @@ let
|
|||
pythonForBuild
|
||||
];
|
||||
|
||||
buildInputs = filter (p: p != null) [
|
||||
buildInputs = filter (p: p != null) ([
|
||||
zlib bzip2 expat lzma libffi gdbm sqlite readline ncurses openssl ]
|
||||
++ optionals x11Support [ tcl tk libX11 xorgproto ]
|
||||
++ optionals stdenv.isDarwin [ CF configd ];
|
||||
++ optionals stdenv.isDarwin [ configd ]);
|
||||
|
||||
hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false);
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ in {
|
|||
suffix = "";
|
||||
};
|
||||
sha256 = "0hds28cg226m8j8sr394nm9yc4gxhvlv109w0avsf2mxrlrz0hsd";
|
||||
inherit (darwin) CF configd;
|
||||
inherit (darwin) configd;
|
||||
inherit passthruFun;
|
||||
};
|
||||
|
||||
|
@ -70,7 +70,7 @@ in {
|
|||
suffix = "";
|
||||
};
|
||||
sha256 = "0jdh9pvx6m6lfz2liwvvhn7vks7qrysqgwn517fkpxb77b33fjn2";
|
||||
inherit (darwin) CF configd;
|
||||
inherit (darwin) configd;
|
||||
inherit passthruFun;
|
||||
};
|
||||
|
||||
|
@ -83,7 +83,7 @@ in {
|
|||
suffix = "";
|
||||
};
|
||||
sha256 = "1pj0mz1xl27khi250p29c0y99vxg662js8zp71aprkf8i8wkr0qa";
|
||||
inherit (darwin) CF configd;
|
||||
inherit (darwin) configd;
|
||||
inherit passthruFun;
|
||||
};
|
||||
|
||||
|
@ -96,7 +96,7 @@ in {
|
|||
suffix = "";
|
||||
};
|
||||
sha256 = "0gskry19ylw91p38pdq36qcgk6h3x5i4ia0ik977kw2943kwr8jm";
|
||||
inherit (darwin) CF configd;
|
||||
inherit (darwin) configd;
|
||||
inherit passthruFun;
|
||||
};
|
||||
|
||||
|
@ -109,7 +109,7 @@ in {
|
|||
suffix = "";
|
||||
};
|
||||
sha256 = "1s4lwn5vzsajlc88m6hkghsvnjw4d00l2dsgng0m2w6vyqbl32bm";
|
||||
inherit (darwin) CF configd;
|
||||
inherit (darwin) configd;
|
||||
inherit passthruFun;
|
||||
};
|
||||
|
||||
|
@ -122,7 +122,7 @@ in {
|
|||
suffix = "a2";
|
||||
};
|
||||
sha256 = "02a301bdcldin05ksdg8xw8xr6gdkpf73p0cabvn9rdl6yhkr3q8";
|
||||
inherit (darwin) CF configd;
|
||||
inherit (darwin) configd;
|
||||
inherit passthruFun;
|
||||
};
|
||||
|
||||
|
@ -136,6 +136,7 @@ in {
|
|||
ncurses = null;
|
||||
gdbm = null;
|
||||
sqlite = null;
|
||||
configd = null;
|
||||
stripConfig = true;
|
||||
stripIdlelib = true;
|
||||
stripTests = true;
|
||||
|
|
|
@ -190,13 +190,10 @@ in rec {
|
|||
useSharedLibraries = false;
|
||||
};
|
||||
|
||||
python = super.callPackage ../../development/interpreters/python/cpython/2.7/boot.nix {
|
||||
CF = null; # use CoreFoundation from bootstrap-tools
|
||||
configd = null;
|
||||
};
|
||||
python2 = self.python;
|
||||
python3 = super.python3Minimal;
|
||||
|
||||
ninja = super.ninja.override { buildDocs = false; };
|
||||
|
||||
darwin = super.darwin // {
|
||||
cctools = super.darwin.cctools.override {
|
||||
enableTapiSupport = false;
|
||||
|
@ -218,11 +215,11 @@ in rec {
|
|||
stage2 = prevStage: let
|
||||
persistent = self: super: with prevStage; {
|
||||
inherit
|
||||
zlib patchutils m4 scons flex perl bison unifdef unzip openssl python
|
||||
zlib patchutils m4 scons flex perl bison unifdef unzip openssl python3
|
||||
libxml2 gettext sharutils gmp libarchive ncurses pkg-config libedit groff
|
||||
openssh sqlite sed serf openldap db cyrus-sasl expat apr-util subversion xz
|
||||
findfreetype libssh curl cmake autoconf automake libtool ed cpio coreutils
|
||||
libssh2 nghttp2 libkrb5 python2 ninja;
|
||||
libssh2 nghttp2 libkrb5 ninja;
|
||||
|
||||
darwin = super.darwin // {
|
||||
inherit (darwin)
|
||||
|
@ -252,11 +249,11 @@ in rec {
|
|||
stage3 = prevStage: let
|
||||
persistent = self: super: with prevStage; {
|
||||
inherit
|
||||
patchutils m4 scons flex perl bison unifdef unzip openssl python
|
||||
patchutils m4 scons flex perl bison unifdef unzip openssl python3
|
||||
gettext sharutils libarchive pkg-config groff bash subversion
|
||||
openssh sqlite sed serf openldap db cyrus-sasl expat apr-util
|
||||
findfreetype libssh curl cmake autoconf automake libtool cpio
|
||||
libssh2 nghttp2 libkrb5 python2 ninja;
|
||||
libssh2 nghttp2 libkrb5 ninja;
|
||||
|
||||
# Avoid pulling in a full python and its extra dependencies for the llvm/clang builds.
|
||||
libxml2 = super.libxml2.override { pythonSupport = false; };
|
||||
|
@ -302,7 +299,7 @@ in rec {
|
|||
stage4 = prevStage: let
|
||||
persistent = self: super: with prevStage; {
|
||||
inherit
|
||||
gnumake gzip gnused bzip2 gawk ed xz patch bash
|
||||
gnumake gzip gnused bzip2 gawk ed xz patch bash python3
|
||||
ncurses libffi zlib gmp pcre gnugrep
|
||||
coreutils findutils diffutils patchutils ninja;
|
||||
|
||||
|
@ -332,7 +329,7 @@ in rec {
|
|||
libxml2-nopython = super.libxml2.override { pythonSupport = false; };
|
||||
CF = super.darwin.CF.override {
|
||||
libxml2 = libxml2-nopython;
|
||||
python = prevStage.python;
|
||||
python3 = prevStage.python3;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -365,17 +362,6 @@ in rec {
|
|||
});
|
||||
in { inherit tools libraries; } // tools // libraries);
|
||||
|
||||
# N.B: the important thing here is to ensure that python == python2
|
||||
# == python27 or you get weird issues with inconsistent package sets.
|
||||
# In a particularly subtle bug, I overrode python2 instead of python27
|
||||
# here, and it caused gnome-doc-utils to complain about:
|
||||
# "PyThreadState_Get: no current thread". This is because Python gets
|
||||
# really unhappy if you have Python A which loads a native python lib
|
||||
# which was linked against Python B, which in our case was happening
|
||||
# because we didn't override python "deeply enough". Anyway, this works
|
||||
# and I'm just leaving this blurb here so people realize why it matters
|
||||
python27 = super.python27.override { CF = prevStage.darwin.CF; };
|
||||
|
||||
darwin = super.darwin // {
|
||||
inherit (darwin) dyld ICU Libsystem libiconv;
|
||||
} // lib.optionalAttrs (super.stdenv.targetPlatform == localSystem) {
|
||||
|
@ -438,7 +424,8 @@ in rec {
|
|||
inherit cc;
|
||||
|
||||
darwin = super.darwin // {
|
||||
xnu = super.darwin.xnu.override { python = super.python.override { configd = null; }; };
|
||||
inherit (prevStage.darwin) CF;
|
||||
xnu = super.darwin.xnu.override { inherit (prevStage) python3; };
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue