Skip to content

Commit

Permalink
Add GHC 9.8.2 (input-output-hk#2170)
Browse files Browse the repository at this point in the history
* Add GHC-9.8.2

* Fix for genprimopcode (from angerman/fix-aarch64-musl)

* Add dummy-ghc materialized files

* Fix patch upper bounds

* Add materialized files

* Update hackage.head

* Use latest double-conversion from hackage

* Update ghc git versions to 9.10 and 9.11 (HEAD)

* GHC Head Fixes

* Skip plugin test for git ghc

* Avoid building cabal-install with ghc >=9.9

* Avoid old version of Win32 in plan.json

* Fix missing ghc-iserv for musl

* Fix for hashable

* Fix ghc-iserv for profiling

* Fix ghc lib build for ghc HEAD

* Update debug info check for ghc-internal

---------

Co-authored-by: Teo Camarasu <teo.camarasu@tracsis.com>
  • Loading branch information
hamishmack and TeofilC authored Mar 17, 2024
1 parent 9004d35 commit a2cfd5d
Show file tree
Hide file tree
Showing 150 changed files with 39,221 additions and 201 deletions.
8 changes: 4 additions & 4 deletions builder/comp-builder.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, stdenv, buildPackages, ghc, lib, gobject-introspection ? null, haskellLib, makeConfigFiles, haddockBuilder, ghcForComponent, hsPkgs, compiler, runCommand, libffi, gmp, windows, zlib, ncurses, nodejs, nonReinstallablePkgs }@defaults:
{ pkgs, stdenv, buildPackages, pkgsBuildBuild, ghc, lib, gobject-introspection ? null, haskellLib, makeConfigFiles, haddockBuilder, ghcForComponent, hsPkgs, compiler, runCommand, libffi, gmp, windows, zlib, ncurses, nodejs, nonReinstallablePkgs }@defaults:
lib.makeOverridable (
let self =
{ componentId
Expand Down Expand Up @@ -194,8 +194,8 @@ let
++ lib.optional (!stdenv.hostPlatform.isGhcjs && builtins.compareVersions defaults.ghc.version "9.8" >= 0)
"--with-ld=${stdenv.cc.bintools.targetPrefix}ld"
++ lib.optionals (stdenv.hostPlatform.isGhcjs) [
"--with-gcc=${buildPackages.emscripten}/bin/emcc"
"--with-ld=${buildPackages.emscripten}/bin/emcc"
"--with-gcc=${pkgsBuildBuild.emscripten}/bin/emcc"
"--with-ld=${pkgsBuildBuild.emscripten}/bin/emcc"
]
++ [ # other flags
(disableFeature dontStrip "executable-stripping")
Expand Down Expand Up @@ -635,7 +635,7 @@ let
''))
+ (lib.optionalString doCoverage ''
mkdir -p $out/share
cp -r dist/hpc $out/share
cp -r dist/${lib.optionalString (builtins.compareVersions defaults.ghc.version "9.9" >= 0) "build/extra-compilation-artifacts/"}hpc $out/share
cp dist/setup-config $out/
'')
}
Expand Down
4 changes: 4 additions & 0 deletions builder/ghc-for-component-wrapper.nix
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ let
done
''
+ lib.optionalString (stdenv.targetPlatform.isMusl && !haskellLib.isNativeMusl && builtins.compareVersions ghc.version "9.9" >0) ''
ln -s $wrappedGhc/bin/${ghcCommand}-iserv $wrappedGhc/bin/ghc-iserv
ln -s $wrappedGhc/bin/${ghcCommand}-iserv-prof $wrappedGhc/bin/ghc-iserv-prof
''
# Wrap haddock, if the base GHC provides it.
+ ''
if [[ -x "${haddock}/bin/haddock" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion builder/hspkg-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ let
pkgconfig = if components ? library then components.library.pkgconfig or [] else [];
};
inherit package name src flags patches defaultSetupSrc;
inherit (pkg) preUnpack postUnpack;
inherit (pkg) preUnpack postUnpack prePatch postPatch;
} // lib.optionalAttrs (package.buildType != "Custom") {
nonReinstallablePkgs = ["base" "Cabal"];
});
Expand Down
31 changes: 21 additions & 10 deletions builder/setup-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
let self =
{ component, package, name, src, enableDWARF ? false, flags ? {}, revision ? null, patches ? [], defaultSetupSrc
, preUnpack ? component.preUnpack, postUnpack ? component.postUnpack
, prePatch ? null, postPatch ? null
, prePatch ? component.prePatch, postPatch ? component.postPatch
, preBuild ? component.preBuild , postBuild ? component.postBuild
, preInstall ? component.preInstall , postInstall ? component.postInstall
, cleanSrc ? haskellLib.cleanCabalComponent package component "setup" src
Expand All @@ -24,9 +24,22 @@ let
inherit fullName flags component enableDWARF nonReinstallablePkgs;
};
hooks = haskellLib.optionalHooks {
prePatch =
# If the package is in a sub directory `cd` there first.
# In some cases the `cleanSrc.subDir` will be empty and the `.cabal`
# file will be in the root of `src` (`cleanSrc.root`). This
# will happen when:
# * the .cabal file is in the projects `src.origSrc or src`
# * the package src was overridden with a value that does not
# include an `origSubDir`
(lib.optionalString (cleanSrc'.subDir != "") ''
cd ${lib.removePrefix "/" cleanSrc'.subDir}
''
) + lib.optionalString (prePatch != null) "\n${prePatch}";

inherit
preUnpack postUnpack
prePatch postPatch
postPatch
preBuild postBuild
preInstall postInstall
;
Expand Down Expand Up @@ -109,14 +122,12 @@ let
diff ./Setup $out/bin/Setup
'';
}
// (lib.optionalAttrs (cleanSrc'.subDir != "") {
prePatch =
# If the package is in a sub directory `cd` there first
''
cd ${lib.removePrefix "/" cleanSrc'.subDir}
'';
})
// (lib.optionalAttrs (patches != []) { patches = map (p: if builtins.isFunction p then p { inherit (package.identifier) version; } else p) patches; })
// lib.optionalAttrs (patches != []) {
patches = map (p:
if builtins.isFunction p
then p { inherit (package.identifier) version; }
else p) patches;
}
// hooks
);
in drv; in self
4 changes: 2 additions & 2 deletions ci.nix
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
ghc96llvm = true;
ghc98 = true;
ghc98llvm = true;
# ghc98X = true; Disabled for now as there are no changes since 9.8.1 release yet and the current source does not boot with 9.8.1
ghc99 = true;
ghc910X = true;
ghc911 = true;
})));
crossSystems = nixpkgsName: nixpkgs: compiler-nix-name:
# We need to use the actual nixpkgs version we're working with here, since the values
Expand Down
41 changes: 19 additions & 22 deletions compiler/ghc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,9 @@ let
CrossCompilePrefix = ${targetPrefix}
'' + lib.optionalString isCrossTarget ''
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
''
# GHC 9.0.1 fails to compile for musl unless HADDOC_DOCS = NO
+ lib.optionalString (isCrossTarget || (targetPlatform.isMusl && builtins.compareVersions ghc-version "9.0.1" >= 0)) ''
'' + lib.optionalString (isCrossTarget || targetPlatform.isMusl) ''
HADDOCK_DOCS = NO
'' + ''
BUILD_SPHINX_HTML = NO
BUILD_SPHINX_PDF = NO
'' + lib.optionalString enableRelocatedStaticLibs ''
Expand Down Expand Up @@ -247,8 +246,6 @@ let
then "ghc928"
else "ghc962";
in
assert (buildPackages.haskell.compiler ? ${compiler-nix-name}
|| throw "Expected pkgs.haskell.compiler.${compiler-nix-name} for building hadrian");
buildPackages.pinned-haskell-nix.tool compiler-nix-name "hadrian" {
compilerSelection = p: p.haskell.compiler;
index-state = buildPackages.haskell-nix.internalHackageIndexState;
Expand Down Expand Up @@ -548,6 +545,10 @@ stdenv.mkDerivation (rec {
mkdir -p $generated/compiler/stage2/build/GHC/Settings
cp _build/stage1/compiler/build/GHC/Settings/Config.hs $generated/compiler/stage2/build/GHC/Settings
fi
if [[ -f compiler/GHC/CmmToLlvm/Version/Bounds.hs ]]; then
mkdir -p $generated/compiler/GHC/CmmToLlvm/Version
cp compiler/GHC/CmmToLlvm/Version/Bounds.hs $generated/compiler/GHC/CmmToLlvm/Version/Bounds.hs
fi
cp _build/stage1/compiler/build/*.hs-incl $generated/compiler/stage2/build || true
''
# Save generated files for needed when building ghc-boot
Expand Down Expand Up @@ -773,10 +774,8 @@ stdenv.mkDerivation (rec {
${hadrian}/bin/hadrian ${hadrianArgs} stage1:lib:terminfo
'' + lib.optionalString (installStage1 && !haskell-nix.haskellLib.isCrossTarget) ''
${hadrian}/bin/hadrian ${hadrianArgs} stage2:exe:iserv
# I don't seem to be able to build _build/stage1/lib/bin/ghc-iserv-prof
# by asking hadrian for this. The issue is likely that the profiling way
# is probably missing from hadrian m(
${hadrian}/bin/hadrian ${hadrianArgs} _build/stage1/lib/bin/ghc-iserv-prof
${hadrian}/bin/hadrian ${hadrianArgs} _build/stage1/${
lib.optionalString (builtins.compareVersions ghc-version "9.9" < 0) "lib/"}bin/ghc-iserv-prof
pushd _build/stage1/bin
for exe in *; do
mv $exe ${targetPrefix}$exe
Expand All @@ -793,19 +792,17 @@ stdenv.mkDerivation (rec {
then ''
mkdir $out
cp -r _build/stage1/bin $out
${
# These are needed when building the reinstallable lib ghc
if targetPlatform.isMusl
then ''
cp _build/stageBoot/bin/genprimopcode $out/bin
cp _build/stageBoot/bin/deriveConstants $out/bin
'' else ''
cp _build/stageBoot/bin/${targetPrefix}genprimopcode $out/bin
ln -s $out/bin/${targetPrefix}genprimopcode $out/bin/genprimopcode
cp _build/stageBoot/bin/${targetPrefix}deriveConstants $out/bin
ln -s $out/bin/${targetPrefix}deriveConstants $out/bin/deriveConstants
''
}
# let's assume that if we find a non-prefixed genprimop,
# we also find a non-prefixed deriveConstants
if [ -f _build/stageBoot/bin/genprimopcode ]; then
cp _build/stageBoot/bin/genprimopcode $out/bin
cp _build/stageBoot/bin/deriveConstants $out/bin
else
cp _build/stageBoot/bin/${targetPrefix}genprimopcode $out/bin
ln -s $out/bin/${targetPrefix}genprimopcode $out/bin/genprimopcode
cp _build/stageBoot/bin/${targetPrefix}deriveConstants $out/bin
ln -s $out/bin/${targetPrefix}deriveConstants $out/bin/deriveConstants
fi
cp -r _build/stage1/lib $out
mkdir $doc
cp -r _build/stage1/share $doc
Expand Down
48 changes: 24 additions & 24 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
# And later it breaks in th-dll due to some change in the windows libs. We should probably
# drop unsable.
nixpkgs-unstable = { url = "github:NixOS/nixpkgs?rev=47585496bcb13fb72e4a90daeea2f434e2501998"; }; # nixpkgs-unstable };
ghc98X = {
ghc910X = {
flake = false;
url = "git+https://gitlab.haskell.org/ghc/ghc?ref=ghc-9.8&submodules=1";
url = "git+https://gitlab.haskell.org/ghc/ghc?ref=ghc-9.10&submodules=1";
};
ghc99 = {
ghc911 = {
flake = false;
url = "git+https://gitlab.haskell.org/ghc/ghc?submodules=1";
};
Expand Down Expand Up @@ -79,9 +79,7 @@
flake = false;
};
iserv-proxy = {
type = "git";
url = "https://gitlab.haskell.org/hamishmack/iserv-proxy.git";
ref = "hkm/remote-iserv";
url = "github:stable-haskell/iserv-proxy?ref=iserv-syms";
flake = false;
};
};
Expand Down
6 changes: 3 additions & 3 deletions lib/cover-project.nix
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ in pkgs.runCommand "project-coverage-report"
fi
# Copy mix, tix, and html information over from each report
if [ -d "$report/share/hpc/vanilla/mix/$identifier" ]; then
cp -Rn $report/share/hpc/vanilla/mix/$identifier $out/share/hpc/vanilla/mix/
fi
for f in $report/share/hpc/vanilla/mix/$identifier*; do
cp -Rn $f $out/share/hpc/vanilla/mix
done
cp -R $report/share/hpc/vanilla/tix/* $out/share/hpc/vanilla/tix/
cp -R $report/share/hpc/vanilla/html/* $out/share/hpc/vanilla/html/
'') coverageReports)}
Expand Down
17 changes: 9 additions & 8 deletions lib/cover.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
}:

let
mixDir = l: "${l}/share/hpc/vanilla/mix/${l.identifier.name}-${l.identifier.version}";
mixDirs = map mixDir mixLibraries;

srcDirs = map (l: l.srcSubDirPath) mixLibraries;

in pkgs.runCommand (name + "-coverage-report")
Expand Down Expand Up @@ -49,13 +46,17 @@ in pkgs.runCommand (name + "-coverage-report")
}
local mixDirArgs=$(mktemp)
${ # Copy out mix files used for this report
lib.concatStrings (map (mixDir: ''
local dir=${mixDir}
echo --hpcdir=$dir >> $mixDirArgs
lib.concatStrings (map (l: ''
local mixDir=${l}/share/hpc/vanilla/mix
local dir=$mixDir/${l.identifier.name}-${l.identifier.version}
if [ -d $dir ]; then
cp -R "$dir" $out/share/hpc/vanilla/mix/
echo --hpcdir=$dir >> $mixDirArgs
cp -R $dir $out/share/hpc/vanilla/mix/
elif [ -n "$(ls -A $mixDir)" ]; then
echo --hpcdir=$mixDir >> $mixDirArgs
cp -R $mixDir/* $out/share/hpc/vanilla/mix/
fi
'') mixDirs)
'') mixLibraries)
}
local includeArgs=$(mktemp)
find $out/share/hpc/vanilla/mix/ -type f \
Expand Down
2 changes: 1 addition & 1 deletion lib/ghcjs-project.nix
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ let
cabal-install
];

inherit (pkgs.buildPackages) emscriptenupstream emscripten emsdk;
inherit (pkgs.pkgsBuildBuild) emscriptenupstream emscripten emsdk;

# Inputs needed to boot the GHCJS compiler
bootInputs = with pkgs.buildPackages; [
Expand Down
Loading

0 comments on commit a2cfd5d

Please sign in to comment.