Add purity to GHC builds on Darwin.

authored by

Joel Taylor and committed by
Peter Simons
db4cb021 6790caf7

+455 -52
+32 -4
pkgs/development/compilers/ghc/7.0.4-binary.nix
··· 1 - {stdenv, fetchurl, perl, ncurses, gmp}: 1 + {stdenv, fetchurl, perl, ncurses, gmp, libiconv}: 2 2 3 3 stdenv.mkDerivation rec { 4 4 version = "7.0.4"; ··· 31 31 buildInputs = [perl]; 32 32 33 33 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 + 34 40 # Strip is harmful, see also below. It's important that this happens 35 41 # first. The GHC Cabal build system makes use of strip by default and 36 42 # has hardcoded paths to /usr/bin/strip in many places. We replace ··· 47 53 '' 48 54 find . -name integer-gmp.buildinfo \ 49 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@" {} \; 50 59 '' + 51 60 # On Linux, use patchelf to modify the executables so that they can 52 61 # find editline/gmp. 53 - (if stdenv.isLinux then '' 62 + stdenv.lib.optionalString stdenv.isLinux '' 54 63 find . -type f -perm +100 \ 55 64 -exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ 56 65 --set-rpath "${ncurses}/lib:${gmp}/lib" {} \; ··· 59 68 for prog in ld ar gcc strip ranlib; do 60 69 find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \; 61 70 done 62 - '' else ""); 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 + ''; 63 89 64 90 configurePhase = '' 65 - ./configure --prefix=$out --with-gmp-libraries=${gmp}/lib --with-gmp-includes=${gmp}/include 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}"} 66 94 ''; 67 95 68 96 # Stripping combined with patchelf breaks the executables (they die
+13 -4
pkgs/development/compilers/ghc/7.0.4.nix
··· 1 - { stdenv, fetchurl, ghc, perl, gmp, ncurses }: 1 + { stdenv, fetchurl, ghc, perl, gmp, ncurses, libiconv }: 2 2 3 3 stdenv.mkDerivation rec { 4 4 version = "7.0.4"; ··· 9 9 sha256 = "1a9b78d9d66c9c21de6c0932e36bb87406a4856f1611bf83bd44539bdc6ed0ed"; 10 10 }; 11 11 12 + patches = [ ./fix-7.0.4-clang.patch ]; 13 + 12 14 buildInputs = [ ghc perl gmp ncurses ]; 13 15 14 16 buildMK = '' ··· 16 18 libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp}/include" 17 19 libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-includes="${ncurses}/include" 18 20 libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="${ncurses}/lib" 21 + ${stdenv.lib.optionalString stdenv.isDarwin '' 22 + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-includes="${libiconv}/include" 23 + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib" 24 + ''} 19 25 ''; 20 26 21 27 preConfigure = '' 22 28 echo "${buildMK}" > mk/build.mk 23 29 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure 30 + '' + stdenv.lib.optionalString stdenv.isDarwin '' 31 + find . -name '*.hs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|' 32 + find . -name '*.lhs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|' 33 + export NIX_LDFLAGS+=" -no_dtrace_dof" 24 34 ''; 25 35 26 - configureFlags=[ 27 - "--with-gcc=${stdenv.cc}/bin/gcc" 28 - ]; 36 + configureFlags = if stdenv.isDarwin then "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}" 37 + else "--with-gcc=${stdenv.cc}/bin/gcc"; 29 38 30 39 NIX_CFLAGS_COMPILE = "-fomit-frame-pointer"; 31 40
+16 -4
pkgs/development/compilers/ghc/7.2.2.nix
··· 1 - { stdenv, fetchurl, ghc, perl, gmp, ncurses }: 1 + { stdenv, fetchurl, ghc, perl, gmp, ncurses, libiconv }: 2 2 3 3 stdenv.mkDerivation rec { 4 4 version = "7.2.2"; ··· 9 9 sha256 = "0g87d3z9275dniaqzkf56qfgzp1msd89nqqhhm2gkc6iga072spz"; 10 10 }; 11 11 12 + patches = [ ./fix-7.2.2-clang.patch ]; 13 + 12 14 buildInputs = [ ghc perl gmp ncurses ]; 13 15 16 + enableParallelBuilding = true; 17 + 14 18 buildMK = '' 15 19 libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="${gmp}/lib" 16 20 libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp}/include" 17 21 libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-includes="${ncurses}/include" 18 22 libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="${ncurses}/lib" 23 + ${stdenv.lib.optionalString stdenv.isDarwin '' 24 + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-includes="${libiconv}/include" 25 + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib" 26 + ''} 19 27 ''; 20 28 21 29 preConfigure = '' 22 30 echo "${buildMK}" > mk/build.mk 23 31 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure 32 + '' + stdenv.lib.optionalString stdenv.isDarwin '' 33 + find . -name '*.hs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|' 34 + find . -name '*.lhs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|' 35 + export NIX_LDFLAGS+=" -no_dtrace_dof" 24 36 ''; 25 37 26 - configureFlags=[ 27 - "--with-gcc=${stdenv.cc}/bin/gcc" 28 - ]; 38 + configureFlags = if stdenv.isDarwin then "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}" 39 + else "--with-gcc=${stdenv.cc}/bin/gcc"; 29 40 30 41 NIX_CFLAGS_COMPILE = "-fomit-frame-pointer"; 31 42 ··· 36 47 meta = { 37 48 homepage = "http://haskell.org/ghc"; 38 49 description = "The Glasgow Haskell Compiler"; 50 + broken = stdenv.isDarwin; 39 51 maintainers = [ 40 52 stdenv.lib.maintainers.marcweber 41 53 stdenv.lib.maintainers.andres
+51 -17
pkgs/development/compilers/ghc/7.4.2-binary.nix
··· 1 - {stdenv, fetchurl, perl, ncurses, gmp}: 1 + {stdenv, fetchurl, perl, ncurses, gmp, libiconv, makeWrapper}: 2 2 3 3 stdenv.mkDerivation rec { 4 4 version = "7.4.2"; ··· 31 31 buildInputs = [perl]; 32 32 33 33 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 + 34 40 # Strip is harmful, see also below. It's important that this happens 35 41 # first. The GHC Cabal build system makes use of strip by default and 36 42 # has hardcoded paths to /usr/bin/strip in many places. We replace ··· 47 53 '' 48 54 find . -name integer-gmp.buildinfo \ 49 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@" {} \; 50 59 '' + 51 60 # On Linux, use patchelf to modify the executables so that they can 52 61 # find editline/gmp. 53 - (if stdenv.isLinux then '' 62 + stdenv.lib.optionalString stdenv.isLinux '' 54 63 find . -type f -perm +100 \ 55 64 -exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ 56 65 --set-rpath "${ncurses}/lib:${gmp}/lib" {} \; ··· 59 68 for prog in ld ar gcc strip ranlib; do 60 69 find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \; 61 70 done 62 - '' else ""); 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 + ''; 63 89 64 90 configurePhase = '' 65 91 ./configure --prefix=$out \ 66 92 --with-gmp-libraries=${gmp}/lib --with-gmp-includes=${gmp}/include \ 67 - ${stdenv.lib.optionalString stdenv.isDarwin "--with-gcc=${./gcc-clang-wrapper.sh}"} 93 + ${stdenv.lib.optionalString stdenv.isDarwin "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}"} 68 94 ''; 69 95 70 96 # Stripping combined with patchelf breaks the executables (they die ··· 75 101 # calls install-strip ... 76 102 buildPhase = "true"; 77 103 78 - postInstall = 79 - '' 80 - # Sanity check, can ghc create executables? 81 - cd $TMP 82 - mkdir test-ghc; cd test-ghc 83 - cat > main.hs << EOF 84 - module Main where 85 - main = putStrLn "yes" 86 - EOF 87 - $out/bin/ghc --make main.hs 88 - echo compilation ok 89 - [ $(./main) == "yes" ] 90 - ''; 104 + preInstall = stdenv.lib.optionalString stdenv.isDarwin '' 105 + mkdir -p $out/lib/ghc-7.4.2 106 + mkdir -p $out/bin 107 + ln -s ${libiconv}/lib/libiconv.dylib $out/bin 108 + ln -s ${libiconv}/lib/libiconv.dylib $out/lib/ghc-7.4.2/libiconv.dylib 109 + ln -s ${libiconv}/lib/libiconv.dylib utils/ghc-cabal/dist-install/build/tmp 110 + ''; 111 + 112 + postInstall = '' 113 + # Sanity check, can ghc create executables? 114 + cd $TMP 115 + mkdir test-ghc; cd test-ghc 116 + cat > main.hs << EOF 117 + {-# LANGUAGE TemplateHaskell #-} 118 + module Main where 119 + main = putStrLn \$([|"yes"|]) 120 + EOF 121 + $out/bin/ghc --make main.hs || exit 1 122 + echo compilation ok 123 + [ $(./main) == "yes" ] 124 + ''; 91 125 92 126 meta.license = stdenv.lib.licenses.bsd3; 93 127 meta.platforms = ["x86_64-linux" "i686-linux" "i686-darwin" "x86_64-darwin"];
+14 -4
pkgs/development/compilers/ghc/7.4.2.nix
··· 1 - { stdenv, fetchurl, ghc, perl, gmp, ncurses }: 1 + { stdenv, fetchurl, ghc, perl, gmp, ncurses, libiconv }: 2 2 3 3 stdenv.mkDerivation rec { 4 4 version = "7.4.2"; ··· 10 10 sha256 = "0vc3zmxqi4gflssmj35n5c8idbvyrhd88abi50whbirwlf4i5vpj"; 11 11 }; 12 12 13 + patches = [ ./fix-7.4.2-clang.patch ]; 14 + 13 15 buildInputs = [ ghc perl gmp ncurses ]; 14 16 17 + enableParallelBuilding = true; 15 18 16 19 buildMK = '' 17 20 libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="${gmp}/lib" 18 21 libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp}/include" 19 22 libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-includes="${ncurses}/include" 20 23 libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="${ncurses}/lib" 24 + ${stdenv.lib.optionalString stdenv.isDarwin '' 25 + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-includes="${libiconv}/include" 26 + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib" 27 + ''} 21 28 ''; 22 29 23 30 preConfigure = '' ··· 25 32 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure 26 33 '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' 27 34 export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}" 35 + '' + stdenv.lib.optionalString stdenv.isDarwin '' 36 + find . -name '*.hs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|' 37 + find . -name '*.lhs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|' 38 + export NIX_LDFLAGS+=" -no_dtrace_dof" 28 39 ''; 29 40 30 - configureFlags=[ 31 - "--with-gcc=${stdenv.cc}/bin/gcc" 32 - ]; 41 + configureFlags = if stdenv.isDarwin then "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}" 42 + else "--with-gcc=${stdenv.cc}/bin/gcc"; 33 43 34 44 # required, because otherwise all symbols from HSffi.o are stripped, and 35 45 # that in turn causes GHCi to abort
+16 -3
pkgs/development/compilers/ghc/7.6.3.nix
··· 1 - { stdenv, fetchurl, ghc, perl, gmp, ncurses, binutils }: 1 + { stdenv, fetchurl, ghc, perl, gmp, ncurses, binutils, libiconv }: 2 2 3 3 let 4 4 # The "-Wa,--noexecstack" options might be needed only with GNU ld (as opposed ··· 17 17 sha256 = "1669m8k9q72rpd2mzs0bh2q6lcwqiwd1ax3vrard1dgn64yq4hxx"; 18 18 }; 19 19 20 + patches = [ ./fix-7.6.3-clang.patch ]; 21 + 20 22 buildInputs = [ ghc perl gmp ncurses ]; 21 23 22 24 buildMK = '' ··· 24 26 libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp}/include" 25 27 libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-includes="${ncurses}/include" 26 28 libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="${ncurses}/lib" 29 + ${stdenv.lib.optionalString stdenv.isDarwin '' 30 + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-includes="${libiconv}/include" 31 + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib" 32 + ''} 27 33 '' + stdenv.lib.optionalString stdenv.isLinux '' 28 34 # Set ghcFlags for building ghc itself 29 35 SRC_HC_OPTS += ${ghcFlags} 30 36 SRC_CC_OPTS += ${cFlags} 31 37 ''; 38 + 39 + enableParallelBuilding = true; 32 40 33 41 preConfigure = '' 34 42 echo "${buildMK}" > mk/build.mk ··· 40 48 41 49 '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' 42 50 export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}" 51 + '' + stdenv.lib.optionalString stdenv.isDarwin '' 52 + find . -name '*.hs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|' 53 + find . -name '*.lhs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|' 54 + export NIX_LDFLAGS+=" -no_dtrace_dof" 43 55 ''; 44 56 45 - configureFlags = "--with-gcc=${stdenv.cc}/bin/gcc"; 57 + configureFlags = if stdenv.isDarwin then "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}" 58 + else "--with-gcc=${stdenv.cc}/bin/gcc"; 46 59 47 60 postInstall = '' 48 61 # ghci uses mmap with rwx protection at it implements dynamic ··· 56 69 57 70 # required, because otherwise all symbols from HSffi.o are stripped, and 58 71 # that in turn causes GHCi to abort 59 - stripDebugFlags=["-S" "--keep-file-symbols"]; 72 + stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols"; 60 73 61 74 meta = { 62 75 homepage = "http://haskell.org/ghc";
+8 -3
pkgs/development/compilers/ghc/7.8.4.nix
··· 1 - { stdenv, fetchurl, ghc, perl, gmp, ncurses }: 1 + { stdenv, fetchurl, ghc, perl, gmp, ncurses, libiconv }: 2 2 3 3 stdenv.mkDerivation rec { 4 4 version = "7.8.4"; ··· 18 18 libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp}/include" 19 19 libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-includes="${ncurses}/include" 20 20 libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="${ncurses}/lib" 21 - DYNAMIC_BY_DEFAULT = NO 21 + ${stdenv.lib.optionalString stdenv.isDarwin '' 22 + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-includes="${libiconv}/include" 23 + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib" 24 + ''} 22 25 ''; 23 26 24 27 preConfigure = '' ··· 26 29 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure 27 30 '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' 28 31 export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}" 32 + '' + stdenv.lib.optionalString stdenv.isDarwin '' 33 + export NIX_LDFLAGS+=" -no_dtrace_dof" 29 34 ''; 30 35 31 36 # required, because otherwise all symbols from HSffi.o are stripped, and 32 37 # that in turn causes GHCi to abort 33 - stripDebugFlags = [ "-S" "--keep-file-symbols" ]; 38 + stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols"; 34 39 35 40 meta = with stdenv.lib; { 36 41 homepage = "http://haskell.org/ghc";
+64
pkgs/development/compilers/ghc/fix-7.0.4-clang.patch
··· 1 + diff --git a/compiler/codeGen/CgInfoTbls.hs b/compiler/codeGen/CgInfoTbls.hs 2 + index f704a69..37753fd 100644 3 + --- a/compiler/codeGen/CgInfoTbls.hs 4 + +++ b/compiler/codeGen/CgInfoTbls.hs 5 + @@ -211,9 +211,7 @@ mkStackLayout = do 6 + [(offset - frame_sp - retAddrSizeW, b) 7 + | (offset, b) <- binds] 8 + 9 + - WARN( not (all (\bind -> fst bind >= 0) rel_binds), 10 + - ppr binds $$ ppr rel_binds $$ 11 + - ppr frame_size $$ ppr real_sp $$ ppr frame_sp ) 12 + + WARN( not (all (\bind -> fst bind >= 0) rel_binds), ppr binds $$ ppr rel_binds $$ ppr frame_size $$ ppr real_sp $$ ppr frame_sp ) 13 + return $ stack_layout rel_binds frame_size 14 + 15 + stack_layout :: [(VirtualSpOffset, CgIdInfo)] 16 + diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs 17 + index 638e1db..a24e564 100644 18 + --- a/compiler/main/GHC.hs 19 + +++ b/compiler/main/GHC.hs 20 + @@ -788,8 +788,7 @@ load2 how_much mod_graph = do 21 + -- is stable). 22 + partial_mg 23 + | LoadDependenciesOf _mod <- how_much 24 + - = ASSERT( case last partial_mg0 of 25 + - AcyclicSCC ms -> ms_mod_name ms == _mod; _ -> False ) 26 + + = ASSERT( case last partial_mg0 of AcyclicSCC ms -> ms_mod_name ms == _mod; _ -> False ) 27 + List.init partial_mg0 28 + | otherwise 29 + = partial_mg0 30 + diff --git a/compiler/simplCore/SimplUtils.lhs b/compiler/simplCore/SimplUtils.lhs 31 + index 99a63e4..3268726 100644 32 + --- a/compiler/simplCore/SimplUtils.lhs 33 + +++ b/compiler/simplCore/SimplUtils.lhs 34 + @@ -388,8 +388,7 @@ mkArgInfo fun rules n_val_args call_cont 35 + else 36 + map isStrictDmd demands ++ vanilla_stricts 37 + | otherwise 38 + - -> WARN( True, text "More demands than arity" <+> ppr fun <+> ppr (idArity fun) 39 + - <+> ppr n_val_args <+> ppr demands ) 40 + + -> WARN( True, text "More demands than arity" <+> ppr fun <+> ppr (idArity fun) <+> ppr n_val_args <+> ppr demands ) 41 + vanilla_stricts -- Not enough args, or no strictness 42 + 43 + add_type_str :: Type -> [Bool] -> [Bool] 44 + @@ -1812,4 +1811,4 @@ without getting changed to c1=I# c2. 45 + I don't think this is worth fixing, even if I knew how. It'll 46 + all come out in the next pass anyway. 47 + 48 + - 49 + \ No newline at end of file 50 + + 51 + diff --git a/compiler/simplCore/Simplify.lhs b/compiler/simplCore/Simplify.lhs 52 + index d0fbd8d..ef87996 100644 53 + --- a/compiler/simplCore/Simplify.lhs 54 + +++ b/compiler/simplCore/Simplify.lhs 55 + @@ -2071,8 +2071,7 @@ mkDupableAlt env case_bndr (con, bndrs', rhs') 56 + rhs = mkConApp dc (map Type (tyConAppArgs scrut_ty) 57 + ++ varsToCoreExprs bndrs') 58 + 59 + - LitAlt {} -> WARN( True, ptext (sLit "mkDupableAlt") 60 + - <+> ppr case_bndr <+> ppr con ) 61 + + LitAlt {} -> WARN( True, ptext (sLit "mkDupableAlt") <+> ppr case_bndr <+> ppr con ) 62 + case_bndr 63 + -- The case binder is alive but trivial, so why has 64 + -- it not been substituted away?
+74
pkgs/development/compilers/ghc/fix-7.2.2-clang.patch
··· 1 + diff --git a/compiler/codeGen/CgInfoTbls.hs b/compiler/codeGen/CgInfoTbls.hs 2 + index dbd22f3..42208f9 100644 3 + --- a/compiler/codeGen/CgInfoTbls.hs 4 + +++ b/compiler/codeGen/CgInfoTbls.hs 5 + @@ -210,9 +210,7 @@ mkStackLayout = do 6 + [(offset - frame_sp - retAddrSizeW, b) 7 + | (offset, b) <- binds] 8 + 9 + - WARN( not (all (\bind -> fst bind >= 0) rel_binds), 10 + - ppr binds $$ ppr rel_binds $$ 11 + - ppr frame_size $$ ppr real_sp $$ ppr frame_sp ) 12 + + WARN( not (all (\bind -> fst bind >= 0) rel_binds), ppr binds $$ ppr rel_binds $$ ppr frame_size $$ ppr real_sp $$ ppr frame_sp ) 13 + return $ stack_layout rel_binds frame_size 14 + 15 + stack_layout :: [(VirtualSpOffset, CgIdInfo)] 16 + diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs 17 + index dece548..9643f30 100644 18 + --- a/compiler/main/GhcMake.hs 19 + +++ b/compiler/main/GhcMake.hs 20 + @@ -236,8 +236,7 @@ load2 how_much mod_graph = do 21 + -- is stable). 22 + partial_mg 23 + | LoadDependenciesOf _mod <- how_much 24 + - = ASSERT( case last partial_mg0 of 25 + - AcyclicSCC ms -> ms_mod_name ms == _mod; _ -> False ) 26 + + = ASSERT( case last partial_mg0 of AcyclicSCC ms -> ms_mod_name ms == _mod; _ -> False ) 27 + List.init partial_mg0 28 + | otherwise 29 + = partial_mg0 30 + @@ -331,8 +330,7 @@ load2 how_much mod_graph = do 31 + liftIO $ intermediateCleanTempFiles dflags mods_to_keep hsc_env1 32 + 33 + -- there should be no Nothings where linkables should be, now 34 + - ASSERT(all (isJust.hm_linkable) 35 + - (eltsUFM (hsc_HPT hsc_env))) do 36 + + ASSERT(all (isJust.hm_linkable) (eltsUFM (hsc_HPT hsc_env))) do 37 + 38 + -- Link everything together 39 + linkresult <- liftIO $ link (ghcLink dflags) dflags False hpt4 40 + diff --git a/compiler/simplCore/SimplUtils.lhs b/compiler/simplCore/SimplUtils.lhs 41 + index dd0ce4b..9501e73 100644 42 + --- a/compiler/simplCore/SimplUtils.lhs 43 + +++ b/compiler/simplCore/SimplUtils.lhs 44 + @@ -393,8 +393,7 @@ mkArgInfo fun rules n_val_args call_cont 45 + else 46 + map isStrictDmd demands ++ vanilla_stricts 47 + | otherwise 48 + - -> WARN( True, text "More demands than arity" <+> ppr fun <+> ppr (idArity fun) 49 + - <+> ppr n_val_args <+> ppr demands ) 50 + + -> WARN( True, text "More demands than arity" <+> ppr fun <+> ppr (idArity fun) <+> ppr n_val_args <+> ppr demands ) 51 + vanilla_stricts -- Not enough args, or no strictness 52 + 53 + add_type_str :: Type -> [Bool] -> [Bool] 54 + @@ -1845,4 +1844,4 @@ without getting changed to c1=I# c2. 55 + I don't think this is worth fixing, even if I knew how. It'll 56 + all come out in the next pass anyway. 57 + 58 + - 59 + \ No newline at end of file 60 + + 61 + diff --git a/compiler/simplCore/Simplify.lhs b/compiler/simplCore/Simplify.lhs 62 + index adcaf13..06d939d 100644 63 + --- a/compiler/simplCore/Simplify.lhs 64 + +++ b/compiler/simplCore/Simplify.lhs 65 + @@ -2185,8 +2185,7 @@ mkDupableAlt env case_bndr (con, bndrs', rhs') 66 + rhs = mkConApp dc (map Type (tyConAppArgs scrut_ty) 67 + ++ varsToCoreExprs bndrs') 68 + 69 + - LitAlt {} -> WARN( True, ptext (sLit "mkDupableAlt") 70 + - <+> ppr case_bndr <+> ppr con ) 71 + + LitAlt {} -> WARN( True, ptext (sLit "mkDupableAlt") <+> ppr case_bndr <+> ppr con ) 72 + case_bndr 73 + -- The case binder is alive but trivial, so why has 74 + -- it not been substituted away?
+57
pkgs/development/compilers/ghc/fix-7.4.2-clang.patch
··· 1 + diff --git a/compiler/codeGen/CgInfoTbls.hs b/compiler/codeGen/CgInfoTbls.hs 2 + index 25ba154..fbb7874 100644 3 + --- a/compiler/codeGen/CgInfoTbls.hs 4 + +++ b/compiler/codeGen/CgInfoTbls.hs 5 + @@ -178,9 +178,7 @@ mkStackLayout = do 6 + [(offset - frame_sp - retAddrSizeW, b) 7 + | (offset, b) <- binds] 8 + 9 + - WARN( not (all (\bind -> fst bind >= 0) rel_binds), 10 + - pprPlatform platform binds $$ pprPlatform platform rel_binds $$ 11 + - ppr frame_size $$ ppr real_sp $$ ppr frame_sp ) 12 + + WARN( not (all (\bind -> fst bind >= 0) rel_binds), pprPlatform platform binds $$ pprPlatform platform rel_binds $$ ppr frame_size $$ ppr real_sp $$ ppr frame_sp ) 13 + return $ stack_layout rel_binds frame_size 14 + 15 + stack_layout :: [(VirtualSpOffset, CgIdInfo)] 16 + diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs 17 + index 091e1be..23447e4 100644 18 + --- a/compiler/main/GhcMake.hs 19 + +++ b/compiler/main/GhcMake.hs 20 + @@ -338,8 +338,7 @@ load2 how_much mod_graph = do 21 + liftIO $ intermediateCleanTempFiles dflags mods_to_keep hsc_env1 22 + 23 + -- there should be no Nothings where linkables should be, now 24 + - ASSERT(all (isJust.hm_linkable) 25 + - (eltsUFM (hsc_HPT hsc_env))) do 26 + + ASSERT(all (isJust.hm_linkable) (eltsUFM (hsc_HPT hsc_env))) do 27 + 28 + -- Link everything together 29 + linkresult <- liftIO $ link (ghcLink dflags) dflags False hpt4 30 + diff --git a/compiler/simplCore/SimplUtils.lhs b/compiler/simplCore/SimplUtils.lhs 31 + index 86dc88d..ecde4fd 100644 32 + --- a/compiler/simplCore/SimplUtils.lhs 33 + +++ b/compiler/simplCore/SimplUtils.lhs 34 + @@ -407,8 +407,7 @@ mkArgInfo fun rules n_val_args call_cont 35 + else 36 + map isStrictDmd demands ++ vanilla_stricts 37 + | otherwise 38 + - -> WARN( True, text "More demands than arity" <+> ppr fun <+> ppr (idArity fun) 39 + - <+> ppr n_val_args <+> ppr demands ) 40 + + -> WARN( True, text "More demands than arity" <+> ppr fun <+> ppr (idArity fun) <+> ppr n_val_args <+> ppr demands ) 41 + vanilla_stricts -- Not enough args, or no strictness 42 + 43 + add_type_str :: Type -> [Bool] -> [Bool] 44 + diff --git a/compiler/simplCore/Simplify.lhs b/compiler/simplCore/Simplify.lhs 45 + index 3bd95a7..4c9ee7c 100644 46 + --- a/compiler/simplCore/Simplify.lhs 47 + +++ b/compiler/simplCore/Simplify.lhs 48 + @@ -2336,8 +2336,7 @@ mkDupableAlt env case_bndr (con, bndrs', rhs') 49 + rhs = mkConApp dc (map Type (tyConAppArgs scrut_ty) 50 + ++ varsToCoreExprs bndrs') 51 + 52 + - LitAlt {} -> WARN( True, ptext (sLit "mkDupableAlt") 53 + - <+> ppr case_bndr <+> ppr con ) 54 + + LitAlt {} -> WARN( True, ptext (sLit "mkDupableAlt") <+> ppr case_bndr <+> ppr con ) 55 + case_bndr 56 + -- The case binder is alive but trivial, so why has 57 + -- it not been substituted away?
+71
pkgs/development/compilers/ghc/fix-7.6.3-clang.patch
··· 1 + diff --git a/compiler/codeGen/CgInfoTbls.hs b/compiler/codeGen/CgInfoTbls.hs 2 + index 7cdb1b6..e953507 100644 3 + --- a/compiler/codeGen/CgInfoTbls.hs 4 + +++ b/compiler/codeGen/CgInfoTbls.hs 5 + @@ -157,9 +157,7 @@ mkStackLayout = do 6 + [(offset - frame_sp - retAddrSizeW, b) 7 + | (offset, b) <- binds] 8 + 9 + - WARN( not (all (\bind -> fst bind >= 0) rel_binds), 10 + - ppr binds $$ ppr rel_binds $$ 11 + - ppr frame_size $$ ppr real_sp $$ ppr frame_sp ) 12 + + WARN( not (all (\bind -> fst bind >= 0) rel_binds), ppr binds $$ ppr rel_binds $$ ppr frame_size $$ ppr real_sp $$ ppr frame_sp ) 13 + return $ stack_layout rel_binds frame_size 14 + 15 + stack_layout :: [(VirtualSpOffset, CgIdInfo)] 16 + diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs 17 + index f563cd9..4ac7812 100644 18 + --- a/compiler/main/GhcMake.hs 19 + +++ b/compiler/main/GhcMake.hs 20 + @@ -331,8 +331,7 @@ load how_much = do 21 + liftIO $ intermediateCleanTempFiles dflags mods_to_keep hsc_env1 22 + 23 + -- there should be no Nothings where linkables should be, now 24 + - ASSERT(all (isJust.hm_linkable) 25 + - (eltsUFM (hsc_HPT hsc_env))) do 26 + + ASSERT(all (isJust.hm_linkable) (eltsUFM (hsc_HPT hsc_env))) do 27 + 28 + -- Link everything together 29 + linkresult <- liftIO $ link (ghcLink dflags) dflags False hpt4 30 + diff --git a/compiler/simplCore/SimplUtils.lhs b/compiler/simplCore/SimplUtils.lhs 31 + index 87aefba..479d2ef 100644 32 + --- a/compiler/simplCore/SimplUtils.lhs 33 + +++ b/compiler/simplCore/SimplUtils.lhs 34 + @@ -415,8 +415,7 @@ mkArgInfo fun rules n_val_args call_cont 35 + else 36 + map isStrictDmd demands ++ vanilla_stricts 37 + | otherwise 38 + - -> WARN( True, text "More demands than arity" <+> ppr fun <+> ppr (idArity fun) 39 + - <+> ppr n_val_args <+> ppr demands ) 40 + + -> WARN( True, text "More demands than arity" <+> ppr fun <+> ppr (idArity fun) <+> ppr n_val_args <+> ppr demands ) 41 + vanilla_stricts -- Not enough args, or no strictness 42 + 43 + add_type_str :: Type -> [Bool] -> [Bool] 44 + diff --git a/compiler/simplCore/Simplify.lhs b/compiler/simplCore/Simplify.lhs 45 + index f2ed224..464fad6 100644 46 + --- a/compiler/simplCore/Simplify.lhs 47 + +++ b/compiler/simplCore/Simplify.lhs 48 + @@ -2359,8 +2359,7 @@ mkDupableAlt env case_bndr (con, bndrs', rhs') 49 + rhs = mkConApp dc (map Type (tyConAppArgs scrut_ty) 50 + ++ varsToCoreExprs bndrs') 51 + 52 + - LitAlt {} -> WARN( True, ptext (sLit "mkDupableAlt") 53 + - <+> ppr case_bndr <+> ppr con ) 54 + + LitAlt {} -> WARN( True, ptext (sLit "mkDupableAlt") <+> ppr case_bndr <+> ppr con ) 55 + case_bndr 56 + -- The case binder is alive but trivial, so why has 57 + -- it not been substituted away? 58 + diff --git a/compiler/types/Coercion.lhs b/compiler/types/Coercion.lhs 59 + index 42e54ba..9b420ae 100644 60 + --- a/compiler/types/Coercion.lhs 61 + +++ b/compiler/types/Coercion.lhs 62 + @@ -498,8 +498,7 @@ splitForAllCo_maybe _ = Nothing 63 + coVarKind :: CoVar -> (Type,Type) 64 + coVarKind cv 65 + | Just (tc, [_kind,ty1,ty2]) <- splitTyConApp_maybe (varType cv) 66 + - = ASSERT (tc `hasKey` eqPrimTyConKey) 67 + - (ty1,ty2) 68 + + = ASSERT (tc `hasKey` eqPrimTyConKey) (ty1,ty2) 69 + | otherwise = panic "coVarKind, non coercion variable" 70 + 71 + -- | Makes a coercion type from two types: the types whose equality
pkgs/development/compilers/ghc/gcc-clang-wrapper.sh pkgs/development/haskell-modules/gcc-clang-wrapper.sh
+11 -3
pkgs/development/compilers/ghc/head.nix
··· 1 - { stdenv, fetchurl, ghc, perl, gmp, ncurses }: 1 + { stdenv, fetchurl, ghc, perl, gmp, ncurses, libiconv }: 2 2 3 3 let 4 4 ··· 7 7 libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp}/include" 8 8 libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-includes="${ncurses}/include" 9 9 libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="${ncurses}/lib" 10 - DYNAMIC_BY_DEFAULT = NO 10 + ${stdenv.lib.optionalString stdenv.isDarwin '' 11 + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-includes="${libiconv}/include" 12 + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib" 13 + ''} 11 14 ''; 12 15 13 16 in ··· 21 24 sha256 = "1zy960q2faq03camq2n4834bd748vkc15h83bapswc68dqncqj20"; 22 25 }; 23 26 27 + postUnpack = '' 28 + # tarball includes many already-compiled files 29 + find . \( -name '*.dyn_o' -o -name '*.dyn_hi' -o -name haddock \) -type f -exec rm {} \; 30 + ''; 31 + 24 32 buildInputs = [ ghc perl ]; 25 33 26 34 preConfigure = '' ··· 39 47 40 48 # required, because otherwise all symbols from HSffi.o are stripped, and 41 49 # that in turn causes GHCi to abort 42 - stripDebugFlags = [ "-S" "--keep-file-symbols" ]; 50 + stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols"; 43 51 44 52 meta = { 45 53 homepage = "http://haskell.org/ghc";
+28 -10
pkgs/top-level/haskell-ng.nix
··· 1 - { pkgs, callPackage }: 1 + { pkgs, callPackage, stdenv }: 2 2 3 3 rec { 4 4 ··· 7 7 compiler = { 8 8 9 9 ghc6102Binary = callPackage ../development/compilers/ghc/6.10.2-binary.nix { gmp = pkgs.gmp4; }; 10 - ghc704Binary = callPackage ../development/compilers/ghc/7.0.4-binary.nix { gmp = pkgs.gmp4; }; 11 - ghc742Binary = callPackage ../development/compilers/ghc/7.4.2-binary.nix { gmp = pkgs.gmp4; }; 10 + ghc704Binary = callPackage ../development/compilers/ghc/7.0.4-binary.nix ({ gmp = pkgs.gmp4; } // stdenv.lib.optionalAttrs stdenv.isDarwin { 11 + libiconv = pkgs.darwin.libiconv; 12 + }); 13 + ghc742Binary = callPackage ../development/compilers/ghc/7.4.2-binary.nix ({ gmp = pkgs.gmp4; } // stdenv.lib.optionalAttrs stdenv.isDarwin { 14 + libiconv = pkgs.darwin.libiconv; 15 + }); 12 16 13 17 ghc6104 = callPackage ../development/compilers/ghc/6.10.4.nix { ghc = compiler.ghc6102Binary; gmp = pkgs.gmp.override { withStatic = true; }; }; 14 18 ghc6123 = callPackage ../development/compilers/ghc/6.12.3.nix { ghc = compiler.ghc6102Binary; gmp = pkgs.gmp.override { withStatic = true; }; }; 15 - ghc704 = callPackage ../development/compilers/ghc/7.0.4.nix { ghc = compiler.ghc704Binary; gmp = pkgs.gmp.override { withStatic = true; }; }; 16 - ghc722 = callPackage ../development/compilers/ghc/7.2.2.nix { ghc = compiler.ghc704Binary; gmp = pkgs.gmp.override { withStatic = true; }; }; 17 - ghc742 = callPackage ../development/compilers/ghc/7.4.2.nix { ghc = compiler.ghc704Binary; gmp = pkgs.gmp.override { withStatic = true; }; }; 18 - ghc763 = callPackage ../development/compilers/ghc/7.6.3.nix { ghc = compiler.ghc704Binary; gmp = pkgs.gmp.override { withStatic = true; }; }; 19 - ghc784 = callPackage ../development/compilers/ghc/7.8.4.nix { ghc = compiler.ghc742Binary; gmp = pkgs.gmp.override { withStatic = true; }; }; 20 - ghc7101 = callPackage ../development/compilers/ghc/7.10.1.nix { ghc = compiler.ghc784; gmp = pkgs.gmp.override { withStatic = true; }; }; 21 - ghcHEAD = callPackage ../development/compilers/ghc/head.nix { ghc = compiler.ghc784; gmp = pkgs.gmp.override { withStatic = true; }; }; 19 + ghc704 = callPackage ../development/compilers/ghc/7.0.4.nix ({ ghc = compiler.ghc704Binary; gmp = pkgs.gmp.override { withStatic = true; }; } // stdenv.lib.optionalAttrs stdenv.isDarwin { 20 + libiconv = pkgs.darwin.libiconv; 21 + }); 22 + ghc722 = callPackage ../development/compilers/ghc/7.2.2.nix ({ ghc = compiler.ghc704Binary; gmp = pkgs.gmp.override { withStatic = true; }; } // stdenv.lib.optionalAttrs stdenv.isDarwin { 23 + libiconv = pkgs.darwin.libiconv; 24 + }); 25 + ghc742 = callPackage ../development/compilers/ghc/7.4.2.nix ({ ghc = compiler.ghc704Binary; gmp = pkgs.gmp.override { withStatic = true; }; } // stdenv.lib.optionalAttrs stdenv.isDarwin { 26 + libiconv = pkgs.darwin.libiconv; 27 + }); 28 + ghc763 = callPackage ../development/compilers/ghc/7.6.3.nix ({ ghc = compiler.ghc704Binary; gmp = pkgs.gmp.override { withStatic = true; }; } // stdenv.lib.optionalAttrs stdenv.isDarwin { 29 + libiconv = pkgs.darwin.libiconv; 30 + }); 31 + ghc784 = callPackage ../development/compilers/ghc/7.8.4.nix ({ ghc = compiler.ghc742Binary; gmp = pkgs.gmp.override { withStatic = true; }; } // stdenv.lib.optionalAttrs stdenv.isDarwin { 32 + libiconv = pkgs.darwin.libiconv; 33 + }); 34 + ghc7101 = callPackage ../development/compilers/ghc/7.10.1.nix ({ ghc = compiler.ghc784; gmp = pkgs.gmp.override { withStatic = true; }; } // stdenv.lib.optionalAttrs stdenv.isDarwin { 35 + libiconv = pkgs.darwin.libiconv; 36 + }); 37 + ghcHEAD = callPackage ../development/compilers/ghc/head.nix ({ ghc = packages.ghc784.ghc; } // stdenv.lib.optionalAttrs stdenv.isDarwin { 38 + libiconv = pkgs.darwin.libiconv; 39 + }); 22 40 ghc = compiler.ghc784; 23 41 24 42 };