Merge pull request #147260 from NixOS/haskell-updates

haskellPackages: improve LLVM handling for GHC

authored by sterni and committed by GitHub 2222809b d6312c26

+257 -150
+23 -2
nixos/doc/manual/from_md/release-notes/rl-2205.section.xml
··· 24 </section> 25 <section xml:id="sec-release-22.05-incompatibilities"> 26 <title>Backward Incompatibilities</title> 27 - <para> 28 - </para> 29 </section> 30 <section xml:id="sec-release-22.05-notable-changes"> 31 <title>Other Notable Changes</title>
··· 24 </section> 25 <section xml:id="sec-release-22.05-incompatibilities"> 26 <title>Backward Incompatibilities</title> 27 + <itemizedlist spacing="compact"> 28 + <listitem> 29 + <para> 30 + <literal>pkgs.ghc</literal> now refers to 31 + <literal>pkgs.targetPackages.haskellPackages.ghc</literal>. 32 + This <emphasis>only</emphasis> makes a difference if you are 33 + cross-compiling and will ensure that 34 + <literal>pkgs.ghc</literal> always runs on the host platform 35 + and compiles for the target platform (similar to 36 + <literal>pkgs.gcc</literal> for example). 37 + <literal>haskellPackages.ghc</literal> still behaves as 38 + before, running on the build platform and compiling for the 39 + host platform (similar to <literal>stdenv.cc</literal>). This 40 + means you don’t have to adjust your derivations if you use 41 + <literal>haskellPackages.callPackage</literal>, but when using 42 + <literal>pkgs.callPackage</literal> and taking 43 + <literal>ghc</literal> as an input, you should now use 44 + <literal>buildPackages.ghc</literal> instead to ensure cross 45 + compilation keeps working (or switch to 46 + <literal>haskellPackages.callPackage</literal>). 47 + </para> 48 + </listitem> 49 + </itemizedlist> 50 </section> 51 <section xml:id="sec-release-22.05-notable-changes"> 52 <title>Other Notable Changes</title>
+12
nixos/doc/manual/release-notes/rl-2205.section.md
··· 10 11 ## Backward Incompatibilities {#sec-release-22.05-incompatibilities} 12 13 ## Other Notable Changes {#sec-release-22.05-notable-changes}
··· 10 11 ## Backward Incompatibilities {#sec-release-22.05-incompatibilities} 12 13 + * `pkgs.ghc` now refers to `pkgs.targetPackages.haskellPackages.ghc`. 14 + This *only* makes a difference if you are cross-compiling and will 15 + ensure that `pkgs.ghc` always runs on the host platform and compiles 16 + for the target platform (similar to `pkgs.gcc` for example). 17 + `haskellPackages.ghc` still behaves as before, running on the build 18 + platform and compiling for the host platform (similar to `stdenv.cc`). 19 + This means you don't have to adjust your derivations if you use 20 + `haskellPackages.callPackage`, but when using `pkgs.callPackage` and 21 + taking `ghc` as an input, you should now use `buildPackages.ghc` 22 + instead to ensure cross compilation keeps working (or switch to 23 + `haskellPackages.callPackage`). 24 + 25 ## Other Notable Changes {#sec-release-22.05-notable-changes}
+30 -4
pkgs/development/compilers/ghc/8.10.2-binary.nix
··· 3 , ncurses5 4 , ncurses6, gmp, libiconv, numactl 5 , llvmPackages 6 7 # minimal = true; will remove files that aren't strictly necessary for 8 # regular builds and GHC bootstrapping. ··· 140 libEnvVar = lib.optionalString stdenv.hostPlatform.isDarwin "DY" 141 + "LD_LIBRARY_PATH"; 142 143 in 144 145 stdenv.mkDerivation rec { ··· 156 157 nativeBuildInputs = [ perl ]; 158 propagatedBuildInputs = 159 - lib.optionals useLLVM [ llvmPackages.llvm ] 160 # Because musl bindists currently provide no way to tell where 161 # libgmp is (see not [musl bindists have no .buildinfo]), we need 162 # to propagate `gmp`, otherwise programs built by this ghc will ··· 177 # fixing the above-mentioned release issue, 178 # and for GHC >= 9.* it is not clear as of writing whether that switch 179 # will be made there too. 180 - ++ lib.optionals stdenv.hostPlatform.isMusl [ gmp ]; # musl bindist needs this 181 182 # Set LD_LIBRARY_PATH or equivalent so that the programs running as part 183 # of the bindist installer can find the libraries they expect. ··· 278 # calls install-strip ... 279 dontBuild = true; 280 281 # Apparently necessary for the ghc Alpine (musl) bindist: 282 # When we strip, and then run the 283 # patchelf --set-rpath "${libPath}:$(patchelf --print-rpath $p)" $p ··· 360 361 doInstallCheck = true; 362 installCheckPhase = '' 363 - unset ${libEnvVar} 364 # Sanity check, can ghc create executables? 365 cd $TMP 366 mkdir test-ghc; cd test-ghc ··· 369 module Main where 370 main = putStrLn \$([|"yes"|]) 371 EOF 372 - $out/bin/ghc --make main.hs || exit 1 373 echo compilation ok 374 [ $(./main) == "yes" ] 375 ''; ··· 377 passthru = { 378 targetPrefix = ""; 379 enableShared = true; 380 381 # Our Cabal compiler name 382 haskellCompilerName = "ghc-${version}";
··· 3 , ncurses5 4 , ncurses6, gmp, libiconv, numactl 5 , llvmPackages 6 + , coreutils 7 + , targetPackages 8 9 # minimal = true; will remove files that aren't strictly necessary for 10 # regular builds and GHC bootstrapping. ··· 142 libEnvVar = lib.optionalString stdenv.hostPlatform.isDarwin "DY" 143 + "LD_LIBRARY_PATH"; 144 145 + runtimeDeps = [ 146 + targetPackages.stdenv.cc 147 + targetPackages.stdenv.cc.bintools 148 + coreutils # for cat 149 + ] 150 + ++ lib.optionals useLLVM [ 151 + (lib.getBin llvmPackages.llvm) 152 + ] 153 + # On darwin, we need unwrapped bintools as well (for otool) 154 + ++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [ 155 + targetPackages.stdenv.cc.bintools.bintools 156 + ]; 157 + 158 in 159 160 stdenv.mkDerivation rec { ··· 171 172 nativeBuildInputs = [ perl ]; 173 propagatedBuildInputs = 174 # Because musl bindists currently provide no way to tell where 175 # libgmp is (see not [musl bindists have no .buildinfo]), we need 176 # to propagate `gmp`, otherwise programs built by this ghc will ··· 191 # fixing the above-mentioned release issue, 192 # and for GHC >= 9.* it is not clear as of writing whether that switch 193 # will be made there too. 194 + lib.optionals stdenv.hostPlatform.isMusl [ gmp ]; # musl bindist needs this 195 196 # Set LD_LIBRARY_PATH or equivalent so that the programs running as part 197 # of the bindist installer can find the libraries they expect. ··· 292 # calls install-strip ... 293 dontBuild = true; 294 295 + # Patch scripts to include runtime dependencies in $PATH. 296 + postInstall = '' 297 + for i in "$out/bin/"*; do 298 + test ! -h "$i" || continue 299 + isScript "$i" || continue 300 + sed -i -e '2i export PATH="${lib.makeBinPath runtimeDeps}:$PATH"' "$i" 301 + done 302 + ''; 303 + 304 # Apparently necessary for the ghc Alpine (musl) bindist: 305 # When we strip, and then run the 306 # patchelf --set-rpath "${libPath}:$(patchelf --print-rpath $p)" $p ··· 383 384 doInstallCheck = true; 385 installCheckPhase = '' 386 # Sanity check, can ghc create executables? 387 cd $TMP 388 mkdir test-ghc; cd test-ghc ··· 391 module Main where 392 main = putStrLn \$([|"yes"|]) 393 EOF 394 + # can't use env -i here because otherwise we don't find -lgmp on musl 395 + env ${libEnvVar}= PATH= \ 396 + $out/bin/ghc --make main.hs || exit 1 397 echo compilation ok 398 [ $(./main) == "yes" ] 399 ''; ··· 401 passthru = { 402 targetPrefix = ""; 403 enableShared = true; 404 + 405 + inherit llvmPackages; 406 407 # Our Cabal compiler name 408 haskellCompilerName = "ghc-${version}";
+27 -5
pkgs/development/compilers/ghc/8.10.7-binary.nix
··· 3 , ncurses5 4 , ncurses6, gmp, libiconv, numactl 5 , llvmPackages 6 7 # minimal = true; will remove files that aren't strictly necessary for 8 # regular builds and GHC bootstrapping. ··· 155 libEnvVar = lib.optionalString stdenv.hostPlatform.isDarwin "DY" 156 + "LD_LIBRARY_PATH"; 157 158 in 159 160 stdenv.mkDerivation rec { ··· 175 # and update this comment accordingly. 176 177 nativeBuildInputs = [ perl ]; 178 - propagatedBuildInputs = 179 - lib.optionals useLLVM [ llvmPackages.llvm ] 180 - ; 181 182 # Set LD_LIBRARY_PATH or equivalent so that the programs running as part 183 # of the bindist installer can find the libraries they expect. ··· 278 # calls install-strip ... 279 dontBuild = true; 280 281 # Apparently necessary for the ghc Alpine (musl) bindist: 282 # When we strip, and then run the 283 # patchelf --set-rpath "${libPath}:$(patchelf --print-rpath $p)" $p ··· 360 361 doInstallCheck = true; 362 installCheckPhase = '' 363 - unset ${libEnvVar} 364 # Sanity check, can ghc create executables? 365 cd $TMP 366 mkdir test-ghc; cd test-ghc ··· 369 module Main where 370 main = putStrLn \$([|"yes"|]) 371 EOF 372 - $out/bin/ghc --make main.hs || exit 1 373 echo compilation ok 374 [ $(./main) == "yes" ] 375 ''; ··· 377 passthru = { 378 targetPrefix = ""; 379 enableShared = true; 380 381 # Our Cabal compiler name 382 haskellCompilerName = "ghc-${version}";
··· 3 , ncurses5 4 , ncurses6, gmp, libiconv, numactl 5 , llvmPackages 6 + , coreutils 7 + , targetPackages 8 9 # minimal = true; will remove files that aren't strictly necessary for 10 # regular builds and GHC bootstrapping. ··· 157 libEnvVar = lib.optionalString stdenv.hostPlatform.isDarwin "DY" 158 + "LD_LIBRARY_PATH"; 159 160 + runtimeDeps = [ 161 + targetPackages.stdenv.cc 162 + targetPackages.stdenv.cc.bintools 163 + coreutils # for cat 164 + ] 165 + ++ lib.optionals useLLVM [ 166 + (lib.getBin llvmPackages.llvm) 167 + ] 168 + # On darwin, we need unwrapped bintools as well (for otool) 169 + ++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [ 170 + targetPackages.stdenv.cc.bintools.bintools 171 + ]; 172 + 173 in 174 175 stdenv.mkDerivation rec { ··· 190 # and update this comment accordingly. 191 192 nativeBuildInputs = [ perl ]; 193 194 # Set LD_LIBRARY_PATH or equivalent so that the programs running as part 195 # of the bindist installer can find the libraries they expect. ··· 290 # calls install-strip ... 291 dontBuild = true; 292 293 + # Patch scripts to include runtime dependencies in $PATH. 294 + postInstall = '' 295 + for i in "$out/bin/"*; do 296 + test ! -h "$i" || continue 297 + isScript "$i" || continue 298 + sed -i -e '2i export PATH="${lib.makeBinPath runtimeDeps}:$PATH"' "$i" 299 + done 300 + ''; 301 + 302 # Apparently necessary for the ghc Alpine (musl) bindist: 303 # When we strip, and then run the 304 # patchelf --set-rpath "${libPath}:$(patchelf --print-rpath $p)" $p ··· 381 382 doInstallCheck = true; 383 installCheckPhase = '' 384 # Sanity check, can ghc create executables? 385 cd $TMP 386 mkdir test-ghc; cd test-ghc ··· 389 module Main where 390 main = putStrLn \$([|"yes"|]) 391 EOF 392 + env -i $out/bin/ghc --make main.hs || exit 1 393 echo compilation ok 394 [ $(./main) == "yes" ] 395 ''; ··· 397 passthru = { 398 targetPrefix = ""; 399 enableShared = true; 400 + 401 + inherit llvmPackages; 402 403 # Our Cabal compiler name 404 haskellCompilerName = "ghc-${version}";
+19 -20
pkgs/development/compilers/ghc/8.10.7.nix
··· 11 , # GHC can be built with system libffi or a bundled one. 12 libffi ? null 13 14 - , useLLVM ? !stdenv.targetPlatform.isx86 15 , # LLVM is conceptually a run-time-only depedendency, but for 16 # non-x86, we need LLVM to bootstrap later stages, so it becomes a 17 # build-time dependency too. ··· 120 ++ lib.optional (!enableIntegerSimple) gmp 121 ++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv; 122 123 toolsForTarget = [ 124 pkgsBuildTarget.targetPackages.stdenv.cc 125 ] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm; ··· 131 # see #84670 and #49071 for more background. 132 useLdGold = targetPlatform.linker == "gold" || 133 (targetPlatform.linker == "bfd" && (targetPackages.stdenv.cc.bintools.bintools.hasGold or false) && !targetPlatform.isMusl); 134 - 135 - runtimeDeps = [ 136 - targetPackages.stdenv.cc.bintools 137 - coreutils 138 - ] 139 - # On darwin, we need unwrapped bintools as well (for otool) 140 - ++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [ 141 - targetPackages.stdenv.cc.bintools.bintools 142 - ]; 143 144 # Makes debugging easier to see which variant is at play in `nix-store -q --tree`. 145 variantSuffix = lib.concatStrings [ ··· 196 postPatch = "patchShebangs ."; 197 198 # GHC is a bit confused on its cross terminology. 199 preConfigure = '' 200 for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do 201 export "''${env#TARGET_}=''${!env}" ··· 212 export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib" 213 export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf" 214 export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip" 215 216 echo -n "${buildMK}" > mk/build.mk 217 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure ··· 290 291 buildInputs = [ perl bash ] ++ (libDeps hostPlatform); 292 293 - propagatedBuildInputs = [ targetPackages.stdenv.cc ] 294 - ++ lib.optional useLLVM llvmPackages.llvm; 295 - 296 depsTargetTarget = map lib.getDev (libDeps targetPlatform); 297 depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform); 298 ··· 320 postInstall = '' 321 # Install the bash completion file. 322 install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc 323 - 324 - # Patch scripts to include "readelf" and "cat" in $PATH. 325 - for i in "$out/bin/"*; do 326 - test ! -h $i || continue 327 - egrep --quiet '^#!' <(head -n 1 $i) || continue 328 - sed -i -e '2i export PATH="$PATH:${lib.makeBinPath runtimeDeps}"' $i 329 - done 330 ''; 331 332 passthru = {
··· 11 , # GHC can be built with system libffi or a bundled one. 12 libffi ? null 13 14 + , useLLVM ? !(stdenv.targetPlatform.isx86 15 + || stdenv.targetPlatform.isPowerPC 16 + || stdenv.targetPlatform.isSparc) 17 , # LLVM is conceptually a run-time-only depedendency, but for 18 # non-x86, we need LLVM to bootstrap later stages, so it becomes a 19 # build-time dependency too. ··· 122 ++ lib.optional (!enableIntegerSimple) gmp 123 ++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv; 124 125 + # TODO(@sternenseemann): is buildTarget LLVM unnecessary? 126 + # GHC doesn't seem to have {LLC,OPT}_HOST 127 toolsForTarget = [ 128 pkgsBuildTarget.targetPackages.stdenv.cc 129 ] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm; ··· 135 # see #84670 and #49071 for more background. 136 useLdGold = targetPlatform.linker == "gold" || 137 (targetPlatform.linker == "bfd" && (targetPackages.stdenv.cc.bintools.bintools.hasGold or false) && !targetPlatform.isMusl); 138 139 # Makes debugging easier to see which variant is at play in `nix-store -q --tree`. 140 variantSuffix = lib.concatStrings [ ··· 191 postPatch = "patchShebangs ."; 192 193 # GHC is a bit confused on its cross terminology. 194 + # TODO(@sternenseemann): investigate coreutils dependencies and pass absolute paths 195 preConfigure = '' 196 for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do 197 export "''${env#TARGET_}=''${!env}" ··· 208 export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib" 209 export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf" 210 export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip" 211 + '' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") '' 212 + export OTOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}otool" 213 + export INSTALL_NAME_TOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}install_name_tool" 214 + '' + lib.optionalString useLLVM '' 215 + export LLC="${lib.getBin llvmPackages.llvm}/bin/llc" 216 + export OPT="${lib.getBin llvmPackages.llvm}/bin/opt" 217 + '' + lib.optionalString (targetCC.isClang || (useLLVM && stdenv.targetPlatform.isDarwin)) (let 218 + # LLVM backend on Darwin needs clang, if we are already using clang, might as well set the environment variable. 219 + # See also https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm 220 + clang = if targetCC.isClang then targetCC else llvmPackages.clang; 221 + in '' 222 + export CLANG="${clang}/bin/${clang.targetPrefix}clang" 223 + '') + '' 224 225 echo -n "${buildMK}" > mk/build.mk 226 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure ··· 299 300 buildInputs = [ perl bash ] ++ (libDeps hostPlatform); 301 302 depsTargetTarget = map lib.getDev (libDeps targetPlatform); 303 depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform); 304 ··· 326 postInstall = '' 327 # Install the bash completion file. 328 install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc 329 ''; 330 331 passthru = {
+28 -5
pkgs/development/compilers/ghc/8.6.5-binary.nix
··· 2 , fetchurl, perl, gcc 3 , ncurses5, ncurses6, gmp, glibc, libiconv 4 , llvmPackages 5 }: 6 7 # Prebuilt only does native ··· 30 31 downloadsUrl = "https://downloads.haskell.org/ghc"; 32 33 in 34 35 stdenv.mkDerivation rec { ··· 62 or (throw "cannot bootstrap GHC on this platform")); 63 64 nativeBuildInputs = [ perl ]; 65 - propagatedBuildInputs = lib.optionals useLLVM [ llvmPackages.llvm ]; 66 67 # Cannot patchelf beforehand due to relative RPATHs that anticipate 68 # the final install location/ ··· 130 # calls install-strip ... 131 dontBuild = true; 132 133 # On Linux, use patchelf to modify the executables so that they can 134 # find editline/gmp. 135 postFixup = lib.optionalString stdenv.isLinux '' ··· 163 164 doInstallCheck = true; 165 installCheckPhase = '' 166 - unset ${libEnvVar} 167 # Sanity check, can ghc create executables? 168 cd $TMP 169 mkdir test-ghc; cd test-ghc ··· 172 module Main where 173 main = putStrLn \$([|"yes"|]) 174 EOF 175 - $out/bin/ghc --make main.hs || exit 1 176 echo compilation ok 177 [ $(./main) == "yes" ] 178 ''; ··· 181 targetPrefix = ""; 182 enableShared = true; 183 184 # Our Cabal compiler name 185 haskellCompilerName = "ghc-${version}"; 186 }; 187 188 meta = rec { 189 license = lib.licenses.bsd3; 190 - platforms = ["x86_64-linux" "aarch64-linux" "i686-linux" "x86_64-darwin"]; 191 - hydraPlatforms = builtins.filter (p: p != "aarch64-linux") platforms; 192 # build segfaults, use ghc8102Binary which has proper musl support instead 193 broken = stdenv.hostPlatform.isMusl; 194 maintainers = with lib.maintainers; [
··· 2 , fetchurl, perl, gcc 3 , ncurses5, ncurses6, gmp, glibc, libiconv 4 , llvmPackages 5 + , coreutils 6 + , targetPackages 7 }: 8 9 # Prebuilt only does native ··· 32 33 downloadsUrl = "https://downloads.haskell.org/ghc"; 34 35 + runtimeDeps = [ 36 + targetPackages.stdenv.cc 37 + targetPackages.stdenv.cc.bintools 38 + coreutils # for cat 39 + ] 40 + ++ lib.optionals useLLVM [ 41 + (lib.getBin llvmPackages.llvm) 42 + ] 43 + # On darwin, we need unwrapped bintools as well (for otool) 44 + ++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [ 45 + targetPackages.stdenv.cc.bintools.bintools 46 + ]; 47 + 48 in 49 50 stdenv.mkDerivation rec { ··· 77 or (throw "cannot bootstrap GHC on this platform")); 78 79 nativeBuildInputs = [ perl ]; 80 81 # Cannot patchelf beforehand due to relative RPATHs that anticipate 82 # the final install location/ ··· 144 # calls install-strip ... 145 dontBuild = true; 146 147 + # Patch scripts to include runtime dependencies in $PATH. 148 + postInstall = '' 149 + for i in "$out/bin/"*; do 150 + test ! -h "$i" || continue 151 + isScript "$i" || continue 152 + sed -i -e '2i export PATH="${lib.makeBinPath runtimeDeps}:$PATH"' "$i" 153 + done 154 + ''; 155 + 156 # On Linux, use patchelf to modify the executables so that they can 157 # find editline/gmp. 158 postFixup = lib.optionalString stdenv.isLinux '' ··· 186 187 doInstallCheck = true; 188 installCheckPhase = '' 189 # Sanity check, can ghc create executables? 190 cd $TMP 191 mkdir test-ghc; cd test-ghc ··· 194 module Main where 195 main = putStrLn \$([|"yes"|]) 196 EOF 197 + env -i $out/bin/ghc --make main.hs || exit 1 198 echo compilation ok 199 [ $(./main) == "yes" ] 200 ''; ··· 203 targetPrefix = ""; 204 enableShared = true; 205 206 + inherit llvmPackages; 207 + 208 # Our Cabal compiler name 209 haskellCompilerName = "ghc-${version}"; 210 }; 211 212 meta = rec { 213 license = lib.licenses.bsd3; 214 + platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"]; 215 # build segfaults, use ghc8102Binary which has proper musl support instead 216 broken = stdenv.hostPlatform.isMusl; 217 maintainers = with lib.maintainers; [
+27 -21
pkgs/development/compilers/ghc/8.8.4.nix
··· 10 , # GHC can be built with system libffi or a bundled one. 11 libffi ? null 12 13 - , useLLVM ? !stdenv.targetPlatform.isx86 14 , # LLVM is conceptually a run-time-only depedendency, but for 15 # non-x86, we need LLVM to bootstrap later stages, so it becomes a 16 # build-time dependency too. ··· 128 ++ lib.optional (!enableIntegerSimple) gmp 129 ++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv; 130 131 toolsForTarget = [ 132 pkgsBuildTarget.targetPackages.stdenv.cc 133 ] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm; ··· 139 # see #84670 and #49071 for more background. 140 useLdGold = targetPlatform.linker == "gold" || 141 (targetPlatform.linker == "bfd" && (targetPackages.stdenv.cc.bintools.bintools.hasGold or false) && !targetPlatform.isMusl); 142 - 143 - runtimeDeps = [ 144 - targetPackages.stdenv.cc.bintools 145 - coreutils 146 - ] 147 - # On darwin, we need unwrapped bintools as well (for otool) 148 - ++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [ 149 - targetPackages.stdenv.cc.bintools.bintools 150 - ]; 151 152 # Makes debugging easier to see which variant is at play in `nix-store -q --tree`. 153 variantSuffix = lib.concatStrings [ ··· 197 postPatch = "patchShebangs ."; 198 199 # GHC is a bit confused on its cross terminology. 200 preConfigure = 201 # Aarch64 allow backward bootstrapping since earlier versions are unstable. 202 # Same for musl, as earlier versions do not provide a musl bindist for bootstrapping. ··· 220 export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib" 221 export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf" 222 export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip" 223 224 echo -n "${buildMK dontStrip}" > mk/build.mk 225 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure ··· 293 294 buildInputs = [ perl bash ] ++ (libDeps hostPlatform); 295 296 - propagatedBuildInputs = [ targetPackages.stdenv.cc ] 297 - ++ lib.optional useLLVM llvmPackages.llvm; 298 - 299 depsTargetTarget = map lib.getDev (libDeps targetPlatform); 300 depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform); 301 ··· 319 postInstall = '' 320 # Install the bash completion file. 321 install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc 322 - 323 - # Patch scripts to include "readelf" and "cat" in $PATH. 324 - for i in "$out/bin/"*; do 325 - test ! -h $i || continue 326 - egrep --quiet '^#!' <(head -n 1 $i) || continue 327 - sed -i -e '2i export PATH="$PATH:${lib.makeBinPath runtimeDeps}"' $i 328 - done 329 ''; 330 331 passthru = { ··· 345 guibou 346 ] ++ lib.teams.haskell.members; 347 timeout = 24 * 3600; 348 - inherit (ghc.meta) license platforms; 349 # integer-simple builds are broken with musl when bootstrapping using 350 # GHC 8.10.2 and below, however it is not possible to reverse bootstrap 351 # GHC 8.8.4 with GHC 8.10.7.
··· 10 , # GHC can be built with system libffi or a bundled one. 11 libffi ? null 12 13 + , useLLVM ? !(stdenv.targetPlatform.isx86 14 + || stdenv.targetPlatform.isPowerPC 15 + || stdenv.targetPlatform.isSparc) 16 , # LLVM is conceptually a run-time-only depedendency, but for 17 # non-x86, we need LLVM to bootstrap later stages, so it becomes a 18 # build-time dependency too. ··· 130 ++ lib.optional (!enableIntegerSimple) gmp 131 ++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv; 132 133 + # TODO(@sternenseemann): is buildTarget LLVM unnecessary? 134 + # GHC doesn't seem to have {LLC,OPT}_HOST 135 toolsForTarget = [ 136 pkgsBuildTarget.targetPackages.stdenv.cc 137 ] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm; ··· 143 # see #84670 and #49071 for more background. 144 useLdGold = targetPlatform.linker == "gold" || 145 (targetPlatform.linker == "bfd" && (targetPackages.stdenv.cc.bintools.bintools.hasGold or false) && !targetPlatform.isMusl); 146 147 # Makes debugging easier to see which variant is at play in `nix-store -q --tree`. 148 variantSuffix = lib.concatStrings [ ··· 192 postPatch = "patchShebangs ."; 193 194 # GHC is a bit confused on its cross terminology. 195 + # TODO(@sternenseemann): investigate coreutils dependencies and pass absolute paths 196 preConfigure = 197 # Aarch64 allow backward bootstrapping since earlier versions are unstable. 198 # Same for musl, as earlier versions do not provide a musl bindist for bootstrapping. ··· 216 export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib" 217 export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf" 218 export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip" 219 + '' + lib.optionalString useLLVM '' 220 + export LLC="${lib.getBin llvmPackages.llvm}/bin/llc" 221 + export OPT="${lib.getBin llvmPackages.llvm}/bin/opt" 222 + '' + lib.optionalString (targetCC.isClang || (useLLVM && stdenv.targetPlatform.isDarwin)) (let 223 + # LLVM backend on Darwin needs clang, if we are already using clang, might as well set the environment variable. 224 + # See also https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm 225 + clang = if targetCC.isClang then targetCC else llvmPackages.clang; 226 + in '' 227 + export CLANG="${clang}/bin/${clang.targetPrefix}clang" 228 + '') + '' 229 230 echo -n "${buildMK dontStrip}" > mk/build.mk 231 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure ··· 299 300 buildInputs = [ perl bash ] ++ (libDeps hostPlatform); 301 302 depsTargetTarget = map lib.getDev (libDeps targetPlatform); 303 depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform); 304 ··· 322 postInstall = '' 323 # Install the bash completion file. 324 install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc 325 ''; 326 327 passthru = { ··· 341 guibou 342 ] ++ lib.teams.haskell.members; 343 timeout = 24 * 3600; 344 + inherit (ghc.meta) license; 345 + # hardcode platforms because the bootstrap GHC differs depending on the platform, 346 + # with differing platforms available for each of them; See HACK comment in 347 + # 8.10.2-binary.nix for an explanation of the musl special casing. 348 + platforms = [ 349 + "x86_64-linux" 350 + ] ++ lib.optionals (!hostPlatform.isMusl) [ 351 + "i686-linux" 352 + "aarch64-linux" 353 + "x86_64-darwin" 354 + ]; 355 # integer-simple builds are broken with musl when bootstrapping using 356 # GHC 8.10.2 and below, however it is not possible to reverse bootstrap 357 # GHC 8.8.4 with GHC 8.10.7.
+19 -20
pkgs/development/compilers/ghc/9.0.1.nix
··· 12 , # GHC can be built with system libffi or a bundled one. 13 libffi ? null 14 15 - , useLLVM ? !stdenv.targetPlatform.isx86 16 , # LLVM is conceptually a run-time-only depedendency, but for 17 # non-x86, we need LLVM to bootstrap later stages, so it becomes a 18 # build-time dependency too. ··· 115 ++ lib.optional (!enableIntegerSimple) gmp 116 ++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv; 117 118 toolsForTarget = [ 119 pkgsBuildTarget.targetPackages.stdenv.cc 120 ] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm; ··· 127 useLdGold = targetPlatform.linker == "gold" || 128 (targetPlatform.linker == "bfd" && (targetPackages.stdenv.cc.bintools.bintools.hasGold or false) && !targetPlatform.isMusl); 129 130 - runtimeDeps = [ 131 - targetPackages.stdenv.cc.bintools 132 - coreutils 133 - ] 134 - # On darwin, we need unwrapped bintools as well (for otool) 135 - ++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [ 136 - targetPackages.stdenv.cc.bintools.bintools 137 - ]; 138 - 139 # Makes debugging easier to see which variant is at play in `nix-store -q --tree`. 140 variantSuffix = lib.concatStrings [ 141 (lib.optionalString stdenv.hostPlatform.isMusl "-musl") ··· 162 LANG = "en_US.UTF-8"; 163 164 # GHC is a bit confused on its cross terminology. 165 preConfigure = '' 166 for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do 167 export "''${env#TARGET_}=''${!env}" ··· 178 export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib" 179 export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf" 180 export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip" 181 182 echo -n "${buildMK}" > mk/build.mk 183 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure ··· 255 256 buildInputs = [ perl bash ] ++ (libDeps hostPlatform); 257 258 - propagatedBuildInputs = [ targetPackages.stdenv.cc ] 259 - ++ lib.optional useLLVM llvmPackages.llvm; 260 - 261 depsTargetTarget = map lib.getDev (libDeps targetPlatform); 262 depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform); 263 ··· 285 postInstall = '' 286 # Install the bash completion file. 287 install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc 288 - 289 - # Patch scripts to include "readelf" and "cat" in $PATH. 290 - for i in "$out/bin/"*; do 291 - test ! -h $i || continue 292 - egrep --quiet '^#!' <(head -n 1 $i) || continue 293 - sed -i -e '2i export PATH="$PATH:${lib.makeBinPath runtimeDeps}"' $i 294 - done 295 ''; 296 297 passthru = {
··· 12 , # GHC can be built with system libffi or a bundled one. 13 libffi ? null 14 15 + , useLLVM ? !(stdenv.targetPlatform.isx86 16 + || stdenv.targetPlatform.isPowerPC 17 + || stdenv.targetPlatform.isSparc) 18 , # LLVM is conceptually a run-time-only depedendency, but for 19 # non-x86, we need LLVM to bootstrap later stages, so it becomes a 20 # build-time dependency too. ··· 117 ++ lib.optional (!enableIntegerSimple) gmp 118 ++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv; 119 120 + # TODO(@sternenseemann): is buildTarget LLVM unnecessary? 121 + # GHC doesn't seem to have {LLC,OPT}_HOST 122 toolsForTarget = [ 123 pkgsBuildTarget.targetPackages.stdenv.cc 124 ] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm; ··· 131 useLdGold = targetPlatform.linker == "gold" || 132 (targetPlatform.linker == "bfd" && (targetPackages.stdenv.cc.bintools.bintools.hasGold or false) && !targetPlatform.isMusl); 133 134 # Makes debugging easier to see which variant is at play in `nix-store -q --tree`. 135 variantSuffix = lib.concatStrings [ 136 (lib.optionalString stdenv.hostPlatform.isMusl "-musl") ··· 157 LANG = "en_US.UTF-8"; 158 159 # GHC is a bit confused on its cross terminology. 160 + # TODO(@sternenseemann): investigate coreutils dependencies and pass absolute paths 161 preConfigure = '' 162 for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do 163 export "''${env#TARGET_}=''${!env}" ··· 174 export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib" 175 export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf" 176 export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip" 177 + '' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") '' 178 + export OTOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}otool" 179 + export INSTALL_NAME_TOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}install_name_tool" 180 + '' + lib.optionalString useLLVM '' 181 + export LLC="${lib.getBin llvmPackages.llvm}/bin/llc" 182 + export OPT="${lib.getBin llvmPackages.llvm}/bin/opt" 183 + '' + lib.optionalString (targetCC.isClang || (useLLVM && stdenv.targetPlatform.isDarwin)) (let 184 + # LLVM backend on Darwin needs clang, if we are already using clang, might as well set the environment variable. 185 + # See also https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm 186 + clang = if targetCC.isClang then targetCC else llvmPackages.clang; 187 + in '' 188 + export CLANG="${clang}/bin/${clang.targetPrefix}clang" 189 + '') + '' 190 191 echo -n "${buildMK}" > mk/build.mk 192 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure ··· 264 265 buildInputs = [ perl bash ] ++ (libDeps hostPlatform); 266 267 depsTargetTarget = map lib.getDev (libDeps targetPlatform); 268 depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform); 269 ··· 291 postInstall = '' 292 # Install the bash completion file. 293 install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc 294 ''; 295 296 passthru = {
+20 -20
pkgs/development/compilers/ghc/9.2.1.nix
··· 12 , # GHC can be built with system libffi or a bundled one. 13 libffi ? null 14 15 - , useLLVM ? !stdenv.targetPlatform.isx86 16 , # LLVM is conceptually a run-time-only depedendency, but for 17 # non-x86, we need LLVM to bootstrap later stages, so it becomes a 18 # build-time dependency too. ··· 115 ++ lib.optional (!enableIntegerSimple) gmp 116 ++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv; 117 118 toolsForTarget = [ 119 pkgsBuildTarget.targetPackages.stdenv.cc 120 ] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm; ··· 126 # see #84670 and #49071 for more background. 127 useLdGold = targetPlatform.linker == "gold" || (targetPlatform.linker == "bfd" && !targetPlatform.isMusl); 128 129 - runtimeDeps = [ 130 - targetPackages.stdenv.cc.bintools 131 - coreutils 132 - ] 133 - # On darwin, we need unwrapped bintools as well (for otool) 134 - ++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [ 135 - targetPackages.stdenv.cc.bintools.bintools 136 - ]; 137 - 138 # Makes debugging easier to see which variant is at play in `nix-store -q --tree`. 139 variantSuffix = lib.concatStrings [ 140 (lib.optionalString stdenv.hostPlatform.isMusl "-musl") ··· 161 LANG = "en_US.UTF-8"; 162 163 # GHC is a bit confused on its cross terminology. 164 preConfigure = '' 165 for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do 166 export "''${env#TARGET_}=''${!env}" ··· 177 export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib" 178 export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf" 179 export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip" 180 181 echo -n "${buildMK}" > mk/build.mk 182 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure ··· 258 259 buildInputs = [ perl bash ] ++ (libDeps hostPlatform); 260 261 - propagatedBuildInputs = [ targetPackages.stdenv.cc ] 262 - ++ lib.optional useLLVM llvmPackages.llvm; 263 - 264 depsTargetTarget = map lib.getDev (libDeps targetPlatform); 265 depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform); 266 ··· 288 postInstall = '' 289 # Install the bash completion file. 290 install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc 291 - 292 - # Patch scripts to include "readelf" and "cat" in $PATH. 293 - for i in "$out/bin/"*; do 294 - test ! -h $i || continue 295 - egrep --quiet '^#!' <(head -n 1 $i) || continue 296 - sed -i -e '2i export PATH="$PATH:${lib.makeBinPath runtimeDeps}"' $i 297 - done 298 ''; 299 300 passthru = {
··· 12 , # GHC can be built with system libffi or a bundled one. 13 libffi ? null 14 15 + , useLLVM ? !(stdenv.targetPlatform.isx86 16 + || stdenv.targetPlatform.isPowerPC 17 + || stdenv.targetPlatform.isSparc 18 + || (stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin)) 19 , # LLVM is conceptually a run-time-only depedendency, but for 20 # non-x86, we need LLVM to bootstrap later stages, so it becomes a 21 # build-time dependency too. ··· 118 ++ lib.optional (!enableIntegerSimple) gmp 119 ++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv; 120 121 + # TODO(@sternenseemann): is buildTarget LLVM unnecessary? 122 + # GHC doesn't seem to have {LLC,OPT}_HOST 123 toolsForTarget = [ 124 pkgsBuildTarget.targetPackages.stdenv.cc 125 ] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm; ··· 131 # see #84670 and #49071 for more background. 132 useLdGold = targetPlatform.linker == "gold" || (targetPlatform.linker == "bfd" && !targetPlatform.isMusl); 133 134 # Makes debugging easier to see which variant is at play in `nix-store -q --tree`. 135 variantSuffix = lib.concatStrings [ 136 (lib.optionalString stdenv.hostPlatform.isMusl "-musl") ··· 157 LANG = "en_US.UTF-8"; 158 159 # GHC is a bit confused on its cross terminology. 160 + # TODO(@sternenseemann): investigate coreutils dependencies and pass absolute paths 161 preConfigure = '' 162 for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do 163 export "''${env#TARGET_}=''${!env}" ··· 174 export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib" 175 export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf" 176 export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip" 177 + '' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") '' 178 + export OTOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}otool" 179 + export INSTALL_NAME_TOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}install_name_tool" 180 + '' + lib.optionalString useLLVM '' 181 + export LLC="${lib.getBin llvmPackages.llvm}/bin/llc" 182 + export OPT="${lib.getBin llvmPackages.llvm}/bin/opt" 183 + '' + lib.optionalString (targetCC.isClang || (useLLVM && stdenv.targetPlatform.isDarwin)) (let 184 + # LLVM backend on Darwin needs clang, if we are already using clang, might as well set the environment variable. 185 + # See also https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm 186 + clang = if targetCC.isClang then targetCC else llvmPackages.clang; 187 + in '' 188 + export CLANG="${clang}/bin/${clang.targetPrefix}clang" 189 + '') + '' 190 191 echo -n "${buildMK}" > mk/build.mk 192 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure ··· 268 269 buildInputs = [ perl bash ] ++ (libDeps hostPlatform); 270 271 depsTargetTarget = map lib.getDev (libDeps targetPlatform); 272 depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform); 273 ··· 295 postInstall = '' 296 # Install the bash completion file. 297 install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc 298 ''; 299 300 passthru = {
+20 -20
pkgs/development/compilers/ghc/head.nix
··· 17 !stdenv.targetPlatform.isWindows 18 , elfutils # for DWARF support 19 20 - , useLLVM ? !stdenv.targetPlatform.isx86 || stdenv.targetPlatform.isiOS 21 , # LLVM is conceptually a run-time-only depedendency, but for 22 # non-x86, we need LLVM to bootstrap later stages, so it becomes a 23 # build-time dependency too. ··· 128 ++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv 129 ++ lib.optional enableDwarf elfutils; 130 131 toolsForTarget = [ 132 pkgsBuildTarget.targetPackages.stdenv.cc 133 ] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm; ··· 140 useLdGold = targetPlatform.linker == "gold" || 141 (targetPlatform.linker == "bfd" && (targetPackages.stdenv.cc.bintools.bintools.hasGold or false) && !targetPlatform.isMusl); 142 143 - runtimeDeps = [ 144 - targetPackages.stdenv.cc.bintools 145 - coreutils 146 - ] 147 - # On darwin, we need unwrapped bintools as well (for otool) 148 - ++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [ 149 - targetPackages.stdenv.cc.bintools.bintools 150 - ]; 151 - 152 # Makes debugging easier to see which variant is at play in `nix-store -q --tree`. 153 variantSuffix = lib.concatStrings [ 154 (lib.optionalString stdenv.hostPlatform.isMusl "-musl") ··· 174 postPatch = "patchShebangs ."; 175 176 # GHC is a bit confused on its cross terminology. 177 preConfigure = '' 178 for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do 179 export "''${env#TARGET_}=''${!env}" ··· 191 export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib" 192 export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf" 193 export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip" 194 195 # otherwise haddock fails when generating the compiler docs 196 export LANG=C.UTF-8 ··· 278 279 buildInputs = [ perl bash ] ++ (libDeps hostPlatform); 280 281 - propagatedBuildInputs = [ targetPackages.stdenv.cc ] 282 - ++ lib.optional useLLVM llvmPackages.llvm; 283 - 284 depsTargetTarget = map lib.getDev (libDeps targetPlatform); 285 depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform); 286 ··· 308 postInstall = '' 309 # Install the bash completion file. 310 install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc 311 - 312 - # Patch scripts to include "readelf" and "cat" in $PATH. 313 - for i in "$out/bin/"*; do 314 - test ! -h $i || continue 315 - egrep --quiet '^#!' <(head -n 1 $i) || continue 316 - sed -i -e '2i export PATH="$PATH:${lib.makeBinPath runtimeDeps}"' $i 317 - done 318 ''; 319 320 passthru = {
··· 17 !stdenv.targetPlatform.isWindows 18 , elfutils # for DWARF support 19 20 + , useLLVM ? !(stdenv.targetPlatform.isx86 21 + || stdenv.targetPlatform.isPowerPC 22 + || stdenv.targetPlatform.isSparc 23 + || (stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin)) 24 , # LLVM is conceptually a run-time-only depedendency, but for 25 # non-x86, we need LLVM to bootstrap later stages, so it becomes a 26 # build-time dependency too. ··· 131 ++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv 132 ++ lib.optional enableDwarf elfutils; 133 134 + # TODO(@sternenseemann): is buildTarget LLVM unnecessary? 135 + # GHC doesn't seem to have {LLC,OPT}_HOST 136 toolsForTarget = [ 137 pkgsBuildTarget.targetPackages.stdenv.cc 138 ] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm; ··· 145 useLdGold = targetPlatform.linker == "gold" || 146 (targetPlatform.linker == "bfd" && (targetPackages.stdenv.cc.bintools.bintools.hasGold or false) && !targetPlatform.isMusl); 147 148 # Makes debugging easier to see which variant is at play in `nix-store -q --tree`. 149 variantSuffix = lib.concatStrings [ 150 (lib.optionalString stdenv.hostPlatform.isMusl "-musl") ··· 170 postPatch = "patchShebangs ."; 171 172 # GHC is a bit confused on its cross terminology. 173 + # TODO(@sternenseemann): investigate coreutils dependencies and pass absolute paths 174 preConfigure = '' 175 for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do 176 export "''${env#TARGET_}=''${!env}" ··· 188 export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib" 189 export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf" 190 export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip" 191 + '' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") '' 192 + export OTOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}otool" 193 + export INSTALL_NAME_TOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}install_name_tool" 194 + '' + lib.optionalString useLLVM '' 195 + export LLC="${lib.getBin llvmPackages.llvm}/bin/llc" 196 + export OPT="${lib.getBin llvmPackages.llvm}/bin/opt" 197 + '' + lib.optionalString (targetCC.isClang || (useLLVM && stdenv.targetPlatform.isDarwin)) (let 198 + # LLVM backend on Darwin needs clang, if we are already using clang, might as well set the environment variable. 199 + # See also https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm 200 + clang = if targetCC.isClang then targetCC else llvmPackages.clang; 201 + in '' 202 + export CLANG="${clang}/bin/${clang.targetPrefix}clang" 203 + '') + '' 204 205 # otherwise haddock fails when generating the compiler docs 206 export LANG=C.UTF-8 ··· 288 289 buildInputs = [ perl bash ] ++ (libDeps hostPlatform); 290 291 depsTargetTarget = map lib.getDev (libDeps targetPlatform); 292 depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform); 293 ··· 315 postInstall = '' 316 # Install the bash completion file. 317 install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc 318 ''; 319 320 passthru = {
+1 -2
pkgs/development/haskell-modules/configuration-ghc-8.10.x.nix
··· 4 5 self: super: { 6 7 - # This compiler version needs llvm 9.x. 8 - llvmPackages = pkgs.lib.dontRecurseIntoAttrs pkgs.llvmPackages_9; 9 10 # Disable GHC 8.10.x core libraries. 11 array = null;
··· 4 5 self: super: { 6 7 + llvmPackages = pkgs.lib.dontRecurseIntoAttrs self.ghc.llvmPackages; 8 9 # Disable GHC 8.10.x core libraries. 10 array = null;
+1 -2
pkgs/development/haskell-modules/configuration-ghc-8.6.x.nix
··· 4 5 self: super: { 6 7 - # This compiler version needs llvm 6.x. 8 - llvmPackages = pkgs.lib.dontRecurseIntoAttrs pkgs.llvmPackages_6; 9 10 # Disable GHC 8.6.x core libraries. 11 array = null;
··· 4 5 self: super: { 6 7 + llvmPackages = pkgs.lib.dontRecurseIntoAttrs self.ghc.llvmPackages; 8 9 # Disable GHC 8.6.x core libraries. 10 array = null;
+1 -2
pkgs/development/haskell-modules/configuration-ghc-8.8.x.nix
··· 4 5 self: super: { 6 7 - # This compiler version needs llvm 7.x. 8 - llvmPackages = pkgs.lib.dontRecurseIntoAttrs pkgs.llvmPackages_7; 9 10 # Disable GHC 8.8.x core libraries. 11 array = null;
··· 4 5 self: super: { 6 7 + llvmPackages = pkgs.lib.dontRecurseIntoAttrs self.ghc.llvmPackages; 8 9 # Disable GHC 8.8.x core libraries. 10 array = null;
+1 -2
pkgs/development/haskell-modules/configuration-ghc-9.0.x.nix
··· 4 5 self: super: { 6 7 - # This compiler version needs llvm 10.x. 8 - llvmPackages = pkgs.lib.dontRecurseIntoAttrs pkgs.llvmPackages_10; 9 10 # Disable GHC 9.0.x core libraries. 11 array = null;
··· 4 5 self: super: { 6 7 + llvmPackages = pkgs.lib.dontRecurseIntoAttrs self.ghc.llvmPackages; 8 9 # Disable GHC 9.0.x core libraries. 10 array = null;
+1 -2
pkgs/development/haskell-modules/configuration-ghc-9.2.x.nix
··· 4 5 self: super: { 6 7 - # This compiler version needs llvm 10.x. 8 - llvmPackages = pkgs.lib.dontRecurseIntoAttrs pkgs.llvmPackages_10; 9 10 # Disable GHC 9.2.x core libraries. 11 array = null;
··· 4 5 self: super: { 6 7 + llvmPackages = pkgs.lib.dontRecurseIntoAttrs self.ghc.llvmPackages; 8 9 # Disable GHC 9.2.x core libraries. 10 array = null;
+1 -1
pkgs/development/haskell-modules/configuration-ghc-head.nix
··· 11 12 self: super: { 13 14 - llvmPackages = pkgs.lib.dontRecurseIntoAttrs pkgs.llvmPackages_10; 15 16 # Disable GHC 8.7.x core libraries. 17 array = null;
··· 11 12 self: super: { 13 14 + llvmPackages = pkgs.lib.dontRecurseIntoAttrs self.ghc.llvmPackages; 15 16 # Disable GHC 8.7.x core libraries. 17 array = null;
+4 -10
pkgs/development/haskell-modules/with-packages-wrapper.nix
··· 1 { lib, stdenv, ghc, llvmPackages, packages, symlinkJoin, makeWrapper 2 - # Include LLVM by default if GHC doesn't have native code generation support 3 - # See https://gitlab.haskell.org/ghc/ghc/-/wikis/platforms 4 - , useLLVM ? !(lib.any lib.id ([ 5 - stdenv.targetPlatform.isx86 6 - stdenv.targetPlatform.isPowerPC 7 - stdenv.targetPlatform.isSparc 8 - ] ++ lib.optionals (lib.versionAtLeast ghc.version "9.2") [ 9 - (stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin) 10 - # TODO(@sternenseemann): Is armv7a supported for iOS? 11 - ])) 12 , postBuild ? "" 13 , ghcLibdir ? null # only used by ghcjs, when resolving plugins 14 }:
··· 1 { lib, stdenv, ghc, llvmPackages, packages, symlinkJoin, makeWrapper 2 + # GHC will have LLVM available if necessary for the respective target, 3 + # so useLLVM only needs to be changed if -fllvm is to be used for a 4 + # platform that has NCG support 5 + , useLLVM ? false 6 , postBuild ? "" 7 , ghcLibdir ? null # only used by ghcjs, when resolving plugins 8 }:
+9 -1
pkgs/top-level/all-packages.nix
··· 12074 # current default compiler is”, if you bump this: 12075 haskellPackages = dontRecurseIntoAttrs haskell.packages.ghc8107; 12076 12077 - inherit (haskellPackages) ghc; 12078 12079 cabal-install = haskell.lib.compose.justStaticExecutables haskellPackages.cabal-install; 12080
··· 12074 # current default compiler is”, if you bump this: 12075 haskellPackages = dontRecurseIntoAttrs haskell.packages.ghc8107; 12076 12077 + # haskellPackages.ghc is build->host (it exposes the compiler used to build the 12078 + # set, similarly to stdenv.cc), but pkgs.ghc should be host->target to be more 12079 + # consistent with the gcc, gnat, clang etc. derivations 12080 + # 12081 + # We use targetPackages.haskellPackages.ghc if available since this also has 12082 + # the withPackages wrapper available. In the final cross-compiled package set 12083 + # however, targetPackages won't be populated, so we need to fall back to the 12084 + # plain, cross-compiled compiler (which is only theoretical at the moment). 12085 + ghc = targetPackages.haskellPackages.ghc or haskell.compiler.ghc8107; 12086 12087 cabal-install = haskell.lib.compose.justStaticExecutables haskellPackages.cabal-install; 12088
+13 -11
pkgs/top-level/haskell-packages.nix
··· 50 51 compiler = { 52 53 - ghc865Binary = callPackage ../development/compilers/ghc/8.6.5-binary.nix { }; 54 55 ghc8102Binary = callPackage ../development/compilers/ghc/8.10.2-binary.nix { 56 llvmPackages = pkgs.llvmPackages_9; ··· 62 }; 63 64 ghc8107Binary = callPackage ../development/compilers/ghc/8.10.7-binary.nix { 65 - llvmPackages = pkgs.llvmPackages_11; 66 }; 67 68 ghc8107BinaryMinimal = callPackage ../development/compilers/ghc/8.10.7-binary.nix { 69 - llvmPackages = pkgs.llvmPackages_11; 70 minimal = true; 71 }; 72 ··· 96 # https://github.com/xattr/xattr/issues/44 and 97 # https://github.com/xattr/xattr/issues/55 are solved. 98 inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook; 99 - buildTargetLlvmPackages = pkgsBuildTarget.llvmPackages_9; 100 - llvmPackages = pkgs.llvmPackages_9; 101 }; 102 ghc901 = callPackage ../development/compilers/ghc/9.0.1.nix { 103 bootPkgs = ··· 109 packages.ghc8107Binary; 110 inherit (buildPackages.python3Packages) sphinx; 111 inherit (buildPackages.darwin) autoSignDarwinBinariesHook; 112 - buildTargetLlvmPackages = pkgsBuildTarget.llvmPackages_10; 113 - llvmPackages = pkgs.llvmPackages_10; 114 }; 115 ghc921 = callPackage ../development/compilers/ghc/9.2.1.nix { 116 bootPkgs = ··· 124 # https://github.com/xattr/xattr/issues/44 and 125 # https://github.com/xattr/xattr/issues/55 are solved. 126 inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook; 127 - buildTargetLlvmPackages = pkgsBuildTarget.llvmPackages_10; 128 - llvmPackages = pkgs.llvmPackages_10; 129 }; 130 ghcHEAD = callPackage ../development/compilers/ghc/head.nix { 131 bootPkgs = packages.ghc8107Binary; ··· 134 # https://github.com/xattr/xattr/issues/44 and 135 # https://github.com/xattr/xattr/issues/55 are solved. 136 inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook; 137 - buildTargetLlvmPackages = pkgsBuildTarget.llvmPackages_10; 138 - llvmPackages = pkgs.llvmPackages_10; 139 libffi = pkgs.libffi; 140 }; 141
··· 50 51 compiler = { 52 53 + ghc865Binary = callPackage ../development/compilers/ghc/8.6.5-binary.nix { 54 + llvmPackages = pkgs.llvmPackages_6; 55 + }; 56 57 ghc8102Binary = callPackage ../development/compilers/ghc/8.10.2-binary.nix { 58 llvmPackages = pkgs.llvmPackages_9; ··· 64 }; 65 66 ghc8107Binary = callPackage ../development/compilers/ghc/8.10.7-binary.nix { 67 + llvmPackages = pkgs.llvmPackages_12; 68 }; 69 70 ghc8107BinaryMinimal = callPackage ../development/compilers/ghc/8.10.7-binary.nix { 71 + llvmPackages = pkgs.llvmPackages_12; 72 minimal = true; 73 }; 74 ··· 98 # https://github.com/xattr/xattr/issues/44 and 99 # https://github.com/xattr/xattr/issues/55 are solved. 100 inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook; 101 + buildTargetLlvmPackages = pkgsBuildTarget.llvmPackages_12; 102 + llvmPackages = pkgs.llvmPackages_12; 103 }; 104 ghc901 = callPackage ../development/compilers/ghc/9.0.1.nix { 105 bootPkgs = ··· 111 packages.ghc8107Binary; 112 inherit (buildPackages.python3Packages) sphinx; 113 inherit (buildPackages.darwin) autoSignDarwinBinariesHook; 114 + buildTargetLlvmPackages = pkgsBuildTarget.llvmPackages_9; 115 + llvmPackages = pkgs.llvmPackages_9; 116 }; 117 ghc921 = callPackage ../development/compilers/ghc/9.2.1.nix { 118 bootPkgs = ··· 126 # https://github.com/xattr/xattr/issues/44 and 127 # https://github.com/xattr/xattr/issues/55 are solved. 128 inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook; 129 + buildTargetLlvmPackages = pkgsBuildTarget.llvmPackages_12; 130 + llvmPackages = pkgs.llvmPackages_12; 131 }; 132 ghcHEAD = callPackage ../development/compilers/ghc/head.nix { 133 bootPkgs = packages.ghc8107Binary; ··· 136 # https://github.com/xattr/xattr/issues/44 and 137 # https://github.com/xattr/xattr/issues/55 are solved. 138 inherit (buildPackages.darwin) xattr autoSignDarwinBinariesHook; 139 + buildTargetLlvmPackages = pkgsBuildTarget.llvmPackages_12; 140 + llvmPackages = pkgs.llvmPackages_12; 141 libffi = pkgs.libffi; 142 }; 143