python-2.6: fixed build on Darwin

* Dropped "nolongdouble.patch". The patch no longer applies to Python 2.6, and
   apparently isn't required anymore either.

 * Added access to native Darwin arch utility. Python tries to run 'arch' in
   the configure stage, but that binary reside in /usr/bin. To make it
   available to the expression, the small wrapper darwinArchUtility is added as
   a buildInput if appropriate.

 * Don't pass --enable-shared. The build fails if we try to enable building of
   shared libraries, apparently because some required libraries aren't linked,
   i.e. the linker call isn't right.

TODO:

 * Figure out how to enable shared linking.

 * The resulting binary on Darwin seem to lack the binascii module.

svn path=/nixpkgs/trunk/; revision=17894
This commit is contained in:
Peter Simons 2009-10-20 12:13:49 +00:00
parent 97166d8a20
commit 90dd9d14bf
5 changed files with 20 additions and 22 deletions

View File

@ -8,10 +8,12 @@
, tcl ? null
, libX11 ? null
, xproto ? null
, arch ? null
}:
assert zlibSupport -> zlib != null;
assert gdbmSupport -> gdbm != null;
assert stdenv.isDarwin -> arch != null;
with stdenv.lib;
@ -30,6 +32,7 @@ let
++ optional (tcl != null) tcl
++ optional (libX11 != null) libX11
++ optional (xproto != null) xproto
++ optional (arch != null) arch
;
in
@ -50,7 +53,7 @@ stdenv.mkDerivation ( {
inherit buildInputs;
C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs);
LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") buildInputs);
configureFlags = "--enable-shared --with-wctype-functions";
configureFlags = ''${if stdenv.isDarwin then "" else " --enable-shared"} --with-wctype-functions'';
preConfigure = ''
# Purity.
@ -83,4 +86,4 @@ stdenv.mkDerivation ( {
# platforms = stdenv.lib.platforms.allBut "i686-darwin";
# Re-enabled for 2.6 to see whether the problem still occurs.
};
} // (if stdenv.system == "i686-darwin" then { NIX_CFLAGS_COMPILE = "-msse2" ; patches = [./search-path.patch ./nolongdouble.patch]; } else {} ) )
} // (if stdenv.system == "i686-darwin" then { NIX_CFLAGS_COMPILE = "-msse2" ; patches = [./search-path.patch]; } else {} ) )

View File

@ -1,20 +0,0 @@
diff -rc Python-2.5.4/configure Python-2.5.4-new/configure
*** Python-2.5.4/configure Sat Dec 13 15:13:52 2008
--- Python-2.5.4-new/configure Fri Jul 24 16:38:05 2009
***************
*** 4534,4540 ****
;;
# is there any other compiler on Darwin besides gcc?
Darwin*)
! BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd"
if test "${enable_universalsdk}"; then
BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
fi
--- 4534,4540 ----
;;
# is there any other compiler on Darwin besides gcc?
Darwin*)
! BASECFLAGS="$BASECFLAGS -no-cpp-precomp -mno-fused-madd"
if test "${enable_universalsdk}"; then
BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
fi

View File

@ -0,0 +1,3 @@
source $stdenv/setup
mkdir -p "$out/bin"
ln -s /usr/bin/arch "$out/bin/"

View File

@ -0,0 +1,8 @@
{stdenv}:
assert stdenv.isDarwin;
stdenv.mkDerivation {
name = "darwin-arch-utility";
builder = ./builder.sh;
}

View File

@ -410,6 +410,9 @@ let
### TOOLS
darwinArchUtility = import ../os-specific/darwin/arch {
inherit stdenv;
};
acct = import ../tools/system/acct {
inherit fetchurl stdenv;
@ -2408,6 +2411,7 @@ let
python26Base = composedArgsAndFun (import ../development/interpreters/python/2.6) {
inherit fetchurl stdenv zlib bzip2 gdbm;
arch = if stdenv.isDarwin then darwinArchUtility else null;
};
python26Full = python26Base.passthru.function {