Skip to content

Commit

Permalink
python2: Fix linking against libpython
Browse files Browse the repository at this point in the history
  • Loading branch information
wkennington committed Jan 20, 2016
1 parent 9593f8b commit 807cebe
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkgs/all-pkgs/python/2.x.nix
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,19 @@ stdenv.mkDerivation rec {
$out/bin/python${versionMajor} -c "import zlib"
'';

postFixup = ''
# The lines we are replacing dont include libpython so we parse it out
LIBS="$(pkg-config --libs --static python | sed 's,[ ]*\(-L\|-l\)[^ ]*python[^ ]*[ ]*, ,g')"
sed -i "s@^LIBS=.*@LIBS= $LIBS@g" $out/lib/python*/config/Makefile
# We need to update _sysconfigdata.py{,o,c}
sed -i "s@'\(SH\|\)LIBS': '.*',@'\1LIBS': '$LIBS',@g" $out/lib/python*/_sysconfigdata.py
rm $out/lib/python*/_sysconfigdata.py{o,c}
$out/bin/python -c "import _sysconfigdata"
$out/bin/python -O -c "import _sysconfigdata"
'';

# Used by python-2.7-deterministic-build.patch
DETERMINISTIC_BUILD = 1;
enableParallelBuilding = true;
Expand Down

0 comments on commit 807cebe

Please sign in to comment.