From 90dd9d14bf6d3763852bb983270e73e7275cd09f Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Tue, 20 Oct 2009 12:13:49 +0000 Subject: [PATCH] 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 --- .../interpreters/python/2.6/default.nix | 7 +++++-- .../python/2.6/nolongdouble.patch | 20 ------------------- pkgs/os-specific/darwin/arch/builder.sh | 3 +++ pkgs/os-specific/darwin/arch/default.nix | 8 ++++++++ pkgs/top-level/all-packages.nix | 4 ++++ 5 files changed, 20 insertions(+), 22 deletions(-) delete mode 100644 pkgs/development/interpreters/python/2.6/nolongdouble.patch create mode 100755 pkgs/os-specific/darwin/arch/builder.sh create mode 100644 pkgs/os-specific/darwin/arch/default.nix diff --git a/pkgs/development/interpreters/python/2.6/default.nix b/pkgs/development/interpreters/python/2.6/default.nix index fc1323234ab4..ba60f6057c67 100644 --- a/pkgs/development/interpreters/python/2.6/default.nix +++ b/pkgs/development/interpreters/python/2.6/default.nix @@ -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 {} ) ) diff --git a/pkgs/development/interpreters/python/2.6/nolongdouble.patch b/pkgs/development/interpreters/python/2.6/nolongdouble.patch deleted file mode 100644 index 8fb53da3d49d..000000000000 --- a/pkgs/development/interpreters/python/2.6/nolongdouble.patch +++ /dev/null @@ -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 diff --git a/pkgs/os-specific/darwin/arch/builder.sh b/pkgs/os-specific/darwin/arch/builder.sh new file mode 100755 index 000000000000..1fb8be484ba7 --- /dev/null +++ b/pkgs/os-specific/darwin/arch/builder.sh @@ -0,0 +1,3 @@ +source $stdenv/setup +mkdir -p "$out/bin" +ln -s /usr/bin/arch "$out/bin/" diff --git a/pkgs/os-specific/darwin/arch/default.nix b/pkgs/os-specific/darwin/arch/default.nix new file mode 100644 index 000000000000..59d00eaf2d1c --- /dev/null +++ b/pkgs/os-specific/darwin/arch/default.nix @@ -0,0 +1,8 @@ +{stdenv}: + +assert stdenv.isDarwin; + +stdenv.mkDerivation { + name = "darwin-arch-utility"; + builder = ./builder.sh; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b32bd089e0f7..0ae0e348f0bf 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 {