Skip to content

Commit

Permalink
Add prerelease ghc 9.8.1 from GitLab commit (input-output-hk#1991)
Browse files Browse the repository at this point in the history
Add prerelease ghc 9.8.1 from GitLab commit

* JS: support -this-unit-id for programs in the linker

See https://gitlab.haskell.org/ghc/ghc/-/merge_requests/10819

* Haskell Language Server 2.0.0.1

* Fix building hoogle with new index-state
  • Loading branch information
hamishmack authored Jul 25, 2023
1 parent f857b53 commit 08889bd
Show file tree
Hide file tree
Showing 403 changed files with 56,069 additions and 449 deletions.
2 changes: 1 addition & 1 deletion build.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ in rec {
inherit evalPackages;
src = pkgs.haskell-nix.sources."hls-1.10";
};
} // {
} // pkgs.lib.optionalAttrs (__compareVersions haskell.compiler.${compiler-nix-name}.version "9.8" < 0) {
"hls-20" = tool compiler-nix-name "haskell-language-server" {
inherit evalPackages;
src = pkgs.haskell-nix.sources."hls-2.0";
Expand Down
5 changes: 3 additions & 2 deletions builder/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,11 @@ let
then pkgs.path
else pkgs.haskell-nix.sources.nixpkgs-2205;
nixpkgsHoogle = import (nixpkgs + /pkgs/development/haskell-modules/hoogle.nix);
in { packages ? [], hoogle ? pkgs.buildPackages.haskell-nix.tool "ghc8107" "hoogle" {
in { packages ? [], hoogle ? pkgs.buildPackages.haskell-nix.tool "ghc928" "hoogle" {
inherit evalPackages;
version = "5.0.18.3";
index-state = pkgs.haskell-nix.internalHackageIndexState;
# index-state = pkgs.haskell-nix.internalHackageIndexState;
index-state = "2023-06-05T00:00:00Z";
}
}:
let
Expand Down
15 changes: 8 additions & 7 deletions ci.nix
Original file line number Diff line number Diff line change
Expand Up @@ -66,30 +66,31 @@
ghc928 = true;
ghc945 = true;
ghc962 = true;
ghc9820230704 = true;
}));
crossSystems = nixpkgsName: nixpkgs: compiler-nix-name:
# We need to use the actual nixpkgs version we're working with here, since the values
# of 'lib.systems.examples' are not understood between all versions
let lib = nixpkgs.lib;
in lib.optionalAttrs (nixpkgsName == "unstable"
&& ((system == "x86_64-linux" && __elem compiler-nix-name ["ghc8107" "ghc962"])
|| (system == "aarch64-linux" && __elem compiler-nix-name ["ghc8107" "ghc962"])
|| (system == "x86_64-darwin" && __elem compiler-nix-name ["ghc8107" "ghc962"])
|| (system == "aarch64-darwin" && __elem compiler-nix-name ["ghc8107" "ghc962"])
&& ((system == "x86_64-linux" && __elem compiler-nix-name ["ghc8107" "ghc962" "ghc9820230704"])
|| (system == "aarch64-linux" && __elem compiler-nix-name ["ghc8107" "ghc962" "ghc9820230704"])
|| (system == "x86_64-darwin" && __elem compiler-nix-name ["ghc8107" "ghc962" "ghc9820230704"])
|| (system == "aarch64-darwin" && __elem compiler-nix-name ["ghc8107" "ghc962" "ghc9820230704"])
)) {
inherit (lib.systems.examples) ghcjs;
} // lib.optionalAttrs (nixpkgsName == "unstable"
&& ((system == "x86_64-linux" && __elem compiler-nix-name ["ghc8107" "ghc902" "ghc926" "ghc927" "ghc928" "ghc945" "ghc962"])
&& ((system == "x86_64-linux" && __elem compiler-nix-name ["ghc8107" "ghc902" "ghc926" "ghc927" "ghc928" "ghc945" "ghc962" "ghc9820230704"])
|| (system == "x86_64-darwin" && __elem compiler-nix-name []))) { # TODO add ghc versions when we have more darwin build capacity
inherit (lib.systems.examples) mingwW64;
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && __elem compiler-nix-name ["ghc8107" "ghc902" "ghc922" "ghc923" "ghc924" "ghc926" "ghc927" "ghc928" "ghc945" "ghc962"]) {
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && __elem compiler-nix-name ["ghc8107" "ghc902" "ghc922" "ghc923" "ghc924" "ghc926" "ghc927" "ghc928" "ghc945" "ghc962" "ghc9820230704"]) {
# Musl cross only works on linux
# aarch64 cross only works on linux
inherit (lib.systems.examples) musl64 aarch64-multiplatform;
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && __elem compiler-nix-name ["ghc927" "ghc928"]) {
# TODO fix this for the compilers we build with hadrian (ghc >=9.4)
inherit (lib.systems.examples) aarch64-multiplatform-musl;
} // lib.optionalAttrs (system == "aarch64-linux" && nixpkgsName == "unstable" && __elem compiler-nix-name ["ghc927" "ghc928" "ghc945" "ghc962"]) {
} // lib.optionalAttrs (system == "aarch64-linux" && nixpkgsName == "unstable" && __elem compiler-nix-name ["ghc927" "ghc928" "ghc945" "ghc962" "ghc9820230704"]) {
inherit (lib.systems.examples) aarch64-multiplatform-musl;
};
isDisabled = d: d.meta.disabled or false;
Expand Down
44 changes: 32 additions & 12 deletions compiler/ghc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ assert enableNativeBignum -> !enableIntegerSimple;
assert enableIntegerSimple -> !enableNativeBignum;

let
src = src-spec.file or fetchurl { inherit (src-spec) url sha256; };
src = src-spec.file or (fetchurl { inherit (src-spec) url sha256; });

inherit (stdenv) buildPlatform hostPlatform targetPlatform;
inherit (haskell-nix.haskellLib) isCrossTarget;
Expand Down Expand Up @@ -241,7 +241,9 @@ let
then ../../materialized/ghc8107/hadrian-ghc92
else if builtins.compareVersions ghc-version "9.6" < 0
then ../../materialized/ghc8107/hadrian-ghc94
else ../../materialized/ghc8107/hadrian-ghc96;
else if builtins.compareVersions ghc-version "9.8" < 0
then ../../materialized/ghc8107/hadrian-ghc96
else ../../materialized/ghc8107/hadrian-ghc98;
modules = [{
# Apply the patches in a way that does not require using something
# like `srcOnly`. The problem with `pkgs.srcOnly` was that it had to run
Expand Down Expand Up @@ -342,9 +344,8 @@ stdenv.mkDerivation (rec {
patches = ghc-patches;

# configure was run by configured-src already.
phases = [ "unpackPhase" "patchPhase" ]
++ lib.optional (ghc-patches != [] && !stdenv.targetPlatform.isGhcjs) "autoreconfPhase" # autoreconf can replace config.sub with one that is missing ghcjs
++ [ "configurePhase" "buildPhase"
phases = [ "unpackPhase" "patchPhase" "autoreconfPhase"
"configurePhase" "buildPhase"
"checkPhase" "installPhase"
"fixupPhase"
"installCheckPhase"
Expand All @@ -358,11 +359,14 @@ stdenv.mkDerivation (rec {
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
export "''${env#TARGET_}=''${!env}"
done
'' + lib.optionalString (targetPlatform.isGhcjs) ''
''
# Use emscripten and the `config.sub` saved by `postPatch`
+ lib.optionalString (targetPlatform.isGhcjs) ''
export CC="${targetCC}/bin/emcc"
export CXX="${targetCC}/bin/em++"
export LD="${targetCC}/bin/emcc"
export EM_CACHE=$(mktemp -d)
mv config.sub.ghcjs config.sub
''
# GHC is a bit confused on its cross terminology, as these would normally be
# the *host* tools.
Expand Down Expand Up @@ -425,8 +429,8 @@ stdenv.mkDerivation (rec {
echo '${ghc-version-date}' > VERSION_DATE
''
# The official ghc 9.2.3 tarball requires booting.
+ lib.optionalString (ghc-version == "9.2.3") ''
./boot
+ lib.optionalString (ghc-version == "9.2.3" || ghc-version == "9.8.20230704") ''
python3 ./boot
'';

configurePlatforms = [ "build" "host" ] ++ lib.optional (!targetPlatform.isGhcjs) "target";
Expand Down Expand Up @@ -626,14 +630,18 @@ stdenv.mkDerivation (rec {
mkdir $doc
mkdir $generated
'';
phases = [ "unpackPhase" "patchPhase" ]
++ lib.optional (ghc-patches != []) "autoreconfPhase"
++ [ "configurePhase" "installPhase"];
phases = [ "unpackPhase" "patchPhase" "autoreconfPhase"
"configurePhase" "installPhase"];
} // lib.optionalAttrs useHadrian {
postConfigure = ''
for a in libraries/*/*.cabal.in utils/*/*.cabal.in compiler/ghc.cabal.in; do
${hadrian}/bin/hadrian ${hadrianArgs} "''${a%.*}"
done
'' + lib.optionalString (builtins.compareVersions ghc-version "9.8.1" >= 0) ''
for a in bytearray-access-ops.txt.pp addr-access-ops.txt.pp primops.txt; do
${hadrian}/bin/hadrian ${hadrianArgs} _build/stage0/compiler/build/$a
cp _build/stage0/compiler/build/$a compiler/GHC/Builtin/$a
done
'' + lib.optionalString stdenv.isDarwin ''
substituteInPlace mk/system-cxx-std-lib-1.0.conf \
--replace 'dynamic-library-dirs:' 'dynamic-library-dirs: ${libcxx}/lib ${libcxxabi}/lib'
Expand All @@ -644,6 +652,12 @@ stdenv.mkDerivation (rec {
--replace 'cross-compiling = YES' \
'cross-compiling = NO'
'';
} // lib.optionalAttrs targetPlatform.isGhcjs {
# Backup the config.sub that knows what `ghcjs` is in case
# `autoreconfPhase` replaces it
postPatch = ''
cp config.sub config.sub.ghcjs
'';
});

# Used to detect non haskell-nix compilers (accidental use of nixpkgs compilers can lead to unexpected errors)
Expand Down Expand Up @@ -671,6 +685,12 @@ stdenv.mkDerivation (rec {
# Needed for `haddock` to work on source that includes non ASCII chars
LANG = "en_US.UTF-8";
LC_ALL = "en_US.UTF-8";
} // lib.optionalAttrs targetPlatform.isGhcjs {
# Backup the config.sub that knows what `ghcjs` is in case
# `autoreconfPhase` replaces it
postPatch = ''
cp config.sub config.sub.ghcjs
'';
} // lib.optionalAttrs (stdenv.buildPlatform.libc == "glibc") {
LOCALE_ARCHIVE = "${buildPackages.glibcLocales}/lib/locale/locale-archive";
} // lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
Expand Down Expand Up @@ -715,7 +735,7 @@ stdenv.mkDerivation (rec {
'';
buildPhase = ''
${hadrian}/bin/hadrian ${hadrianArgs}
'' + lib.optionalString (installStage1 && !stdenv.targetPlatform.isGhcjs) ''
'' + lib.optionalString (installStage1 && !stdenv.targetPlatform.isGhcjs && builtins.compareVersions ghc-version "9.8" < 0) ''
${hadrian}/bin/hadrian ${hadrianArgs} stage1:lib:libiserv
'' + lib.optionalString targetPlatform.isMusl ''
${hadrian}/bin/hadrian ${hadrianArgs} stage1:lib:terminfo
Expand Down
8 changes: 4 additions & 4 deletions flake.lock

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

Loading

0 comments on commit 08889bd

Please sign in to comment.