diff options
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r-- | pkgs/development/compilers/ghc/7.0.4-binary.nix | 36 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/7.0.4.nix | 17 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/7.2.2.nix | 20 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/7.4.2-binary.nix | 68 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/7.4.2.nix | 18 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/7.6.3.nix | 19 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/7.8.4.nix | 11 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/fix-7.0.4-clang.patch | 64 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/fix-7.2.2-clang.patch | 74 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/fix-7.4.2-clang.patch | 57 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/fix-7.6.3-clang.patch | 71 | ||||
-rwxr-xr-x | pkgs/development/compilers/ghc/gcc-clang-wrapper.sh | 46 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/head.nix | 7 |
13 files changed, 421 insertions, 87 deletions
diff --git a/pkgs/development/compilers/ghc/7.0.4-binary.nix b/pkgs/development/compilers/ghc/7.0.4-binary.nix index 1fedfaedf51c..cd774f912571 100644 --- a/pkgs/development/compilers/ghc/7.0.4-binary.nix +++ b/pkgs/development/compilers/ghc/7.0.4-binary.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, perl, ncurses, gmp}: +{stdenv, fetchurl, perl, ncurses, gmp, libiconv}: stdenv.mkDerivation rec { version = "7.0.4"; @@ -31,6 +31,12 @@ stdenv.mkDerivation rec { buildInputs = [perl]; postUnpack = + # GHC has dtrace probes, which causes ld to try to open /usr/lib/libdtrace.dylib + # during linking + stdenv.lib.optionalString stdenv.isDarwin '' + export NIX_LDFLAGS+=" -no_dtrace_dof" + '' + + # Strip is harmful, see also below. It's important that this happens # first. The GHC Cabal build system makes use of strip by default and # has hardcoded paths to /usr/bin/strip in many places. We replace @@ -47,10 +53,13 @@ stdenv.mkDerivation rec { '' find . -name integer-gmp.buildinfo \ -exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${gmp}/lib@" {} \; + '' + stdenv.lib.optionalString stdenv.isDarwin '' + find . -name base.buildinfo \ + -exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${libiconv}/lib@" {} \; '' + # On Linux, use patchelf to modify the executables so that they can # find editline/gmp. - (if stdenv.isLinux then '' + stdenv.lib.optionalString stdenv.isLinux '' find . -type f -perm +100 \ -exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "${ncurses}/lib:${gmp}/lib" {} \; @@ -59,10 +68,29 @@ stdenv.mkDerivation rec { 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 ""); + '' + stdenv.lib.optionalString stdenv.isDarwin '' + # not enough room in the object files for the full path to libiconv :( + fix () { + install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib $1 + } + + ln -s ${libiconv}/lib/libiconv.dylib ghc-7.4.2/utils/ghc-pwd/dist-install/build/tmp + ln -s ${libiconv}/lib/libiconv.dylib ghc-7.4.2/utils/hpc/dist-install/build/tmp + ln -s ${libiconv}/lib/libiconv.dylib ghc-7.4.2/ghc/stage2/build/tmp + + for file in ghc-cabal ghc-pwd ghc-stage2 ghc-pkg haddock hsc2hs hpc; do + fix $(find . -type f -name $file) + done + + for file in $(find . -name setup-config); do + substituteInPlace $file --replace /usr/bin/ranlib "$(type -P ranlib)" + done + ''; 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 \ + ${stdenv.lib.optionalString stdenv.isDarwin "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}"} ''; # Stripping combined with patchelf breaks the executables (they die diff --git a/pkgs/development/compilers/ghc/7.0.4.nix b/pkgs/development/compilers/ghc/7.0.4.nix index fe7ec94c00dd..b4bff6e3dd2c 100644 --- a/pkgs/development/compilers/ghc/7.0.4.nix +++ b/pkgs/development/compilers/ghc/7.0.4.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, ghc, perl, gmp, ncurses }: +{ stdenv, fetchurl, ghc, perl, gmp, ncurses, libiconv }: stdenv.mkDerivation rec { version = "7.0.4"; @@ -9,6 +9,8 @@ stdenv.mkDerivation rec { sha256 = "1a9b78d9d66c9c21de6c0932e36bb87406a4856f1611bf83bd44539bdc6ed0ed"; }; + patches = [ ./fix-7.0.4-clang.patch ]; + buildInputs = [ ghc perl gmp ncurses ]; buildMK = '' @@ -16,16 +18,23 @@ stdenv.mkDerivation rec { libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp}/include" libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-includes="${ncurses}/include" libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="${ncurses}/lib" + ${stdenv.lib.optionalString stdenv.isDarwin '' + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-includes="${libiconv}/include" + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib" + ''} ''; preConfigure = '' echo "${buildMK}" > mk/build.mk sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure + '' + stdenv.lib.optionalString stdenv.isDarwin '' + find . -name '*.hs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|' + find . -name '*.lhs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|' + export NIX_LDFLAGS+=" -no_dtrace_dof" ''; - configureFlags=[ - "--with-gcc=${stdenv.cc}/bin/gcc" - ]; + configureFlags = if stdenv.isDarwin then "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}" + else "--with-gcc=${stdenv.cc}/bin/gcc"; NIX_CFLAGS_COMPILE = "-fomit-frame-pointer"; diff --git a/pkgs/development/compilers/ghc/7.2.2.nix b/pkgs/development/compilers/ghc/7.2.2.nix index fbf37f628370..c8f0ace31770 100644 --- a/pkgs/development/compilers/ghc/7.2.2.nix +++ b/pkgs/development/compilers/ghc/7.2.2.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, ghc, perl, gmp, ncurses }: +{ stdenv, fetchurl, ghc, perl, gmp, ncurses, libiconv }: stdenv.mkDerivation rec { version = "7.2.2"; @@ -9,23 +9,34 @@ stdenv.mkDerivation rec { sha256 = "0g87d3z9275dniaqzkf56qfgzp1msd89nqqhhm2gkc6iga072spz"; }; + patches = [ ./fix-7.2.2-clang.patch ]; + buildInputs = [ ghc perl gmp ncurses ]; + enableParallelBuilding = true; + buildMK = '' libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="${gmp}/lib" libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp}/include" libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-includes="${ncurses}/include" libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="${ncurses}/lib" + ${stdenv.lib.optionalString stdenv.isDarwin '' + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-includes="${libiconv}/include" + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib" + ''} ''; preConfigure = '' echo "${buildMK}" > mk/build.mk sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure + '' + stdenv.lib.optionalString stdenv.isDarwin '' + find . -name '*.hs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|' + find . -name '*.lhs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|' + export NIX_LDFLAGS+=" -no_dtrace_dof" ''; - configureFlags=[ - "--with-gcc=${stdenv.cc}/bin/gcc" - ]; + configureFlags = if stdenv.isDarwin then "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}" + else "--with-gcc=${stdenv.cc}/bin/gcc"; NIX_CFLAGS_COMPILE = "-fomit-frame-pointer"; @@ -36,6 +47,7 @@ stdenv.mkDerivation rec { meta = { homepage = "http://haskell.org/ghc"; description = "The Glasgow Haskell Compiler"; + broken = stdenv.isDarwin; maintainers = [ stdenv.lib.maintainers.marcweber stdenv.lib.maintainers.andres diff --git a/pkgs/development/compilers/ghc/7.4.2-binary.nix b/pkgs/development/compilers/ghc/7.4.2-binary.nix index 9fd1f038e7cd..4bf7d6d35319 100644 --- a/pkgs/development/compilers/ghc/7.4.2-binary.nix +++ b/pkgs/development/compilers/ghc/7.4.2-binary.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, perl, ncurses, gmp}: +{stdenv, fetchurl, perl, ncurses, gmp, libiconv, makeWrapper}: stdenv.mkDerivation rec { version = "7.4.2"; @@ -31,6 +31,12 @@ stdenv.mkDerivation rec { buildInputs = [perl]; postUnpack = + # GHC has dtrace probes, which causes ld to try to open /usr/lib/libdtrace.dylib + # during linking + stdenv.lib.optionalString stdenv.isDarwin '' + export NIX_LDFLAGS+=" -no_dtrace_dof" + '' + + # Strip is harmful, see also below. It's important that this happens # first. The GHC Cabal build system makes use of strip by default and # has hardcoded paths to /usr/bin/strip in many places. We replace @@ -47,10 +53,13 @@ stdenv.mkDerivation rec { '' find . -name integer-gmp.buildinfo \ -exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${gmp}/lib@" {} \; + '' + stdenv.lib.optionalString stdenv.isDarwin '' + find . -name base.buildinfo \ + -exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${libiconv}/lib@" {} \; '' + # On Linux, use patchelf to modify the executables so that they can # find editline/gmp. - (if stdenv.isLinux then '' + stdenv.lib.optionalString stdenv.isLinux '' find . -type f -perm +100 \ -exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath "${ncurses}/lib:${gmp}/lib" {} \; @@ -59,12 +68,29 @@ stdenv.mkDerivation rec { 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 ""); + '' + stdenv.lib.optionalString stdenv.isDarwin '' + # not enough room in the object files for the full path to libiconv :( + fix () { + install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib $1 + } + + ln -s ${libiconv}/lib/libiconv.dylib ghc-7.4.2/utils/ghc-pwd/dist-install/build/tmp + ln -s ${libiconv}/lib/libiconv.dylib ghc-7.4.2/utils/hpc/dist-install/build/tmp + ln -s ${libiconv}/lib/libiconv.dylib ghc-7.4.2/ghc/stage2/build/tmp + + for file in ghc-cabal ghc-pwd ghc-stage2 ghc-pkg haddock hsc2hs hpc; do + fix $(find . -type f -name $file) + done + + for file in $(find . -name setup-config); do + substituteInPlace $file --replace /usr/bin/ranlib "$(type -P ranlib)" + done + ''; configurePhase = '' ./configure --prefix=$out \ --with-gmp-libraries=${gmp}/lib --with-gmp-includes=${gmp}/include \ - ${stdenv.lib.optionalString stdenv.isDarwin "--with-gcc=${./gcc-clang-wrapper.sh}"} + ${stdenv.lib.optionalString stdenv.isDarwin "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}"} ''; # Stripping combined with patchelf breaks the executables (they die @@ -75,19 +101,27 @@ stdenv.mkDerivation rec { # calls install-strip ... buildPhase = "true"; - postInstall = - '' - # Sanity check, can ghc create executables? - cd $TMP - mkdir test-ghc; cd test-ghc - cat > main.hs << EOF - module Main where - main = putStrLn "yes" - EOF - $out/bin/ghc --make main.hs - echo compilation ok - [ $(./main) == "yes" ] - ''; + preInstall = stdenv.lib.optionalString stdenv.isDarwin '' + mkdir -p $out/lib/ghc-7.4.2 + mkdir -p $out/bin + ln -s ${libiconv}/lib/libiconv.dylib $out/bin + ln -s ${libiconv}/lib/libiconv.dylib $out/lib/ghc-7.4.2/libiconv.dylib + ln -s ${libiconv}/lib/libiconv.dylib utils/ghc-cabal/dist-install/build/tmp + ''; + + postInstall = '' + # Sanity check, can ghc create executables? + cd $TMP + mkdir test-ghc; cd test-ghc + cat > main.hs << EOF + {-# LANGUAGE TemplateHaskell #-} + module Main where + main = putStrLn \$([|"yes"|]) + EOF + $out/bin/ghc --make main.hs || exit 1 + echo compilation ok + [ $(./main) == "yes" ] + ''; meta.license = stdenv.lib.licenses.bsd3; meta.platforms = ["x86_64-linux" "i686-linux" "i686-darwin" "x86_64-darwin"]; diff --git a/pkgs/development/compilers/ghc/7.4.2.nix b/pkgs/development/compilers/ghc/7.4.2.nix index d5a3fb49c9b1..e2bfb917446e 100644 --- a/pkgs/development/compilers/ghc/7.4.2.nix +++ b/pkgs/development/compilers/ghc/7.4.2.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, ghc, perl, gmp, ncurses }: +{ stdenv, fetchurl, ghc, perl, gmp, ncurses, libiconv }: stdenv.mkDerivation rec { version = "7.4.2"; @@ -10,14 +10,21 @@ stdenv.mkDerivation rec { sha256 = "0vc3zmxqi4gflssmj35n5c8idbvyrhd88abi50whbirwlf4i5vpj"; }; + patches = [ ./fix-7.4.2-clang.patch ]; + buildInputs = [ ghc perl gmp ncurses ]; + enableParallelBuilding = true; buildMK = '' libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="${gmp}/lib" libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp}/include" libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-includes="${ncurses}/include" libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="${ncurses}/lib" + ${stdenv.lib.optionalString stdenv.isDarwin '' + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-includes="${libiconv}/include" + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib" + ''} ''; preConfigure = '' @@ -25,11 +32,14 @@ stdenv.mkDerivation rec { sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}" + '' + stdenv.lib.optionalString stdenv.isDarwin '' + find . -name '*.hs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|' + find . -name '*.lhs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|' + export NIX_LDFLAGS+=" -no_dtrace_dof" ''; - configureFlags=[ - "--with-gcc=${stdenv.cc}/bin/gcc" - ]; + configureFlags = if stdenv.isDarwin then "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}" + else "--with-gcc=${stdenv.cc}/bin/gcc"; # required, because otherwise all symbols from HSffi.o are stripped, and # that in turn causes GHCi to abort diff --git a/pkgs/development/compilers/ghc/7.6.3.nix b/pkgs/development/compilers/ghc/7.6.3.nix index 7db52d1eeecb..e47dc4fc10eb 100644 --- a/pkgs/development/compilers/ghc/7.6.3.nix +++ b/pkgs/development/compilers/ghc/7.6.3.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, ghc, perl, gmp, ncurses, binutils }: +{ stdenv, fetchurl, ghc, perl, gmp, ncurses, binutils, libiconv }: let # The "-Wa,--noexecstack" options might be needed only with GNU ld (as opposed @@ -17,6 +17,8 @@ in stdenv.mkDerivation rec { sha256 = "1669m8k9q72rpd2mzs0bh2q6lcwqiwd1ax3vrard1dgn64yq4hxx"; }; + patches = [ ./fix-7.6.3-clang.patch ]; + buildInputs = [ ghc perl gmp ncurses ]; buildMK = '' @@ -24,12 +26,18 @@ in stdenv.mkDerivation rec { libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp}/include" libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-includes="${ncurses}/include" libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="${ncurses}/lib" + ${stdenv.lib.optionalString stdenv.isDarwin '' + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-includes="${libiconv}/include" + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib" + ''} '' + stdenv.lib.optionalString stdenv.isLinux '' # Set ghcFlags for building ghc itself SRC_HC_OPTS += ${ghcFlags} SRC_CC_OPTS += ${cFlags} ''; + enableParallelBuilding = true; + preConfigure = '' echo "${buildMK}" > mk/build.mk sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure @@ -40,9 +48,14 @@ in stdenv.mkDerivation rec { '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}" + '' + stdenv.lib.optionalString stdenv.isDarwin '' + find . -name '*.hs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|' + find . -name '*.lhs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|' + export NIX_LDFLAGS+=" -no_dtrace_dof" ''; - configureFlags = "--with-gcc=${stdenv.cc}/bin/gcc"; + configureFlags = if stdenv.isDarwin then "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}" + else "--with-gcc=${stdenv.cc}/bin/gcc"; postInstall = '' # ghci uses mmap with rwx protection at it implements dynamic @@ -56,7 +69,7 @@ in stdenv.mkDerivation rec { # required, because otherwise all symbols from HSffi.o are stripped, and # that in turn causes GHCi to abort - stripDebugFlags=["-S" "--keep-file-symbols"]; + stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols"; meta = { homepage = "http://haskell.org/ghc"; diff --git a/pkgs/development/compilers/ghc/7.8.4.nix b/pkgs/development/compilers/ghc/7.8.4.nix index 1634524fc03c..e9e1e1eafd03 100644 --- a/pkgs/development/compilers/ghc/7.8.4.nix +++ b/pkgs/development/compilers/ghc/7.8.4.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, ghc, perl, gmp, ncurses }: +{ stdenv, fetchurl, ghc, perl, gmp, ncurses, libiconv }: stdenv.mkDerivation rec { version = "7.8.4"; @@ -18,7 +18,10 @@ stdenv.mkDerivation rec { libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp}/include" libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-includes="${ncurses}/include" libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="${ncurses}/lib" - DYNAMIC_BY_DEFAULT = NO + ${stdenv.lib.optionalString stdenv.isDarwin '' + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-includes="${libiconv}/include" + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib" + ''} ''; preConfigure = '' @@ -26,11 +29,13 @@ stdenv.mkDerivation rec { sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}" + '' + stdenv.lib.optionalString stdenv.isDarwin '' + export NIX_LDFLAGS+=" -no_dtrace_dof" ''; # required, because otherwise all symbols from HSffi.o are stripped, and # that in turn causes GHCi to abort - stripDebugFlags = [ "-S" "--keep-file-symbols" ]; + stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols"; meta = with stdenv.lib; { homepage = "http://haskell.org/ghc"; diff --git a/pkgs/development/compilers/ghc/fix-7.0.4-clang.patch b/pkgs/development/compilers/ghc/fix-7.0.4-clang.patch new file mode 100644 index 000000000000..cfce51a28ae5 --- /dev/null +++ b/pkgs/development/compilers/ghc/fix-7.0.4-clang.patch @@ -0,0 +1,64 @@ +diff --git a/compiler/codeGen/CgInfoTbls.hs b/compiler/codeGen/CgInfoTbls.hs +index f704a69..37753fd 100644 +--- a/compiler/codeGen/CgInfoTbls.hs ++++ b/compiler/codeGen/CgInfoTbls.hs +@@ -211,9 +211,7 @@ mkStackLayout = do + [(offset - frame_sp - retAddrSizeW, b) + | (offset, b) <- binds] + +- WARN( not (all (\bind -> fst bind >= 0) rel_binds), +- ppr binds $$ ppr rel_binds $$ +- ppr frame_size $$ ppr real_sp $$ ppr frame_sp ) ++ WARN( not (all (\bind -> fst bind >= 0) rel_binds), ppr binds $$ ppr rel_binds $$ ppr frame_size $$ ppr real_sp $$ ppr frame_sp ) + return $ stack_layout rel_binds frame_size + + stack_layout :: [(VirtualSpOffset, CgIdInfo)] +diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs +index 638e1db..a24e564 100644 +--- a/compiler/main/GHC.hs ++++ b/compiler/main/GHC.hs +@@ -788,8 +788,7 @@ load2 how_much mod_graph = do + -- is stable). + partial_mg + | LoadDependenciesOf _mod <- how_much +- = ASSERT( case last partial_mg0 of +- AcyclicSCC ms -> ms_mod_name ms == _mod; _ -> False ) ++ = ASSERT( case last partial_mg0 of AcyclicSCC ms -> ms_mod_name ms == _mod; _ -> False ) + List.init partial_mg0 + | otherwise + = partial_mg0 +diff --git a/compiler/simplCore/SimplUtils.lhs b/compiler/simplCore/SimplUtils.lhs +index 99a63e4..3268726 100644 +--- a/compiler/simplCore/SimplUtils.lhs ++++ b/compiler/simplCore/SimplUtils.lhs +@@ -388,8 +388,7 @@ mkArgInfo fun rules n_val_args call_cont + else + map isStrictDmd demands ++ vanilla_stricts + | otherwise +- -> WARN( True, text "More demands than arity" <+> ppr fun <+> ppr (idArity fun) +- <+> ppr n_val_args <+> ppr demands ) ++ -> WARN( True, text "More demands than arity" <+> ppr fun <+> ppr (idArity fun) <+> ppr n_val_args <+> ppr demands ) + vanilla_stricts -- Not enough args, or no strictness + + add_type_str :: Type -> [Bool] -> [Bool] +@@ -1812,4 +1811,4 @@ without getting changed to c1=I# c2. + I don't think this is worth fixing, even if I knew how. It'll + all come out in the next pass anyway. + +- +\ No newline at end of file ++ +diff --git a/compiler/simplCore/Simplify.lhs b/compiler/simplCore/Simplify.lhs +index d0fbd8d..ef87996 100644 +--- a/compiler/simplCore/Simplify.lhs ++++ b/compiler/simplCore/Simplify.lhs +@@ -2071,8 +2071,7 @@ mkDupableAlt env case_bndr (con, bndrs', rhs') + rhs = mkConApp dc (map Type (tyConAppArgs scrut_ty) + ++ varsToCoreExprs bndrs') + +- LitAlt {} -> WARN( True, ptext (sLit "mkDupableAlt") +- <+> ppr case_bndr <+> ppr con ) ++ LitAlt {} -> WARN( True, ptext (sLit "mkDupableAlt") <+> ppr case_bndr <+> ppr con ) + case_bndr + -- The case binder is alive but trivial, so why has + -- it not been substituted away? diff --git a/pkgs/development/compilers/ghc/fix-7.2.2-clang.patch b/pkgs/development/compilers/ghc/fix-7.2.2-clang.patch new file mode 100644 index 000000000000..9592d54188ed --- /dev/null +++ b/pkgs/development/compilers/ghc/fix-7.2.2-clang.patch @@ -0,0 +1,74 @@ +diff --git a/compiler/codeGen/CgInfoTbls.hs b/compiler/codeGen/CgInfoTbls.hs +index dbd22f3..42208f9 100644 +--- a/compiler/codeGen/CgInfoTbls.hs ++++ b/compiler/codeGen/CgInfoTbls.hs +@@ -210,9 +210,7 @@ mkStackLayout = do + [(offset - frame_sp - retAddrSizeW, b) + | (offset, b) <- binds] + +- WARN( not (all (\bind -> fst bind >= 0) rel_binds), +- ppr binds $$ ppr rel_binds $$ +- ppr frame_size $$ ppr real_sp $$ ppr frame_sp ) ++ WARN( not (all (\bind -> fst bind >= 0) rel_binds), ppr binds $$ ppr rel_binds $$ ppr frame_size $$ ppr real_sp $$ ppr frame_sp ) + return $ stack_layout rel_binds frame_size + + stack_layout :: [(VirtualSpOffset, CgIdInfo)] +diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs +index dece548..9643f30 100644 +--- a/compiler/main/GhcMake.hs ++++ b/compiler/main/GhcMake.hs +@@ -236,8 +236,7 @@ load2 how_much mod_graph = do + -- is stable). + partial_mg + | LoadDependenciesOf _mod <- how_much +- = ASSERT( case last partial_mg0 of +- AcyclicSCC ms -> ms_mod_name ms == _mod; _ -> False ) ++ = ASSERT( case last partial_mg0 of AcyclicSCC ms -> ms_mod_name ms == _mod; _ -> False ) + List.init partial_mg0 + | otherwise + = partial_mg0 +@@ -331,8 +330,7 @@ load2 how_much mod_graph = do + liftIO $ intermediateCleanTempFiles dflags mods_to_keep hsc_env1 + + -- there should be no Nothings where linkables should be, now +- ASSERT(all (isJust.hm_linkable) +- (eltsUFM (hsc_HPT hsc_env))) do ++ ASSERT(all (isJust.hm_linkable) (eltsUFM (hsc_HPT hsc_env))) do + + -- Link everything together + linkresult <- liftIO $ link (ghcLink dflags) dflags False hpt4 +diff --git a/compiler/simplCore/SimplUtils.lhs b/compiler/simplCore/SimplUtils.lhs +index dd0ce4b..9501e73 100644 +--- a/compiler/simplCore/SimplUtils.lhs ++++ b/compiler/simplCore/SimplUtils.lhs +@@ -393,8 +393,7 @@ mkArgInfo fun rules n_val_args call_cont + else + map isStrictDmd demands ++ vanilla_stricts + | otherwise +- -> WARN( True, text "More demands than arity" <+> ppr fun <+> ppr (idArity fun) +- <+> ppr n_val_args <+> ppr demands ) ++ -> WARN( True, text "More demands than arity" <+> ppr fun <+> ppr (idArity fun) <+> ppr n_val_args <+> ppr demands ) + vanilla_stricts -- Not enough args, or no strictness + + add_type_str :: Type -> [Bool] -> [Bool] +@@ -1845,4 +1844,4 @@ without getting changed to c1=I# c2. + I don't think this is worth fixing, even if I knew how. It'll + all come out in the next pass anyway. + +- +\ No newline at end of file ++ +diff --git a/compiler/simplCore/Simplify.lhs b/compiler/simplCore/Simplify.lhs +index adcaf13..06d939d 100644 +--- a/compiler/simplCore/Simplify.lhs ++++ b/compiler/simplCore/Simplify.lhs +@@ -2185,8 +2185,7 @@ mkDupableAlt env case_bndr (con, bndrs', rhs') + rhs = mkConApp dc (map Type (tyConAppArgs scrut_ty) + ++ varsToCoreExprs bndrs') + +- LitAlt {} -> WARN( True, ptext (sLit "mkDupableAlt") +- <+> ppr case_bndr <+> ppr con ) ++ LitAlt {} -> WARN( True, ptext (sLit "mkDupableAlt") <+> ppr case_bndr <+> ppr con ) + case_bndr + -- The case binder is alive but trivial, so why has + -- it not been substituted away? diff --git a/pkgs/development/compilers/ghc/fix-7.4.2-clang.patch b/pkgs/development/compilers/ghc/fix-7.4.2-clang.patch new file mode 100644 index 000000000000..ce1593b3e31d --- /dev/null +++ b/pkgs/development/compilers/ghc/fix-7.4.2-clang.patch @@ -0,0 +1,57 @@ +diff --git a/compiler/codeGen/CgInfoTbls.hs b/compiler/codeGen/CgInfoTbls.hs +index 25ba154..fbb7874 100644 +--- a/compiler/codeGen/CgInfoTbls.hs ++++ b/compiler/codeGen/CgInfoTbls.hs +@@ -178,9 +178,7 @@ mkStackLayout = do + [(offset - frame_sp - retAddrSizeW, b) + | (offset, b) <- binds] + +- 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 ) ++ 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 ) + return $ stack_layout rel_binds frame_size + + stack_layout :: [(VirtualSpOffset, CgIdInfo)] +diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs +index 091e1be..23447e4 100644 +--- a/compiler/main/GhcMake.hs ++++ b/compiler/main/GhcMake.hs +@@ -338,8 +338,7 @@ load2 how_much mod_graph = do + liftIO $ intermediateCleanTempFiles dflags mods_to_keep hsc_env1 + + -- there should be no Nothings where linkables should be, now +- ASSERT(all (isJust.hm_linkable) +- (eltsUFM (hsc_HPT hsc_env))) do ++ ASSERT(all (isJust.hm_linkable) (eltsUFM (hsc_HPT hsc_env))) do + + -- Link everything together + linkresult <- liftIO $ link (ghcLink dflags) dflags False hpt4 +diff --git a/compiler/simplCore/SimplUtils.lhs b/compiler/simplCore/SimplUtils.lhs +index 86dc88d..ecde4fd 100644 +--- a/compiler/simplCore/SimplUtils.lhs ++++ b/compiler/simplCore/SimplUtils.lhs +@@ -407,8 +407,7 @@ mkArgInfo fun rules n_val_args call_cont + else + map isStrictDmd demands ++ vanilla_stricts + | otherwise +- -> WARN( True, text "More demands than arity" <+> ppr fun <+> ppr (idArity fun) +- <+> ppr n_val_args <+> ppr demands ) ++ -> WARN( True, text "More demands than arity" <+> ppr fun <+> ppr (idArity fun) <+> ppr n_val_args <+> ppr demands ) + vanilla_stricts -- Not enough args, or no strictness + + add_type_str :: Type -> [Bool] -> [Bool] +diff --git a/compiler/simplCore/Simplify.lhs b/compiler/simplCore/Simplify.lhs +index 3bd95a7..4c9ee7c 100644 +--- a/compiler/simplCore/Simplify.lhs ++++ b/compiler/simplCore/Simplify.lhs +@@ -2336,8 +2336,7 @@ mkDupableAlt env case_bndr (con, bndrs', rhs') + rhs = mkConApp dc (map Type (tyConAppArgs scrut_ty) + ++ varsToCoreExprs bndrs') + +- LitAlt {} -> WARN( True, ptext (sLit "mkDupableAlt") +- <+> ppr case_bndr <+> ppr con ) ++ LitAlt {} -> WARN( True, ptext (sLit "mkDupableAlt") <+> ppr case_bndr <+> ppr con ) + case_bndr + -- The case binder is alive but trivial, so why has + -- it not been substituted away? diff --git a/pkgs/development/compilers/ghc/fix-7.6.3-clang.patch b/pkgs/development/compilers/ghc/fix-7.6.3-clang.patch new file mode 100644 index 000000000000..e83fd252d72c --- /dev/null +++ b/pkgs/development/compilers/ghc/fix-7.6.3-clang.patch @@ -0,0 +1,71 @@ +diff --git a/compiler/codeGen/CgInfoTbls.hs b/compiler/codeGen/CgInfoTbls.hs +index 7cdb1b6..e953507 100644 +--- a/compiler/codeGen/CgInfoTbls.hs ++++ b/compiler/codeGen/CgInfoTbls.hs +@@ -157,9 +157,7 @@ mkStackLayout = do + [(offset - frame_sp - retAddrSizeW, b) + | (offset, b) <- binds] + +- WARN( not (all (\bind -> fst bind >= 0) rel_binds), +- ppr binds $$ ppr rel_binds $$ +- ppr frame_size $$ ppr real_sp $$ ppr frame_sp ) ++ WARN( not (all (\bind -> fst bind >= 0) rel_binds), ppr binds $$ ppr rel_binds $$ ppr frame_size $$ ppr real_sp $$ ppr frame_sp ) + return $ stack_layout rel_binds frame_size + + stack_layout :: [(VirtualSpOffset, CgIdInfo)] +diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs +index f563cd9..4ac7812 100644 +--- a/compiler/main/GhcMake.hs ++++ b/compiler/main/GhcMake.hs +@@ -331,8 +331,7 @@ load how_much = do + liftIO $ intermediateCleanTempFiles dflags mods_to_keep hsc_env1 + + -- there should be no Nothings where linkables should be, now +- ASSERT(all (isJust.hm_linkable) +- (eltsUFM (hsc_HPT hsc_env))) do ++ ASSERT(all (isJust.hm_linkable) (eltsUFM (hsc_HPT hsc_env))) do + + -- Link everything together + linkresult <- liftIO $ link (ghcLink dflags) dflags False hpt4 +diff --git a/compiler/simplCore/SimplUtils.lhs b/compiler/simplCore/SimplUtils.lhs +index 87aefba..479d2ef 100644 +--- a/compiler/simplCore/SimplUtils.lhs ++++ b/compiler/simplCore/SimplUtils.lhs +@@ -415,8 +415,7 @@ mkArgInfo fun rules n_val_args call_cont + else + map isStrictDmd demands ++ vanilla_stricts + | otherwise +- -> WARN( True, text "More demands than arity" <+> ppr fun <+> ppr (idArity fun) +- <+> ppr n_val_args <+> ppr demands ) ++ -> WARN( True, text "More demands than arity" <+> ppr fun <+> ppr (idArity fun) <+> ppr n_val_args <+> ppr demands ) + vanilla_stricts -- Not enough args, or no strictness + + add_type_str :: Type -> [Bool] -> [Bool] +diff --git a/compiler/simplCore/Simplify.lhs b/compiler/simplCore/Simplify.lhs +index f2ed224..464fad6 100644 +--- a/compiler/simplCore/Simplify.lhs ++++ b/compiler/simplCore/Simplify.lhs +@@ -2359,8 +2359,7 @@ mkDupableAlt env case_bndr (con, bndrs', rhs') + rhs = mkConApp dc (map Type (tyConAppArgs scrut_ty) + ++ varsToCoreExprs bndrs') + +- LitAlt {} -> WARN( True, ptext (sLit "mkDupableAlt") +- <+> ppr case_bndr <+> ppr con ) ++ LitAlt {} -> WARN( True, ptext (sLit "mkDupableAlt") <+> ppr case_bndr <+> ppr con ) + case_bndr + -- The case binder is alive but trivial, so why has + -- it not been substituted away? +diff --git a/compiler/types/Coercion.lhs b/compiler/types/Coercion.lhs +index 42e54ba..9b420ae 100644 +--- a/compiler/types/Coercion.lhs ++++ b/compiler/types/Coercion.lhs +@@ -498,8 +498,7 @@ splitForAllCo_maybe _ = Nothing + coVarKind :: CoVar -> (Type,Type) + coVarKind cv + | Just (tc, [_kind,ty1,ty2]) <- splitTyConApp_maybe (varType cv) +- = ASSERT (tc `hasKey` eqPrimTyConKey) +- (ty1,ty2) ++ = ASSERT (tc `hasKey` eqPrimTyConKey) (ty1,ty2) + | otherwise = panic "coVarKind, non coercion variable" + + -- | Makes a coercion type from two types: the types whose equality diff --git a/pkgs/development/compilers/ghc/gcc-clang-wrapper.sh b/pkgs/development/compilers/ghc/gcc-clang-wrapper.sh deleted file mode 100755 index d081be231a1c..000000000000 --- a/pkgs/development/compilers/ghc/gcc-clang-wrapper.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh - -inPreprocessorMode () { - hasE=0 - hasU=0 - hasT=0 - for arg in "$@" - do - if [ 'x-E' = "x$arg" ]; then hasE=1; fi - if [ 'x-undef' = "x$arg" ]; then hasU=1; fi - if [ 'x-traditional' = "x$arg" ]; then hasT=1; fi - done - [ "$hasE$hasU$hasT" = '111' ] -} - -extraClangArgs="-Wno-invalid-pp-token -Wno-unicode -Wno-trigraphs" - -adjustPreprocessorLanguage () { - newArgs='' - while [ $# -gt 0 ] - do - newArgs="$newArgs $1" - if [ "$1" = '-x' ] - then - shift - if [ $# -gt 0 ] - then - if [ "$1" = 'c' ] - then - newArgs="$newArgs assembler-with-cpp" - else - newArgs="$newArgs $1" - fi - fi - fi - shift - done - echo $newArgs -} - -if inPreprocessorMode "$@" -then - exec clang $extraClangArgs `adjustPreprocessorLanguage "$@"` -else - exec clang $extraClangArgs "${@/-nodefaultlibs/}" -fi diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index 5ffe421f08cd..0363855977f7 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchgit, ghc, perl, gmp, ncurses, autoconf, automake, happy, alex }: +{ stdenv, fetchgit, ghc, perl, gmp, ncurses, libiconv, autoconf, automake, happy, alex }: let @@ -7,7 +7,10 @@ let libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp}/include" libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-includes="${ncurses}/include" libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="${ncurses}/lib" - DYNAMIC_BY_DEFAULT = NO + ${stdenv.lib.optionalString stdenv.isDarwin '' + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-includes="${libiconv}/include" + libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib" + ''} ''; in |