···10761076`disableLibraryProfiling drv`
10771077: Sets the `enableLibraryProfiling` argument to `false` for `drv`.
1078107810791079+`disableParallelBuilding drv`
10801080+: Sets the `enableParallelBuilding` argument to `false` for `drv`.
10811081+10791082#### Library functions in the Haskell package sets {#haskell-package-set-lib-functions}
1080108310811084Some library functions depend on packages from the Haskell package sets. Thus they are
+4-4
pkgs/data/misc/hackage/pin.json
···11{
22- "commit": "4670ba3f52eae6737137ddcb817182f3daad4f26",
33- "url": "https://github.com/commercialhaskell/all-cabal-hashes/archive/4670ba3f52eae6737137ddcb817182f3daad4f26.tar.gz",
44- "sha256": "18q5shdmh12147502135q6132rmzp29qfjhwrcjwidl0pi9ki70i",
55- "msg": "Update from Hackage at 2024-08-19T17:17:03Z"
22+ "commit": "5d97d9c05e76d8cecb68f1e9063afb39ca0fb26b",
33+ "url": "https://github.com/commercialhaskell/all-cabal-hashes/archive/5d97d9c05e76d8cecb68f1e9063afb39ca0fb26b.tar.gz",
44+ "sha256": "1ic4wn5immv06m1m2cq6mzrrgrxbidxmj39licxlkmnm9jlwzjwr",
55+ "msg": "Update from Hackage at 2024-09-03T10:29:19Z"
66}
+152-31
pkgs/development/compilers/ghc/8.10.7.nix
···11-{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
11+{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, buildPackages, targetPackages
2233# build-tools
44, bootPkgs
···3232, # If enabled, use -fPIC when compiling static libs.
3333 enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
34343535-, enableProfiledLibs ? true
3535+ # Exceeds Hydra output limit (at the time of writing ~3GB) when cross compiled to riscv64.
3636+ # A riscv64 cross-compiler fits into the limit comfortably.
3737+, enableProfiledLibs ? !stdenv.hostPlatform.isRiscV64
36383739, # Whether to build dynamic libs for the standard library (on the target
3840 # platform). Static libs are always built.
3941 enableShared ? !stdenv.targetPlatform.isWindows && !stdenv.targetPlatform.useiOSPrebuilt
40424143, # Whether to build terminfo.
4242- enableTerminfo ? !stdenv.targetPlatform.isWindows
4444+ enableTerminfo ? !(stdenv.targetPlatform.isWindows
4545+ # terminfo can't be built for cross
4646+ || (stdenv.buildPlatform != stdenv.hostPlatform)
4747+ || (stdenv.hostPlatform != stdenv.targetPlatform))
43484449, # What flavour to build. An empty string indicates no
4550 # specific flavour and falls back to ghc default values.
···55605661, enableHaddockProgram ?
5762 # Disabled for cross; see note [HADDOCK_DOCS].
5858- (stdenv.targetPlatform == stdenv.hostPlatform)
6363+ (stdenv.buildPlatform == stdenv.hostPlatform && stdenv.targetPlatform == stdenv.hostPlatform)
59646065, # Whether to disable the large address space allocator
6166 # necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
6267 disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
6868+6969+, # Whether to build an unregisterised version of GHC.
7070+ # GHC will normally auto-detect whether it can do a registered build, but this
7171+ # option will force it to do an unregistered build when set to true.
7272+ # See https://gitlab.haskell.org/ghc/ghc/-/wikis/building/unregisterised
7373+ enableUnregisterised ? false
6374}@args:
64756576assert !enableIntegerSimple -> gmp != null;
66776778# Cross cannot currently build the `haddock` program for silly reasons,
6879# see note [HADDOCK_DOCS].
6969-assert (stdenv.targetPlatform != stdenv.hostPlatform) -> !enableHaddockProgram;
8080+assert (stdenv.buildPlatform != stdenv.hostPlatform || stdenv.targetPlatform != stdenv.hostPlatform) -> !enableHaddockProgram;
8181+8282+# GHC does not support building when all 3 platforms are different.
8383+assert stdenv.buildPlatform == stdenv.hostPlatform || stdenv.hostPlatform == stdenv.targetPlatform;
70847185let
7272- libffi_name = if stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 then "libffi" else "libffi_3_3";
7386 inherit (stdenv) buildPlatform hostPlatform targetPlatform;
7474-7575- inherit (bootPkgs) ghc;
76877788 # TODO(@Ericson2314) Make unconditional
7889 targetPrefix = lib.optionalString
···8697 endif
8798 BUILD_SPHINX_HTML = ${if enableDocs then "YES" else "NO"}
8899 BUILD_SPHINX_PDF = NO
100100+101101+ WITH_TERMINFO = ${if enableTerminfo then "YES" else "NO"}
89102 '' +
90103 # Note [HADDOCK_DOCS]:
91104 # Unfortunately currently `HADDOCK_DOCS` controls both whether the `haddock`
···134147 pkgsBuildTarget.targetPackages.stdenv.cc
135148 ] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm;
136149150150+ buildCC = buildPackages.stdenv.cc;
137151 targetCC = builtins.head toolsForTarget;
152152+ installCC = pkgsHostTarget.targetPackages.stdenv.cc;
138153139154 # toolPath calculates the absolute path to the name tool associated with a
140155 # given `stdenv.cc` derivation, i.e. it picks the correct derivation to take
···145160 tools = {
146161 "cc" = cc;
147162 "c++" = cc;
148148- as = cc.bintools.bintools;
163163+ as = cc.bintools;
149164150150- ar = cc.bintools.bintools;
151151- ranlib = cc.bintools.bintools;
152152- nm = cc.bintools.bintools;
153153- readelf = cc.bintools.bintools;
165165+ ar = cc.bintools;
166166+ ranlib = cc.bintools;
167167+ nm = cc.bintools;
168168+ readelf = cc.bintools;
169169+ objdump = cc.bintools;
154170155171 ld = cc.bintools;
156172 "ld.gold" = cc.bintools;
···169185 if stdenv.targetPlatform.isDarwin
170186 then cc.bintools
171187 else cc.bintools.bintools;
188188+189189+ # clang is used as an assembler on darwin with the LLVM backend
190190+ clang = cc;
172191 }.${name};
173192 in
174193 "${tools}/bin/${tools.targetPrefix}${name}";
···185204 (lib.optionalString enableIntegerSimple "-integer-simple")
186205 ];
187206188188-in
207207+ libffi_name =
208208+ if stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64
209209+ then "libffi"
210210+ else "libffi_3_3";
189211190190-# C compiler, bintools and LLVM are used at build time, but will also leak into
191191-# the resulting GHC's settings file and used at runtime. This means that we are
192192-# currently only able to build GHC if hostPlatform == buildPlatform.
193193-assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
194194-assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
195195-assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
212212+ # These libraries are library dependencies of the standard libraries bundled
213213+ # by GHC (core libs) users will link their compiled artifacts again. Thus,
214214+ # they should be taken from targetPackages.
215215+ #
216216+ # We need to use pkgsHostTarget if we are cross compiling a native GHC compiler,
217217+ # though (when native compiling GHC, pkgsHostTarget == targetPackages):
218218+ #
219219+ # 1. targetPackages would be empty(-ish) in this situation since we can't
220220+ # execute cross compiled compilers in order to obtain the libraries
221221+ # that would be in targetPackages.
222222+ # 2. pkgsHostTarget is fine to use since hostPlatform == targetPlatform in this
223223+ # situation.
224224+ # 3. The core libs used by the final GHC (stage 2) for user artifacts are also
225225+ # used to build stage 2 GHC itself, i.e. the core libs are both host and
226226+ # target.
227227+ targetLibs =
228228+ let
229229+ basePackageSet =
230230+ if hostPlatform != targetPlatform
231231+ then targetPackages
232232+ else pkgsHostTarget;
233233+ in
234234+ {
235235+ inherit (basePackageSet) gmp ncurses;
236236+ # dynamic inherits are not possible in Nix
237237+ libffi = basePackageSet.${libffi_name};
238238+ };
239239+240240+in
196241197242stdenv.mkDerivation (rec {
198243 version = "8.10.7";
···277322 for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
278323 export "''${env#TARGET_}=''${!env}"
279324 done
325325+ # Stage0 (build->build) which builds stage 1
326326+ export GHC="${bootPkgs.ghc}/bin/ghc"
280327 # GHC is a bit confused on its cross terminology, as these would normally be
281328 # the *host* tools.
282329 export CC="${toolPath "cc" targetCC}"
···289336 export RANLIB="${toolPath "ranlib" targetCC}"
290337 export READELF="${toolPath "readelf" targetCC}"
291338 export STRIP="${toolPath "strip" targetCC}"
339339+ export OBJDUMP="${toolPath "objdump" targetCC}"
292340 '' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") ''
293341 export OTOOL="${toolPath "otool" targetCC}"
294342 export INSTALL_NAME_TOOL="${toolPath "install_name_tool" targetCC}"
···297345 export OPT="${lib.getBin buildTargetLlvmPackages.llvm}/bin/opt"
298346 '' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
299347 # LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
300300- export CLANG="${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
348348+ # The executable we specify via $CLANG is used as an assembler (exclusively, it seems, but this isn't
349349+ # clarified in any user facing documentation). As such, it'll be called on assembly produced by $CC
350350+ # which usually comes from the darwin stdenv. To prevent a situation where $CLANG doesn't understand
351351+ # the assembly it is given, we need to make sure that it matches the LLVM version of $CC if possible.
352352+ # It is unclear (at the time of writing 2024-09-01) whether $CC should match the LLVM version we use
353353+ # for llc and opt which would require using a custom darwin stdenv for targetCC.
354354+ export CLANG="${
355355+ if targetCC.isClang
356356+ then toolPath "clang" targetCC
357357+ else "${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
358358+ }"
301359 '' + ''
360360+ # No need for absolute paths since these tools only need to work during the build
361361+ export CC_STAGE0="$CC_FOR_BUILD"
362362+ export LD_STAGE0="$LD_FOR_BUILD"
363363+ export AR_STAGE0="$AR_FOR_BUILD"
302364303365 echo -n "${buildMK}" > mk/build.mk
304366 sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
···329391 done
330392 '';
331393394394+ # Although it is usually correct to pass --host, we don't do that here because
395395+ # GHC's usage of build, host, and target is non-standard.
396396+ # See https://gitlab.haskell.org/ghc/ghc/-/wikis/building/cross-compiling
332397 # TODO(@Ericson2314): Always pass "--target" and always prefix.
333333- configurePlatforms = [ "build" "host" ]
334334- ++ lib.optional (targetPlatform != hostPlatform) "target";
398398+ configurePlatforms = [ "build" ]
399399+ ++ lib.optional (buildPlatform != hostPlatform || targetPlatform != hostPlatform) "target";
335400336401 # `--with` flags for libraries needed for RTS linker
337402 configureFlags = [
338403 "--datadir=$doc/share/doc/ghc"
339339- "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
404404+ ] ++ lib.optionals enableTerminfo [
405405+ "--with-curses-includes=${lib.getDev targetLibs.ncurses}/include"
406406+ "--with-curses-libraries=${lib.getLib targetLibs.ncurses}/lib"
340407 ] ++ lib.optionals (args.${libffi_name} != null) [
341408 "--with-system-libffi"
342342- "--with-ffi-includes=${targetPackages.${libffi_name}.dev}/include"
343343- "--with-ffi-libraries=${targetPackages.${libffi_name}.out}/lib"
409409+ "--with-ffi-includes=${targetLibs.libffi.dev}/include"
410410+ "--with-ffi-libraries=${targetLibs.libffi.out}/lib"
344411 ] ++ lib.optionals (targetPlatform == hostPlatform && !enableIntegerSimple) [
345345- "--with-gmp-includes=${targetPackages.gmp.dev}/include"
346346- "--with-gmp-libraries=${targetPackages.gmp.out}/lib"
412412+ "--with-gmp-includes=${targetLibs.gmp.dev}/include"
413413+ "--with-gmp-libraries=${targetLibs.gmp.out}/lib"
347414 ] ++ lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
348415 "--with-iconv-includes=${libiconv}/include"
349416 "--with-iconv-libraries=${libiconv}/lib"
···355422 "CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
356423 ] ++ lib.optionals (disableLargeAddressSpace) [
357424 "--disable-large-address-space"
425425+ ] ++ lib.optionals enableUnregisterised [
426426+ "--enable-unregisterised"
358427 ];
359428360429 # Make sure we never relax`$PATH` and hooks support for compatibility.
···365434366435 nativeBuildInputs = [
367436 perl autoreconfHook autoconf automake m4 python3
368368- ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
437437+ bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
438438+ bootPkgs.ghc-settings-edit
369439 ] ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
370440 autoSignDarwinBinariesHook
371441 ] ++ lib.optionals enableDocs [
372442 sphinx
373443 ];
374444445445+ # Everything the stage0 compiler needs to build stage1: CC, bintools, extra libs.
446446+ # See also GHC, {CC,LD,AR}_STAGE0 in preConfigure.
447447+ depsBuildBuild = [
448448+ # N.B. We do not declare bootPkgs.ghc in any of the stdenv.mkDerivation
449449+ # dependency lists to prevent the bintools setup hook from adding ghc's
450450+ # lib directory to the linker flags. Instead we tell configure about it
451451+ # via the GHC environment variable.
452452+ buildCC
453453+ # stage0 builds terminfo unconditionally, so we always need ncurses
454454+ ncurses
455455+ ];
375456 # For building runtime libs
376457 depsBuildTarget = toolsForTarget;
377458378378- buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
459459+ # Prevent stage0 ghc from leaking into the final result. This was an issue
460460+ # with GHC 9.6.
461461+ disallowedReferences = [
462462+ bootPkgs.ghc
463463+ ];
464464+465465+ buildInputs = [ bash ] ++ (libDeps hostPlatform);
379466380467 depsTargetTarget = map lib.getDev (libDeps targetPlatform);
381468 depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);
···402489 requiredSystemFeatures = [ "big-parallel" ];
403490404491 postInstall = ''
492492+ settingsFile="$out/lib/${targetPrefix}${passthru.haskellCompilerName}/settings"
493493+494494+ # Make the installed GHC use the host->target tools.
495495+ ghc-settings-edit "$settingsFile" \
496496+ "C compiler command" "${toolPath "cc" installCC}" \
497497+ "Haskell CPP command" "${toolPath "cc" installCC}" \
498498+ "C++ compiler command" "${toolPath "c++" installCC}" \
499499+ "ld command" "${toolPath "ld${lib.optionalString useLdGold ".gold"}" installCC}" \
500500+ "Merge objects command" "${toolPath "ld${lib.optionalString useLdGold ".gold"}" installCC}" \
501501+ "ar command" "${toolPath "ar" installCC}" \
502502+ "ranlib command" "${toolPath "ranlib" installCC}"
503503+ ''
504504+ + lib.optionalString (stdenv.targetPlatform.linker == "cctools") ''
505505+ ghc-settings-edit "$settingsFile" \
506506+ "otool command" "${toolPath "otool" installCC}" \
507507+ "install_name_tool command" "${toolPath "install_name_tool" installCC}"
508508+ ''
509509+ + lib.optionalString useLLVM ''
510510+ ghc-settings-edit "$settingsFile" \
511511+ "LLVM llc command" "${lib.getBin llvmPackages.llvm}/bin/llc" \
512512+ "LLVM opt command" "${lib.getBin llvmPackages.llvm}/bin/opt"
513513+ ''
514514+ + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
515515+ ghc-settings-edit "$settingsFile" \
516516+ "LLVM clang command" "${
517517+ # See comment for CLANG in preConfigure
518518+ if installCC.isClang
519519+ then toolPath "clang" installCC
520520+ else "${llvmPackages.clang}/bin/${llvmPackages.clang.targetPrefix}clang"
521521+ }"
522522+ ''
523523+ + ''
524524+405525 # Install the bash completion file.
406526 install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
407527 '';
···427547 guibou
428548 ] ++ lib.teams.haskell.members;
429549 timeout = 24 * 3600;
430430- inherit (ghc.meta) license platforms;
550550+ platforms = lib.platforms.all;
551551+ inherit (bootPkgs.ghc.meta) license;
431552 };
432553433554} // lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
+162-34
pkgs/development/compilers/ghc/common-hadrian.nix
···1212, stdenv
1313, pkgsBuildTarget
1414, pkgsHostTarget
1515+, buildPackages
1516, targetPackages
1617, fetchpatch
1718···5859, # If enabled, use -fPIC when compiling static libs.
5960 enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
60616161-, enableProfiledLibs ? true
6262+ # Exceeds Hydra output limit (at the time of writing ~3GB) when cross compiled to riscv64.
6363+ # A riscv64 cross-compiler fits into the limit comfortably.
6464+, enableProfiledLibs ? !stdenv.hostPlatform.isRiscV64
62656366, # Whether to build dynamic libs for the standard library (on the target
6467 # platform). Static libs are always built.
6568 enableShared ? with stdenv.targetPlatform; !isWindows && !useiOSPrebuilt && !isStatic && !isGhcjs
66696770, # Whether to build terminfo.
7171+ # FIXME(@sternenseemann): This actually doesn't influence what hadrian does,
7272+ # just what buildInputs etc. looks like. It would be best if we could actually
7373+ # tell it what to do like it was possible with make.
6874 enableTerminfo ? !(stdenv.targetPlatform.isWindows
6969- || stdenv.targetPlatform.isGhcjs)
7575+ || stdenv.targetPlatform.isGhcjs
7676+ # terminfo can't be built for cross
7777+ || (stdenv.buildPlatform != stdenv.hostPlatform)
7878+ || (stdenv.hostPlatform != stdenv.targetPlatform))
70797180, # Libdw.c only supports x86_64, i686 and s390x as of 2022-08-04
7281 enableDwarf ? (stdenv.targetPlatform.isx86 ||
···117126 -- no way to set this via the command line
118127 finalStage :: Stage
119128 finalStage = ${
120120- # Always build the stage 2 compiler if possible. Note we can currently
121121- # assume hostPlatform == buildPlatform.
122122- # TODO(@sternenseemann): improve this condition when we can cross-compile GHC
129129+ # Always build the stage 2 compiler if possible.
130130+ # TODO(@sternensemann): unify condition with make-built GHCs
123131 if stdenv.hostPlatform.canExecute stdenv.targetPlatform
124132 then "Stage2" # native compiler or “native” cross e.g. pkgsStatic
125133 else "Stage1" # cross compiler
···178186 hash = "sha256-MpvTmFFsNiPDoOp9BhZyWeapeibQ77zgEV+xzZ1UAXs=";
179187 })
180188 ]
189189+ ++ lib.optionals (lib.versionAtLeast version "9.6" && lib.versionOlder version "9.8") [
190190+ # Fix unlit being installed under a different name than is used in the
191191+ # settings file: https://gitlab.haskell.org/ghc/ghc/-/issues/23317
192192+ (fetchpatch {
193193+ name = "ghc-9.6-fix-unlit-path.patch";
194194+ url = "https://gitlab.haskell.org/ghc/ghc/-/commit/8fde4ac84ec7b1ead238cb158bbef48555d12af9.patch";
195195+ hash = "sha256-3+CyRBpebEZi8YpS22SsdGQHqi0drR7cCKPtKbR3zyE=";
196196+ })
197197+ ]
181198 ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
182199 # Prevent the paths module from emitting symbols that we don't use
183200 # when building with separate outputs.
···222239, # Whether to disable the large address space allocator
223240 # necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
224241 disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
242242+243243+, # Whether to build an unregisterised version of GHC.
244244+ # GHC will normally auto-detect whether it can do a registered build, but this
245245+ # option will force it to do an unregistered build when set to true.
246246+ # See https://gitlab.haskell.org/ghc/ghc/-/wikis/building/unregisterised
247247+ enableUnregisterised ? false
225248}:
226249227250assert !enableNativeBignum -> gmp != null;
228251252252+# GHC does not support building when all 3 platforms are different.
253253+assert stdenv.buildPlatform == stdenv.hostPlatform || stdenv.hostPlatform == stdenv.targetPlatform;
254254+255255+# It is currently impossible to cross-compile GHC with Hadrian.
256256+assert stdenv.buildPlatform == stdenv.hostPlatform;
257257+229258let
230259 inherit (stdenv) buildPlatform hostPlatform targetPlatform;
231231-232232- inherit (bootPkgs) ghc;
233260234261 # TODO(@Ericson2314) Make unconditional
235262 targetPrefix = lib.optionalString
···265292 else pkgsBuildTarget.targetPackages.stdenv.cc)
266293 ] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm;
267294295295+ buildCC = buildPackages.stdenv.cc;
268296 targetCC = builtins.head toolsForTarget;
297297+ installCC =
298298+ if targetPlatform.isGhcjs
299299+ then pkgsHostTarget.emscripten
300300+ else pkgsHostTarget.targetPackages.stdenv.cc;
269301270302 # toolPath calculates the absolute path to the name tool associated with a
271303 # given `stdenv.cc` derivation, i.e. it picks the correct derivation to take
···276308 tools = {
277309 "cc" = cc;
278310 "c++" = cc;
279279- as = cc.bintools.bintools;
311311+ as = cc.bintools;
280312281281- ar = cc.bintools.bintools;
282282- ranlib = cc.bintools.bintools;
283283- nm = cc.bintools.bintools;
284284- readelf = cc.bintools.bintools;
313313+ ar = cc.bintools;
314314+ ranlib = cc.bintools;
315315+ nm = cc.bintools;
316316+ readelf = cc.bintools;
317317+ objdump = cc.bintools;
285318286319 ld = cc.bintools;
287320 "ld.gold" = cc.bintools;
···300333 if stdenv.targetPlatform.isDarwin
301334 then cc.bintools
302335 else cc.bintools.bintools;
336336+337337+ # clang is used as an assembler on darwin with the LLVM backend
338338+ clang = cc;
303339 }.${name};
304340 in
305341 "${tools}/bin/${tools.targetPrefix}${name}";
···316352 (lib.optionalString enableNativeBignum "-native-bignum")
317353 ];
318354319319-in
355355+ # These libraries are library dependencies of the standard libraries bundled
356356+ # by GHC (core libs) users will link their compiled artifacts again. Thus,
357357+ # they should be taken from targetPackages.
358358+ #
359359+ # We need to use pkgsHostTarget if we are cross compiling a native GHC compiler,
360360+ # though (when native compiling GHC, pkgsHostTarget == targetPackages):
361361+ #
362362+ # 1. targetPackages would be empty(-ish) in this situation since we can't
363363+ # execute cross compiled compilers in order to obtain the libraries
364364+ # that would be in targetPackages.
365365+ # 2. pkgsHostTarget is fine to use since hostPlatform == targetPlatform in this
366366+ # situation.
367367+ # 3. The core libs used by the final GHC (stage 2) for user artifacts are also
368368+ # used to build stage 2 GHC itself, i.e. the core libs are both host and
369369+ # target.
370370+ targetLibs = {
371371+ inherit
372372+ (if hostPlatform != targetPlatform then targetPackages else pkgsHostTarget)
373373+ elfutils
374374+ gmp
375375+ libffi
376376+ ncurses;
377377+ };
320378321321-# C compiler, bintools and LLVM are used at build time, but will also leak into
322322-# the resulting GHC's settings file and used at runtime. This means that we are
323323-# currently only able to build GHC if hostPlatform == buildPlatform.
324324-assert !targetPlatform.isGhcjs -> targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
325325-assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
326326-assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
379379+ # Our Cabal compiler name
380380+ haskellCompilerName = "ghc-${version}";
381381+382382+in
327383328384stdenv.mkDerivation ({
329385 pname = "${targetPrefix}ghc${variantSuffix}";
···346402 for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
347403 export "''${env#TARGET_}=''${!env}"
348404 done
405405+ # No need for absolute paths since these tools only need to work during the build
406406+ export CC_STAGE0="$CC_FOR_BUILD"
407407+ export LD_STAGE0="$LD_FOR_BUILD"
408408+ export AR_STAGE0="$AR_FOR_BUILD"
409409+410410+ # Stage0 (build->build) which builds stage 1
411411+ export GHC="${bootPkgs.ghc}/bin/ghc"
349412 # GHC is a bit confused on its cross terminology, as these would normally be
350413 # the *host* tools.
351414 export CC="${toolPath "cc" targetCC}"
···358421 export RANLIB="${toolPath "ranlib" targetCC}"
359422 export READELF="${toolPath "readelf" targetCC}"
360423 export STRIP="${toolPath "strip" targetCC}"
424424+ export OBJDUMP="${toolPath "objdump" targetCC}"
361425 '' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") ''
362426 export OTOOL="${toolPath "otool" targetCC}"
363427 export INSTALL_NAME_TOOL="${toolPath "install_name_tool" targetCC}"
···366430 export OPT="${lib.getBin buildTargetLlvmPackages.llvm}/bin/opt"
367431 '' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
368432 # LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
369369- export CLANG="${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
433433+ # The executable we specify via $CLANG is used as an assembler (exclusively, it seems, but this isn't
434434+ # clarified in any user facing documentation). As such, it'll be called on assembly produced by $CC
435435+ # which usually comes from the darwin stdenv. To prevent a situation where $CLANG doesn't understand
436436+ # the assembly it is given, we need to make sure that it matches the LLVM version of $CC if possible.
437437+ # It is unclear (at the time of writing 2024-09-01) whether $CC should match the LLVM version we use
438438+ # for llc and opt which would require using a custom darwin stdenv for targetCC.
439439+ export CLANG="${
440440+ if targetCC.isClang
441441+ then toolPath "clang" targetCC
442442+ else "${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
443443+ }"
370444 '' +
371445 lib.optionalString (stdenv.hostPlatform.isLinux && hostPlatform.libc == "glibc") ''
372446 export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"
···433507 # `--with` flags for libraries needed for RTS linker
434508 configureFlags = [
435509 "--datadir=$doc/share/doc/ghc"
436436- "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
510510+ ] ++ lib.optionals enableTerminfo [
511511+ "--with-curses-includes=${lib.getDev targetLibs.ncurses}/include"
512512+ "--with-curses-libraries=${lib.getLib targetLibs.ncurses}/lib"
437513 ] ++ lib.optionals (libffi != null && !targetPlatform.isGhcjs) [
438514 "--with-system-libffi"
439439- "--with-ffi-includes=${targetPackages.libffi.dev}/include"
440440- "--with-ffi-libraries=${targetPackages.libffi.out}/lib"
515515+ "--with-ffi-includes=${targetLibs.libffi.dev}/include"
516516+ "--with-ffi-libraries=${targetLibs.libffi.out}/lib"
441517 ] ++ lib.optionals (targetPlatform == hostPlatform && !enableNativeBignum) [
442442- "--with-gmp-includes=${targetPackages.gmp.dev}/include"
443443- "--with-gmp-libraries=${targetPackages.gmp.out}/lib"
518518+ "--with-gmp-includes=${targetLibs.gmp.dev}/include"
519519+ "--with-gmp-libraries=${targetLibs.gmp.out}/lib"
444520 ] ++ lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
445521 "--with-iconv-includes=${libiconv}/include"
446522 "--with-iconv-libraries=${libiconv}/lib"
···454530 "--disable-large-address-space"
455531 ] ++ lib.optionals enableDwarf [
456532 "--enable-dwarf-unwind"
457457- "--with-libdw-includes=${lib.getDev targetPackages.elfutils}/include"
458458- "--with-libdw-libraries=${lib.getLib targetPackages.elfutils}/lib"
533533+ "--with-libdw-includes=${lib.getDev targetLibs.elfutils}/include"
534534+ "--with-libdw-libraries=${lib.getLib targetLibs.elfutils}/lib"
459535 ] ++ lib.optionals targetPlatform.isDarwin [
460536 # Darwin uses llvm-ar. GHC will try to use `-L` with `ar` when it is `llvm-ar`
461537 # but it doesn’t currently work because Cabal never uses `-L` on Darwin. See:
462538 # https://gitlab.haskell.org/ghc/ghc/-/issues/23188
463539 # https://github.com/haskell/cabal/issues/8882
464540 "fp_cv_prog_ar_supports_dash_l=no"
541541+ ] ++ lib.optionals enableUnregisterised [
542542+ "--enable-unregisterised"
465543 ];
466544467545 # Make sure we never relax`$PATH` and hooks support for compatibility.
···471549 dontAddExtraLibs = true;
472550473551 nativeBuildInputs = [
474474- perl ghc hadrian bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
552552+ perl hadrian bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
475553 # autoconf and friends are necessary for hadrian to create the bindist
476554 autoconf automake m4
477555 # Python is used in a few scripts invoked by hadrian to generate e.g. rts headers.
478556 python3
557557+ # Tool used to update GHC's settings file in postInstall
558558+ bootPkgs.ghc-settings-edit
479559 ] ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
480560 autoSignDarwinBinariesHook
481561 ] ++ lib.optionals enableDocs [
···484564485565 # For building runtime libs
486566 depsBuildTarget = toolsForTarget;
567567+ # Everything the stage0 compiler needs to build stage1: CC, bintools, extra libs.
568568+ # See also GHC, {CC,LD,AR}_STAGE0 in preConfigure.
569569+ depsBuildBuild = [
570570+ # N.B. We do not declare bootPkgs.ghc in any of the stdenv.mkDerivation
571571+ # dependency lists to prevent the bintools setup hook from adding ghc's
572572+ # lib directory to the linker flags. Instead we tell configure about it
573573+ # via the GHC environment variable.
574574+ buildCC
575575+ # stage0 builds terminfo unconditionally, so we always need ncurses
576576+ ncurses
577577+ ];
487578488488- buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
579579+ # Prevent stage0 ghc from leaking into the final result. This was an issue
580580+ # with GHC 9.6.
581581+ disallowedReferences = [
582582+ bootPkgs.ghc
583583+ ];
584584+585585+ buildInputs = [ bash ] ++ (libDeps hostPlatform);
489586490587 depsTargetTarget = map lib.getDev (libDeps targetPlatform);
491588 depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);
···553650 # leave bindist directory
554651 popd
555652653653+ settingsFile="$out/lib/${targetPrefix}${haskellCompilerName}/lib/settings"
654654+655655+ # Make the installed GHC use the host->target tools.
656656+ ghc-settings-edit "$settingsFile" \
657657+ "C compiler command" "${toolPath "cc" installCC}" \
658658+ "Haskell CPP command" "${toolPath "cc" installCC}" \
659659+ "C++ compiler command" "${toolPath "c++" installCC}" \
660660+ "ld command" "${toolPath "ld${lib.optionalString useLdGold ".gold"}" installCC}" \
661661+ "Merge objects command" "${toolPath "ld${lib.optionalString useLdGold ".gold"}" installCC}" \
662662+ "ar command" "${toolPath "ar" installCC}" \
663663+ "ranlib command" "${toolPath "ranlib" installCC}"
664664+ ''
665665+ + lib.optionalString (stdenv.targetPlatform.linker == "cctools") ''
666666+ ghc-settings-edit "$settingsFile" \
667667+ "otool command" "${toolPath "otool" installCC}" \
668668+ "install_name_tool command" "${toolPath "install_name_tool" installCC}"
669669+ ''
670670+ + lib.optionalString useLLVM ''
671671+ ghc-settings-edit "$settingsFile" \
672672+ "LLVM llc command" "${lib.getBin llvmPackages.llvm}/bin/llc" \
673673+ "LLVM opt command" "${lib.getBin llvmPackages.llvm}/bin/opt"
674674+ ''
675675+ + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
676676+ ghc-settings-edit "$settingsFile" \
677677+ "LLVM clang command" "${
678678+ # See comment for CLANG in preConfigure
679679+ if installCC.isClang
680680+ then toolPath "clang" installCC
681681+ else "${llvmPackages.clang}/bin/${llvmPackages.clang.targetPrefix}clang"
682682+ }"
683683+ ''
684684+ + ''
685685+556686 # Install the bash completion file.
557687 install -Dm 644 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
558688 '';
559689560690 passthru = {
561561- inherit bootPkgs targetPrefix;
691691+ inherit bootPkgs targetPrefix haskellCompilerName;
562692563693 inherit llvmPackages;
564694 inherit enableShared;
565565-566566- # Our Cabal compiler name
567567- haskellCompilerName = "ghc-${version}";
568695569696 # Expose hadrian used for bootstrapping, for debugging purposes
570697 inherit hadrian;
···581708 guibou
582709 ] ++ lib.teams.haskell.members;
583710 timeout = 24 * 3600;
584584- inherit (ghc.meta) license platforms;
711711+ platforms = lib.platforms.all;
712712+ inherit (bootPkgs.ghc.meta) license;
585713 };
586714587715 dontStrip = targetPlatform.useAndroidPrebuilt || targetPlatform.isWasm;
···33, url ? "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz"
44}:
5566-{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
66+{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, buildPackages, targetPackages
7788# build-tools
99, bootPkgs
···3535, # If enabled, use -fPIC when compiling static libs.
3636 enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
37373838-, enableProfiledLibs ? true
3838+ # Exceeds Hydra output limit (at the time of writing ~3GB) when cross compiled to riscv64.
3939+ # A riscv64 cross-compiler fits into the limit comfortably.
4040+, enableProfiledLibs ? !stdenv.hostPlatform.isRiscV64
39414042, # Whether to build dynamic libs for the standard library (on the target
4143 # platform). Static libs are always built.
4244 enableShared ? with stdenv.targetPlatform; !isWindows && !useiOSPrebuilt && !isStatic
43454446, # Whether to build terminfo.
4545- enableTerminfo ? !stdenv.targetPlatform.isWindows
4747+ enableTerminfo ? !(stdenv.targetPlatform.isWindows
4848+ # terminfo can't be built for cross
4949+ || (stdenv.buildPlatform != stdenv.hostPlatform)
5050+ || (stdenv.hostPlatform != stdenv.targetPlatform))
46514752, # What flavour to build. An empty string indicates no
4853 # specific flavour and falls back to ghc default values.
···58635964, enableHaddockProgram ?
6065 # Disabled for cross; see note [HADDOCK_DOCS].
6161- (stdenv.targetPlatform == stdenv.hostPlatform)
6666+ (stdenv.buildPlatform == stdenv.hostPlatform && stdenv.targetPlatform == stdenv.hostPlatform)
62676368, # Whether to disable the large address space allocator
6469 # necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
6570 disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
7171+7272+, # Whether to build an unregisterised version of GHC.
7373+ # GHC will normally auto-detect whether it can do a registered build, but this
7474+ # option will force it to do an unregistered build when set to true.
7575+ # See https://gitlab.haskell.org/ghc/ghc/-/wikis/building/unregisterised
7676+ # Registerised RV64 compiler produces programs that segfault
7777+ # See https://gitlab.haskell.org/ghc/ghc/-/issues/23957
7878+ enableUnregisterised ? stdenv.hostPlatform.isRiscV64 || stdenv.targetPlatform.isRiscV64
6679}:
67806881assert !enableNativeBignum -> gmp != null;
69827083# Cross cannot currently build the `haddock` program for silly reasons,
7184# see note [HADDOCK_DOCS].
7272-assert (stdenv.targetPlatform != stdenv.hostPlatform) -> !enableHaddockProgram;
8585+assert (stdenv.buildPlatform != stdenv.hostPlatform || stdenv.targetPlatform != stdenv.hostPlatform) -> !enableHaddockProgram;
8686+8787+# GHC does not support building when all 3 platforms are different.
8888+assert stdenv.buildPlatform == stdenv.hostPlatform || stdenv.hostPlatform == stdenv.targetPlatform;
73897490let
7591 inherit (stdenv) buildPlatform hostPlatform targetPlatform;
7676-7777- inherit (bootPkgs) ghc;
78927993 # TODO(@Ericson2314) Make unconditional
8094 targetPrefix = lib.optionalString
···88102 endif
89103 BUILD_SPHINX_HTML = ${if enableDocs then "YES" else "NO"}
90104 BUILD_SPHINX_PDF = NO
105105+106106+ WITH_TERMINFO = ${if enableTerminfo then "YES" else "NO"}
91107 '' +
92108 # Note [HADDOCK_DOCS]:
93109 # Unfortunately currently `HADDOCK_DOCS` controls both whether the `haddock`
···134150 pkgsBuildTarget.targetPackages.stdenv.cc
135151 ] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm;
136152153153+ buildCC = buildPackages.stdenv.cc;
137154 targetCC = builtins.head toolsForTarget;
155155+ installCC = pkgsHostTarget.targetPackages.stdenv.cc;
138156139157 # toolPath calculates the absolute path to the name tool associated with a
140158 # given `stdenv.cc` derivation, i.e. it picks the correct derivation to take
···145163 tools = {
146164 "cc" = cc;
147165 "c++" = cc;
148148- as = cc.bintools.bintools;
166166+ as = cc.bintools;
149167150150- ar = cc.bintools.bintools;
151151- ranlib = cc.bintools.bintools;
152152- nm = cc.bintools.bintools;
153153- readelf = cc.bintools.bintools;
168168+ ar = cc.bintools;
169169+ ranlib = cc.bintools;
170170+ nm = cc.bintools;
171171+ readelf = cc.bintools;
172172+ objdump = cc.bintools;
154173155174 ld = cc.bintools;
156175 "ld.gold" = cc.bintools;
···169188 if stdenv.targetPlatform.isDarwin
170189 then cc.bintools
171190 else cc.bintools.bintools;
191191+192192+ # clang is used as an assembler on darwin with the LLVM backend
193193+ clang = cc;
172194 }.${name};
173195 in
174196 "${tools}/bin/${tools.targetPrefix}${name}";
···185207 (lib.optionalString enableNativeBignum "-native-bignum")
186208 ];
187209188188-in
210210+ # These libraries are library dependencies of the standard libraries bundled
211211+ # by GHC (core libs) users will link their compiled artifacts again. Thus,
212212+ # they should be taken from targetPackages.
213213+ #
214214+ # We need to use pkgsHostTarget if we are cross compiling a native GHC compiler,
215215+ # though (when native compiling GHC, pkgsHostTarget == targetPackages):
216216+ #
217217+ # 1. targetPackages would be empty(-ish) in this situation since we can't
218218+ # execute cross compiled compilers in order to obtain the libraries
219219+ # that would be in targetPackages.
220220+ # 2. pkgsHostTarget is fine to use since hostPlatform == targetPlatform in this
221221+ # situation.
222222+ # 3. The core libs used by the final GHC (stage 2) for user artifacts are also
223223+ # used to build stage 2 GHC itself, i.e. the core libs are both host and
224224+ # target.
225225+ targetLibs = {
226226+ inherit
227227+ (if hostPlatform != targetPlatform then targetPackages else pkgsHostTarget)
228228+ gmp
229229+ libffi
230230+ ncurses;
231231+ };
189232190190-# C compiler, bintools and LLVM are used at build time, but will also leak into
191191-# the resulting GHC's settings file and used at runtime. This means that we are
192192-# currently only able to build GHC if hostPlatform == buildPlatform.
193193-assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
194194-assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
195195-assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
233233+in
196234197235stdenv.mkDerivation (rec {
198236 pname = "${targetPrefix}ghc${variantSuffix}";
···282320 for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
283321 export "''${env#TARGET_}=''${!env}"
284322 done
323323+ # Stage0 (build->build) which builds stage 1
324324+ export GHC="${bootPkgs.ghc}/bin/ghc"
285325 # GHC is a bit confused on its cross terminology, as these would normally be
286326 # the *host* tools.
287327 export CC="${toolPath "cc" targetCC}"
···294334 export RANLIB="${toolPath "ranlib" targetCC}"
295335 export READELF="${toolPath "readelf" targetCC}"
296336 export STRIP="${toolPath "strip" targetCC}"
337337+ export OBJDUMP="${toolPath "objdump" targetCC}"
297338 '' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") ''
298339 export OTOOL="${toolPath "otool" targetCC}"
299340 export INSTALL_NAME_TOOL="${toolPath "install_name_tool" targetCC}"
···302343 export OPT="${lib.getBin buildTargetLlvmPackages.llvm}/bin/opt"
303344 '' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
304345 # LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
305305- export CLANG="${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
346346+ # The executable we specify via $CLANG is used as an assembler (exclusively, it seems, but this isn't
347347+ # clarified in any user facing documentation). As such, it'll be called on assembly produced by $CC
348348+ # which usually comes from the darwin stdenv. To prevent a situation where $CLANG doesn't understand
349349+ # the assembly it is given, we need to make sure that it matches the LLVM version of $CC if possible.
350350+ # It is unclear (at the time of writing 2024-09-01) whether $CC should match the LLVM version we use
351351+ # for llc and opt which would require using a custom darwin stdenv for targetCC.
352352+ export CLANG="${
353353+ if targetCC.isClang
354354+ then toolPath "clang" targetCC
355355+ else "${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
356356+ }"
306357 ''
307358 + ''
359359+ # No need for absolute paths since these tools only need to work during the build
360360+ export CC_STAGE0="$CC_FOR_BUILD"
361361+ export LD_STAGE0="$LD_FOR_BUILD"
362362+ export AR_STAGE0="$AR_FOR_BUILD"
363363+308364 echo -n "${buildMK}" > mk/build.mk
309365 ''
310366 + lib.optionalString (lib.versionOlder version "9.2" || lib.versionAtLeast version "9.4") ''
···346402 'MinBootGhcVersion="8.10"'
347403 '';
348404405405+ # Although it is usually correct to pass --host, we don't do that here because
406406+ # GHC's usage of build, host, and target is non-standard.
407407+ # See https://gitlab.haskell.org/ghc/ghc/-/wikis/building/cross-compiling
349408 # TODO(@Ericson2314): Always pass "--target" and always prefix.
350350- configurePlatforms = [ "build" "host" ]
351351- ++ lib.optional (targetPlatform != hostPlatform) "target";
409409+ configurePlatforms = [ "build" ]
410410+ ++ lib.optional (buildPlatform != hostPlatform || targetPlatform != hostPlatform) "target";
352411353412 # `--with` flags for libraries needed for RTS linker
354413 configureFlags = [
355414 "--datadir=$doc/share/doc/ghc"
356356- "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
415415+ ] ++ lib.optionals enableTerminfo [
416416+ "--with-curses-includes=${lib.getDev targetLibs.ncurses}/include"
417417+ "--with-curses-libraries=${lib.getLib targetLibs.ncurses}/lib"
357418 ] ++ lib.optionals (libffi != null) [
358419 "--with-system-libffi"
359359- "--with-ffi-includes=${targetPackages.libffi.dev}/include"
360360- "--with-ffi-libraries=${targetPackages.libffi.out}/lib"
420420+ "--with-ffi-includes=${targetLibs.libffi.dev}/include"
421421+ "--with-ffi-libraries=${targetLibs.libffi.out}/lib"
361422 ] ++ lib.optionals (targetPlatform == hostPlatform && !enableNativeBignum) [
362362- "--with-gmp-includes=${targetPackages.gmp.dev}/include"
363363- "--with-gmp-libraries=${targetPackages.gmp.out}/lib"
423423+ "--with-gmp-includes=${targetLibs.gmp.dev}/include"
424424+ "--with-gmp-libraries=${targetLibs.gmp.out}/lib"
364425 ] ++ lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
365426 "--with-iconv-includes=${libiconv}/include"
366427 "--with-iconv-libraries=${libiconv}/lib"
···372433 "CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
373434 ] ++ lib.optionals (disableLargeAddressSpace) [
374435 "--disable-large-address-space"
436436+ ] ++ lib.optionals enableUnregisterised [
437437+ "--enable-unregisterised"
375438 ];
376439377440 # Make sure we never relax`$PATH` and hooks support for compatibility.
···382445383446 nativeBuildInputs = [
384447 perl autoconf automake m4 python3
385385- ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
448448+ bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
449449+ bootPkgs.ghc-settings-edit
386450 ] ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
387451 autoSignDarwinBinariesHook
388452 ] ++ lib.optionals enableDocs [
···393457 xattr
394458 ];
395459460460+ # Everything the stage0 compiler needs to build stage1: CC, bintools, extra libs.
461461+ # See also GHC, {CC,LD,AR}_STAGE0 in preConfigure.
462462+ depsBuildBuild = [
463463+ # N.B. We do not declare bootPkgs.ghc in any of the stdenv.mkDerivation
464464+ # dependency lists to prevent the bintools setup hook from adding ghc's
465465+ # lib directory to the linker flags. Instead we tell configure about it
466466+ # via the GHC environment variable.
467467+ buildCC
468468+ # stage0 builds terminfo unconditionally, so we always need ncurses
469469+ ncurses
470470+ ];
396471 # For building runtime libs
397472 depsBuildTarget = toolsForTarget;
398473399399- buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
474474+ # Prevent stage0 ghc from leaking into the final result. This was an issue
475475+ # with GHC 9.6.
476476+ disallowedReferences = [
477477+ bootPkgs.ghc
478478+ ];
479479+480480+ buildInputs = [ bash ] ++ (libDeps hostPlatform);
400481401482 depsTargetTarget = map lib.getDev (libDeps targetPlatform);
402483 depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);
···423504 requiredSystemFeatures = [ "big-parallel" ];
424505425506 postInstall = ''
507507+ settingsFile="$out/lib/${targetPrefix}${passthru.haskellCompilerName}/settings"
508508+509509+ # Make the installed GHC use the host->target tools.
510510+ ghc-settings-edit "$settingsFile" \
511511+ "C compiler command" "${toolPath "cc" installCC}" \
512512+ "Haskell CPP command" "${toolPath "cc" installCC}" \
513513+ "C++ compiler command" "${toolPath "c++" installCC}" \
514514+ "ld command" "${toolPath "ld${lib.optionalString useLdGold ".gold"}" installCC}" \
515515+ "Merge objects command" "${toolPath "ld${lib.optionalString useLdGold ".gold"}" installCC}" \
516516+ "ar command" "${toolPath "ar" installCC}" \
517517+ "ranlib command" "${toolPath "ranlib" installCC}"
518518+ ''
519519+ + lib.optionalString (stdenv.targetPlatform.linker == "cctools") ''
520520+ ghc-settings-edit "$settingsFile" \
521521+ "otool command" "${toolPath "otool" installCC}" \
522522+ "install_name_tool command" "${toolPath "install_name_tool" installCC}"
523523+ ''
524524+ + lib.optionalString useLLVM ''
525525+ ghc-settings-edit "$settingsFile" \
526526+ "LLVM llc command" "${lib.getBin llvmPackages.llvm}/bin/llc" \
527527+ "LLVM opt command" "${lib.getBin llvmPackages.llvm}/bin/opt"
528528+ ''
529529+ + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
530530+ ghc-settings-edit "$settingsFile" \
531531+ "LLVM clang command" "${
532532+ # See comment for CLANG in preConfigure
533533+ if installCC.isClang
534534+ then toolPath "clang" installCC
535535+ else "${llvmPackages.clang}/bin/${llvmPackages.clang.targetPrefix}clang"
536536+ }"
537537+ ''
538538+ + ''
539539+426540 # Install the bash completion file.
427541 install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
428542 '';
···448562 guibou
449563 ] ++ lib.teams.haskell.members;
450564 timeout = 24 * 3600;
451451- inherit (ghc.meta) license platforms;
565565+ platforms = lib.platforms.all;
566566+ inherit (bootPkgs.ghc.meta) license;
452567 };
453568454569} // lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
···8383 with-utf8 = addExtraLibrary pkgs.libiconv super.with-utf8;
8484 with-utf8_1_1_0_0 = addExtraLibrary pkgs.libiconv super.with-utf8_1_1_0_0;
85858686- # the system-fileio tests use canonicalizePath, which fails in the sandbox
8787- system-fileio = dontCheck super.system-fileio;
8888-8986 git-annex = overrideCabal (drv: {
9087 # We can't use testFlags since git-annex side steps the Cabal test mechanism
9188 preCheck = drv.preCheck or "" + ''
···158158 - amqp-conduit # failure in job https://hydra.nixos.org/build/233228080 at 2023-09-02
159159 - amqp-worker # failure in job https://hydra.nixos.org/build/236675859 at 2023-10-04
160160 - analyze # failure in job https://hydra.nixos.org/build/233251441 at 2023-09-02
161161+ - anansi # failure in job https://hydra.nixos.org/build/273451545 at 2024-10-01
161162 - anansi-pandoc # failure in job https://hydra.nixos.org/build/233252389 at 2023-09-02
162163 - android-activity # failure in job https://hydra.nixos.org/build/233203400 at 2023-09-02
163164 - android # failure in job https://hydra.nixos.org/build/233222148 at 2023-09-02
···611612 - cabal2ebuild # failure in job https://hydra.nixos.org/build/233221248 at 2023-09-02
612613 - cabal2ghci # failure in job https://hydra.nixos.org/build/233233018 at 2023-09-02
613614 - cabal2json # failure in job https://hydra.nixos.org/build/233196099 at 2023-09-02
615615+ - cabal-add # failure in job https://hydra.nixos.org/build/273461296 at 2024-10-01
614616 - cabal-audit # failure in job https://hydra.nixos.org/build/233193414 at 2023-09-02
615617 - cabal-auto-expose # failure in job https://hydra.nixos.org/build/233195440 at 2023-09-02
616618 - cabal-build-programs # failure in job https://hydra.nixos.org/build/257091363 at 2024-04-27
···799801 - clanki # failure in job https://hydra.nixos.org/build/233196970 at 2023-09-02
800802 - clarifai # failure in job https://hydra.nixos.org/build/233229480 at 2023-09-02
801803 - CLASE # failure in job https://hydra.nixos.org/build/233234459 at 2023-09-02
802802- - clash-prelude # failure in job https://hydra.nixos.org/build/233252128 at 2023-09-02
804804+ - clashilator # failure in job https://hydra.nixos.org/build/273442437 at 2024-10-01
805805+ - clash-multisignal # failure in job https://hydra.nixos.org/build/273463331 at 2024-10-01
806806+ - clash-prelude-quickcheck # failure in job https://hydra.nixos.org/build/273453747 at 2024-10-01
803807 - Clash-Royale-Hack-Cheats # failure in job https://hydra.nixos.org/build/233216034 at 2023-09-02
808808+ - clash-systemverilog # failure in job https://hydra.nixos.org/build/273453889 at 2024-10-01
809809+ - clash-verilog # failure in job https://hydra.nixos.org/build/273466517 at 2024-10-01
810810+ - clash-vhdl # failure in job https://hydra.nixos.org/build/273460098 at 2024-10-01
804811 - ClasshSS # failure in job https://hydra.nixos.org/build/255688076 at 2024-04-16
805812 - ClassLaws # failure in job https://hydra.nixos.org/build/233243019 at 2023-09-02
806813 - classy-effects-base # failure in updateAutotoolsGnuConfigScriptsPhase in job https://hydra.nixos.org/build/237233636 at 2023-10-21
···13191326 - dijkstra-simple # failure in job https://hydra.nixos.org/build/233218373 at 2023-09-02
13201327 - DimensionalHash # failure in job https://hydra.nixos.org/build/233230945 at 2023-09-02
13211328 - dino # failure in job https://hydra.nixos.org/build/252725815 at 2024-03-16
13221322- - diohsc # failure in job https://hydra.nixos.org/build/259625302 at 2024-05-15
13231329 - diophantine # failure in job https://hydra.nixos.org/build/233229215 at 2023-09-02
13241330 - diplomacy # failure in job https://hydra.nixos.org/build/233207895 at 2023-09-02
13251331 - direct-binary-files # failure in job https://hydra.nixos.org/build/233246387 at 2023-09-02
···13291335 - directory-ospath-streaming # failure in job https://hydra.nixos.org/build/233240003 at 2023-09-02
13301336 - direct-plugins # failure in job https://hydra.nixos.org/build/233211547 at 2023-09-02
13311337 - direm # failure in job https://hydra.nixos.org/build/233211496 at 2023-09-02
13381338+ - dirstream # failure in job https://hydra.nixos.org/build/273442606 at 2024-10-01
13321339 - disco # failure in job https://hydra.nixos.org/build/233212298 at 2023-09-02
13331340 - discordian-calendar # failure in job https://hydra.nixos.org/build/233218124 at 2023-09-02
13341341 - discord-types # failure in job https://hydra.nixos.org/build/233251778 at 2023-09-02
···27912798 - hs2ps # failure in job https://hydra.nixos.org/build/233258362 at 2023-09-02
27922799 - hsakamai # failure in job https://hydra.nixos.org/build/252722933 at 2024-03-16
27932800 - hsaml2 # failure in job https://hydra.nixos.org/build/233252618 at 2023-09-02
28012801+ - hs-asapo # failure in job https://hydra.nixos.org/build/273456994 at 2024-10-01
27942802 - hsautogui # failure in job https://hydra.nixos.org/build/253687662 at 2024-03-31
27952803 - hsay # failure in job https://hydra.nixos.org/build/233218925 at 2023-09-02
27962804 - hsbc # failure in job https://hydra.nixos.org/build/233206310 at 2023-09-02
···48094817 - proof-assistant-bot # failure in job https://hydra.nixos.org/build/234974688 at 2023-09-13
48104818 - proof-combinators # failure in job https://hydra.nixos.org/build/233210521 at 2023-09-02
48114819 - PropaFP # failure in job https://hydra.nixos.org/build/233206496 at 2023-09-02
48204820+ - propeller # failure in job https://hydra.nixos.org/build/273449652 at 2024-10-01
48124821 - Proper # failure in job https://hydra.nixos.org/build/233194417 at 2023-09-02
48134822 - properties # failure in job https://hydra.nixos.org/build/233240862 at 2023-09-02
48144823 - property-list # failure in job https://hydra.nixos.org/build/233254907 at 2023-09-02
···55005509 - sint # failure in job https://hydra.nixos.org/build/233238431 at 2023-09-02
55015510 - siphash # failure in job https://hydra.nixos.org/build/233199344 at 2023-09-02
55025511 - sitepipe # failure in job https://hydra.nixos.org/build/233201989 at 2023-09-02
55125512+ - si-timers # failure in job https://hydra.nixos.org/build/273467737 at 2024-10-01
55035513 - sixfiguregroup # failure in job https://hydra.nixos.org/build/233252141 at 2023-09-02
55045514 - sixty-five-oh-two # failure in job https://hydra.nixos.org/build/252714578 at 2024-03-16
55055515 - sized-grid # failure in job https://hydra.nixos.org/build/233239056 at 2023-09-02
···57835793 - strict-ghc-plugin # failure in job https://hydra.nixos.org/build/233246830 at 2023-09-02
57845794 - strict-impl-params # failure in job https://hydra.nixos.org/build/252732248 at 2024-03-16
57855795 - strictly # failure in job https://hydra.nixos.org/build/233197142 at 2023-09-02
57965796+ - strict-mvar # failure in job https://hydra.nixos.org/build/273459853 at 2024-10-01
57865797 - strict-optics # failure in job https://hydra.nixos.org/build/267983907 at 2024-07-31
57985798+ - strict-stm # failure in job https://hydra.nixos.org/build/273449297 at 2024-10-01
57875799 - strict-tuple-lens # failure in job https://hydra.nixos.org/build/233194548 at 2023-09-02
57885800 - strict-writer # failure in job https://hydra.nixos.org/build/252725649 at 2024-03-16
57895801 - string-class # failure in job https://hydra.nixos.org/build/233230041 at 2023-09-02
···58885900 - system-command # failure in job https://hydra.nixos.org/build/233239356 at 2023-09-02
58895901 - systemd-ntfy # failure in job https://hydra.nixos.org/build/236686880 at 2023-10-04
58905902 - system-extra # failure in job https://hydra.nixos.org/build/233203137 at 2023-09-02
58915891- - system-fileio # failure in job https://hydra.nixos.org/build/252731084 at 2024-03-16
58925903 - system-inotify # failure in job https://hydra.nixos.org/build/233206871 at 2023-09-02
58935904 - system-lifted # failure in job https://hydra.nixos.org/build/233236013 at 2023-09-02
58945905 - system-linux-proc # failure in job https://hydra.nixos.org/build/233209447 at 2023-09-02
···60956106 - tiger # failure in job https://hydra.nixos.org/build/233249333 at 2023-09-02
60966107 - TigerHash # failure in job https://hydra.nixos.org/build/233208162 at 2023-09-02
60976108 - tightrope # failure in job https://hydra.nixos.org/build/233215237 at 2023-09-02
61096109+ - tiktoken # failure in job https://hydra.nixos.org/build/273448419 at 2024-10-01
60986110 - tikzsd # failure in job https://hydra.nixos.org/build/233224431 at 2023-09-02
60996111 - timecalc # failure in job https://hydra.nixos.org/build/233207970 at 2023-09-02
61006112 - time-extras # failure in job https://hydra.nixos.org/build/233204030 at 2023-09-02
···62626274 - typed-process-effectful # failure in job https://hydra.nixos.org/build/236684332 at 2023-10-04
62636275 - typedquery # failure in job https://hydra.nixos.org/build/233215307 at 2023-09-02
62646276 - typed-session # failure in job https://hydra.nixos.org/build/270089993 at 2024-08-31
62776277+ - typed-session-state-algorithm # failure in job https://hydra.nixos.org/build/273462641 at 2024-10-01
62656278 - typed-spreadsheet # failure in job https://hydra.nixos.org/build/233248967 at 2023-09-02
62666279 - typed-time # failure in job https://hydra.nixos.org/build/233246930 at 2023-09-02
62676280 - typed-wire # failure in job https://hydra.nixos.org/build/233237626 at 2023-09-02
···63186331 - unboxed # failure in job https://hydra.nixos.org/build/233219555 at 2023-09-02
63196332 - unboxed-references # failure in job https://hydra.nixos.org/build/233192713 at 2023-09-02
63206333 - unbreak # failure in job https://hydra.nixos.org/build/233242560 at 2023-09-02
63346334+ - uncertain # failure in job https://hydra.nixos.org/build/273461304 at 2024-10-01
63216335 - unescaping-print # failure in job https://hydra.nixos.org/build/252736030 at 2024-03-16
63226336 - unfix-binders # failure in job https://hydra.nixos.org/build/233259262 at 2023-09-02
63236337 - unfoldable # failure in job https://hydra.nixos.org/build/252721990 at 2024-03-16
···11+ghc-settings-edit is a small tool for changing certain fields in the settings
22+file that is part of every GHC installation (usually located at
33+lib/ghc-$version/lib/settings or lib/ghc-$version/settings). This is sometimes
44+necessary because GHC's build process leaks the tools used at build time into
55+the final settings file. This is fine, as long as the build and host platform
66+of the GHC build is the same since it will be possible to execute the tools
77+used at build time at run time. In case we are cross compiling GHC itself,
88+the settings file needs to be changed so that the correct tools are used in the
99+final installation. The GHC build system itself doesn't allow for this due to
1010+its somewhat peculiar bootstrapping mechanism.
1111+1212+This tool was originally written by sternenseemann and is licensed under the MIT
1313+license (as is nixpkgs) as well as the BSD 3 Clause license since it incorporates
1414+some code from GHC. It is primarily intended for use in nixpkgs, so it should be
1515+considered unstable: No guarantees about the stability of its command line
1616+interface are made at this time.
1717+1818+> -- SPDX-License-Identifier: MIT AND BSD-3-Clause
1919+> {-# LANGUAGE LambdaCase #-}
2020+> module Main where
2121+2222+ghc-settings-edit requires no additional dependencies to the ones already
2323+required to bootstrap GHC. This means that it only depends on GHC and core
2424+libraries shipped with the compiler (base and containers). This property should
2525+be preserved going forward as to not needlessly complicate bootstrapping GHC
2626+in nixpkgs. Additionally, a wide range of library versions and thus GHC versions
2727+should be supported (via CPP if necessary).
2828+2929+> import Control.Monad (foldM)
3030+> import qualified Data.Map.Lazy as Map
3131+> import System.Environment (getArgs, getProgName)
3232+> import Text.Read (readEither)
3333+3434+Note that the containers dependency is needed to represent the contents of the
3535+settings file. In theory, [(String, String)] (think lookup) would suffice, but
3636+base doesn't provide any facilities for updating such lists. To avoid needlessly
3737+reinventing the wheel here, we depend on an extra core library.
3838+3939+> type SettingsMap = Map.Map String String
4040+4141+ghc-settings-edit accepts the following arguments:
4242+4343+- The path to the settings file which is edited in place.
4444+- For every field in the settings file to be updated, two arguments need to be
4545+ passed: the name of the field and its new value. Any number of these pairs
4646+ may be provided. If a field is missing from the given settings file,
4747+ it won't be added (see also below).
4848+4949+> usage :: String -> String
5050+> usage name = "Usage: " ++ name ++ " FILE [KEY NEWVAL [KEY2 NEWVAL2 ...]]"
5151+5252+The arguments and the contents of the settings file are fed into the performEdits
5353+function which implements the main logic of ghc-settings-edit (except IO).
5454+5555+> performEdits :: [String] -> String -> Either String String
5656+> performEdits editArgs settingsString = do
5757+5858+First, the settings file is parsed and read into the SettingsMap structure. For
5959+parsing, we can simply rely read, as GHC uses the familiar Read/Show format
6060+(plus some formatting) for storing its settings. This is the main reason
6161+ghc-settings-edit is written in Haskell: We don't need to roll our own parser.
6262+6363+> settingsMap <- Map.fromList <$> readEither settingsString
6464+6565+We also need to parse the remaining command line arguments (after the path)
6666+which means splitting them into pairs of arguments describing the individual
6767+edits. We use the chunkList utility function from GHC for this which is vendored
6868+below. Since it doesn't guarantee that all sublists have the exact length given,
6969+we'll have to check the length of the returned “pairs” later.
7070+7171+> let edits = chunkList 2 editArgs
7272+7373+Since each edit is a transformation of the SettingsMap, we use a fold to go
7474+through the edits. The Either monad allows us to bail out if one is malformed.
7575+The use of Map.adjust ensures that fields that aren't present in the original
7676+settings file aren't added since the corresponding GHC installation wouldn't
7777+understand them. Note that this is done silently which may be suboptimal:
7878+It could be better to fail.
7979+8080+> show . Map.toList <$> foldM applyEdit settingsMap edits
8181+> where
8282+> applyEdit :: SettingsMap -> [String] -> Either String SettingsMap
8383+> applyEdit m [key, newValue] = Right $ Map.adjust (const newValue) key m
8484+> applyEdit _ _ = Left "Uneven number of edit arguments provided"
8585+8686+main just wraps performEdits and takes care of reading from and writing to the
8787+given file.
8888+8989+> main :: IO ()
9090+> main =
9191+> getArgs >>= \case
9292+> (settingsFile:edits) -> do
9393+> orig <- readFile settingsFile
9494+> case performEdits edits orig of
9595+> Right edited -> writeFile settingsFile edited
9696+> Left errorMsg -> error errorMsg
9797+> _ -> do
9898+> name <- getProgName
9999+> error $ usage name
100100+101101+As mentioned, chunkList is taken from GHC, specifically GHC.Utils.Misc of GHC
102102+verson 9.8.2. We don't depend on the ghc library directly (which would be
103103+possible in theory) since there are no stability guarantees or deprecation
104104+windows for the ghc's public library.
105105+106106+> -- | Split a list into chunks of /n/ elements
107107+> chunkList :: Int -> [a] -> [[a]]
108108+> chunkList _ [] = []
109109+> chunkList n xs = as : chunkList n bs where (as,bs) = splitAt n xs
+2-2
pkgs/development/tools/misc/binutils/default.nix
···8484 # not need to know binutils' BINDIR at all. It's an absolute path
8585 # where libraries are stored.
8686 ./plugins-no-BINDIR.patch
8787- ] ++ lib.optionals buildPlatform.isDarwin [
8787+ ] ++ lib.optionals hostPlatform.isDarwin [
8888 # Note: Conditional to avoid Linux rebuilds on staging-next. Remove the conditional with the next update.
8989 # ld64 needs `-undefined dynamic_lookup` to link `libctf-nobfd.dylib`, but the Darwin
9090 # version detection in `libtool.m4` fails to detect the Darwin version correctly.
···122122 ++ lib.optionals targetPlatform.isVc4 [ flex ]
123123 ;
124124125125- buildInputs = [ zlib gettext ] ++ lib.optionals buildPlatform.isDarwin [ CoreServices ];
125125+ buildInputs = [ zlib gettext ] ++ lib.optionals hostPlatform.isDarwin [ CoreServices ];
126126127127 inherit noSysDirs;
128128
+2
pkgs/test/cross/default.nix
···146146 pkgs.pkgsCross.mips64el-linux-gnuabi64.stdenv
147147 pkgs.pkgsCross.mips64el-linux-gnuabin32.stdenv
148148 pkgs.pkgsCross.mingwW64.stdenv
149149+ # Uses the expression that is used by the most cross-compil_ed_ GHCs
150150+ pkgs.pkgsCross.riscv64.haskell.compiler.native-bignum.ghc948
149151150152 ] ++ lib.optionals (with pkgs.stdenv.buildPlatform; isx86_64 && isLinux) [
151153 # Musl-to-glibc cross on the same architecture tends to turn up
+94-83
pkgs/top-level/haskell-packages.nix
···11-{ buildPackages, pkgsBuildTarget, pkgs, newScope, stdenv }:
11+{ buildPackages, pkgsBuildBuild, pkgsBuildTarget, pkgs, newScope, stdenv }:
2233let
44 # These are attributes in compiler that support integer-simple.
···52525353 package-list = callPackage ../development/haskell-modules/package-list.nix {};
54545555- compiler = {
5555+ # Always get boot compilers from `pkgsBuildBuild`. The boot (stage0) compiler
5656+ # is used to build another compiler (stage1) that'll be used to build the
5757+ # final compiler (stage2) (except when building a cross-compiler). This means
5858+ # that stage1's host platform is the same as stage0: build. Consequently,
5959+ # stage0 needs to be build->build.
6060+ #
6161+ # Note that we use bb.haskell.packages.*. haskell.packages.*.ghc is similar to
6262+ # stdenv: The ghc comes from the previous package set, i.e. this predicate holds:
6363+ # `name: pkgs: pkgs.haskell.packages.${name}.ghc == pkgs.buildPackages.haskell.compiler.${name}.ghc`.
6464+ # This isn't problematic since pkgsBuildBuild.buildPackages is also build->build,
6565+ # just something to keep in mind.
6666+ compiler = let bb = pkgsBuildBuild.haskell; in {
5667 ghc865Binary = callPackage ../development/compilers/ghc/8.6.5-binary.nix {
5768 # Should be llvmPackages_6 which has been removed from nixpkgs
5869 llvmPackages = null;
···7384 ghc8107 = callPackage ../development/compilers/ghc/8.10.7.nix {
7485 bootPkgs =
7586 # the oldest ghc with aarch64-darwin support is 8.10.5
7676- if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
8787+ if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
7788 # to my (@a-m-joseph) knowledge there are no newer official binaries for this platform
7878- packages.ghc865Binary
8989+ bb.packages.ghc865Binary
7990 else
8080- packages.ghc8107Binary;
9191+ bb.packages.ghc8107Binary;
8192 inherit (buildPackages.python311Packages) sphinx; # a distutils issue with 3.12
8293 python3 = buildPackages.python311; # so that we don't have two of them
8394 # Need to use apple's patched xattr until
···91102 ghc902 = callPackage ../development/compilers/ghc/9.0.2.nix {
92103 bootPkgs =
93104 # the oldest ghc with aarch64-darwin support is 8.10.5
9494- if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
9595- packages.ghc810
105105+ if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
106106+ bb.packages.ghc810
96107 else
9797- packages.ghc8107Binary;
108108+ bb.packages.ghc8107Binary;
98109 inherit (buildPackages.python311Packages) sphinx; # a distutils issue with 3.12
99110 python3 = buildPackages.python311; # so that we don't have two of them
100111 inherit (buildPackages.darwin) autoSignDarwinBinariesHook xattr;
···104115 ghc90 = compiler.ghc902;
105116 ghc925 = callPackage ../development/compilers/ghc/9.2.5.nix {
106117 bootPkgs =
107107- if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
108108- packages.ghc810
118118+ if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
119119+ bb.packages.ghc810
109120 else
110110- packages.ghc8107Binary;
121121+ bb.packages.ghc8107Binary;
111122 inherit (buildPackages.python311Packages) sphinx; # a distutils issue with 3.12
112123 python3 = buildPackages.python311; # so that we don't have two of them
113124 # Need to use apple's patched xattr until
···119130 };
120131 ghc926 = callPackage ../development/compilers/ghc/9.2.6.nix {
121132 bootPkgs =
122122- if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
123123- packages.ghc810
133133+ if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
134134+ bb.packages.ghc810
124135 else
125125- packages.ghc8107Binary;
136136+ bb.packages.ghc8107Binary;
126137 inherit (buildPackages.python311Packages) sphinx; # a distutils issue with 3.12
127138 python3 = buildPackages.python311; # so that we don't have two of them
128139 # Need to use apple's patched xattr until
···134145 };
135146 ghc927 = callPackage ../development/compilers/ghc/9.2.7.nix {
136147 bootPkgs =
137137- if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
138138- packages.ghc810
148148+ if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
149149+ bb.packages.ghc810
139150 else
140140- packages.ghc8107Binary;
151151+ bb.packages.ghc8107Binary;
141152 inherit (buildPackages.python311Packages) sphinx; # a distutils issue with 3.12
142153 python3 = buildPackages.python311; # so that we don't have two of them
143154 # Need to use apple's patched xattr until
···149160 };
150161 ghc928 = callPackage ../development/compilers/ghc/9.2.8.nix {
151162 bootPkgs =
152152- if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
153153- packages.ghc810
163163+ if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
164164+ bb.packages.ghc810
154165 else
155155- packages.ghc8107Binary;
166166+ bb.packages.ghc8107Binary;
156167 inherit (buildPackages.python311Packages) sphinx; # a distutils issue with 3.12
157168 python3 = buildPackages.python311; # so that we don't have two of them
158169 # Need to use apple's patched xattr until
···170181 # Use 8.10 as a workaround where possible to keep bootstrap path short.
171182172183 # On ARM text won't build with GHC 8.10.*
173173- if stdenv.hostPlatform.isAarch then
184184+ if stdenv.buildPlatform.isAarch then
174185 # TODO(@sternenseemann): package bindist
175175- packages.ghc902
186186+ bb.packages.ghc902
176187 # No suitable bindists for powerpc64le
177177- else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
178178- packages.ghc902
188188+ else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
189189+ bb.packages.ghc902
179190 else
180180- packages.ghc8107Binary;
191191+ bb.packages.ghc8107Binary;
181192 inherit (buildPackages.python311Packages) sphinx; # a distutils issue with 3.12
182193 python3 = buildPackages.python311; # so that we don't have two of them
183194 # Need to use apple's patched xattr until
···195206 # Use 8.10 as a workaround where possible to keep bootstrap path short.
196207197208 # On ARM text won't build with GHC 8.10.*
198198- if stdenv.hostPlatform.isAarch then
209209+ if stdenv.buildPlatform.isAarch then
199210 # TODO(@sternenseemann): package bindist
200200- packages.ghc902
211211+ bb.packages.ghc902
201212 # No suitable bindists for powerpc64le
202202- else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
203203- packages.ghc902
213213+ else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
214214+ bb.packages.ghc902
204215 else
205205- packages.ghc8107Binary;
216216+ bb.packages.ghc8107Binary;
206217 inherit (buildPackages.python311Packages) sphinx; # a distutils issue with 3.12
207218 python3 = buildPackages.python311; # so that we don't have two of them
208219 # Need to use apple's patched xattr until
···220231 # Use 8.10 as a workaround where possible to keep bootstrap path short.
221232222233 # On ARM text won't build with GHC 8.10.*
223223- if stdenv.hostPlatform.isAarch then
234234+ if stdenv.buildPlatform.isAarch then
224235 # TODO(@sternenseemann): package bindist
225225- packages.ghc902
236236+ bb.packages.ghc902
226237 # No suitable bindists for powerpc64le
227227- else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
228228- packages.ghc902
238238+ else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
239239+ bb.packages.ghc902
229240 else
230230- packages.ghc8107Binary;
241241+ bb.packages.ghc8107Binary;
231242 inherit (buildPackages.python3Packages) sphinx;
232243 # Need to use apple's patched xattr until
233244 # https://github.com/xattr/xattr/issues/44 and
···244255 # Use 8.10 as a workaround where possible to keep bootstrap path short.
245256246257 # On ARM text won't build with GHC 8.10.*
247247- if stdenv.hostPlatform.isAarch then
258258+ if stdenv.buildPlatform.isAarch then
248259 # TODO(@sternenseemann): package bindist
249249- packages.ghc902
260260+ bb.packages.ghc902
250261 # No suitable bindists for powerpc64le
251251- else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
252252- packages.ghc902
262262+ else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
263263+ bb.packages.ghc902
253264 else
254254- packages.ghc8107Binary;
265265+ bb.packages.ghc8107Binary;
255266 inherit (buildPackages.python3Packages) sphinx;
256267 # Need to use apple's patched xattr until
257268 # https://github.com/xattr/xattr/issues/44 and
···265276 ghc963 = callPackage ../development/compilers/ghc/9.6.3.nix {
266277 bootPkgs =
267278 # For GHC 9.2 no armv7l bindists are available.
268268- if stdenv.hostPlatform.isAarch32 then
269269- packages.ghc928
270270- else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
271271- packages.ghc928
279279+ if stdenv.buildPlatform.isAarch32 then
280280+ bb.packages.ghc928
281281+ else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
282282+ bb.packages.ghc928
272283 else
273273- packages.ghc924Binary;
284284+ bb.packages.ghc924Binary;
274285 inherit (buildPackages.python3Packages) sphinx;
275286 # Need to use apple's patched xattr until
276287 # https://github.com/xattr/xattr/issues/44 and
···283294 ghc964 = callPackage ../development/compilers/ghc/9.6.4.nix {
284295 bootPkgs =
285296 # For GHC 9.2 no armv7l bindists are available.
286286- if stdenv.hostPlatform.isAarch32 then
287287- packages.ghc928
288288- else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
289289- packages.ghc928
297297+ if stdenv.buildPlatform.isAarch32 then
298298+ bb.packages.ghc928
299299+ else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
300300+ bb.packages.ghc928
290301 else
291291- packages.ghc924Binary;
302302+ bb.packages.ghc924Binary;
292303 inherit (buildPackages.python3Packages) sphinx;
293304 # Need to use apple's patched xattr until
294305 # https://github.com/xattr/xattr/issues/44 and
···301312 ghc965 = callPackage ../development/compilers/ghc/9.6.5.nix {
302313 bootPkgs =
303314 # For GHC 9.2 no armv7l bindists are available.
304304- if stdenv.hostPlatform.isAarch32 then
305305- packages.ghc928
306306- else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
307307- packages.ghc928
315315+ if stdenv.buildPlatform.isAarch32 then
316316+ bb.packages.ghc928
317317+ else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
318318+ bb.packages.ghc928
308319 else
309309- packages.ghc924Binary;
320320+ bb.packages.ghc924Binary;
310321 inherit (buildPackages.python3Packages) sphinx;
311322 # Need to use apple's patched xattr until
312323 # https://github.com/xattr/xattr/issues/44 and
···319330 ghc966 = callPackage ../development/compilers/ghc/9.6.6.nix {
320331 bootPkgs =
321332 # For GHC 9.2 no armv7l bindists are available.
322322- if stdenv.hostPlatform.isAarch32 then
323323- packages.ghc928
324324- else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
325325- packages.ghc928
333333+ if stdenv.buildPlatform.isAarch32 then
334334+ bb.packages.ghc928
335335+ else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
336336+ bb.packages.ghc928
326337 else
327327- packages.ghc924Binary;
338338+ bb.packages.ghc924Binary;
328339 inherit (buildPackages.python3Packages) sphinx;
329340 # Need to use apple's patched xattr until
330341 # https://github.com/xattr/xattr/issues/44 and
···338349 ghc981 = callPackage ../development/compilers/ghc/9.8.1.nix {
339350 bootPkgs =
340351 # For GHC 9.6 no armv7l bindists are available.
341341- if stdenv.hostPlatform.isAarch32 then
342342- packages.ghc963
343343- else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
344344- packages.ghc963
352352+ if stdenv.buildPlatform.isAarch32 then
353353+ bb.packages.ghc963
354354+ else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
355355+ bb.packages.ghc963
345356 else
346346- packages.ghc963Binary;
357357+ bb.packages.ghc963Binary;
347358 inherit (buildPackages.python3Packages) sphinx;
348359 # Need to use apple's patched xattr until
349360 # https://github.com/xattr/xattr/issues/44 and
···356367 ghc982 = callPackage ../development/compilers/ghc/9.8.2.nix {
357368 bootPkgs =
358369 # For GHC 9.6 no armv7l bindists are available.
359359- if stdenv.hostPlatform.isAarch32 then
360360- packages.ghc963
361361- else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
362362- packages.ghc963
370370+ if stdenv.buildPlatform.isAarch32 then
371371+ bb.packages.ghc963
372372+ else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
373373+ bb.packages.ghc963
363374 else
364364- packages.ghc963Binary;
375375+ bb.packages.ghc963Binary;
365376 inherit (buildPackages.python3Packages) sphinx;
366377 # Need to use apple's patched xattr until
367378 # https://github.com/xattr/xattr/issues/44 and
···375386 ghc9101 = callPackage ../development/compilers/ghc/9.10.1.nix {
376387 bootPkgs =
377388 # For GHC 9.6 no armv7l bindists are available.
378378- if stdenv.hostPlatform.isAarch32 then
379379- packages.ghc963
380380- else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
381381- packages.ghc963
382382- else if stdenv.hostPlatform.isDarwin then
389389+ if stdenv.buildPlatform.isAarch32 then
390390+ bb.packages.ghc963
391391+ else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
392392+ bb.packages.ghc963
393393+ else if stdenv.buildPlatform.isDarwin then
383394 # it seems like the GHC 9.6.* bindists are built with a different
384395 # toolchain than we are using (which I'm guessing from the fact
385396 # that 9.6.4 bindists pass linker flags our ld doesn't support).
386397 # With both 9.6.3 and 9.6.4 binary it is impossible to link against
387398 # the clock package (probably a hsc2hs problem).
388388- packages.ghc963
399399+ bb.packages.ghc963
389400 else
390390- packages.ghc963Binary;
401401+ bb.packages.ghc963Binary;
391402 inherit (buildPackages.python3Packages) sphinx;
392403 # Need to use apple's patched xattr until
393404 # https://github.com/xattr/xattr/issues/44 and
···401412 ghcHEAD = callPackage ../development/compilers/ghc/head.nix {
402413 bootPkgs =
403414 # For GHC 9.6 no armv7l bindists are available.
404404- if stdenv.hostPlatform.isAarch32 then
405405- packages.ghc963
406406- else if stdenv.hostPlatform.isPower64 && stdenv.hostPlatform.isLittleEndian then
407407- packages.ghc963
415415+ if stdenv.buildPlatform.isAarch32 then
416416+ bb.packages.ghc963
417417+ else if stdenv.buildPlatform.isPower64 && stdenv.buildPlatform.isLittleEndian then
418418+ bb.packages.ghc963
408419 else
409409- packages.ghc963Binary;
420420+ bb.packages.ghc963Binary;
410421 inherit (buildPackages.python3Packages) sphinx;
411422 # Need to use apple's patched xattr until
412423 # https://github.com/xattr/xattr/issues/44 and
···419430420431 ghcjs = compiler.ghcjs810;
421432 ghcjs810 = callPackage ../development/compilers/ghcjs/8.10 {
422422- bootPkgs = packages.ghc810;
433433+ bootPkgs = bb.packages.ghc810;
423434 ghcjsSrcJson = ../development/compilers/ghcjs/8.10/git.json;
424435 stage0 = ../development/compilers/ghcjs/8.10/stage0.nix;
425436 };
+74-47
pkgs/top-level/release-haskell.nix
···327327 lambdabot
328328 lhs2tex
329329 madlang
330330- mailctl
331330 matterhorn
332331 mkjson
333332 mueval
···394393 };
395394396395 # GHCs linked to musl.
397397- pkgsMusl.haskell.compiler = lib.recursiveUpdate
398398- (packagePlatforms pkgs.pkgsMusl.haskell.compiler)
399399- {
400400- # remove musl ghc865Binary since it is known to be broken and
401401- # causes an evaluation error on darwin.
402402- ghc865Binary = {};
403403-404404- ghcjs = {};
405405- ghcjs810 = {};
406406- };
407407-408408- # Get some cache going for MUSL-enabled GHC.
409409- pkgsMusl.haskellPackages =
396396+ pkgsMusl =
410397 removePlatforms
411398 [
412399 # pkgsMusl is compiled natively with musl. It is not
···420407 "aarch64-darwin"
421408 ]
422409 {
423423- inherit (packagePlatforms pkgs.pkgsMusl.haskellPackages)
424424- hello
425425- lens
426426- random
427427- ;
410410+ haskell.compiler = lib.recursiveUpdate
411411+ (packagePlatforms pkgs.pkgsMusl.haskell.compiler)
412412+ {
413413+ # remove musl ghc865Binary since it is known to be broken and
414414+ # causes an evaluation error on darwin.
415415+ ghc865Binary = {};
416416+417417+ ghcjs = {};
418418+ ghcjs810 = {};
419419+ };
420420+421421+ # Get some cache going for MUSL-enabled GHC.
422422+ haskellPackages =
423423+ {
424424+ inherit (packagePlatforms pkgs.pkgsMusl.haskellPackages)
425425+ hello
426426+ lens
427427+ random
428428+ ;
429429+ };
428430 };
429431430432 # Test some statically linked packages to catch regressions
···473475 };
474476 };
475477476476- pkgsCross.ghcjs =
477477- removePlatforms
478478- [
479479- # Hydra output size of 3GB is exceeded
480480- "aarch64-linux"
481481- ]
482482- {
483483- haskellPackages = {
484484- inherit (packagePlatforms pkgs.pkgsCross.ghcjs.haskellPackages)
485485- ghc
486486- hello
487487- microlens
488488- ;
478478+ pkgsCross = {
479479+ ghcjs =
480480+ removePlatforms
481481+ [
482482+ # Hydra output size of 3GB is exceeded
483483+ "aarch64-linux"
484484+ ]
485485+ {
486486+ haskellPackages = {
487487+ inherit (packagePlatforms pkgs.pkgsCross.ghcjs.haskellPackages)
488488+ ghc
489489+ hello
490490+ microlens
491491+ ;
492492+ };
493493+494494+ haskell.packages.ghc98 = {
495495+ inherit (packagePlatforms pkgs.pkgsCross.ghcjs.haskell.packages.ghc98)
496496+ ghc
497497+ hello
498498+ microlens
499499+ ;
500500+ };
501501+502502+ haskell.packages.ghcHEAD = {
503503+ inherit (packagePlatforms pkgs.pkgsCross.ghcjs.haskell.packages.ghcHEAD)
504504+ ghc
505505+ hello
506506+ microlens
507507+ ;
508508+ };
489509 };
490510491491- haskell.packages.ghc98 = {
492492- inherit (packagePlatforms pkgs.pkgsCross.ghcjs.haskell.packages.ghc98)
493493- ghc
494494- hello
495495- microlens
511511+ riscv64 = {
512512+ # Cross compilation of GHC
513513+ haskell.compiler = {
514514+ inherit (packagePlatforms pkgs.pkgsCross.riscv64.haskell.compiler)
515515+ # Our oldest GHC which still uses its own expression. 8.10.7 can
516516+ # theoretically be used to chain bootstrap all GHCs on riscv64
517517+ # which doesn't have official bindists.
518518+ ghc8107
519519+ # Latest GHC we are able to cross-compile.
520520+ ghc948
496521 ;
497497- };
522522+ };
523523+ };
498524499499- haskell.packages.ghcHEAD = {
500500- inherit (packagePlatforms pkgs.pkgsCross.ghcjs.haskell.packages.ghcHEAD)
501501- ghc
502502- hello
503503- microlens
525525+ aarch64-multiplatform = {
526526+ # Cross compilation of GHC
527527+ haskell.compiler = {
528528+ inherit (packagePlatforms pkgs.pkgsCross.aarch64-multiplatform.haskell.compiler)
529529+ # Uses a separate expression and LLVM backend for aarch64.
530530+ ghc8107
531531+ # Latest GHC we are able to cross-compile. Uses NCG backend.
532532+ ghc948
504533 ;
505505- };
506534 };
535535+ };
536536+ };
507537 })
508538 (versionedCompilerJobs {
509539 # Packages which should be checked on more than the
···545575 compilerNames.ghc8107
546576 # Support ceased as of 2.5.0.0
547577 compilerNames.ghc902
548548- # No support yet (2024-05-12)
549549- compilerNames.ghc9101
550578 ] released;
551579 hoogle = lib.subtractLists [
552552- compilerNames.ghc9101
553580 ] released;
554581 hlint = lib.subtractLists [
555582 compilerNames.ghc902