python2*: fix detecting C libs, no header references

This commit is contained in:
Vladimír Čunát 2015-04-18 20:59:36 +02:00
parent 4b1392fb07
commit 4101db0bec
2 changed files with 23 additions and 14 deletions

View File

@ -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 =
''

View File

@ -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' \