141141 CrossCompilePrefix = ${ targetPrefix }
142142 '' + lib . optionalString isCrossTarget ''
143143 Stage1Only = ${ if targetPlatform . system == hostPlatform . system then "NO" else "YES" }
144- ''
145- # GHC 9.0.1 fails to compile for musl unless HADDOC_DOCS = NO
146- + lib . optionalString ( isCrossTarget || ( targetPlatform . isMusl && builtins . compareVersions ghc-version "9.0.1" >= 0 ) ) ''
144+ '' + lib . optionalString ( isCrossTarget || targetPlatform . isMusl ) ''
147145 HADDOCK_DOCS = NO
146+ '' + ''
148147 BUILD_SPHINX_HTML = NO
149148 BUILD_SPHINX_PDF = NO
150149 '' + lib . optionalString enableRelocatedStaticLibs ''
247246 then "ghc928"
248247 else "ghc962" ;
249248 in
250- assert ( buildPackages . haskell . compiler ? ${ compiler-nix-name }
251- || throw "Expected pkgs.haskell.compiler.${ compiler-nix-name } for building hadrian" ) ;
252249 buildPackages . pinned-haskell-nix . tool compiler-nix-name "hadrian" {
253250 compilerSelection = p : p . haskell . compiler ;
254251 index-state = buildPackages . haskell-nix . internalHackageIndexState ;
@@ -548,6 +545,10 @@ stdenv.mkDerivation (rec {
548545 mkdir -p $generated/compiler/stage2/build/GHC/Settings
549546 cp _build/stage1/compiler/build/GHC/Settings/Config.hs $generated/compiler/stage2/build/GHC/Settings
550547 fi
548+ if [[ -f compiler/GHC/CmmToLlvm/Version/Bounds.hs ]]; then
549+ mkdir -p $generated/compiler/GHC/CmmToLlvm/Version
550+ cp compiler/GHC/CmmToLlvm/Version/Bounds.hs $generated/compiler/GHC/CmmToLlvm/Version/Bounds.hs
551+ fi
551552 cp _build/stage1/compiler/build/*.hs-incl $generated/compiler/stage2/build || true
552553 ''
553554 # Save generated files for needed when building ghc-boot
@@ -773,10 +774,8 @@ stdenv.mkDerivation (rec {
773774 ${ hadrian } /bin/hadrian ${ hadrianArgs } stage1:lib:terminfo
774775 '' + lib . optionalString ( installStage1 && ! haskell-nix . haskellLib . isCrossTarget ) ''
775776 ${ hadrian } /bin/hadrian ${ hadrianArgs } stage2:exe:iserv
776- # I don't seem to be able to build _build/stage1/lib/bin/ghc-iserv-prof
777- # by asking hadrian for this. The issue is likely that the profiling way
778- # is probably missing from hadrian m(
779- ${ hadrian } /bin/hadrian ${ hadrianArgs } _build/stage1/lib/bin/ghc-iserv-prof
777+ ${ hadrian } /bin/hadrian ${ hadrianArgs } _build/stage1/${
778+ lib . optionalString ( builtins . compareVersions ghc-version "9.9" < 0 ) "lib/" } bin/ghc-iserv-prof
780779 pushd _build/stage1/bin
781780 for exe in *; do
782781 mv $exe ${ targetPrefix } $exe
@@ -793,19 +792,17 @@ stdenv.mkDerivation (rec {
793792 then ''
794793 mkdir $out
795794 cp -r _build/stage1/bin $out
796- ${
797- # These are needed when building the reinstallable lib ghc
798- if targetPlatform . isMusl
799- then ''
800- cp _build/stageBoot/bin/genprimopcode $out/bin
801- cp _build/stageBoot/bin/deriveConstants $out/bin
802- '' else ''
803- cp _build/stageBoot/bin/${ targetPrefix } genprimopcode $out/bin
804- ln -s $out/bin/${ targetPrefix } genprimopcode $out/bin/genprimopcode
805- cp _build/stageBoot/bin/${ targetPrefix } deriveConstants $out/bin
806- ln -s $out/bin/${ targetPrefix } deriveConstants $out/bin/deriveConstants
807- ''
808- }
795+ # let's assume that if we find a non-prefixed genprimop,
796+ # we also find a non-prefixed deriveConstants
797+ if [ -f _build/stageBoot/bin/genprimopcode ]; then
798+ cp _build/stageBoot/bin/genprimopcode $out/bin
799+ cp _build/stageBoot/bin/deriveConstants $out/bin
800+ else
801+ cp _build/stageBoot/bin/${ targetPrefix } genprimopcode $out/bin
802+ ln -s $out/bin/${ targetPrefix } genprimopcode $out/bin/genprimopcode
803+ cp _build/stageBoot/bin/${ targetPrefix } deriveConstants $out/bin
804+ ln -s $out/bin/${ targetPrefix } deriveConstants $out/bin/deriveConstants
805+ fi
809806 cp -r _build/stage1/lib $out
810807 mkdir $doc
811808 cp -r _build/stage1/share $doc
0 commit comments