Changed the bootstrapping version of ghc-6.10.1.

Several binaries (except for ghc itself, for which there was a
workaround) were broken before because they were stripped
during installation. Now, all binaries should work, in particular
ghc-pkg ...

svn path=/nixpkgs/trunk/; revision=13717
This commit is contained in:
Andres Löh 2009-01-06 16:29:49 +00:00
parent ed62007229
commit 77d9eec2a1

View File

@ -27,34 +27,42 @@ stdenv.mkDerivation rec {
buildInputs = [perl makeWrapper]; buildInputs = [perl makeWrapper];
# On Linux, use patchelf to modify the executables so that they can postUnpack =
# find editline/gmp. # Strip is harmful, see also below. It's important that this happens
postUnpack = (if stdenv.isLinux then '' # first. The GHC Cabal build system makes use of strip by default and
find . -type f -perm +100 \ # has hardcoded paths to /usr/bin/strip in many places. We replace
-exec patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \ # those below, making them point to our dummy script.
--set-rpath "${editline}/lib:${ncurses}/lib:${gmp}/lib" {} \; ''
for prog in strip ranlib; do mkdir "$TMP/bin"
find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \; for i in strip; do
done echo '#!/bin/sh' >> "$TMP/bin/$i"
'' else "") chmod +x "$TMP/bin/$i"
+ '' PATH="$TMP/bin:$PATH"
mkdir "$TMP/bin" done
for i in strip; do '' +
echo '#!/bin/sh' >> "$TMP/bin/$i" # On Linux, use patchelf to modify the executables so that they can
chmod +x "$TMP/bin/$i" # find editline/gmp.
PATH="$TMP/bin:$PATH" (if stdenv.isLinux then ''
done find . -type f -perm +100 \
'' -exec patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
--set-rpath "${editline}/lib:${ncurses}/lib:${gmp}/lib" {} \;
; for prog in ld ar gcc strip ranlib; do
find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \;
done
'' else "");
configurePhase = '' configurePhase = ''
./configure --prefix=$out --with-gmp-libraries=${gmp}/lib --with-gmp-includes=${gmp}/include ./configure --prefix=$out --with-gmp-libraries=${gmp}/lib --with-gmp-includes=${gmp}/include
''; '';
# Stripping combined with patchelf breaks the executables (they die # Stripping combined with patchelf breaks the executables (they die
# with a segfault or the kernel even refuses the execve). (NIXPKGS-85) # with a segfault or the kernel even refuses the execve). (NIXPKGS-85)
dontStrip = true; dontStrip = true;
# No building is necessary, but calling make without flags ironically
# calls install-strip ...
buildPhase = ":";
# The binaries for Darwin use frameworks, so fake those frameworks, # The binaries for Darwin use frameworks, so fake those frameworks,
# and create some wrapper scripts that set DYLD_FRAMEWORK_PATH so # and create some wrapper scripts that set DYLD_FRAMEWORK_PATH so
# that the executables work with no special setup. # that the executables work with no special setup.
@ -78,9 +86,6 @@ stdenv.mkDerivation rec {
" else "") " else "")
+ +
'' ''
# the installed ghc executable segfaults, maybe some stripping or such has been done somewhere?
# Just copy teh version from the $TMP dir over
cp ghc/dist-stage2/build/ghc/ghc $out/lib/ghc-${version}/ghc
# bah, the passing gmp doesn't work, so let's add it to the final package.conf in a quick but dirty way # bah, the passing gmp doesn't work, so let's add it to the final package.conf in a quick but dirty way
sed -i "s@^\(.*pkgName = PackageName \"rts\".*\libraryDirs = \\[\)\(.*\)@\\1\"${gmp}/lib\",\2@" $out/lib/ghc-${version}/package.conf sed -i "s@^\(.*pkgName = PackageName \"rts\".*\libraryDirs = \\[\)\(.*\)@\\1\"${gmp}/lib\",\2@" $out/lib/ghc-${version}/package.conf