···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
···1011## Backward Incompatibilities {#sec-release-22.05-incompatibilities}
1200000000000013## Other Notable Changes {#sec-release-22.05-notable-changes}
···1011## Backward Incompatibilities {#sec-release-22.05-incompatibilities}
1213+* `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
0067 # 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";
1420000000000000143in
144145stdenv.mkDerivation rec {
···156157 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
181182 # 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;
280000000000281 # 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
···360361 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
00373 echo compilation ok
374 [ $(./main) == "yes" ]
375 '';
···377 passthru = {
378 targetPrefix = "";
379 enableShared = true;
00380381 # Our Cabal compiler name
382 haskellCompilerName = "ghc-${version}";
···3, ncurses5
4, ncurses6, gmp, libiconv, numactl
5, llvmPackages
6+, coreutils
7+, targetPackages
89 # 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";
144145+ 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+158in
159160stdenv.mkDerivation rec {
···171172 nativeBuildInputs = [ perl ];
173 propagatedBuildInputs =
0174 # 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
195196 # 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;
294295+ # 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
···383384 doInstallCheck = true;
385 installCheckPhase = ''
0386 # 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;
406407 # 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
0067 # 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";
1570000000000000158in
159160stdenv.mkDerivation rec {
···175 # and update this comment accordingly.
176177 nativeBuildInputs = [ perl ];
178- propagatedBuildInputs =
179- lib.optionals useLLVM [ llvmPackages.llvm ]
180- ;
181182 # 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;
280000000000281 # 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
···360361 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;
00380381 # Our Cabal compiler name
382 haskellCompilerName = "ghc-${version}";
···3, ncurses5
4, ncurses6, gmp, libiconv, numactl
5, llvmPackages
6+, coreutils
7+, targetPackages
89 # 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";
159160+ 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+173in
174175stdenv.mkDerivation rec {
···190 # and update this comment accordingly.
191192 nativeBuildInputs = [ perl ];
000193194 # 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;
292293+ # 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
···381382 doInstallCheck = true;
383 installCheckPhase = ''
0384 # 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;
402403 # 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
1314-, useLLVM ? !stdenv.targetPlatform.isx86
0015, # 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;
12200123 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- ];
143144 # Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
145 variantSuffix = lib.concatStrings [
···196 postPatch = "patchShebangs .";
197198 # GHC is a bit confused on its cross terminology.
0199 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"
0000000000000215216 echo -n "${buildMK}" > mk/build.mk
217 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
···290291 buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
292293- 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 '';
331332 passthru = {
···11, # GHC can be built with system libffi or a bundled one.
12 libffi ? null
1314+, 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;
124125+ # 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);
000000000138139 # Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
140 variantSuffix = lib.concatStrings [
···191 postPatch = "patchShebangs .";
192193 # 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+ '') + ''
224225 echo -n "${buildMK}" > mk/build.mk
226 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
···299300 buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
301000302 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
0000000329 '';
330331 passthru = {
+28-5
pkgs/development/compilers/ghc/8.6.5-binary.nix
···2, fetchurl, perl, gcc
3, ncurses5, ncurses6, gmp, glibc, libiconv
4, llvmPackages
005}:
67# Prebuilt only does native
···3031 downloadsUrl = "https://downloads.haskell.org/ghc";
32000000000000033in
3435stdenv.mkDerivation rec {
···62 or (throw "cannot bootstrap GHC on this platform"));
6364 nativeBuildInputs = [ perl ];
65- propagatedBuildInputs = lib.optionals useLLVM [ llvmPackages.llvm ];
6667 # Cannot patchelf beforehand due to relative RPATHs that anticipate
68 # the final install location/
···130 # calls install-strip ...
131 dontBuild = true;
132000000000133 # On Linux, use patchelf to modify the executables so that they can
134 # find editline/gmp.
135 postFixup = lib.optionalString stdenv.isLinux ''
···163164 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;
18300184 # Our Cabal compiler name
185 haskellCompilerName = "ghc-${version}";
186 };
187188 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}:
89# Prebuilt only does native
···3233 downloadsUrl = "https://downloads.haskell.org/ghc";
3435+ 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+48in
4950stdenv.mkDerivation rec {
···77 or (throw "cannot bootstrap GHC on this platform"));
7879 nativeBuildInputs = [ perl ];
08081 # Cannot patchelf beforehand due to relative RPATHs that anticipate
82 # the final install location/
···144 # calls install-strip ...
145 dontBuild = true;
146147+ # 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 ''
···186187 doInstallCheck = true;
188 installCheckPhase = ''
0189 # 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;
205206+ inherit llvmPackages;
207+208 # Our Cabal compiler name
209 haskellCompilerName = "ghc-${version}";
210 };
211212 meta = rec {
213 license = lib.licenses.bsd3;
214+ platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"];
0215 # 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
1213-, useLLVM ? !stdenv.targetPlatform.isx86
0014, # 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;
13000131 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- ];
151152 # Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
153 variantSuffix = lib.concatStrings [
···197 postPatch = "patchShebangs .";
198199 # GHC is a bit confused on its cross terminology.
0200 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"
0000000000223224 echo -n "${buildMK dontStrip}" > mk/build.mk
225 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
···293294 buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
295296- 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 '';
330331 passthru = {
···345 guibou
346 ] ++ lib.teams.haskell.members;
347 timeout = 24 * 3600;
348- inherit (ghc.meta) license platforms;
0000000000349 # 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
1213+, 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;
132133+ # 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);
000000000146147 # Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
148 variantSuffix = lib.concatStrings [
···192 postPatch = "patchShebangs .";
193194 # 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+ '') + ''
229230 echo -n "${buildMK dontStrip}" > mk/build.mk
231 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
···299300 buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
301000302 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
0000000325 '';
326327 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
1415-, useLLVM ? !stdenv.targetPlatform.isx86
0016, # 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;
11700118 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);
129130- 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";
163164 # GHC is a bit confused on its cross terminology.
0165 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"
0000000000000181182 echo -n "${buildMK}" > mk/build.mk
183 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
···255256 buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
257258- 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 '';
296297 passthru = {
···12, # GHC can be built with system libffi or a bundled one.
13 libffi ? null
1415+, 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;
119120+ # 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);
133000000000134 # 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";
158159 # 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+ '') + ''
190191 echo -n "${buildMK}" > mk/build.mk
192 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
···264265 buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
266000267 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
0000000294 '';
295296 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
1415-, useLLVM ? !stdenv.targetPlatform.isx86
00016, # 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;
11700118 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);
128129- 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";
162163 # GHC is a bit confused on its cross terminology.
0164 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"
0000000000000180181 echo -n "${buildMK}" > mk/build.mk
182 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
···258259 buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
260261- 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 '';
299300 passthru = {
···12, # GHC can be built with system libffi or a bundled one.
13 libffi ? null
1415+, 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;
120121+ # 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);
133000000000134 # 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";
158159 # 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+ '') + ''
190191 echo -n "${buildMK}" > mk/build.mk
192 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
···268269 buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
270000271 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
0000000298 '';
299300 passthru = {
+20-20
pkgs/development/compilers/ghc/head.nix
···17 !stdenv.targetPlatform.isWindows
18, elfutils # for DWARF support
1920-, useLLVM ? !stdenv.targetPlatform.isx86 || stdenv.targetPlatform.isiOS
00021, # 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;
13000131 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);
142143- 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 .";
175176 # GHC is a bit confused on its cross terminology.
0177 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"
0000000000000194195 # otherwise haddock fails when generating the compiler docs
196 export LANG=C.UTF-8
···278279 buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
280281- 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 '';
319320 passthru = {
···17 !stdenv.targetPlatform.isWindows
18, elfutils # for DWARF support
1920+, 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;
133134+ # 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);
147000000000148 # 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 .";
171172 # 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+ '') + ''
204205 # otherwise haddock fails when generating the compiler docs
206 export LANG=C.UTF-8
···288289 buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
290000291 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
0000000318 '';
319320 passthru = {
···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
0000006, 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;
1207612077- inherit (haskellPackages) ghc;
000000001207812079 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;
1207612077+ # 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;
1208612087 cabal-install = haskell.lib.compose.justStaticExecutables haskellPackages.cabal-install;
12088