|
232 | 232 | if targetPlatform.isGhcjs |
233 | 233 | then [ buildPackages.emscripten ] |
234 | 234 | else if hostPlatform == buildPlatform |
235 | | - then [ targetPackages.stdenv.cc ] ++ lib.optional useLLVM llvmPackages.llvm |
| 235 | + then [ targetPackages.stdenv.cc ] ++ lib.optionals useLLVM [llvmPackages.llvm llvmPackages.clang] |
236 | 236 | else assert targetPlatform == hostPlatform; # build != host == target |
237 | 237 | [ stdenv.cc ] ++ lib.optional useLLVM buildLlvmPackages.llvm; |
238 | 238 |
|
|
362 | 362 | # Sometimes we have to dispatch between the bintools wrapper and the unwrapped |
363 | 363 | # derivation for certain tools depending on the platform. |
364 | 364 | bintoolsFor = { |
365 | | - # GHC needs install_name_tool on all darwin platforms. On aarch64-darwin it is |
366 | | - # part of the bintools wrapper (due to codesigning requirements), but not on |
367 | | - # x86_64-darwin. |
368 | | - install_name_tool = |
369 | | - if stdenv.targetPlatform.isAarch64 |
370 | | - then targetCC.bintools |
371 | | - else targetCC.bintools.bintools; |
372 | | - # Same goes for strip. |
| 365 | + # GHC needs install_name_tool on all darwin platforms. |
| 366 | + install_name_tool = targetCC.bintools.bintools; |
373 | 367 | strip = |
374 | 368 | # TODO(@sternenseemann): also use wrapper if linker == "bfd" or "gold" |
375 | 369 | if stdenv.targetPlatform.isAarch64 |
@@ -403,14 +397,26 @@ stdenv.mkDerivation (rec { |
403 | 397 | done |
404 | 398 | '' |
405 | 399 | # Use emscripten and the `config.sub` saved by `postPatch` |
406 | | - + lib.optionalString (targetPlatform.isGhcjs) '' |
| 400 | + + lib.optionalString (targetPlatform.isGhcjs) ('' |
407 | 401 | export CC="${targetCC}/bin/emcc" |
408 | 402 | export CXX="${targetCC}/bin/em++" |
409 | 403 | export LD="${targetCC}/bin/emcc" |
410 | | - export NM="${targetCC}/share/emscripten/emnm" |
| 404 | + '' + ( |
| 405 | + # Including AR and RANLIB here breaks tests.js-template-haskell for GHC 9.6 |
| 406 | + # `LLVM ERROR: malformed uleb128, extends past end` |
| 407 | + if builtins.compareVersions ghc-version "9.8" >= 0 |
| 408 | + then '' |
| 409 | + export AR="${targetCC}/bin/emar" |
| 410 | + export NM="${targetCC}/share/emscripten/emnm" |
| 411 | + export RANLIB="${targetCC}/bin/emranlib" |
| 412 | + '' |
| 413 | + else '' |
| 414 | + export NM="${targetCC}/share/emscripten/emnm" |
| 415 | + '' |
| 416 | + ) + '' |
411 | 417 | export EM_CACHE=$(mktemp -d) |
412 | 418 | mv config.sub.ghcjs config.sub |
413 | | - '' |
| 419 | + '') |
414 | 420 | # GHC is a bit confused on its cross terminology, as these would normally be |
415 | 421 | # the *host* tools. |
416 | 422 | + lib.optionalString (!targetPlatform.isGhcjs) ('' |
@@ -744,7 +750,7 @@ stdenv.mkDerivation (rec { |
744 | 750 | } // extra-passthru; |
745 | 751 |
|
746 | 752 | meta = { |
747 | | - homepage = http://haskell.org/ghc; |
| 753 | + homepage = "https://haskell.org/ghc"; |
748 | 754 | description = "The Glasgow Haskell Compiler"; |
749 | 755 | maintainers = []; |
750 | 756 | inherit (ghc.meta) license platforms; |
|
0 commit comments