From 4101db0bec17f968e694a771b2a6a6d5c96d3e25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Sat, 18 Apr 2015 20:59:36 +0200 Subject: [PATCH] python2*: fix detecting C libs, no header references --- .../interpreters/python/2.6/default.nix | 20 +++++++++++-------- .../interpreters/python/2.7/default.nix | 17 ++++++++++------ 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/pkgs/development/interpreters/python/2.6/default.nix b/pkgs/development/interpreters/python/2.6/default.nix index 9bf161ffc1aa..787e3ea9e3b5 100644 --- a/pkgs/development/interpreters/python/2.6/default.nix +++ b/pkgs/development/interpreters/python/2.6/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, zlib ? null, zlibSupport ? true, bzip2, includeModules ? false +{ stdenv, fetchurl, pkgconfig, zlib ? null, zlibSupport ? true, bzip2, includeModules ? false , sqlite, tcl, tk, x11, openssl, readline, db, ncurses, gdbm, self, callPackage }: assert zlibSupport -> zlib != null; @@ -48,9 +48,13 @@ let buildInputs = optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc ++ - [ bzip2 openssl ]++ optionals includeModules [ db openssl ncurses gdbm readline x11 tcl tk sqlite ] + [ pkgconfig bzip2 openssl ]++ optionals includeModules [ db openssl ncurses gdbm readline x11 tcl tk sqlite ] ++ optional zlibSupport zlib; + mkPaths = paths: { + C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p.dev or p}/include") buildInputs); + LIBRARY_PATH = concatStringsSep ":" (map (p: "${p.lib or (p.out or p)}/lib") buildInputs); + }; # Build the basic Python interpreter without modules that have # external dependencies. @@ -60,8 +64,7 @@ let inherit majorVersion version src patches buildInputs preConfigure; - C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs); - LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") buildInputs); + inherit (mkPaths buildInputs) C_INCLUDE_PATH LIBRARY_PATH; configureFlags = "--enable-shared --with-threads --enable-unicode"; @@ -83,10 +86,12 @@ let ln -s $out/lib/python${majorVersion}/pdb.py $out/bin/pdb${majorVersion} mv $out/share/man/man1/{python.1,python2.6.1} ln -s $out/share/man/man1/{python2.6.1,python.1} - + paxmark E $out/bin/python${majorVersion} - + ${ optionalString includeModules "$out/bin/python ./setup.py build_ext"} + + rm "$out/lib/python2.7/plat-linux2/regen" # refers to glibc.dev ''; passthru = rec { @@ -135,8 +140,7 @@ let buildInputs = [ python ] ++ deps; - C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs); - LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") buildInputs); + inherit (mkPaths buildInputs) C_INCLUDE_PATH LIBRARY_PATH; buildPhase = '' diff --git a/pkgs/development/interpreters/python/2.7/default.nix b/pkgs/development/interpreters/python/2.7/default.nix index 8b24fe004631..56f209809414 100644 --- a/pkgs/development/interpreters/python/2.7/default.nix +++ b/pkgs/development/interpreters/python/2.7/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, self, callPackage +{ stdenv, fetchurl, pkgconfig, self, callPackage , bzip2, openssl , includeModules ? false @@ -60,13 +60,18 @@ let buildInputs = optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc ++ - [ bzip2 openssl ] + [ pkgconfig bzip2 openssl ] ++ optionals includeModules ( [ db gdbm ncurses sqlite readline ] ++ optionals x11Support [ tcl tk x11 libX11 ] ) ++ optional zlibSupport zlib; + mkPaths = paths: { + C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p.dev or p}/include") buildInputs); + LIBRARY_PATH = concatStringsSep ":" (map (p: "${p.lib or (p.out or p)}/lib") buildInputs); + }; + # Build the basic Python interpreter without modules that have # external dependencies. python = stdenv.mkDerivation { @@ -76,8 +81,7 @@ let inherit majorVersion version src patches buildInputs preConfigure; LDFLAGS = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s"; - C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs); - LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") buildInputs); + inherit (mkPaths buildInputs) C_INCLUDE_PATH LIBRARY_PATH; configureFlags = "--enable-shared --with-threads --enable-unicode"; @@ -105,6 +109,8 @@ let paxmark E $out/bin/python${majorVersion} ${ optionalString includeModules "$out/bin/python ./setup.py build_ext"} + + rm "$out/lib/python2.7/plat-linux2/regen" # refers to glibc.dev ''; passthru = rec { @@ -153,8 +159,7 @@ let buildInputs = [ python ] ++ deps; - C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs); - LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") buildInputs); + inherit (mkPaths buildInputs) C_INCLUDE_PATH LIBRARY_PATH; buildPhase = '' substituteInPlace setup.py --replace 'self.extensions = extensions' \