···1-{stdenv, fetchurl, perl, ncurses, gmp}:
23stdenv.mkDerivation rec {
4 version = "7.0.4";
···31 buildInputs = [perl];
3233 postUnpack =
00000034 # Strip is harmful, see also below. It's important that this happens
35 # first. The GHC Cabal build system makes use of strip by default and
36 # has hardcoded paths to /usr/bin/strip in many places. We replace
···47 ''
48 find . -name integer-gmp.buildinfo \
49 -exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${gmp}/lib@" {} \;
00050 '' +
51 # On Linux, use patchelf to modify the executables so that they can
52 # find editline/gmp.
53- (if stdenv.isLinux then ''
54 find . -type f -perm +100 \
55 -exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
56 --set-rpath "${ncurses}/lib:${gmp}/lib" {} \;
···59 for prog in ld ar gcc strip ranlib; do
60 find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \;
61 done
62- '' else "");
000000000000000006364 configurePhase = ''
65- ./configure --prefix=$out --with-gmp-libraries=${gmp}/lib --with-gmp-includes=${gmp}/include
0066 '';
6768 # Stripping combined with patchelf breaks the executables (they die
···1+{stdenv, fetchurl, perl, ncurses, gmp, libiconv}:
23stdenv.mkDerivation rec {
4 version = "7.0.4";
···31 buildInputs = [perl];
3233 postUnpack =
34+ # GHC has dtrace probes, which causes ld to try to open /usr/lib/libdtrace.dylib
35+ # during linking
36+ stdenv.lib.optionalString stdenv.isDarwin ''
37+ export NIX_LDFLAGS+=" -no_dtrace_dof"
38+ '' +
39+40 # Strip is harmful, see also below. It's important that this happens
41 # first. The GHC Cabal build system makes use of strip by default and
42 # has hardcoded paths to /usr/bin/strip in many places. We replace
···53 ''
54 find . -name integer-gmp.buildinfo \
55 -exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${gmp}/lib@" {} \;
56+ '' + stdenv.lib.optionalString stdenv.isDarwin ''
57+ find . -name base.buildinfo \
58+ -exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${libiconv}/lib@" {} \;
59 '' +
60 # On Linux, use patchelf to modify the executables so that they can
61 # find editline/gmp.
62+ stdenv.lib.optionalString stdenv.isLinux ''
63 find . -type f -perm +100 \
64 -exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
65 --set-rpath "${ncurses}/lib:${gmp}/lib" {} \;
···68 for prog in ld ar gcc strip ranlib; do
69 find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \;
70 done
71+ '' + stdenv.lib.optionalString stdenv.isDarwin ''
72+ # not enough room in the object files for the full path to libiconv :(
73+ fix () {
74+ install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib $1
75+ }
76+77+ ln -s ${libiconv}/lib/libiconv.dylib ghc-7.4.2/utils/ghc-pwd/dist-install/build/tmp
78+ ln -s ${libiconv}/lib/libiconv.dylib ghc-7.4.2/utils/hpc/dist-install/build/tmp
79+ ln -s ${libiconv}/lib/libiconv.dylib ghc-7.4.2/ghc/stage2/build/tmp
80+81+ for file in ghc-cabal ghc-pwd ghc-stage2 ghc-pkg haddock hsc2hs hpc; do
82+ fix $(find . -type f -name $file)
83+ done
84+85+ for file in $(find . -name setup-config); do
86+ substituteInPlace $file --replace /usr/bin/ranlib "$(type -P ranlib)"
87+ done
88+ '';
8990 configurePhase = ''
91+ ./configure --prefix=$out \
92+ --with-gmp-libraries=${gmp}/lib --with-gmp-includes=${gmp}/include \
93+ ${stdenv.lib.optionalString stdenv.isDarwin "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}"}
94 '';
9596 # Stripping combined with patchelf breaks the executables (they die