Merge pull request #311940 from NixOS/haskell-updates

haskellPackages: update stackage and hackage
This commit is contained in:
Naïm Favier
2024-05-19 18:46:23 +02:00
committed by GitHub
20 changed files with 2745 additions and 4401 deletions
+4 -4
View File
@@ -1,6 +1,6 @@
{
"commit": "9e419b038d7108160caf4efc41ebd5dfc4d51821",
"url": "https://github.com/commercialhaskell/all-cabal-hashes/archive/9e419b038d7108160caf4efc41ebd5dfc4d51821.tar.gz",
"sha256": "1vqsxznsq6s1hfb3b7ghs0fqa1rapqccjcz5jy3h9w3dq4v3gfqz",
"msg": "Update from Hackage at 2024-04-27T10:57:54Z"
"commit": "88d42dc0129b0e3f4f702149a58667c66add9262",
"url": "https://github.com/commercialhaskell/all-cabal-hashes/archive/88d42dc0129b0e3f4f702149a58667c66add9262.tar.gz",
"sha256": "0imff76qbg1hsvsdds6dc2wfip0prdsa0bixd5b575jr6yjlkirh",
"msg": "Update from Hackage at 2024-05-15T11:29:34Z"
}
+3 -392
View File
@@ -1,393 +1,4 @@
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
# build-tools
, bootPkgs
, autoconf, automake, coreutils, fetchurl, perl, python3, m4, sphinx, xattr
, autoSignDarwinBinariesHook
, bash
, fetchpatch
, libiconv ? null, ncurses
, glibcLocales ? null
, # GHC can be built with system libffi or a bundled one.
libffi ? null
, useLLVM ? !(stdenv.targetPlatform.isx86
|| stdenv.targetPlatform.isPower
|| stdenv.targetPlatform.isSparc)
, # LLVM is conceptually a run-time-only dependency, but for
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
# build-time dependency too.
buildTargetLlvmPackages, llvmPackages
, # If enabled, GHC will be built with the GPL-free but slightly slower native
# bignum backend instead of the faster but GPLed gmp backend.
enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp
&& lib.meta.availableOn stdenv.targetPlatform gmp)
, gmp
, # If enabled, use -fPIC when compiling static libs.
enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
, enableProfiledLibs ? true
, # Whether to build dynamic libs for the standard library (on the target
# platform). Static libs are always built.
enableShared ? with stdenv.targetPlatform; !isWindows && !useiOSPrebuilt && !isStatic
, # Whether to build terminfo.
enableTerminfo ? !stdenv.targetPlatform.isWindows
, # What flavour to build. An empty string indicates no
# specific flavour and falls back to ghc default values.
ghcFlavour ? lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
(if useLLVM then "perf-cross" else "perf-cross-ncg")
, # Whether to build sphinx documentation.
enableDocs ? (
# Docs disabled if we are building on musl because it's a large task to keep
# all `sphinx` dependencies building in this environment.
!stdenv.buildPlatform.isMusl
)
, enableHaddockProgram ?
# Disabled for cross; see note [HADDOCK_DOCS].
(stdenv.targetPlatform == stdenv.hostPlatform)
, # Whether to disable the large address space allocator
# necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
}:
assert !enableNativeBignum -> gmp != null;
# Cross cannot currently build the `haddock` program for silly reasons,
# see note [HADDOCK_DOCS].
assert (stdenv.targetPlatform != stdenv.hostPlatform) -> !enableHaddockProgram;
let
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
inherit (bootPkgs) ghc;
# TODO(@Ericson2314) Make unconditional
targetPrefix = lib.optionalString
(targetPlatform != hostPlatform)
"${targetPlatform.config}-";
buildMK = ''
BuildFlavour = ${ghcFlavour}
ifneq \"\$(BuildFlavour)\" \"\"
include mk/flavours/\$(BuildFlavour).mk
endif
BUILD_SPHINX_HTML = ${if enableDocs then "YES" else "NO"}
BUILD_SPHINX_PDF = NO
'' +
# Note [HADDOCK_DOCS]:
# Unfortunately currently `HADDOCK_DOCS` controls both whether the `haddock`
# program is built (which we generally always want to have a complete GHC install)
# and whether it is run on the GHC sources to generate hyperlinked source code
# (which is impossible for cross-compilation); see:
# https://gitlab.haskell.org/ghc/ghc/-/issues/20077
# This implies that currently a cross-compiled GHC will never have a `haddock`
# program, so it can never generate haddocks for any packages.
# If this is solved in the future, we'd like to unconditionally
# build the haddock program (removing the `enableHaddockProgram` option).
''
HADDOCK_DOCS = ${if enableHaddockProgram then "YES" else "NO"}
# Build haddocks for boot packages with hyperlinking
EXTRA_HADDOCK_OPTS += --hyperlinked-source --quickjump
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
BIGNUM_BACKEND = ${if enableNativeBignum then "native" else "gmp"}
'' + lib.optionalString (targetPlatform != hostPlatform) ''
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
CrossCompilePrefix = ${targetPrefix}
'' + lib.optionalString (!enableProfiledLibs) ''
BUILD_PROF_LIBS = NO
'' +
# -fexternal-dynamic-refs apparently (because it's not clear from the documentation)
# makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell.
# This solution was described in https://www.tweag.io/blog/2020-09-30-bazel-static-haskell
lib.optionalString enableRelocatedStaticLibs ''
GhcLibHcOpts += -fPIC -fexternal-dynamic-refs
GhcRtsHcOpts += -fPIC -fexternal-dynamic-refs
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
EXTRA_CC_OPTS += -std=gnu99
'';
# Splicer will pull out correct variations
libDeps = platform: lib.optional enableTerminfo ncurses
++ [libffi]
++ lib.optional (!enableNativeBignum) gmp
++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
# TODO(@sternenseemann): is buildTarget LLVM unnecessary?
# GHC doesn't seem to have {LLC,OPT}_HOST
toolsForTarget = [
pkgsBuildTarget.targetPackages.stdenv.cc
] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm;
targetCC = builtins.head toolsForTarget;
# Sometimes we have to dispatch between the bintools wrapper and the unwrapped
# derivation for certain tools depending on the platform.
bintoolsFor = {
# GHC needs install_name_tool on all darwin platforms. On aarch64-darwin it is
# part of the bintools wrapper (due to codesigning requirements), but not on
# x86_64-darwin.
install_name_tool =
if stdenv.targetPlatform.isAarch64
then targetCC.bintools
else targetCC.bintools.bintools;
# Same goes for strip.
strip =
# TODO(@sternenseemann): also use wrapper if linker == "bfd" or "gold"
if stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin
then targetCC.bintools
else targetCC.bintools.bintools;
};
# Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues.
# But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
# see #84670 and #49071 for more background.
useLdGold = targetPlatform.linker == "gold" ||
(targetPlatform.linker == "bfd" && (targetCC.bintools.bintools.hasGold or false) && !targetPlatform.isMusl);
# Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
variantSuffix = lib.concatStrings [
(lib.optionalString stdenv.hostPlatform.isMusl "-musl")
(lib.optionalString enableNativeBignum "-native-bignum")
];
in
# C compiler, bintools and LLVM are used at build time, but will also leak into
# the resulting GHC's settings file and used at runtime. This means that we are
# currently only able to build GHC if hostPlatform == buildPlatform.
assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
stdenv.mkDerivation (rec {
import ./common-make-native-bignum.nix {
version = "9.0.2";
pname = "${targetPrefix}ghc${variantSuffix}";
src = fetchurl {
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
sha256 = "140e42b96346322d1a39eb17602bcdc76e292028ad4a69286b230bab188a9197";
};
enableParallelBuilding = true;
outputs = [ "out" "doc" ];
patches = [
# Fix docs build with sphinx >= 6.0
# https://gitlab.haskell.org/ghc/ghc/-/issues/22766
(fetchpatch {
name = "ghc-docs-sphinx-6.0.patch";
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/10e94a556b4f90769b7fd718b9790d58ae566600.patch";
sha256 = "0kmhfamr16w8gch0lgln2912r8aryjky1hfcda3jkcwa5cdzgjdv";
})
# Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
./docs-sphinx-7.patch
# fix hyperlinked haddock sources: https://github.com/haskell/haddock/pull/1482
(fetchpatch {
url = "https://patch-diff.githubusercontent.com/raw/haskell/haddock/pull/1482.patch";
sha256 = "sha256-8w8QUCsODaTvknCDGgTfFNZa8ZmvIKaKS+2ZJZ9foYk=";
extraPrefix = "utils/haddock/";
stripLen = 1;
})
# Add flag that fixes C++ exception handling; opt-in. Merged in 9.4 and 9.2.2.
# https://gitlab.haskell.org/ghc/ghc/-/merge_requests/7423
(fetchpatch {
name = "ghc-9.0.2-fcompact-unwind.patch";
# Note that the test suite is not packaged.
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/c6132c782d974a7701e7f6447bdcd2bf6db4299a.patch?merge_request_iid=7423";
sha256 = "sha256-b4feGZIaKDj/UKjWTNY6/jH4s2iate0wAgMxG3rAbZI=";
})
] ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
# Prevent the paths module from emitting symbols that we don't use
# when building with separate outputs.
#
# These cause problems as they're not eliminated by GHC's dead code
# elimination on aarch64-darwin. (see
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
./Cabal-3.2-3.4-paths-fix-cycle-aarch64-darwin.patch
];
postPatch = "patchShebangs .";
# GHC needs the locale configured during the Haddock phase.
LANG = "en_US.UTF-8";
# GHC is a bit confused on its cross terminology.
# TODO(@sternenseemann): investigate coreutils dependencies and pass absolute paths
preConfigure = ''
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
export "''${env#TARGET_}=''${!env}"
done
# GHC is a bit confused on its cross terminology, as these would normally be
# the *host* tools.
export CC="${targetCC}/bin/${targetCC.targetPrefix}cc"
export CXX="${targetCC}/bin/${targetCC.targetPrefix}c++"
# Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${lib.optionalString useLdGold ".gold"}"
export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as"
export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar"
export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm"
export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib"
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
export STRIP="${bintoolsFor.strip}/bin/${bintoolsFor.strip.targetPrefix}strip"
'' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") ''
export OTOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}otool"
export INSTALL_NAME_TOOL="${bintoolsFor.install_name_tool}/bin/${bintoolsFor.install_name_tool.targetPrefix}install_name_tool"
'' + lib.optionalString useLLVM ''
export LLC="${lib.getBin buildTargetLlvmPackages.llvm}/bin/llc"
export OPT="${lib.getBin buildTargetLlvmPackages.llvm}/bin/opt"
'' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
export CLANG="${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
'' + ''
echo -n "${buildMK}" > mk/build.mk
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
'' + lib.optionalString (stdenv.isLinux && hostPlatform.libc == "glibc") ''
export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"
'' + lib.optionalString (!stdenv.isDarwin) ''
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
'' + lib.optionalString stdenv.isDarwin ''
export NIX_LDFLAGS+=" -no_dtrace_dof"
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets
'' + lib.optionalString targetPlatform.isMusl ''
echo "patching llvm-targets for musl targets..."
echo "Cloning these existing '*-linux-gnu*' targets:"
grep linux-gnu llvm-targets | sed 's/^/ /'
echo "(go go gadget sed)"
sed -i 's,\(^.*linux-\)gnu\(.*\)$,\0\n\1musl\2,' llvm-targets
echo "llvm-targets now contains these '*-linux-musl*' targets:"
grep linux-musl llvm-targets | sed 's/^/ /'
echo "And now patching to preserve '-musleabi' as done with '-gnueabi'"
# (aclocal.m4 is actual source, but patch configure as well since we don't re-gen)
for x in configure aclocal.m4; do
substituteInPlace $x \
--replace '*-android*|*-gnueabi*)' \
'*-android*|*-gnueabi*|*-musleabi*)'
done
'';
# TODO(@Ericson2314): Always pass "--target" and always prefix.
configurePlatforms = [ "build" "host" ]
++ lib.optional (targetPlatform != hostPlatform) "target";
# `--with` flags for libraries needed for RTS linker
configureFlags = [
"--datadir=$doc/share/doc/ghc"
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
] ++ lib.optionals (libffi != null) [
"--with-system-libffi"
"--with-ffi-includes=${targetPackages.libffi.dev}/include"
"--with-ffi-libraries=${targetPackages.libffi.out}/lib"
] ++ lib.optionals (targetPlatform == hostPlatform && !enableNativeBignum) [
"--with-gmp-includes=${targetPackages.gmp.dev}/include"
"--with-gmp-libraries=${targetPackages.gmp.out}/lib"
] ++ lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
"--with-iconv-includes=${libiconv}/include"
"--with-iconv-libraries=${libiconv}/lib"
] ++ lib.optionals (targetPlatform != hostPlatform) [
"--enable-bootstrap-with-devel-snapshot"
] ++ lib.optionals useLdGold [
"CFLAGS=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
] ++ lib.optionals (disableLargeAddressSpace) [
"--disable-large-address-space"
];
# Make sure we never relax`$PATH` and hooks support for compatibility.
strictDeps = true;
# Dont add -liconv to LDFLAGS automatically so that GHC will add it itself.
dontAddExtraLibs = true;
nativeBuildInputs = [
perl autoconf automake m4 python3
ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
autoSignDarwinBinariesHook
] ++ lib.optionals enableDocs [
sphinx
] ++ lib.optionals stdenv.isDarwin [
# TODO(@sternenseemann): backport addition of XATTR env var like
# https://gitlab.haskell.org/ghc/ghc/-/merge_requests/6447
xattr
];
# For building runtime libs
depsBuildTarget = toolsForTarget;
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
depsTargetTarget = map lib.getDev (libDeps targetPlatform);
depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);
# required, because otherwise all symbols from HSffi.o are stripped, and
# that in turn causes GHCi to abort
stripDebugFlags = [ "-S" ] ++ lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
checkTarget = "test";
hardeningDisable =
[ "format" ]
# In nixpkgs, musl based builds currently enable `pie` hardening by default
# (see `defaultHardeningFlags` in `make-derivation.nix`).
# But GHC cannot currently produce outputs that are ready for `-pie` linking.
# Thus, disable `pie` hardening, otherwise `recompile with -fPIE` errors appear.
# See:
# * https://github.com/NixOS/nixpkgs/issues/129247
# * https://gitlab.haskell.org/ghc/ghc/-/issues/19580
++ lib.optional stdenv.targetPlatform.isMusl "pie";
# big-parallel allows us to build with more than 2 cores on
# Hydra which already warrants a significant speedup
requiredSystemFeatures = [ "big-parallel" ];
postInstall = ''
# Install the bash completion file.
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
'';
passthru = {
inherit bootPkgs targetPrefix;
inherit llvmPackages;
inherit enableShared;
# This is used by the haskell builder to query
# the presence of the haddock program.
hasHaddock = enableHaddockProgram;
# Our Cabal compiler name
haskellCompilerName = "ghc-${version}";
};
meta = {
homepage = "http://haskell.org/ghc";
description = "The Glasgow Haskell Compiler";
maintainers = with lib.maintainers; [
guibou
] ++ lib.teams.haskell.members;
timeout = 24 * 3600;
inherit (ghc.meta) license platforms;
};
} // lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
dontStrip = true;
dontPatchELF = true;
noAuditTmpdir = true;
})
sha256 = "140e42b96346322d1a39eb17602bcdc76e292028ad4a69286b230bab188a9197";
}
+3 -388
View File
@@ -1,389 +1,4 @@
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
# build-tools
, bootPkgs
, autoconf, automake, coreutils, fetchpatch, fetchurl, perl, python3, m4, sphinx
, xattr, autoSignDarwinBinariesHook
, bash
, libiconv ? null, ncurses
, glibcLocales ? null
, # GHC can be built with system libffi or a bundled one.
libffi ? null
, useLLVM ? !(stdenv.targetPlatform.isx86
|| stdenv.targetPlatform.isPower
|| stdenv.targetPlatform.isSparc
|| stdenv.targetPlatform.isAarch64)
, # LLVM is conceptually a run-time-only dependency, but for
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
# build-time dependency too.
buildTargetLlvmPackages, llvmPackages
, # If enabled, GHC will be built with the GPL-free but slightly slower native
# bignum backend instead of the faster but GPLed gmp backend.
enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp
&& lib.meta.availableOn stdenv.targetPlatform gmp)
, gmp
, # If enabled, use -fPIC when compiling static libs.
enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
, enableProfiledLibs ? true
, # Whether to build dynamic libs for the standard library (on the target
# platform). Static libs are always built.
enableShared ? with stdenv.targetPlatform; !isWindows && !useiOSPrebuilt && !isStatic
, # Whether to build terminfo.
enableTerminfo ? !stdenv.targetPlatform.isWindows
, # What flavour to build. An empty string indicates no
# specific flavour and falls back to ghc default values.
ghcFlavour ? lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
(if useLLVM then "perf-cross" else "perf-cross-ncg")
, # Whether to build sphinx documentation.
enableDocs ? (
# Docs disabled if we are building on musl because it's a large task to keep
# all `sphinx` dependencies building in this environment.
!stdenv.buildPlatform.isMusl
)
, enableHaddockProgram ?
# Disabled for cross; see note [HADDOCK_DOCS].
(stdenv.targetPlatform == stdenv.hostPlatform)
, # Whether to disable the large address space allocator
# necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
}:
assert !enableNativeBignum -> gmp != null;
# Cross cannot currently build the `haddock` program for silly reasons,
# see note [HADDOCK_DOCS].
assert (stdenv.targetPlatform != stdenv.hostPlatform) -> !enableHaddockProgram;
let
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
inherit (bootPkgs) ghc;
# TODO(@Ericson2314) Make unconditional
targetPrefix = lib.optionalString
(targetPlatform != hostPlatform)
"${targetPlatform.config}-";
buildMK = ''
BuildFlavour = ${ghcFlavour}
ifneq \"\$(BuildFlavour)\" \"\"
include mk/flavours/\$(BuildFlavour).mk
endif
BUILD_SPHINX_HTML = ${if enableDocs then "YES" else "NO"}
BUILD_SPHINX_PDF = NO
'' +
# Note [HADDOCK_DOCS]:
# Unfortunately currently `HADDOCK_DOCS` controls both whether the `haddock`
# program is built (which we generally always want to have a complete GHC install)
# and whether it is run on the GHC sources to generate hyperlinked source code
# (which is impossible for cross-compilation); see:
# https://gitlab.haskell.org/ghc/ghc/-/issues/20077
# This implies that currently a cross-compiled GHC will never have a `haddock`
# program, so it can never generate haddocks for any packages.
# If this is solved in the future, we'd like to unconditionally
# build the haddock program (removing the `enableHaddockProgram` option).
''
HADDOCK_DOCS = ${if enableHaddockProgram then "YES" else "NO"}
# Build haddocks for boot packages with hyperlinking
EXTRA_HADDOCK_OPTS += --hyperlinked-source --quickjump
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
BIGNUM_BACKEND = ${if enableNativeBignum then "native" else "gmp"}
'' + lib.optionalString (targetPlatform != hostPlatform) ''
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
CrossCompilePrefix = ${targetPrefix}
'' + lib.optionalString (!enableProfiledLibs) ''
BUILD_PROF_LIBS = NO
'' +
# -fexternal-dynamic-refs apparently (because it's not clear from the documentation)
# makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell.
# This solution was described in https://www.tweag.io/blog/2020-09-30-bazel-static-haskell
lib.optionalString enableRelocatedStaticLibs ''
GhcLibHcOpts += -fPIC -fexternal-dynamic-refs
GhcRtsHcOpts += -fPIC -fexternal-dynamic-refs
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
EXTRA_CC_OPTS += -std=gnu99
'';
# Splicer will pull out correct variations
libDeps = platform: lib.optional enableTerminfo ncurses
++ [libffi]
++ lib.optional (!enableNativeBignum) gmp
++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
# TODO(@sternenseemann): is buildTarget LLVM unnecessary?
# GHC doesn't seem to have {LLC,OPT}_HOST
toolsForTarget = [
pkgsBuildTarget.targetPackages.stdenv.cc
] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm;
targetCC = builtins.head toolsForTarget;
# Sometimes we have to dispatch between the bintools wrapper and the unwrapped
# derivation for certain tools depending on the platform.
bintoolsFor = {
# GHC needs install_name_tool on all darwin platforms. On aarch64-darwin it is
# part of the bintools wrapper (due to codesigning requirements), but not on
# x86_64-darwin.
install_name_tool =
if stdenv.targetPlatform.isAarch64
then targetCC.bintools
else targetCC.bintools.bintools;
# Same goes for strip.
strip =
# TODO(@sternenseemann): also use wrapper if linker == "bfd" or "gold"
if stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin
then targetCC.bintools
else targetCC.bintools.bintools;
};
# Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues.
# But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
# see #84670 and #49071 for more background.
useLdGold = targetPlatform.linker == "gold" ||
(targetPlatform.linker == "bfd" && (targetCC.bintools.bintools.hasGold or false) && !targetPlatform.isMusl);
# Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
variantSuffix = lib.concatStrings [
(lib.optionalString stdenv.hostPlatform.isMusl "-musl")
(lib.optionalString enableNativeBignum "-native-bignum")
];
in
# C compiler, bintools and LLVM are used at build time, but will also leak into
# the resulting GHC's settings file and used at runtime. This means that we are
# currently only able to build GHC if hostPlatform == buildPlatform.
assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
stdenv.mkDerivation (rec {
import ./common-make-native-bignum.nix {
version = "9.2.5";
pname = "${targetPrefix}ghc${variantSuffix}";
src = fetchurl {
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
sha256 = "0606797d1b38e2d88ee2243f38ec6b9a1aa93e9b578e95f0de9a9c0a4144021c";
};
enableParallelBuilding = true;
outputs = [ "out" "doc" ];
patches = [
# Fix docs build with sphinx >= 6.0
# https://gitlab.haskell.org/ghc/ghc/-/issues/22766
(fetchpatch {
name = "ghc-docs-sphinx-6.0.patch";
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/10e94a556b4f90769b7fd718b9790d58ae566600.patch";
sha256 = "0kmhfamr16w8gch0lgln2912r8aryjky1hfcda3jkcwa5cdzgjdv";
})
# Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
./docs-sphinx-7.patch
# fix hyperlinked haddock sources: https://github.com/haskell/haddock/pull/1482
(fetchpatch {
url = "https://patch-diff.githubusercontent.com/raw/haskell/haddock/pull/1482.patch";
sha256 = "sha256-8w8QUCsODaTvknCDGgTfFNZa8ZmvIKaKS+2ZJZ9foYk=";
extraPrefix = "utils/haddock/";
stripLen = 1;
})
# Don't generate code that doesn't compile when --enable-relocatable is passed to Setup.hs
# Can be removed if the Cabal library included with ghc backports the linked fix
(fetchpatch {
url = "https://github.com/haskell/cabal/commit/6c796218c92f93c95e94d5ec2d077f6956f68e98.patch";
stripLen = 1;
extraPrefix = "libraries/Cabal/";
sha256 = "sha256-yRQ6YmMiwBwiYseC5BsrEtDgFbWvst+maGgDtdD0vAY=";
})
] ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
# Prevent the paths module from emitting symbols that we don't use
# when building with separate outputs.
#
# These cause problems as they're not eliminated by GHC's dead code
# elimination on aarch64-darwin. (see
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
];
postPatch = "patchShebangs .";
# GHC needs the locale configured during the Haddock phase.
LANG = "en_US.UTF-8";
# GHC is a bit confused on its cross terminology.
# TODO(@sternenseemann): investigate coreutils dependencies and pass absolute paths
preConfigure = ''
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
export "''${env#TARGET_}=''${!env}"
done
# GHC is a bit confused on its cross terminology, as these would normally be
# the *host* tools.
export CC="${targetCC}/bin/${targetCC.targetPrefix}cc"
export CXX="${targetCC}/bin/${targetCC.targetPrefix}c++"
# Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${lib.optionalString useLdGold ".gold"}"
export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as"
export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar"
export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm"
export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib"
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
export STRIP="${bintoolsFor.strip}/bin/${bintoolsFor.strip.targetPrefix}strip"
'' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") ''
export OTOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}otool"
export INSTALL_NAME_TOOL="${bintoolsFor.install_name_tool}/bin/${bintoolsFor.install_name_tool.targetPrefix}install_name_tool"
'' + lib.optionalString useLLVM ''
export LLC="${lib.getBin buildTargetLlvmPackages.llvm}/bin/llc"
export OPT="${lib.getBin buildTargetLlvmPackages.llvm}/bin/opt"
'' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
export CLANG="${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
'' + ''
echo -n "${buildMK}" > mk/build.mk
'' + lib.optionalString (stdenv.isLinux && hostPlatform.libc == "glibc") ''
export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"
'' + lib.optionalString (!stdenv.isDarwin) ''
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
'' + lib.optionalString stdenv.isDarwin ''
export NIX_LDFLAGS+=" -no_dtrace_dof"
# GHC tries the host xattr /usr/bin/xattr by default which fails since it expects python to be 2.7
export XATTR=${lib.getBin xattr}/bin/xattr
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets
'' + lib.optionalString targetPlatform.isMusl ''
echo "patching llvm-targets for musl targets..."
echo "Cloning these existing '*-linux-gnu*' targets:"
grep linux-gnu llvm-targets | sed 's/^/ /'
echo "(go go gadget sed)"
sed -i 's,\(^.*linux-\)gnu\(.*\)$,\0\n\1musl\2,' llvm-targets
echo "llvm-targets now contains these '*-linux-musl*' targets:"
grep linux-musl llvm-targets | sed 's/^/ /'
echo "And now patching to preserve '-musleabi' as done with '-gnueabi'"
# (aclocal.m4 is actual source, but patch configure as well since we don't re-gen)
for x in configure aclocal.m4; do
substituteInPlace $x \
--replace '*-android*|*-gnueabi*)' \
'*-android*|*-gnueabi*|*-musleabi*)'
done
'';
# TODO(@Ericson2314): Always pass "--target" and always prefix.
configurePlatforms = [ "build" "host" ]
++ lib.optional (targetPlatform != hostPlatform) "target";
# `--with` flags for libraries needed for RTS linker
configureFlags = [
"--datadir=$doc/share/doc/ghc"
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
] ++ lib.optionals (libffi != null) [
"--with-system-libffi"
"--with-ffi-includes=${targetPackages.libffi.dev}/include"
"--with-ffi-libraries=${targetPackages.libffi.out}/lib"
] ++ lib.optionals (targetPlatform == hostPlatform && !enableNativeBignum) [
"--with-gmp-includes=${targetPackages.gmp.dev}/include"
"--with-gmp-libraries=${targetPackages.gmp.out}/lib"
] ++ lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
"--with-iconv-includes=${libiconv}/include"
"--with-iconv-libraries=${libiconv}/lib"
] ++ lib.optionals (targetPlatform != hostPlatform) [
"--enable-bootstrap-with-devel-snapshot"
] ++ lib.optionals useLdGold [
"CFLAGS=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
] ++ lib.optionals (disableLargeAddressSpace) [
"--disable-large-address-space"
];
# Make sure we never relax`$PATH` and hooks support for compatibility.
strictDeps = true;
# Dont add -liconv to LDFLAGS automatically so that GHC will add it itself.
dontAddExtraLibs = true;
nativeBuildInputs = [
perl autoconf automake m4 python3
ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
autoSignDarwinBinariesHook
] ++ lib.optionals enableDocs [
sphinx
];
# For building runtime libs
depsBuildTarget = toolsForTarget;
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
depsTargetTarget = map lib.getDev (libDeps targetPlatform);
depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);
# required, because otherwise all symbols from HSffi.o are stripped, and
# that in turn causes GHCi to abort
stripDebugFlags = [ "-S" ] ++ lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
checkTarget = "test";
hardeningDisable =
[ "format" ]
# In nixpkgs, musl based builds currently enable `pie` hardening by default
# (see `defaultHardeningFlags` in `make-derivation.nix`).
# But GHC cannot currently produce outputs that are ready for `-pie` linking.
# Thus, disable `pie` hardening, otherwise `recompile with -fPIE` errors appear.
# See:
# * https://github.com/NixOS/nixpkgs/issues/129247
# * https://gitlab.haskell.org/ghc/ghc/-/issues/19580
++ lib.optional stdenv.targetPlatform.isMusl "pie";
# big-parallel allows us to build with more than 2 cores on
# Hydra which already warrants a significant speedup
requiredSystemFeatures = [ "big-parallel" ];
postInstall = ''
# Install the bash completion file.
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
'';
passthru = {
inherit bootPkgs targetPrefix;
inherit llvmPackages;
inherit enableShared;
# This is used by the haskell builder to query
# the presence of the haddock program.
hasHaddock = enableHaddockProgram;
# Our Cabal compiler name
haskellCompilerName = "ghc-${version}";
};
meta = {
homepage = "http://haskell.org/ghc";
description = "The Glasgow Haskell Compiler";
maintainers = with lib.maintainers; [
guibou
] ++ lib.teams.haskell.members;
timeout = 24 * 3600;
inherit (ghc.meta) license platforms;
};
} // lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
dontStrip = true;
dontPatchELF = true;
noAuditTmpdir = true;
})
sha256 = "0606797d1b38e2d88ee2243f38ec6b9a1aa93e9b578e95f0de9a9c0a4144021c";
}
+3 -388
View File
@@ -1,389 +1,4 @@
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
# build-tools
, bootPkgs
, autoconf, automake, coreutils, fetchpatch, fetchurl, perl, python3, m4, sphinx
, xattr, autoSignDarwinBinariesHook
, bash
, libiconv ? null, ncurses
, glibcLocales ? null
, # GHC can be built with system libffi or a bundled one.
libffi ? null
, useLLVM ? !(stdenv.targetPlatform.isx86
|| stdenv.targetPlatform.isPower
|| stdenv.targetPlatform.isSparc
|| stdenv.targetPlatform.isAarch64)
, # LLVM is conceptually a run-time-only dependency, but for
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
# build-time dependency too.
buildTargetLlvmPackages, llvmPackages
, # If enabled, GHC will be built with the GPL-free but slightly slower native
# bignum backend instead of the faster but GPLed gmp backend.
enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp
&& lib.meta.availableOn stdenv.targetPlatform gmp)
, gmp
, # If enabled, use -fPIC when compiling static libs.
enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
, enableProfiledLibs ? true
, # Whether to build dynamic libs for the standard library (on the target
# platform). Static libs are always built.
enableShared ? with stdenv.targetPlatform; !isWindows && !useiOSPrebuilt && !isStatic
, # Whether to build terminfo.
enableTerminfo ? !stdenv.targetPlatform.isWindows
, # What flavour to build. An empty string indicates no
# specific flavour and falls back to ghc default values.
ghcFlavour ? lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
(if useLLVM then "perf-cross" else "perf-cross-ncg")
, # Whether to build sphinx documentation.
enableDocs ? (
# Docs disabled if we are building on musl because it's a large task to keep
# all `sphinx` dependencies building in this environment.
!stdenv.buildPlatform.isMusl
)
, enableHaddockProgram ?
# Disabled for cross; see note [HADDOCK_DOCS].
(stdenv.targetPlatform == stdenv.hostPlatform)
, # Whether to disable the large address space allocator
# necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
}:
assert !enableNativeBignum -> gmp != null;
# Cross cannot currently build the `haddock` program for silly reasons,
# see note [HADDOCK_DOCS].
assert (stdenv.targetPlatform != stdenv.hostPlatform) -> !enableHaddockProgram;
let
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
inherit (bootPkgs) ghc;
# TODO(@Ericson2314) Make unconditional
targetPrefix = lib.optionalString
(targetPlatform != hostPlatform)
"${targetPlatform.config}-";
buildMK = ''
BuildFlavour = ${ghcFlavour}
ifneq \"\$(BuildFlavour)\" \"\"
include mk/flavours/\$(BuildFlavour).mk
endif
BUILD_SPHINX_HTML = ${if enableDocs then "YES" else "NO"}
BUILD_SPHINX_PDF = NO
'' +
# Note [HADDOCK_DOCS]:
# Unfortunately currently `HADDOCK_DOCS` controls both whether the `haddock`
# program is built (which we generally always want to have a complete GHC install)
# and whether it is run on the GHC sources to generate hyperlinked source code
# (which is impossible for cross-compilation); see:
# https://gitlab.haskell.org/ghc/ghc/-/issues/20077
# This implies that currently a cross-compiled GHC will never have a `haddock`
# program, so it can never generate haddocks for any packages.
# If this is solved in the future, we'd like to unconditionally
# build the haddock program (removing the `enableHaddockProgram` option).
''
HADDOCK_DOCS = ${if enableHaddockProgram then "YES" else "NO"}
# Build haddocks for boot packages with hyperlinking
EXTRA_HADDOCK_OPTS += --hyperlinked-source --quickjump
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
BIGNUM_BACKEND = ${if enableNativeBignum then "native" else "gmp"}
'' + lib.optionalString (targetPlatform != hostPlatform) ''
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
CrossCompilePrefix = ${targetPrefix}
'' + lib.optionalString (!enableProfiledLibs) ''
BUILD_PROF_LIBS = NO
'' +
# -fexternal-dynamic-refs apparently (because it's not clear from the documentation)
# makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell.
# This solution was described in https://www.tweag.io/blog/2020-09-30-bazel-static-haskell
lib.optionalString enableRelocatedStaticLibs ''
GhcLibHcOpts += -fPIC -fexternal-dynamic-refs
GhcRtsHcOpts += -fPIC -fexternal-dynamic-refs
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
EXTRA_CC_OPTS += -std=gnu99
'';
# Splicer will pull out correct variations
libDeps = platform: lib.optional enableTerminfo ncurses
++ [libffi]
++ lib.optional (!enableNativeBignum) gmp
++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
# TODO(@sternenseemann): is buildTarget LLVM unnecessary?
# GHC doesn't seem to have {LLC,OPT}_HOST
toolsForTarget = [
pkgsBuildTarget.targetPackages.stdenv.cc
] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm;
targetCC = builtins.head toolsForTarget;
# Sometimes we have to dispatch between the bintools wrapper and the unwrapped
# derivation for certain tools depending on the platform.
bintoolsFor = {
# GHC needs install_name_tool on all darwin platforms. On aarch64-darwin it is
# part of the bintools wrapper (due to codesigning requirements), but not on
# x86_64-darwin.
install_name_tool =
if stdenv.targetPlatform.isAarch64
then targetCC.bintools
else targetCC.bintools.bintools;
# Same goes for strip.
strip =
# TODO(@sternenseemann): also use wrapper if linker == "bfd" or "gold"
if stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin
then targetCC.bintools
else targetCC.bintools.bintools;
};
# Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues.
# But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
# see #84670 and #49071 for more background.
useLdGold = targetPlatform.linker == "gold" ||
(targetPlatform.linker == "bfd" && (targetCC.bintools.bintools.hasGold or false) && !targetPlatform.isMusl);
# Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
variantSuffix = lib.concatStrings [
(lib.optionalString stdenv.hostPlatform.isMusl "-musl")
(lib.optionalString enableNativeBignum "-native-bignum")
];
in
# C compiler, bintools and LLVM are used at build time, but will also leak into
# the resulting GHC's settings file and used at runtime. This means that we are
# currently only able to build GHC if hostPlatform == buildPlatform.
assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
stdenv.mkDerivation (rec {
import ./common-make-native-bignum.nix {
version = "9.2.6";
pname = "${targetPrefix}ghc${variantSuffix}";
src = fetchurl {
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
sha256 = "7a54cf0398ad488b4ed219e15d1d1e64c0b6876c43a0564550dd11f0540d7305";
};
enableParallelBuilding = true;
outputs = [ "out" "doc" ];
patches = [
# Fix docs build with sphinx >= 6.0
# https://gitlab.haskell.org/ghc/ghc/-/issues/22766
(fetchpatch {
name = "ghc-docs-sphinx-6.0.patch";
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/10e94a556b4f90769b7fd718b9790d58ae566600.patch";
sha256 = "0kmhfamr16w8gch0lgln2912r8aryjky1hfcda3jkcwa5cdzgjdv";
})
# Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
./docs-sphinx-7.patch
# fix hyperlinked haddock sources: https://github.com/haskell/haddock/pull/1482
(fetchpatch {
url = "https://patch-diff.githubusercontent.com/raw/haskell/haddock/pull/1482.patch";
sha256 = "sha256-8w8QUCsODaTvknCDGgTfFNZa8ZmvIKaKS+2ZJZ9foYk=";
extraPrefix = "utils/haddock/";
stripLen = 1;
})
# Don't generate code that doesn't compile when --enable-relocatable is passed to Setup.hs
# Can be removed if the Cabal library included with ghc backports the linked fix
(fetchpatch {
url = "https://github.com/haskell/cabal/commit/6c796218c92f93c95e94d5ec2d077f6956f68e98.patch";
stripLen = 1;
extraPrefix = "libraries/Cabal/";
sha256 = "sha256-yRQ6YmMiwBwiYseC5BsrEtDgFbWvst+maGgDtdD0vAY=";
})
] ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
# Prevent the paths module from emitting symbols that we don't use
# when building with separate outputs.
#
# These cause problems as they're not eliminated by GHC's dead code
# elimination on aarch64-darwin. (see
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
];
postPatch = "patchShebangs .";
# GHC needs the locale configured during the Haddock phase.
LANG = "en_US.UTF-8";
# GHC is a bit confused on its cross terminology.
# TODO(@sternenseemann): investigate coreutils dependencies and pass absolute paths
preConfigure = ''
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
export "''${env#TARGET_}=''${!env}"
done
# GHC is a bit confused on its cross terminology, as these would normally be
# the *host* tools.
export CC="${targetCC}/bin/${targetCC.targetPrefix}cc"
export CXX="${targetCC}/bin/${targetCC.targetPrefix}c++"
# Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${lib.optionalString useLdGold ".gold"}"
export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as"
export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar"
export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm"
export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib"
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
export STRIP="${bintoolsFor.strip}/bin/${bintoolsFor.strip.targetPrefix}strip"
'' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") ''
export OTOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}otool"
export INSTALL_NAME_TOOL="${bintoolsFor.install_name_tool}/bin/${bintoolsFor.install_name_tool.targetPrefix}install_name_tool"
'' + lib.optionalString useLLVM ''
export LLC="${lib.getBin buildTargetLlvmPackages.llvm}/bin/llc"
export OPT="${lib.getBin buildTargetLlvmPackages.llvm}/bin/opt"
'' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
export CLANG="${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
'' + ''
echo -n "${buildMK}" > mk/build.mk
'' + lib.optionalString (stdenv.isLinux && hostPlatform.libc == "glibc") ''
export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"
'' + lib.optionalString (!stdenv.isDarwin) ''
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
'' + lib.optionalString stdenv.isDarwin ''
export NIX_LDFLAGS+=" -no_dtrace_dof"
# GHC tries the host xattr /usr/bin/xattr by default which fails since it expects python to be 2.7
export XATTR=${lib.getBin xattr}/bin/xattr
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets
'' + lib.optionalString targetPlatform.isMusl ''
echo "patching llvm-targets for musl targets..."
echo "Cloning these existing '*-linux-gnu*' targets:"
grep linux-gnu llvm-targets | sed 's/^/ /'
echo "(go go gadget sed)"
sed -i 's,\(^.*linux-\)gnu\(.*\)$,\0\n\1musl\2,' llvm-targets
echo "llvm-targets now contains these '*-linux-musl*' targets:"
grep linux-musl llvm-targets | sed 's/^/ /'
echo "And now patching to preserve '-musleabi' as done with '-gnueabi'"
# (aclocal.m4 is actual source, but patch configure as well since we don't re-gen)
for x in configure aclocal.m4; do
substituteInPlace $x \
--replace '*-android*|*-gnueabi*)' \
'*-android*|*-gnueabi*|*-musleabi*)'
done
'';
# TODO(@Ericson2314): Always pass "--target" and always prefix.
configurePlatforms = [ "build" "host" ]
++ lib.optional (targetPlatform != hostPlatform) "target";
# `--with` flags for libraries needed for RTS linker
configureFlags = [
"--datadir=$doc/share/doc/ghc"
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
] ++ lib.optionals (libffi != null) [
"--with-system-libffi"
"--with-ffi-includes=${targetPackages.libffi.dev}/include"
"--with-ffi-libraries=${targetPackages.libffi.out}/lib"
] ++ lib.optionals (targetPlatform == hostPlatform && !enableNativeBignum) [
"--with-gmp-includes=${targetPackages.gmp.dev}/include"
"--with-gmp-libraries=${targetPackages.gmp.out}/lib"
] ++ lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
"--with-iconv-includes=${libiconv}/include"
"--with-iconv-libraries=${libiconv}/lib"
] ++ lib.optionals (targetPlatform != hostPlatform) [
"--enable-bootstrap-with-devel-snapshot"
] ++ lib.optionals useLdGold [
"CFLAGS=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
] ++ lib.optionals (disableLargeAddressSpace) [
"--disable-large-address-space"
];
# Make sure we never relax`$PATH` and hooks support for compatibility.
strictDeps = true;
# Dont add -liconv to LDFLAGS automatically so that GHC will add it itself.
dontAddExtraLibs = true;
nativeBuildInputs = [
perl autoconf automake m4 python3
ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
autoSignDarwinBinariesHook
] ++ lib.optionals enableDocs [
sphinx
];
# For building runtime libs
depsBuildTarget = toolsForTarget;
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
depsTargetTarget = map lib.getDev (libDeps targetPlatform);
depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);
# required, because otherwise all symbols from HSffi.o are stripped, and
# that in turn causes GHCi to abort
stripDebugFlags = [ "-S" ] ++ lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
checkTarget = "test";
hardeningDisable =
[ "format" ]
# In nixpkgs, musl based builds currently enable `pie` hardening by default
# (see `defaultHardeningFlags` in `make-derivation.nix`).
# But GHC cannot currently produce outputs that are ready for `-pie` linking.
# Thus, disable `pie` hardening, otherwise `recompile with -fPIE` errors appear.
# See:
# * https://github.com/NixOS/nixpkgs/issues/129247
# * https://gitlab.haskell.org/ghc/ghc/-/issues/19580
++ lib.optional stdenv.targetPlatform.isMusl "pie";
# big-parallel allows us to build with more than 2 cores on
# Hydra which already warrants a significant speedup
requiredSystemFeatures = [ "big-parallel" ];
postInstall = ''
# Install the bash completion file.
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
'';
passthru = {
inherit bootPkgs targetPrefix;
inherit llvmPackages;
inherit enableShared;
# This is used by the haskell builder to query
# the presence of the haddock program.
hasHaddock = enableHaddockProgram;
# Our Cabal compiler name
haskellCompilerName = "ghc-${version}";
};
meta = {
homepage = "http://haskell.org/ghc";
description = "The Glasgow Haskell Compiler";
maintainers = with lib.maintainers; [
guibou
] ++ lib.teams.haskell.members;
timeout = 24 * 3600;
inherit (ghc.meta) license platforms;
};
} // lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
dontStrip = true;
dontPatchELF = true;
noAuditTmpdir = true;
})
sha256 = "7a54cf0398ad488b4ed219e15d1d1e64c0b6876c43a0564550dd11f0540d7305";
}
+3 -388
View File
@@ -1,389 +1,4 @@
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
# build-tools
, bootPkgs
, autoconf, automake, coreutils, fetchpatch, fetchurl, perl, python3, m4, sphinx
, xattr, autoSignDarwinBinariesHook
, bash
, libiconv ? null, ncurses
, glibcLocales ? null
, # GHC can be built with system libffi or a bundled one.
libffi ? null
, useLLVM ? !(stdenv.targetPlatform.isx86
|| stdenv.targetPlatform.isPower
|| stdenv.targetPlatform.isSparc
|| stdenv.targetPlatform.isAarch64)
, # LLVM is conceptually a run-time-only dependency, but for
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
# build-time dependency too.
buildTargetLlvmPackages, llvmPackages
, # If enabled, GHC will be built with the GPL-free but slightly slower native
# bignum backend instead of the faster but GPLed gmp backend.
enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp
&& lib.meta.availableOn stdenv.targetPlatform gmp)
, gmp
, # If enabled, use -fPIC when compiling static libs.
enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
, enableProfiledLibs ? true
, # Whether to build dynamic libs for the standard library (on the target
# platform). Static libs are always built.
enableShared ? with stdenv.targetPlatform; !isWindows && !useiOSPrebuilt && !isStatic
, # Whether to build terminfo.
enableTerminfo ? !stdenv.targetPlatform.isWindows
, # What flavour to build. An empty string indicates no
# specific flavour and falls back to ghc default values.
ghcFlavour ? lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
(if useLLVM then "perf-cross" else "perf-cross-ncg")
, # Whether to build sphinx documentation.
enableDocs ? (
# Docs disabled if we are building on musl because it's a large task to keep
# all `sphinx` dependencies building in this environment.
!stdenv.buildPlatform.isMusl
)
, enableHaddockProgram ?
# Disabled for cross; see note [HADDOCK_DOCS].
(stdenv.targetPlatform == stdenv.hostPlatform)
, # Whether to disable the large address space allocator
# necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
}:
assert !enableNativeBignum -> gmp != null;
# Cross cannot currently build the `haddock` program for silly reasons,
# see note [HADDOCK_DOCS].
assert (stdenv.targetPlatform != stdenv.hostPlatform) -> !enableHaddockProgram;
let
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
inherit (bootPkgs) ghc;
# TODO(@Ericson2314) Make unconditional
targetPrefix = lib.optionalString
(targetPlatform != hostPlatform)
"${targetPlatform.config}-";
buildMK = ''
BuildFlavour = ${ghcFlavour}
ifneq \"\$(BuildFlavour)\" \"\"
include mk/flavours/\$(BuildFlavour).mk
endif
BUILD_SPHINX_HTML = ${if enableDocs then "YES" else "NO"}
BUILD_SPHINX_PDF = NO
'' +
# Note [HADDOCK_DOCS]:
# Unfortunately currently `HADDOCK_DOCS` controls both whether the `haddock`
# program is built (which we generally always want to have a complete GHC install)
# and whether it is run on the GHC sources to generate hyperlinked source code
# (which is impossible for cross-compilation); see:
# https://gitlab.haskell.org/ghc/ghc/-/issues/20077
# This implies that currently a cross-compiled GHC will never have a `haddock`
# program, so it can never generate haddocks for any packages.
# If this is solved in the future, we'd like to unconditionally
# build the haddock program (removing the `enableHaddockProgram` option).
''
HADDOCK_DOCS = ${if enableHaddockProgram then "YES" else "NO"}
# Build haddocks for boot packages with hyperlinking
EXTRA_HADDOCK_OPTS += --hyperlinked-source --quickjump
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
BIGNUM_BACKEND = ${if enableNativeBignum then "native" else "gmp"}
'' + lib.optionalString (targetPlatform != hostPlatform) ''
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
CrossCompilePrefix = ${targetPrefix}
'' + lib.optionalString (!enableProfiledLibs) ''
BUILD_PROF_LIBS = NO
'' +
# -fexternal-dynamic-refs apparently (because it's not clear from the documentation)
# makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell.
# This solution was described in https://www.tweag.io/blog/2020-09-30-bazel-static-haskell
lib.optionalString enableRelocatedStaticLibs ''
GhcLibHcOpts += -fPIC -fexternal-dynamic-refs
GhcRtsHcOpts += -fPIC -fexternal-dynamic-refs
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
EXTRA_CC_OPTS += -std=gnu99
'';
# Splicer will pull out correct variations
libDeps = platform: lib.optional enableTerminfo ncurses
++ [libffi]
++ lib.optional (!enableNativeBignum) gmp
++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
# TODO(@sternenseemann): is buildTarget LLVM unnecessary?
# GHC doesn't seem to have {LLC,OPT}_HOST
toolsForTarget = [
pkgsBuildTarget.targetPackages.stdenv.cc
] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm;
targetCC = builtins.head toolsForTarget;
# Sometimes we have to dispatch between the bintools wrapper and the unwrapped
# derivation for certain tools depending on the platform.
bintoolsFor = {
# GHC needs install_name_tool on all darwin platforms. On aarch64-darwin it is
# part of the bintools wrapper (due to codesigning requirements), but not on
# x86_64-darwin.
install_name_tool =
if stdenv.targetPlatform.isAarch64
then targetCC.bintools
else targetCC.bintools.bintools;
# Same goes for strip.
strip =
# TODO(@sternenseemann): also use wrapper if linker == "bfd" or "gold"
if stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin
then targetCC.bintools
else targetCC.bintools.bintools;
};
# Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues.
# But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
# see #84670 and #49071 for more background.
useLdGold = targetPlatform.linker == "gold" ||
(targetPlatform.linker == "bfd" && (targetCC.bintools.bintools.hasGold or false) && !targetPlatform.isMusl);
# Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
variantSuffix = lib.concatStrings [
(lib.optionalString stdenv.hostPlatform.isMusl "-musl")
(lib.optionalString enableNativeBignum "-native-bignum")
];
in
# C compiler, bintools and LLVM are used at build time, but will also leak into
# the resulting GHC's settings file and used at runtime. This means that we are
# currently only able to build GHC if hostPlatform == buildPlatform.
assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
stdenv.mkDerivation (rec {
import ./common-make-native-bignum.nix {
version = "9.2.7";
pname = "${targetPrefix}ghc${variantSuffix}";
src = fetchurl {
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
sha256 = "a253567a17b734a4c0dd0ffa296d33c2a5b5a54a77df988806a2a1e1ca7e88b8";
};
enableParallelBuilding = true;
outputs = [ "out" "doc" ];
patches = [
# Fix docs build with sphinx >= 6.0
# https://gitlab.haskell.org/ghc/ghc/-/issues/22766
(fetchpatch {
name = "ghc-docs-sphinx-6.0.patch";
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/10e94a556b4f90769b7fd718b9790d58ae566600.patch";
sha256 = "0kmhfamr16w8gch0lgln2912r8aryjky1hfcda3jkcwa5cdzgjdv";
})
# Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
./docs-sphinx-7.patch
# fix hyperlinked haddock sources: https://github.com/haskell/haddock/pull/1482
(fetchpatch {
url = "https://patch-diff.githubusercontent.com/raw/haskell/haddock/pull/1482.patch";
sha256 = "sha256-8w8QUCsODaTvknCDGgTfFNZa8ZmvIKaKS+2ZJZ9foYk=";
extraPrefix = "utils/haddock/";
stripLen = 1;
})
# Don't generate code that doesn't compile when --enable-relocatable is passed to Setup.hs
# Can be removed if the Cabal library included with ghc backports the linked fix
(fetchpatch {
url = "https://github.com/haskell/cabal/commit/6c796218c92f93c95e94d5ec2d077f6956f68e98.patch";
stripLen = 1;
extraPrefix = "libraries/Cabal/";
sha256 = "sha256-yRQ6YmMiwBwiYseC5BsrEtDgFbWvst+maGgDtdD0vAY=";
})
] ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
# Prevent the paths module from emitting symbols that we don't use
# when building with separate outputs.
#
# These cause problems as they're not eliminated by GHC's dead code
# elimination on aarch64-darwin. (see
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
];
postPatch = "patchShebangs .";
# GHC needs the locale configured during the Haddock phase.
LANG = "en_US.UTF-8";
# GHC is a bit confused on its cross terminology.
# TODO(@sternenseemann): investigate coreutils dependencies and pass absolute paths
preConfigure = ''
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
export "''${env#TARGET_}=''${!env}"
done
# GHC is a bit confused on its cross terminology, as these would normally be
# the *host* tools.
export CC="${targetCC}/bin/${targetCC.targetPrefix}cc"
export CXX="${targetCC}/bin/${targetCC.targetPrefix}c++"
# Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${lib.optionalString useLdGold ".gold"}"
export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as"
export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar"
export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm"
export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib"
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
export STRIP="${bintoolsFor.strip}/bin/${bintoolsFor.strip.targetPrefix}strip"
'' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") ''
export OTOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}otool"
export INSTALL_NAME_TOOL="${bintoolsFor.install_name_tool}/bin/${bintoolsFor.install_name_tool.targetPrefix}install_name_tool"
'' + lib.optionalString useLLVM ''
export LLC="${lib.getBin buildTargetLlvmPackages.llvm}/bin/llc"
export OPT="${lib.getBin buildTargetLlvmPackages.llvm}/bin/opt"
'' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
export CLANG="${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
'' + ''
echo -n "${buildMK}" > mk/build.mk
'' + lib.optionalString (stdenv.isLinux && hostPlatform.libc == "glibc") ''
export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"
'' + lib.optionalString (!stdenv.isDarwin) ''
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
'' + lib.optionalString stdenv.isDarwin ''
export NIX_LDFLAGS+=" -no_dtrace_dof"
# GHC tries the host xattr /usr/bin/xattr by default which fails since it expects python to be 2.7
export XATTR=${lib.getBin xattr}/bin/xattr
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets
'' + lib.optionalString targetPlatform.isMusl ''
echo "patching llvm-targets for musl targets..."
echo "Cloning these existing '*-linux-gnu*' targets:"
grep linux-gnu llvm-targets | sed 's/^/ /'
echo "(go go gadget sed)"
sed -i 's,\(^.*linux-\)gnu\(.*\)$,\0\n\1musl\2,' llvm-targets
echo "llvm-targets now contains these '*-linux-musl*' targets:"
grep linux-musl llvm-targets | sed 's/^/ /'
echo "And now patching to preserve '-musleabi' as done with '-gnueabi'"
# (aclocal.m4 is actual source, but patch configure as well since we don't re-gen)
for x in configure aclocal.m4; do
substituteInPlace $x \
--replace '*-android*|*-gnueabi*)' \
'*-android*|*-gnueabi*|*-musleabi*)'
done
'';
# TODO(@Ericson2314): Always pass "--target" and always prefix.
configurePlatforms = [ "build" "host" ]
++ lib.optional (targetPlatform != hostPlatform) "target";
# `--with` flags for libraries needed for RTS linker
configureFlags = [
"--datadir=$doc/share/doc/ghc"
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
] ++ lib.optionals (libffi != null) [
"--with-system-libffi"
"--with-ffi-includes=${targetPackages.libffi.dev}/include"
"--with-ffi-libraries=${targetPackages.libffi.out}/lib"
] ++ lib.optionals (targetPlatform == hostPlatform && !enableNativeBignum) [
"--with-gmp-includes=${targetPackages.gmp.dev}/include"
"--with-gmp-libraries=${targetPackages.gmp.out}/lib"
] ++ lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
"--with-iconv-includes=${libiconv}/include"
"--with-iconv-libraries=${libiconv}/lib"
] ++ lib.optionals (targetPlatform != hostPlatform) [
"--enable-bootstrap-with-devel-snapshot"
] ++ lib.optionals useLdGold [
"CFLAGS=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
] ++ lib.optionals (disableLargeAddressSpace) [
"--disable-large-address-space"
];
# Make sure we never relax`$PATH` and hooks support for compatibility.
strictDeps = true;
# Dont add -liconv to LDFLAGS automatically so that GHC will add it itself.
dontAddExtraLibs = true;
nativeBuildInputs = [
perl autoconf automake m4 python3
ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
autoSignDarwinBinariesHook
] ++ lib.optionals enableDocs [
sphinx
];
# For building runtime libs
depsBuildTarget = toolsForTarget;
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
depsTargetTarget = map lib.getDev (libDeps targetPlatform);
depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);
# required, because otherwise all symbols from HSffi.o are stripped, and
# that in turn causes GHCi to abort
stripDebugFlags = [ "-S" ] ++ lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
checkTarget = "test";
hardeningDisable =
[ "format" ]
# In nixpkgs, musl based builds currently enable `pie` hardening by default
# (see `defaultHardeningFlags` in `make-derivation.nix`).
# But GHC cannot currently produce outputs that are ready for `-pie` linking.
# Thus, disable `pie` hardening, otherwise `recompile with -fPIE` errors appear.
# See:
# * https://github.com/NixOS/nixpkgs/issues/129247
# * https://gitlab.haskell.org/ghc/ghc/-/issues/19580
++ lib.optional stdenv.targetPlatform.isMusl "pie";
# big-parallel allows us to build with more than 2 cores on
# Hydra which already warrants a significant speedup
requiredSystemFeatures = [ "big-parallel" ];
postInstall = ''
# Install the bash completion file.
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
'';
passthru = {
inherit bootPkgs targetPrefix;
inherit llvmPackages;
inherit enableShared;
# This is used by the haskell builder to query
# the presence of the haddock program.
hasHaddock = enableHaddockProgram;
# Our Cabal compiler name
haskellCompilerName = "ghc-${version}";
};
meta = {
homepage = "http://haskell.org/ghc";
description = "The Glasgow Haskell Compiler";
maintainers = with lib.maintainers; [
guibou
] ++ lib.teams.haskell.members;
timeout = 24 * 3600;
inherit (ghc.meta) license platforms;
};
} // lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
dontStrip = true;
dontPatchELF = true;
noAuditTmpdir = true;
})
sha256 = "a253567a17b734a4c0dd0ffa296d33c2a5b5a54a77df988806a2a1e1ca7e88b8";
}
+3 -388
View File
@@ -1,389 +1,4 @@
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
# build-tools
, bootPkgs
, autoconf, automake, coreutils, fetchpatch, fetchurl, perl, python3, m4, sphinx
, xattr, autoSignDarwinBinariesHook
, bash
, libiconv ? null, ncurses
, glibcLocales ? null
, # GHC can be built with system libffi or a bundled one.
libffi ? null
, useLLVM ? !(stdenv.targetPlatform.isx86
|| stdenv.targetPlatform.isPower
|| stdenv.targetPlatform.isSparc
|| stdenv.targetPlatform.isAarch64)
, # LLVM is conceptually a run-time-only dependency, but for
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
# build-time dependency too.
buildTargetLlvmPackages, llvmPackages
, # If enabled, GHC will be built with the GPL-free but slightly slower native
# bignum backend instead of the faster but GPLed gmp backend.
enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp
&& lib.meta.availableOn stdenv.targetPlatform gmp)
, gmp
, # If enabled, use -fPIC when compiling static libs.
enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
, enableProfiledLibs ? true
, # Whether to build dynamic libs for the standard library (on the target
# platform). Static libs are always built.
enableShared ? with stdenv.targetPlatform; !isWindows && !useiOSPrebuilt && !isStatic
, # Whether to build terminfo.
enableTerminfo ? !stdenv.targetPlatform.isWindows
, # What flavour to build. An empty string indicates no
# specific flavour and falls back to ghc default values.
ghcFlavour ? lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
(if useLLVM then "perf-cross" else "perf-cross-ncg")
, # Whether to build sphinx documentation.
enableDocs ? (
# Docs disabled if we are building on musl because it's a large task to keep
# all `sphinx` dependencies building in this environment.
!stdenv.buildPlatform.isMusl
)
, enableHaddockProgram ?
# Disabled for cross; see note [HADDOCK_DOCS].
(stdenv.targetPlatform == stdenv.hostPlatform)
, # Whether to disable the large address space allocator
# necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
}:
assert !enableNativeBignum -> gmp != null;
# Cross cannot currently build the `haddock` program for silly reasons,
# see note [HADDOCK_DOCS].
assert (stdenv.targetPlatform != stdenv.hostPlatform) -> !enableHaddockProgram;
let
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
inherit (bootPkgs) ghc;
# TODO(@Ericson2314) Make unconditional
targetPrefix = lib.optionalString
(targetPlatform != hostPlatform)
"${targetPlatform.config}-";
buildMK = ''
BuildFlavour = ${ghcFlavour}
ifneq \"\$(BuildFlavour)\" \"\"
include mk/flavours/\$(BuildFlavour).mk
endif
BUILD_SPHINX_HTML = ${if enableDocs then "YES" else "NO"}
BUILD_SPHINX_PDF = NO
'' +
# Note [HADDOCK_DOCS]:
# Unfortunately currently `HADDOCK_DOCS` controls both whether the `haddock`
# program is built (which we generally always want to have a complete GHC install)
# and whether it is run on the GHC sources to generate hyperlinked source code
# (which is impossible for cross-compilation); see:
# https://gitlab.haskell.org/ghc/ghc/-/issues/20077
# This implies that currently a cross-compiled GHC will never have a `haddock`
# program, so it can never generate haddocks for any packages.
# If this is solved in the future, we'd like to unconditionally
# build the haddock program (removing the `enableHaddockProgram` option).
''
HADDOCK_DOCS = ${if enableHaddockProgram then "YES" else "NO"}
# Build haddocks for boot packages with hyperlinking
EXTRA_HADDOCK_OPTS += --hyperlinked-source --quickjump
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
BIGNUM_BACKEND = ${if enableNativeBignum then "native" else "gmp"}
'' + lib.optionalString (targetPlatform != hostPlatform) ''
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
CrossCompilePrefix = ${targetPrefix}
'' + lib.optionalString (!enableProfiledLibs) ''
BUILD_PROF_LIBS = NO
'' +
# -fexternal-dynamic-refs apparently (because it's not clear from the documentation)
# makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell.
# This solution was described in https://www.tweag.io/blog/2020-09-30-bazel-static-haskell
lib.optionalString enableRelocatedStaticLibs ''
GhcLibHcOpts += -fPIC -fexternal-dynamic-refs
GhcRtsHcOpts += -fPIC -fexternal-dynamic-refs
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
EXTRA_CC_OPTS += -std=gnu99
'';
# Splicer will pull out correct variations
libDeps = platform: lib.optional enableTerminfo ncurses
++ [libffi]
++ lib.optional (!enableNativeBignum) gmp
++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
# TODO(@sternenseemann): is buildTarget LLVM unnecessary?
# GHC doesn't seem to have {LLC,OPT}_HOST
toolsForTarget = [
pkgsBuildTarget.targetPackages.stdenv.cc
] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm;
targetCC = builtins.head toolsForTarget;
# Sometimes we have to dispatch between the bintools wrapper and the unwrapped
# derivation for certain tools depending on the platform.
bintoolsFor = {
# GHC needs install_name_tool on all darwin platforms. On aarch64-darwin it is
# part of the bintools wrapper (due to codesigning requirements), but not on
# x86_64-darwin.
install_name_tool =
if stdenv.targetPlatform.isAarch64
then targetCC.bintools
else targetCC.bintools.bintools;
# Same goes for strip.
strip =
# TODO(@sternenseemann): also use wrapper if linker == "bfd" or "gold"
if stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin
then targetCC.bintools
else targetCC.bintools.bintools;
};
# Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues.
# But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
# see #84670 and #49071 for more background.
useLdGold = targetPlatform.linker == "gold" ||
(targetPlatform.linker == "bfd" && (targetCC.bintools.bintools.hasGold or false) && !targetPlatform.isMusl);
# Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
variantSuffix = lib.concatStrings [
(lib.optionalString stdenv.hostPlatform.isMusl "-musl")
(lib.optionalString enableNativeBignum "-native-bignum")
];
in
# C compiler, bintools and LLVM are used at build time, but will also leak into
# the resulting GHC's settings file and used at runtime. This means that we are
# currently only able to build GHC if hostPlatform == buildPlatform.
assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
stdenv.mkDerivation (rec {
import ./common-make-native-bignum.nix {
version = "9.2.8";
pname = "${targetPrefix}ghc${variantSuffix}";
src = fetchurl {
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
sha256 = "sha256-XxPReGv0/RL0tF+qN6vttbs/NtXlj32lMH6L/oilZ6E=";
};
enableParallelBuilding = true;
outputs = [ "out" "doc" ];
patches = [
# Fix docs build with sphinx >= 6.0
# https://gitlab.haskell.org/ghc/ghc/-/issues/22766
(fetchpatch {
name = "ghc-docs-sphinx-6.0.patch";
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/10e94a556b4f90769b7fd718b9790d58ae566600.patch";
sha256 = "0kmhfamr16w8gch0lgln2912r8aryjky1hfcda3jkcwa5cdzgjdv";
})
# Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
./docs-sphinx-7.patch
# fix hyperlinked haddock sources: https://github.com/haskell/haddock/pull/1482
(fetchpatch {
url = "https://patch-diff.githubusercontent.com/raw/haskell/haddock/pull/1482.patch";
sha256 = "sha256-8w8QUCsODaTvknCDGgTfFNZa8ZmvIKaKS+2ZJZ9foYk=";
extraPrefix = "utils/haddock/";
stripLen = 1;
})
# Don't generate code that doesn't compile when --enable-relocatable is passed to Setup.hs
# Can be removed if the Cabal library included with ghc backports the linked fix
(fetchpatch {
url = "https://github.com/haskell/cabal/commit/6c796218c92f93c95e94d5ec2d077f6956f68e98.patch";
stripLen = 1;
extraPrefix = "libraries/Cabal/";
sha256 = "sha256-yRQ6YmMiwBwiYseC5BsrEtDgFbWvst+maGgDtdD0vAY=";
})
] ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
# Prevent the paths module from emitting symbols that we don't use
# when building with separate outputs.
#
# These cause problems as they're not eliminated by GHC's dead code
# elimination on aarch64-darwin. (see
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
];
postPatch = "patchShebangs .";
# GHC needs the locale configured during the Haddock phase.
LANG = "en_US.UTF-8";
# GHC is a bit confused on its cross terminology.
# TODO(@sternenseemann): investigate coreutils dependencies and pass absolute paths
preConfigure = ''
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
export "''${env#TARGET_}=''${!env}"
done
# GHC is a bit confused on its cross terminology, as these would normally be
# the *host* tools.
export CC="${targetCC}/bin/${targetCC.targetPrefix}cc"
export CXX="${targetCC}/bin/${targetCC.targetPrefix}c++"
# Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${lib.optionalString useLdGold ".gold"}"
export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as"
export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar"
export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm"
export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib"
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
export STRIP="${bintoolsFor.strip}/bin/${bintoolsFor.strip.targetPrefix}strip"
'' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") ''
export OTOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}otool"
export INSTALL_NAME_TOOL="${bintoolsFor.install_name_tool}/bin/${bintoolsFor.install_name_tool.targetPrefix}install_name_tool"
'' + lib.optionalString useLLVM ''
export LLC="${lib.getBin buildTargetLlvmPackages.llvm}/bin/llc"
export OPT="${lib.getBin buildTargetLlvmPackages.llvm}/bin/opt"
'' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
export CLANG="${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
'' + ''
echo -n "${buildMK}" > mk/build.mk
'' + lib.optionalString (stdenv.isLinux && hostPlatform.libc == "glibc") ''
export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"
'' + lib.optionalString (!stdenv.isDarwin) ''
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
'' + lib.optionalString stdenv.isDarwin ''
export NIX_LDFLAGS+=" -no_dtrace_dof"
# GHC tries the host xattr /usr/bin/xattr by default which fails since it expects python to be 2.7
export XATTR=${lib.getBin xattr}/bin/xattr
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets
'' + lib.optionalString targetPlatform.isMusl ''
echo "patching llvm-targets for musl targets..."
echo "Cloning these existing '*-linux-gnu*' targets:"
grep linux-gnu llvm-targets | sed 's/^/ /'
echo "(go go gadget sed)"
sed -i 's,\(^.*linux-\)gnu\(.*\)$,\0\n\1musl\2,' llvm-targets
echo "llvm-targets now contains these '*-linux-musl*' targets:"
grep linux-musl llvm-targets | sed 's/^/ /'
echo "And now patching to preserve '-musleabi' as done with '-gnueabi'"
# (aclocal.m4 is actual source, but patch configure as well since we don't re-gen)
for x in configure aclocal.m4; do
substituteInPlace $x \
--replace '*-android*|*-gnueabi*)' \
'*-android*|*-gnueabi*|*-musleabi*)'
done
'';
# TODO(@Ericson2314): Always pass "--target" and always prefix.
configurePlatforms = [ "build" "host" ]
++ lib.optional (targetPlatform != hostPlatform) "target";
# `--with` flags for libraries needed for RTS linker
configureFlags = [
"--datadir=$doc/share/doc/ghc"
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
] ++ lib.optionals (libffi != null) [
"--with-system-libffi"
"--with-ffi-includes=${targetPackages.libffi.dev}/include"
"--with-ffi-libraries=${targetPackages.libffi.out}/lib"
] ++ lib.optionals (targetPlatform == hostPlatform && !enableNativeBignum) [
"--with-gmp-includes=${targetPackages.gmp.dev}/include"
"--with-gmp-libraries=${targetPackages.gmp.out}/lib"
] ++ lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
"--with-iconv-includes=${libiconv}/include"
"--with-iconv-libraries=${libiconv}/lib"
] ++ lib.optionals (targetPlatform != hostPlatform) [
"--enable-bootstrap-with-devel-snapshot"
] ++ lib.optionals useLdGold [
"CFLAGS=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
] ++ lib.optionals (disableLargeAddressSpace) [
"--disable-large-address-space"
];
# Make sure we never relax`$PATH` and hooks support for compatibility.
strictDeps = true;
# Dont add -liconv to LDFLAGS automatically so that GHC will add it itself.
dontAddExtraLibs = true;
nativeBuildInputs = [
perl autoconf automake m4 python3
ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
autoSignDarwinBinariesHook
] ++ lib.optionals enableDocs [
sphinx
];
# For building runtime libs
depsBuildTarget = toolsForTarget;
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
depsTargetTarget = map lib.getDev (libDeps targetPlatform);
depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);
# required, because otherwise all symbols from HSffi.o are stripped, and
# that in turn causes GHCi to abort
stripDebugFlags = [ "-S" ] ++ lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
checkTarget = "test";
hardeningDisable =
[ "format" ]
# In nixpkgs, musl based builds currently enable `pie` hardening by default
# (see `defaultHardeningFlags` in `make-derivation.nix`).
# But GHC cannot currently produce outputs that are ready for `-pie` linking.
# Thus, disable `pie` hardening, otherwise `recompile with -fPIE` errors appear.
# See:
# * https://github.com/NixOS/nixpkgs/issues/129247
# * https://gitlab.haskell.org/ghc/ghc/-/issues/19580
++ lib.optional stdenv.targetPlatform.isMusl "pie";
# big-parallel allows us to build with more than 2 cores on
# Hydra which already warrants a significant speedup
requiredSystemFeatures = [ "big-parallel" ];
postInstall = ''
# Install the bash completion file.
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
'';
passthru = {
inherit bootPkgs targetPrefix;
inherit llvmPackages;
inherit enableShared;
# This is used by the haskell builder to query
# the presence of the haddock program.
hasHaddock = enableHaddockProgram;
# Our Cabal compiler name
haskellCompilerName = "ghc-${version}";
};
meta = {
homepage = "http://haskell.org/ghc";
description = "The Glasgow Haskell Compiler";
maintainers = with lib.maintainers; [
guibou
] ++ lib.teams.haskell.members;
timeout = 24 * 3600;
inherit (ghc.meta) license platforms;
};
} // lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
dontStrip = true;
dontPatchELF = true;
noAuditTmpdir = true;
})
sha256 = "sha256-XxPReGv0/RL0tF+qN6vttbs/NtXlj32lMH6L/oilZ6E=";
}
+3 -393
View File
@@ -1,396 +1,6 @@
# DO NOT port this expression to hadrian. It is not possible to build a GHC
# cross compiler with 9.4.* and hadrian.
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
# build-tools
, bootPkgs
, autoconf, automake, coreutils, fetchpatch, fetchurl, perl, python3, m4, sphinx
, xattr, autoSignDarwinBinariesHook
, bash
, libiconv ? null, ncurses
, glibcLocales ? null
, # GHC can be built with system libffi or a bundled one.
libffi ? null
, useLLVM ? !(stdenv.targetPlatform.isx86
|| stdenv.targetPlatform.isPower
|| stdenv.targetPlatform.isSparc
|| stdenv.targetPlatform.isAarch64)
, # LLVM is conceptually a run-time-only dependency, but for
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
# build-time dependency too.
buildTargetLlvmPackages, llvmPackages
, # If enabled, GHC will be built with the GPL-free but slightly slower native
# bignum backend instead of the faster but GPLed gmp backend.
enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp
&& lib.meta.availableOn stdenv.targetPlatform gmp)
, gmp
, # If enabled, use -fPIC when compiling static libs.
enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
, enableProfiledLibs ? true
, # Whether to build dynamic libs for the standard library (on the target
# platform). Static libs are always built.
enableShared ? with stdenv.targetPlatform; !isWindows && !useiOSPrebuilt && !isStatic
, # Whether to build terminfo.
enableTerminfo ? !stdenv.targetPlatform.isWindows
, # What flavour to build. An empty string indicates no
# specific flavour and falls back to ghc default values.
ghcFlavour ? lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
(if useLLVM then "perf-cross" else "perf-cross-ncg")
, # Whether to build sphinx documentation.
enableDocs ? (
# Docs disabled if we are building on musl because it's a large task to keep
# all `sphinx` dependencies building in this environment.
!stdenv.buildPlatform.isMusl
)
, enableHaddockProgram ?
# Disabled for cross; see note [HADDOCK_DOCS].
(stdenv.targetPlatform == stdenv.hostPlatform)
, # Whether to disable the large address space allocator
# necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
}:
assert !enableNativeBignum -> gmp != null;
# Cross cannot currently build the `haddock` program for silly reasons,
# see note [HADDOCK_DOCS].
assert (stdenv.targetPlatform != stdenv.hostPlatform) -> !enableHaddockProgram;
let
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
inherit (bootPkgs) ghc;
# TODO(@Ericson2314) Make unconditional
targetPrefix = lib.optionalString
(targetPlatform != hostPlatform)
"${targetPlatform.config}-";
buildMK = ''
BuildFlavour = ${ghcFlavour}
ifneq \"\$(BuildFlavour)\" \"\"
include mk/flavours/\$(BuildFlavour).mk
endif
BUILD_SPHINX_HTML = ${if enableDocs then "YES" else "NO"}
BUILD_SPHINX_PDF = NO
'' +
# Note [HADDOCK_DOCS]:
# Unfortunately currently `HADDOCK_DOCS` controls both whether the `haddock`
# program is built (which we generally always want to have a complete GHC install)
# and whether it is run on the GHC sources to generate hyperlinked source code
# (which is impossible for cross-compilation); see:
# https://gitlab.haskell.org/ghc/ghc/-/issues/20077
# This implies that currently a cross-compiled GHC will never have a `haddock`
# program, so it can never generate haddocks for any packages.
# If this is solved in the future, we'd like to unconditionally
# build the haddock program (removing the `enableHaddockProgram` option).
''
HADDOCK_DOCS = ${if enableHaddockProgram then "YES" else "NO"}
# Build haddocks for boot packages with hyperlinking
EXTRA_HADDOCK_OPTS += --hyperlinked-source --quickjump
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
BIGNUM_BACKEND = ${if enableNativeBignum then "native" else "gmp"}
'' + lib.optionalString (targetPlatform != hostPlatform) ''
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
CrossCompilePrefix = ${targetPrefix}
'' + lib.optionalString (!enableProfiledLibs) ''
BUILD_PROF_LIBS = NO
'' +
# -fexternal-dynamic-refs apparently (because it's not clear from the documentation)
# makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell.
# This solution was described in https://www.tweag.io/blog/2020-09-30-bazel-static-haskell
lib.optionalString enableRelocatedStaticLibs ''
GhcLibHcOpts += -fPIC -fexternal-dynamic-refs
GhcRtsHcOpts += -fPIC -fexternal-dynamic-refs
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
EXTRA_CC_OPTS += -std=gnu99
'';
# Splicer will pull out correct variations
libDeps = platform: lib.optional enableTerminfo ncurses
++ [libffi]
++ lib.optional (!enableNativeBignum) gmp
++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
# TODO(@sternenseemann): is buildTarget LLVM unnecessary?
# GHC doesn't seem to have {LLC,OPT}_HOST
toolsForTarget = [
pkgsBuildTarget.targetPackages.stdenv.cc
] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm;
targetCC = builtins.head toolsForTarget;
# Sometimes we have to dispatch between the bintools wrapper and the unwrapped
# derivation for certain tools depending on the platform.
bintoolsFor = {
# GHC needs install_name_tool on all darwin platforms. On aarch64-darwin it is
# part of the bintools wrapper (due to codesigning requirements), but not on
# x86_64-darwin.
install_name_tool =
if stdenv.targetPlatform.isAarch64
then targetCC.bintools
else targetCC.bintools.bintools;
# Same goes for strip.
strip =
# TODO(@sternenseemann): also use wrapper if linker == "bfd" or "gold"
if stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin
then targetCC.bintools
else targetCC.bintools.bintools;
};
# Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues.
# But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
# see #84670 and #49071 for more background.
useLdGold = targetPlatform.linker == "gold" ||
(targetPlatform.linker == "bfd" && (targetCC.bintools.bintools.hasGold or false) && !targetPlatform.isMusl);
# Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
variantSuffix = lib.concatStrings [
(lib.optionalString stdenv.hostPlatform.isMusl "-musl")
(lib.optionalString enableNativeBignum "-native-bignum")
];
in
# C compiler, bintools and LLVM are used at build time, but will also leak into
# the resulting GHC's settings file and used at runtime. This means that we are
# currently only able to build GHC if hostPlatform == buildPlatform.
assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
stdenv.mkDerivation (rec {
import ./common-make-native-bignum.nix {
version = "9.4.5";
pname = "${targetPrefix}ghc${variantSuffix}";
src = fetchurl {
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
sha256 = "6256cf9caf6d6dc7b611dcfbb247df2d528e85aa39d22a698e870e5a590e8601";
};
enableParallelBuilding = true;
outputs = [ "out" "doc" ];
patches = [
# Don't generate code that doesn't compile when --enable-relocatable is passed to Setup.hs
# Can be removed if the Cabal library included with ghc backports the linked fix
(fetchpatch {
url = "https://github.com/haskell/cabal/commit/6c796218c92f93c95e94d5ec2d077f6956f68e98.patch";
stripLen = 1;
extraPrefix = "libraries/Cabal/";
sha256 = "sha256-yRQ6YmMiwBwiYseC5BsrEtDgFbWvst+maGgDtdD0vAY=";
})
# Fix docs build with sphinx >= 6.0
# https://gitlab.haskell.org/ghc/ghc/-/issues/22766
(fetchpatch {
name = "ghc-docs-sphinx-6.0.patch";
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/10e94a556b4f90769b7fd718b9790d58ae566600.patch";
sha256 = "0kmhfamr16w8gch0lgln2912r8aryjky1hfcda3jkcwa5cdzgjdv";
})
# Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
./docs-sphinx-7.patch
] ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
# Prevent the paths module from emitting symbols that we don't use
# when building with separate outputs.
#
# These cause problems as they're not eliminated by GHC's dead code
# elimination on aarch64-darwin. (see
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
];
postPatch = "patchShebangs .";
# GHC needs the locale configured during the Haddock phase.
LANG = "en_US.UTF-8";
# GHC is a bit confused on its cross terminology.
# TODO(@sternenseemann): investigate coreutils dependencies and pass absolute paths
preConfigure = ''
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
export "''${env#TARGET_}=''${!env}"
done
# GHC is a bit confused on its cross terminology, as these would normally be
# the *host* tools.
export CC="${targetCC}/bin/${targetCC.targetPrefix}cc"
export CXX="${targetCC}/bin/${targetCC.targetPrefix}c++"
# Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${lib.optionalString useLdGold ".gold"}"
export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as"
export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar"
export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm"
export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib"
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
export STRIP="${bintoolsFor.strip}/bin/${bintoolsFor.strip.targetPrefix}strip"
'' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") ''
export OTOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}otool"
export INSTALL_NAME_TOOL="${bintoolsFor.install_name_tool}/bin/${bintoolsFor.install_name_tool.targetPrefix}install_name_tool"
'' + lib.optionalString useLLVM ''
export LLC="${lib.getBin buildTargetLlvmPackages.llvm}/bin/llc"
export OPT="${lib.getBin buildTargetLlvmPackages.llvm}/bin/opt"
'' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
export CLANG="${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
'' + ''
echo -n "${buildMK}" > mk/build.mk
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
'' + lib.optionalString (stdenv.isLinux && hostPlatform.libc == "glibc") ''
export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"
'' + lib.optionalString (!stdenv.isDarwin) ''
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
'' + lib.optionalString stdenv.isDarwin ''
export NIX_LDFLAGS+=" -no_dtrace_dof"
# GHC tries the host xattr /usr/bin/xattr by default which fails since it expects python to be 2.7
export XATTR=${lib.getBin xattr}/bin/xattr
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets
'' + lib.optionalString targetPlatform.isMusl ''
echo "patching llvm-targets for musl targets..."
echo "Cloning these existing '*-linux-gnu*' targets:"
grep linux-gnu llvm-targets | sed 's/^/ /'
echo "(go go gadget sed)"
sed -i 's,\(^.*linux-\)gnu\(.*\)$,\0\n\1musl\2,' llvm-targets
echo "llvm-targets now contains these '*-linux-musl*' targets:"
grep linux-musl llvm-targets | sed 's/^/ /'
echo "And now patching to preserve '-musleabi' as done with '-gnueabi'"
# (aclocal.m4 is actual source, but patch configure as well since we don't re-gen)
for x in configure aclocal.m4; do
substituteInPlace $x \
--replace '*-android*|*-gnueabi*)' \
'*-android*|*-gnueabi*|*-musleabi*)'
done
''
# HACK: allow bootstrapping with GHC 8.10 which works fine, as we don't have
# binary 9.0 packaged. Bootstrapping with 9.2 is broken without hadrian.
+ ''
substituteInPlace configure --replace \
'MinBootGhcVersion="9.0"' \
'MinBootGhcVersion="8.10"'
'';
# TODO(@Ericson2314): Always pass "--target" and always prefix.
configurePlatforms = [ "build" "host" ]
++ lib.optional (targetPlatform != hostPlatform) "target";
# `--with` flags for libraries needed for RTS linker
configureFlags = [
"--datadir=$doc/share/doc/ghc"
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
] ++ lib.optionals (libffi != null) [
"--with-system-libffi"
"--with-ffi-includes=${targetPackages.libffi.dev}/include"
"--with-ffi-libraries=${targetPackages.libffi.out}/lib"
] ++ lib.optionals (targetPlatform == hostPlatform && !enableNativeBignum) [
"--with-gmp-includes=${targetPackages.gmp.dev}/include"
"--with-gmp-libraries=${targetPackages.gmp.out}/lib"
] ++ lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
"--with-iconv-includes=${libiconv}/include"
"--with-iconv-libraries=${libiconv}/lib"
] ++ lib.optionals (targetPlatform != hostPlatform) [
"--enable-bootstrap-with-devel-snapshot"
] ++ lib.optionals useLdGold [
"CFLAGS=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
] ++ lib.optionals (disableLargeAddressSpace) [
"--disable-large-address-space"
];
# Make sure we never relax`$PATH` and hooks support for compatibility.
strictDeps = true;
# Dont add -liconv to LDFLAGS automatically so that GHC will add it itself.
dontAddExtraLibs = true;
nativeBuildInputs = [
perl autoconf automake m4 python3
ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
autoSignDarwinBinariesHook
] ++ lib.optionals enableDocs [
sphinx
];
# For building runtime libs
depsBuildTarget = toolsForTarget;
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
depsTargetTarget = map lib.getDev (libDeps targetPlatform);
depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);
# required, because otherwise all symbols from HSffi.o are stripped, and
# that in turn causes GHCi to abort
stripDebugFlags = [ "-S" ] ++ lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
checkTarget = "test";
hardeningDisable =
[ "format" ]
# In nixpkgs, musl based builds currently enable `pie` hardening by default
# (see `defaultHardeningFlags` in `make-derivation.nix`).
# But GHC cannot currently produce outputs that are ready for `-pie` linking.
# Thus, disable `pie` hardening, otherwise `recompile with -fPIE` errors appear.
# See:
# * https://github.com/NixOS/nixpkgs/issues/129247
# * https://gitlab.haskell.org/ghc/ghc/-/issues/19580
++ lib.optional stdenv.targetPlatform.isMusl "pie";
# big-parallel allows us to build with more than 2 cores on
# Hydra which already warrants a significant speedup
requiredSystemFeatures = [ "big-parallel" ];
postInstall = ''
# Install the bash completion file.
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
'';
passthru = {
inherit bootPkgs targetPrefix;
inherit llvmPackages;
inherit enableShared;
# This is used by the haskell builder to query
# the presence of the haddock program.
hasHaddock = enableHaddockProgram;
# Our Cabal compiler name
haskellCompilerName = "ghc-${version}";
};
meta = {
homepage = "http://haskell.org/ghc";
description = "The Glasgow Haskell Compiler";
maintainers = with lib.maintainers; [
guibou
] ++ lib.teams.haskell.members;
timeout = 24 * 3600;
inherit (ghc.meta) license platforms;
};
} // lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
dontStrip = true;
dontPatchELF = true;
noAuditTmpdir = true;
})
sha256 = "6256cf9caf6d6dc7b611dcfbb247df2d528e85aa39d22a698e870e5a590e8601";
}
+3 -389
View File
@@ -1,392 +1,6 @@
# DO NOT port this expression to hadrian. It is not possible to build a GHC
# cross compiler with 9.4.* and hadrian.
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
# build-tools
, bootPkgs
, autoconf, automake, coreutils, fetchpatch, fetchurl, perl, python3, m4, sphinx
, xattr, autoSignDarwinBinariesHook
, bash
, libiconv ? null, ncurses
, glibcLocales ? null
, # GHC can be built with system libffi or a bundled one.
libffi ? null
, useLLVM ? !(stdenv.targetPlatform.isx86
|| stdenv.targetPlatform.isPower
|| stdenv.targetPlatform.isSparc
|| stdenv.targetPlatform.isAarch64)
, # LLVM is conceptually a run-time-only dependency, but for
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
# build-time dependency too.
buildTargetLlvmPackages, llvmPackages
, # If enabled, GHC will be built with the GPL-free but slightly slower native
# bignum backend instead of the faster but GPLed gmp backend.
enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp
&& lib.meta.availableOn stdenv.targetPlatform gmp)
, gmp
, # If enabled, use -fPIC when compiling static libs.
enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
, enableProfiledLibs ? true
, # Whether to build dynamic libs for the standard library (on the target
# platform). Static libs are always built.
enableShared ? with stdenv.targetPlatform; !isWindows && !useiOSPrebuilt && !isStatic
, # Whether to build terminfo.
enableTerminfo ? !stdenv.targetPlatform.isWindows
, # What flavour to build. An empty string indicates no
# specific flavour and falls back to ghc default values.
ghcFlavour ? lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
(if useLLVM then "perf-cross" else "perf-cross-ncg")
, # Whether to build sphinx documentation.
enableDocs ? (
# Docs disabled if we are building on musl because it's a large task to keep
# all `sphinx` dependencies building in this environment.
!stdenv.buildPlatform.isMusl
)
, enableHaddockProgram ?
# Disabled for cross; see note [HADDOCK_DOCS].
(stdenv.targetPlatform == stdenv.hostPlatform)
, # Whether to disable the large address space allocator
# necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
}:
assert !enableNativeBignum -> gmp != null;
# Cross cannot currently build the `haddock` program for silly reasons,
# see note [HADDOCK_DOCS].
assert (stdenv.targetPlatform != stdenv.hostPlatform) -> !enableHaddockProgram;
let
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
inherit (bootPkgs) ghc;
# TODO(@Ericson2314) Make unconditional
targetPrefix = lib.optionalString
(targetPlatform != hostPlatform)
"${targetPlatform.config}-";
buildMK = ''
BuildFlavour = ${ghcFlavour}
ifneq \"\$(BuildFlavour)\" \"\"
include mk/flavours/\$(BuildFlavour).mk
endif
BUILD_SPHINX_HTML = ${if enableDocs then "YES" else "NO"}
BUILD_SPHINX_PDF = NO
'' +
# Note [HADDOCK_DOCS]:
# Unfortunately currently `HADDOCK_DOCS` controls both whether the `haddock`
# program is built (which we generally always want to have a complete GHC install)
# and whether it is run on the GHC sources to generate hyperlinked source code
# (which is impossible for cross-compilation); see:
# https://gitlab.haskell.org/ghc/ghc/-/issues/20077
# This implies that currently a cross-compiled GHC will never have a `haddock`
# program, so it can never generate haddocks for any packages.
# If this is solved in the future, we'd like to unconditionally
# build the haddock program (removing the `enableHaddockProgram` option).
''
HADDOCK_DOCS = ${if enableHaddockProgram then "YES" else "NO"}
# Build haddocks for boot packages with hyperlinking
EXTRA_HADDOCK_OPTS += --hyperlinked-source --quickjump
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
BIGNUM_BACKEND = ${if enableNativeBignum then "native" else "gmp"}
'' + lib.optionalString (targetPlatform != hostPlatform) ''
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
CrossCompilePrefix = ${targetPrefix}
'' + lib.optionalString (!enableProfiledLibs) ''
BUILD_PROF_LIBS = NO
'' +
# -fexternal-dynamic-refs apparently (because it's not clear from the documentation)
# makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell.
# This solution was described in https://www.tweag.io/blog/2020-09-30-bazel-static-haskell
lib.optionalString enableRelocatedStaticLibs ''
GhcLibHcOpts += -fPIC -fexternal-dynamic-refs
GhcRtsHcOpts += -fPIC -fexternal-dynamic-refs
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
EXTRA_CC_OPTS += -std=gnu99
'';
# Splicer will pull out correct variations
libDeps = platform: lib.optional enableTerminfo ncurses
++ [libffi]
++ lib.optional (!enableNativeBignum) gmp
++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
# TODO(@sternenseemann): is buildTarget LLVM unnecessary?
# GHC doesn't seem to have {LLC,OPT}_HOST
toolsForTarget = [
pkgsBuildTarget.targetPackages.stdenv.cc
] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm;
targetCC = builtins.head toolsForTarget;
# Sometimes we have to dispatch between the bintools wrapper and the unwrapped
# derivation for certain tools depending on the platform.
bintoolsFor = {
# GHC needs install_name_tool on all darwin platforms. On aarch64-darwin it is
# part of the bintools wrapper (due to codesigning requirements), but not on
# x86_64-darwin.
install_name_tool =
if stdenv.targetPlatform.isAarch64
then targetCC.bintools
else targetCC.bintools.bintools;
# Same goes for strip.
strip =
# TODO(@sternenseemann): also use wrapper if linker == "bfd" or "gold"
if stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin
then targetCC.bintools
else targetCC.bintools.bintools;
};
# Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues.
# But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
# see #84670 and #49071 for more background.
useLdGold = targetPlatform.linker == "gold" ||
(targetPlatform.linker == "bfd" && (targetCC.bintools.bintools.hasGold or false) && !targetPlatform.isMusl);
# Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
variantSuffix = lib.concatStrings [
(lib.optionalString stdenv.hostPlatform.isMusl "-musl")
(lib.optionalString enableNativeBignum "-native-bignum")
];
in
# C compiler, bintools and LLVM are used at build time, but will also leak into
# the resulting GHC's settings file and used at runtime. This means that we are
# currently only able to build GHC if hostPlatform == buildPlatform.
assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
stdenv.mkDerivation (rec {
import ./common-make-native-bignum.nix {
version = "9.4.6";
pname = "${targetPrefix}ghc${variantSuffix}";
src = fetchurl {
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
sha256 = "1b705cf52692f9d4d6707cdf8e761590f5f56ec8ea6a65e36610db392d3d24b9";
};
enableParallelBuilding = true;
outputs = [ "out" "doc" ];
patches = [
# Don't generate code that doesn't compile when --enable-relocatable is passed to Setup.hs
# Can be removed if the Cabal library included with ghc backports the linked fix
(fetchpatch {
url = "https://github.com/haskell/cabal/commit/6c796218c92f93c95e94d5ec2d077f6956f68e98.patch";
stripLen = 1;
extraPrefix = "libraries/Cabal/";
sha256 = "sha256-yRQ6YmMiwBwiYseC5BsrEtDgFbWvst+maGgDtdD0vAY=";
})
# Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
./docs-sphinx-7.patch
# Work around a type not being defined when including Rts.h in bytestring's cbits
# due to missing feature macros. See https://gitlab.haskell.org/ghc/ghc/-/issues/23810.
./9.4.6-bytestring-posix-source.patch
] ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
# Prevent the paths module from emitting symbols that we don't use
# when building with separate outputs.
#
# These cause problems as they're not eliminated by GHC's dead code
# elimination on aarch64-darwin. (see
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
];
postPatch = "patchShebangs .";
# GHC needs the locale configured during the Haddock phase.
LANG = "en_US.UTF-8";
# GHC is a bit confused on its cross terminology.
# TODO(@sternenseemann): investigate coreutils dependencies and pass absolute paths
preConfigure = ''
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
export "''${env#TARGET_}=''${!env}"
done
# GHC is a bit confused on its cross terminology, as these would normally be
# the *host* tools.
export CC="${targetCC}/bin/${targetCC.targetPrefix}cc"
export CXX="${targetCC}/bin/${targetCC.targetPrefix}c++"
# Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${lib.optionalString useLdGold ".gold"}"
export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as"
export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar"
export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm"
export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib"
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
export STRIP="${bintoolsFor.strip}/bin/${bintoolsFor.strip.targetPrefix}strip"
'' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") ''
export OTOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}otool"
export INSTALL_NAME_TOOL="${bintoolsFor.install_name_tool}/bin/${bintoolsFor.install_name_tool.targetPrefix}install_name_tool"
'' + lib.optionalString useLLVM ''
export LLC="${lib.getBin buildTargetLlvmPackages.llvm}/bin/llc"
export OPT="${lib.getBin buildTargetLlvmPackages.llvm}/bin/opt"
'' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
export CLANG="${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
'' + ''
echo -n "${buildMK}" > mk/build.mk
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
'' + lib.optionalString (stdenv.isLinux && hostPlatform.libc == "glibc") ''
export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"
'' + lib.optionalString (!stdenv.isDarwin) ''
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
'' + lib.optionalString stdenv.isDarwin ''
export NIX_LDFLAGS+=" -no_dtrace_dof"
# GHC tries the host xattr /usr/bin/xattr by default which fails since it expects python to be 2.7
export XATTR=${lib.getBin xattr}/bin/xattr
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets
'' + lib.optionalString targetPlatform.isMusl ''
echo "patching llvm-targets for musl targets..."
echo "Cloning these existing '*-linux-gnu*' targets:"
grep linux-gnu llvm-targets | sed 's/^/ /'
echo "(go go gadget sed)"
sed -i 's,\(^.*linux-\)gnu\(.*\)$,\0\n\1musl\2,' llvm-targets
echo "llvm-targets now contains these '*-linux-musl*' targets:"
grep linux-musl llvm-targets | sed 's/^/ /'
echo "And now patching to preserve '-musleabi' as done with '-gnueabi'"
# (aclocal.m4 is actual source, but patch configure as well since we don't re-gen)
for x in configure aclocal.m4; do
substituteInPlace $x \
--replace '*-android*|*-gnueabi*)' \
'*-android*|*-gnueabi*|*-musleabi*)'
done
''
# HACK: allow bootstrapping with GHC 8.10 which works fine, as we don't have
# binary 9.0 packaged. Bootstrapping with 9.2 is broken without hadrian.
+ ''
substituteInPlace configure --replace \
'MinBootGhcVersion="9.0"' \
'MinBootGhcVersion="8.10"'
'';
# TODO(@Ericson2314): Always pass "--target" and always prefix.
configurePlatforms = [ "build" "host" ]
++ lib.optional (targetPlatform != hostPlatform) "target";
# `--with` flags for libraries needed for RTS linker
configureFlags = [
"--datadir=$doc/share/doc/ghc"
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
] ++ lib.optionals (libffi != null) [
"--with-system-libffi"
"--with-ffi-includes=${targetPackages.libffi.dev}/include"
"--with-ffi-libraries=${targetPackages.libffi.out}/lib"
] ++ lib.optionals (targetPlatform == hostPlatform && !enableNativeBignum) [
"--with-gmp-includes=${targetPackages.gmp.dev}/include"
"--with-gmp-libraries=${targetPackages.gmp.out}/lib"
] ++ lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
"--with-iconv-includes=${libiconv}/include"
"--with-iconv-libraries=${libiconv}/lib"
] ++ lib.optionals (targetPlatform != hostPlatform) [
"--enable-bootstrap-with-devel-snapshot"
] ++ lib.optionals useLdGold [
"CFLAGS=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
] ++ lib.optionals (disableLargeAddressSpace) [
"--disable-large-address-space"
];
# Make sure we never relax`$PATH` and hooks support for compatibility.
strictDeps = true;
# Dont add -liconv to LDFLAGS automatically so that GHC will add it itself.
dontAddExtraLibs = true;
nativeBuildInputs = [
perl autoconf automake m4 python3
ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
autoSignDarwinBinariesHook
] ++ lib.optionals enableDocs [
sphinx
];
# For building runtime libs
depsBuildTarget = toolsForTarget;
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
depsTargetTarget = map lib.getDev (libDeps targetPlatform);
depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);
# required, because otherwise all symbols from HSffi.o are stripped, and
# that in turn causes GHCi to abort
stripDebugFlags = [ "-S" ] ++ lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
checkTarget = "test";
hardeningDisable =
[ "format" ]
# In nixpkgs, musl based builds currently enable `pie` hardening by default
# (see `defaultHardeningFlags` in `make-derivation.nix`).
# But GHC cannot currently produce outputs that are ready for `-pie` linking.
# Thus, disable `pie` hardening, otherwise `recompile with -fPIE` errors appear.
# See:
# * https://github.com/NixOS/nixpkgs/issues/129247
# * https://gitlab.haskell.org/ghc/ghc/-/issues/19580
++ lib.optional stdenv.targetPlatform.isMusl "pie";
# big-parallel allows us to build with more than 2 cores on
# Hydra which already warrants a significant speedup
requiredSystemFeatures = [ "big-parallel" ];
postInstall = ''
# Install the bash completion file.
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
'';
passthru = {
inherit bootPkgs targetPrefix;
inherit llvmPackages;
inherit enableShared;
# This is used by the haskell builder to query
# the presence of the haddock program.
hasHaddock = enableHaddockProgram;
# Our Cabal compiler name
haskellCompilerName = "ghc-${version}";
};
meta = {
homepage = "http://haskell.org/ghc";
description = "The Glasgow Haskell Compiler";
maintainers = with lib.maintainers; [
guibou
] ++ lib.teams.haskell.members;
timeout = 24 * 3600;
inherit (ghc.meta) license platforms;
};
} // lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
dontStrip = true;
dontPatchELF = true;
noAuditTmpdir = true;
})
sha256 = "1b705cf52692f9d4d6707cdf8e761590f5f56ec8ea6a65e36610db392d3d24b9";
}
+3 -385
View File
@@ -1,388 +1,6 @@
# DO NOT port this expression to hadrian. It is not possible to build a GHC
# cross compiler with 9.4.* and hadrian.
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
# build-tools
, bootPkgs
, autoconf, automake, coreutils, fetchpatch, fetchurl, perl, python3, m4, sphinx
, xattr, autoSignDarwinBinariesHook
, bash
, libiconv ? null, ncurses
, glibcLocales ? null
, # GHC can be built with system libffi or a bundled one.
libffi ? null
, useLLVM ? !(stdenv.targetPlatform.isx86
|| stdenv.targetPlatform.isPower
|| stdenv.targetPlatform.isSparc
|| stdenv.targetPlatform.isAarch64)
, # LLVM is conceptually a run-time-only dependency, but for
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
# build-time dependency too.
buildTargetLlvmPackages, llvmPackages
, # If enabled, GHC will be built with the GPL-free but slightly slower native
# bignum backend instead of the faster but GPLed gmp backend.
enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp
&& lib.meta.availableOn stdenv.targetPlatform gmp)
, gmp
, # If enabled, use -fPIC when compiling static libs.
enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
, enableProfiledLibs ? true
, # Whether to build dynamic libs for the standard library (on the target
# platform). Static libs are always built.
enableShared ? with stdenv.targetPlatform; !isWindows && !useiOSPrebuilt && !isStatic
, # Whether to build terminfo.
enableTerminfo ? !stdenv.targetPlatform.isWindows
, # What flavour to build. An empty string indicates no
# specific flavour and falls back to ghc default values.
ghcFlavour ? lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
(if useLLVM then "perf-cross" else "perf-cross-ncg")
, # Whether to build sphinx documentation.
enableDocs ? (
# Docs disabled if we are building on musl because it's a large task to keep
# all `sphinx` dependencies building in this environment.
!stdenv.buildPlatform.isMusl
)
, enableHaddockProgram ?
# Disabled for cross; see note [HADDOCK_DOCS].
(stdenv.targetPlatform == stdenv.hostPlatform)
, # Whether to disable the large address space allocator
# necessary fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
disableLargeAddressSpace ? stdenv.targetPlatform.isiOS
}:
assert !enableNativeBignum -> gmp != null;
# Cross cannot currently build the `haddock` program for silly reasons,
# see note [HADDOCK_DOCS].
assert (stdenv.targetPlatform != stdenv.hostPlatform) -> !enableHaddockProgram;
let
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
inherit (bootPkgs) ghc;
# TODO(@Ericson2314) Make unconditional
targetPrefix = lib.optionalString
(targetPlatform != hostPlatform)
"${targetPlatform.config}-";
buildMK = ''
BuildFlavour = ${ghcFlavour}
ifneq \"\$(BuildFlavour)\" \"\"
include mk/flavours/\$(BuildFlavour).mk
endif
BUILD_SPHINX_HTML = ${if enableDocs then "YES" else "NO"}
BUILD_SPHINX_PDF = NO
'' +
# Note [HADDOCK_DOCS]:
# Unfortunately currently `HADDOCK_DOCS` controls both whether the `haddock`
# program is built (which we generally always want to have a complete GHC install)
# and whether it is run on the GHC sources to generate hyperlinked source code
# (which is impossible for cross-compilation); see:
# https://gitlab.haskell.org/ghc/ghc/-/issues/20077
# This implies that currently a cross-compiled GHC will never have a `haddock`
# program, so it can never generate haddocks for any packages.
# If this is solved in the future, we'd like to unconditionally
# build the haddock program (removing the `enableHaddockProgram` option).
''
HADDOCK_DOCS = ${if enableHaddockProgram then "YES" else "NO"}
# Build haddocks for boot packages with hyperlinking
EXTRA_HADDOCK_OPTS += --hyperlinked-source --quickjump
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
BIGNUM_BACKEND = ${if enableNativeBignum then "native" else "gmp"}
'' + lib.optionalString (targetPlatform != hostPlatform) ''
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
CrossCompilePrefix = ${targetPrefix}
'' + lib.optionalString (!enableProfiledLibs) ''
BUILD_PROF_LIBS = NO
'' +
# -fexternal-dynamic-refs apparently (because it's not clear from the documentation)
# makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell.
# This solution was described in https://www.tweag.io/blog/2020-09-30-bazel-static-haskell
lib.optionalString enableRelocatedStaticLibs ''
GhcLibHcOpts += -fPIC -fexternal-dynamic-refs
GhcRtsHcOpts += -fPIC -fexternal-dynamic-refs
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
EXTRA_CC_OPTS += -std=gnu99
'';
# Splicer will pull out correct variations
libDeps = platform: lib.optional enableTerminfo ncurses
++ [libffi]
++ lib.optional (!enableNativeBignum) gmp
++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
# TODO(@sternenseemann): is buildTarget LLVM unnecessary?
# GHC doesn't seem to have {LLC,OPT}_HOST
toolsForTarget = [
pkgsBuildTarget.targetPackages.stdenv.cc
] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm;
targetCC = builtins.head toolsForTarget;
# Sometimes we have to dispatch between the bintools wrapper and the unwrapped
# derivation for certain tools depending on the platform.
bintoolsFor = {
# GHC needs install_name_tool on all darwin platforms. On aarch64-darwin it is
# part of the bintools wrapper (due to codesigning requirements), but not on
# x86_64-darwin.
install_name_tool =
if stdenv.targetPlatform.isAarch64
then targetCC.bintools
else targetCC.bintools.bintools;
# Same goes for strip.
strip =
# TODO(@sternenseemann): also use wrapper if linker == "bfd" or "gold"
if stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin
then targetCC.bintools
else targetCC.bintools.bintools;
};
# Use gold either following the default, or to avoid the BFD linker due to some bugs / perf issues.
# But we cannot avoid BFD when using musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
# see #84670 and #49071 for more background.
useLdGold = targetPlatform.linker == "gold" ||
(targetPlatform.linker == "bfd" && (targetCC.bintools.bintools.hasGold or false) && !targetPlatform.isMusl);
# Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
variantSuffix = lib.concatStrings [
(lib.optionalString stdenv.hostPlatform.isMusl "-musl")
(lib.optionalString enableNativeBignum "-native-bignum")
];
in
# C compiler, bintools and LLVM are used at build time, but will also leak into
# the resulting GHC's settings file and used at runtime. This means that we are
# currently only able to build GHC if hostPlatform == buildPlatform.
assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
stdenv.mkDerivation (rec {
import ./common-make-native-bignum.nix {
version = "9.4.7";
pname = "${targetPrefix}ghc${variantSuffix}";
src = fetchurl {
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
sha256 = "06775a52b4d13ac09edc6dabc299fd11e59d8886bbcae450af367baee2684c8f";
};
enableParallelBuilding = true;
outputs = [ "out" "doc" ];
patches = [
# Don't generate code that doesn't compile when --enable-relocatable is passed to Setup.hs
# Can be removed if the Cabal library included with ghc backports the linked fix
(fetchpatch {
url = "https://github.com/haskell/cabal/commit/6c796218c92f93c95e94d5ec2d077f6956f68e98.patch";
stripLen = 1;
extraPrefix = "libraries/Cabal/";
sha256 = "sha256-yRQ6YmMiwBwiYseC5BsrEtDgFbWvst+maGgDtdD0vAY=";
})
# Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
./docs-sphinx-7.patch
] ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
# Prevent the paths module from emitting symbols that we don't use
# when building with separate outputs.
#
# These cause problems as they're not eliminated by GHC's dead code
# elimination on aarch64-darwin. (see
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
];
postPatch = "patchShebangs .";
# GHC needs the locale configured during the Haddock phase.
LANG = "en_US.UTF-8";
# GHC is a bit confused on its cross terminology.
# TODO(@sternenseemann): investigate coreutils dependencies and pass absolute paths
preConfigure = ''
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
export "''${env#TARGET_}=''${!env}"
done
# GHC is a bit confused on its cross terminology, as these would normally be
# the *host* tools.
export CC="${targetCC}/bin/${targetCC.targetPrefix}cc"
export CXX="${targetCC}/bin/${targetCC.targetPrefix}c++"
# Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${lib.optionalString useLdGold ".gold"}"
export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as"
export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar"
export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm"
export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib"
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
export STRIP="${bintoolsFor.strip}/bin/${bintoolsFor.strip.targetPrefix}strip"
'' + lib.optionalString (stdenv.targetPlatform.linker == "cctools") ''
export OTOOL="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}otool"
export INSTALL_NAME_TOOL="${bintoolsFor.install_name_tool}/bin/${bintoolsFor.install_name_tool.targetPrefix}install_name_tool"
'' + lib.optionalString useLLVM ''
export LLC="${lib.getBin buildTargetLlvmPackages.llvm}/bin/llc"
export OPT="${lib.getBin buildTargetLlvmPackages.llvm}/bin/opt"
'' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
export CLANG="${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
'' + ''
echo -n "${buildMK}" > mk/build.mk
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
'' + lib.optionalString (stdenv.isLinux && hostPlatform.libc == "glibc") ''
export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"
'' + lib.optionalString (!stdenv.isDarwin) ''
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
'' + lib.optionalString stdenv.isDarwin ''
export NIX_LDFLAGS+=" -no_dtrace_dof"
# GHC tries the host xattr /usr/bin/xattr by default which fails since it expects python to be 2.7
export XATTR=${lib.getBin xattr}/bin/xattr
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets
'' + lib.optionalString targetPlatform.isMusl ''
echo "patching llvm-targets for musl targets..."
echo "Cloning these existing '*-linux-gnu*' targets:"
grep linux-gnu llvm-targets | sed 's/^/ /'
echo "(go go gadget sed)"
sed -i 's,\(^.*linux-\)gnu\(.*\)$,\0\n\1musl\2,' llvm-targets
echo "llvm-targets now contains these '*-linux-musl*' targets:"
grep linux-musl llvm-targets | sed 's/^/ /'
echo "And now patching to preserve '-musleabi' as done with '-gnueabi'"
# (aclocal.m4 is actual source, but patch configure as well since we don't re-gen)
for x in configure aclocal.m4; do
substituteInPlace $x \
--replace '*-android*|*-gnueabi*)' \
'*-android*|*-gnueabi*|*-musleabi*)'
done
''
# HACK: allow bootstrapping with GHC 8.10 which works fine, as we don't have
# binary 9.0 packaged. Bootstrapping with 9.2 is broken without hadrian.
+ ''
substituteInPlace configure --replace \
'MinBootGhcVersion="9.0"' \
'MinBootGhcVersion="8.10"'
'';
# TODO(@Ericson2314): Always pass "--target" and always prefix.
configurePlatforms = [ "build" "host" ]
++ lib.optional (targetPlatform != hostPlatform) "target";
# `--with` flags for libraries needed for RTS linker
configureFlags = [
"--datadir=$doc/share/doc/ghc"
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
] ++ lib.optionals (libffi != null) [
"--with-system-libffi"
"--with-ffi-includes=${targetPackages.libffi.dev}/include"
"--with-ffi-libraries=${targetPackages.libffi.out}/lib"
] ++ lib.optionals (targetPlatform == hostPlatform && !enableNativeBignum) [
"--with-gmp-includes=${targetPackages.gmp.dev}/include"
"--with-gmp-libraries=${targetPackages.gmp.out}/lib"
] ++ lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
"--with-iconv-includes=${libiconv}/include"
"--with-iconv-libraries=${libiconv}/lib"
] ++ lib.optionals (targetPlatform != hostPlatform) [
"--enable-bootstrap-with-devel-snapshot"
] ++ lib.optionals useLdGold [
"CFLAGS=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
] ++ lib.optionals (disableLargeAddressSpace) [
"--disable-large-address-space"
];
# Make sure we never relax`$PATH` and hooks support for compatibility.
strictDeps = true;
# Dont add -liconv to LDFLAGS automatically so that GHC will add it itself.
dontAddExtraLibs = true;
nativeBuildInputs = [
perl autoconf automake m4 python3
ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
autoSignDarwinBinariesHook
] ++ lib.optionals enableDocs [
sphinx
];
# For building runtime libs
depsBuildTarget = toolsForTarget;
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
depsTargetTarget = map lib.getDev (libDeps targetPlatform);
depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);
# required, because otherwise all symbols from HSffi.o are stripped, and
# that in turn causes GHCi to abort
stripDebugFlags = [ "-S" ] ++ lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
checkTarget = "test";
hardeningDisable =
[ "format" ]
# In nixpkgs, musl based builds currently enable `pie` hardening by default
# (see `defaultHardeningFlags` in `make-derivation.nix`).
# But GHC cannot currently produce outputs that are ready for `-pie` linking.
# Thus, disable `pie` hardening, otherwise `recompile with -fPIE` errors appear.
# See:
# * https://github.com/NixOS/nixpkgs/issues/129247
# * https://gitlab.haskell.org/ghc/ghc/-/issues/19580
++ lib.optional stdenv.targetPlatform.isMusl "pie";
# big-parallel allows us to build with more than 2 cores on
# Hydra which already warrants a significant speedup
requiredSystemFeatures = [ "big-parallel" ];
postInstall = ''
# Install the bash completion file.
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
'';
passthru = {
inherit bootPkgs targetPrefix;
inherit llvmPackages;
inherit enableShared;
# This is used by the haskell builder to query
# the presence of the haddock program.
hasHaddock = enableHaddockProgram;
# Our Cabal compiler name
haskellCompilerName = "ghc-${version}";
};
meta = {
homepage = "http://haskell.org/ghc";
description = "The Glasgow Haskell Compiler";
maintainers = with lib.maintainers; [
guibou
] ++ lib.teams.haskell.members;
timeout = 24 * 3600;
inherit (ghc.meta) license platforms;
};
} // lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
dontStrip = true;
dontPatchELF = true;
noAuditTmpdir = true;
})
sha256 = "06775a52b4d13ac09edc6dabc299fd11e59d8886bbcae450af367baee2684c8f";
}
@@ -0,0 +1,6 @@
# DO NOT port this expression to hadrian. It is not possible to build a GHC
# cross compiler with 9.4.* and hadrian.
import ./common-make-native-bignum.nix {
version = "9.4.8";
sha256 = "0bf407eb67fe3e3c24b0f4c8dea8cb63e07f63ca0f76cf2058565143507ab85e";
}
@@ -1,5 +1,8 @@
# DO NOT port this expression to hadrian. It is not possible to build a GHC
# cross compiler with 9.4.* and hadrian.
{ version
, sha256
, url ? "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz"
}:
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
# build-tools
@@ -17,7 +20,7 @@
, useLLVM ? !(stdenv.targetPlatform.isx86
|| stdenv.targetPlatform.isPower
|| stdenv.targetPlatform.isSparc
|| stdenv.targetPlatform.isAarch64)
|| (lib.versionAtLeast version "9.2" && stdenv.targetPlatform.isAarch64))
, # LLVM is conceptually a run-time-only dependency, but for
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
# build-time dependency too.
@@ -173,19 +176,61 @@ assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
stdenv.mkDerivation (rec {
version = "9.4.8";
pname = "${targetPrefix}ghc${variantSuffix}";
inherit version;
src = fetchurl {
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
sha256 = "0bf407eb67fe3e3c24b0f4c8dea8cb63e07f63ca0f76cf2058565143507ab85e";
inherit url sha256;
};
enableParallelBuilding = true;
outputs = [ "out" "doc" ];
patches = [
# FIXME(@sternenseemann): This can be simplified a lot (causing a rebuild)
patches = (if lib.versions.majorMinor version == "9.0" then [
# Fix docs build with sphinx >= 6.0
# https://gitlab.haskell.org/ghc/ghc/-/issues/22766
(fetchpatch {
name = "ghc-docs-sphinx-6.0.patch";
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/10e94a556b4f90769b7fd718b9790d58ae566600.patch";
sha256 = "0kmhfamr16w8gch0lgln2912r8aryjky1hfcda3jkcwa5cdzgjdv";
})
# Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
./docs-sphinx-7.patch
# fix hyperlinked haddock sources: https://github.com/haskell/haddock/pull/1482
(fetchpatch {
url = "https://patch-diff.githubusercontent.com/raw/haskell/haddock/pull/1482.patch";
sha256 = "sha256-8w8QUCsODaTvknCDGgTfFNZa8ZmvIKaKS+2ZJZ9foYk=";
extraPrefix = "utils/haddock/";
stripLen = 1;
})
# Add flag that fixes C++ exception handling; opt-in. Merged in 9.4 and 9.2.2.
# https://gitlab.haskell.org/ghc/ghc/-/merge_requests/7423
(fetchpatch {
name = "ghc-9.0.2-fcompact-unwind.patch";
# Note that the test suite is not packaged.
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/c6132c782d974a7701e7f6447bdcd2bf6db4299a.patch?merge_request_iid=7423";
sha256 = "sha256-b4feGZIaKDj/UKjWTNY6/jH4s2iate0wAgMxG3rAbZI=";
})
] else if lib.versions.majorMinor version == "9.2" then [
# Fix docs build with sphinx >= 6.0
# https://gitlab.haskell.org/ghc/ghc/-/issues/22766
(fetchpatch {
name = "ghc-docs-sphinx-6.0.patch";
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/10e94a556b4f90769b7fd718b9790d58ae566600.patch";
sha256 = "0kmhfamr16w8gch0lgln2912r8aryjky1hfcda3jkcwa5cdzgjdv";
})
# Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
./docs-sphinx-7.patch
# fix hyperlinked haddock sources: https://github.com/haskell/haddock/pull/1482
(fetchpatch {
url = "https://patch-diff.githubusercontent.com/raw/haskell/haddock/pull/1482.patch";
sha256 = "sha256-8w8QUCsODaTvknCDGgTfFNZa8ZmvIKaKS+2ZJZ9foYk=";
extraPrefix = "utils/haddock/";
stripLen = 1;
})
# Don't generate code that doesn't compile when --enable-relocatable is passed to Setup.hs
# Can be removed if the Cabal library included with ghc backports the linked fix
(fetchpatch {
@@ -194,17 +239,45 @@ stdenv.mkDerivation (rec {
extraPrefix = "libraries/Cabal/";
sha256 = "sha256-yRQ6YmMiwBwiYseC5BsrEtDgFbWvst+maGgDtdD0vAY=";
})
] else if lib.versions.majorMinor version == "9.4" then [
# Don't generate code that doesn't compile when --enable-relocatable is passed to Setup.hs
# Can be removed if the Cabal library included with ghc backports the linked fix
(fetchpatch {
url = "https://github.com/haskell/cabal/commit/6c796218c92f93c95e94d5ec2d077f6956f68e98.patch";
stripLen = 1;
extraPrefix = "libraries/Cabal/";
sha256 = "sha256-yRQ6YmMiwBwiYseC5BsrEtDgFbWvst+maGgDtdD0vAY=";
})
]
++ lib.optionals (version == "9.4.5") [
# Fix docs build with sphinx >= 6.0
# https://gitlab.haskell.org/ghc/ghc/-/issues/22766
(fetchpatch {
name = "ghc-docs-sphinx-6.0.patch";
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/10e94a556b4f90769b7fd718b9790d58ae566600.patch";
sha256 = "0kmhfamr16w8gch0lgln2912r8aryjky1hfcda3jkcwa5cdzgjdv";
})
]
++ [
# Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
./docs-sphinx-7.patch
] ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
]
++ lib.optionals (version == "9.4.6") [
# Work around a type not being defined when including Rts.h in bytestring's cbits
# due to missing feature macros. See https://gitlab.haskell.org/ghc/ghc/-/issues/23810.
./9.4.6-bytestring-posix-source.patch
] else [ ])
++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
# Prevent the paths module from emitting symbols that we don't use
# when building with separate outputs.
#
# These cause problems as they're not eliminated by GHC's dead code
# elimination on aarch64-darwin. (see
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
(if lib.versionAtLeast version "9.2"
then ./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
else ./Cabal-3.2-3.4-paths-fix-cycle-aarch64-darwin.patch)
];
postPatch = "patchShebangs .";
@@ -239,10 +312,15 @@ stdenv.mkDerivation (rec {
'' + lib.optionalString (useLLVM && stdenv.targetPlatform.isDarwin) ''
# LLVM backend on Darwin needs clang: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/codegens.html#llvm-code-generator-fllvm
export CLANG="${buildTargetLlvmPackages.clang}/bin/${buildTargetLlvmPackages.clang.targetPrefix}clang"
''
+ lib.optionalString (version == "9.0.2" || lib.versionAtLeast version "9.4") ''
'' + ''
echo -n "${buildMK}" > mk/build.mk
'' + lib.optionalString (lib.versionAtLeast version "9.4") ''
''
+ lib.optionalString (lib.versionOlder version "9.2" || lib.versionAtLeast version "9.4") ''
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
'' + lib.optionalString (stdenv.isLinux && hostPlatform.libc == "glibc") ''
export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"
@@ -250,6 +328,7 @@ stdenv.mkDerivation (rec {
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
'' + lib.optionalString stdenv.isDarwin ''
export NIX_LDFLAGS+=" -no_dtrace_dof"
'' + lib.optionalString (stdenv.isDarwin && lib.versionAtLeast version "9.2") ''
# GHC tries the host xattr /usr/bin/xattr by default which fails since it expects python to be 2.7
export XATTR=${lib.getBin xattr}/bin/xattr
@@ -274,7 +353,7 @@ stdenv.mkDerivation (rec {
''
# HACK: allow bootstrapping with GHC 8.10 which works fine, as we don't have
# binary 9.0 packaged. Bootstrapping with 9.2 is broken without hadrian.
+ ''
+ lib.optionalString (lib.versions.majorMinor version == "9.4") ''
substituteInPlace configure --replace \
'MinBootGhcVersion="9.0"' \
'MinBootGhcVersion="8.10"'
@@ -321,6 +400,10 @@ stdenv.mkDerivation (rec {
autoSignDarwinBinariesHook
] ++ lib.optionals enableDocs [
sphinx
] ++ lib.optionals (stdenv.isDarwin && lib.versions.majorMinor version == "9.0") [
# TODO(@sternenseemann): backport addition of XATTR env var like
# https://gitlab.haskell.org/ghc/ghc/-/merge_requests/6447
xattr
];
# For building runtime libs
@@ -24,7 +24,7 @@ self: super: {
Cabal-syntax = self.Cabal-syntax_3_10_3_0;
} // lib.optionalAttrs (lib.versionOlder self.ghc.version "9.2.5") {
# Use process core package when possible
process = self.process_1_6_19_0;
process = self.process_1_6_20_0;
}));
# cabal-install needs most recent versions of Cabal and Cabal-syntax,
@@ -48,7 +48,7 @@ self: super: {
# cabal-install, but we need to recompile process even if the correct
# version is available to prevent inconsistent dependencies:
# process depends on directory.
process = cself.process_1_6_19_0;
process = cself.process_1_6_20_0;
# Prevent dependency on doctest which causes an inconsistent dependency
# due to depending on ghc which depends on directory etc.
@@ -220,16 +220,6 @@ self: super: {
fused-effects-random = doJailbreak super.fused-effects-random;
fused-effects-readline = doJailbreak super.fused-effects-readline;
# Allow scotty < 0.21
# For < 0.22 add https://github.com/taffybar/taffybar/commit/71fe820d892a85e49ad2f2843eac0a59e01f3fd4
taffybar = appendPatches [
(pkgs.fetchpatch {
name = "taffybar-scotty-0.20.patch";
url = "https://github.com/taffybar/taffybar/commit/dcc4184fa63295d51b6c6efb2f97f23b13170e66.patch";
sha256 = "0hsn0zxpc8icabdq48jlkfn2v07xfjy4l344fnq2pbdc5apcm0fy";
})
] super.taffybar;
# fix tests failure for base≥4.15 (https://github.com/kim/leveldb-haskell/pull/41)
leveldb-haskell = appendPatch (fetchpatch {
url = "https://github.com/kim/leveldb-haskell/commit/f5249081f589233890ddb1945ec548ca9fb717cf.patch";
@@ -389,7 +379,7 @@ self: super: {
name = "git-annex-${super.git-annex.version}-src";
url = "git://git-annex.branchable.com/";
rev = "refs/tags/" + super.git-annex.version;
sha256 = "sha256-tlEsBXfELnK9rU4LHSDNby/yym+guqXjsh2GA+L9aWA=";
sha256 = "sha256-adV7I1P0O/dqH1rEyf3c2Vp4GSiiHReJyqnkSOYQGT0=";
# delete android and Android directories which cause issues on
# darwin (case insensitive directory). Since we don't need them
# during the build process, we can delete it to prevent a hash
@@ -558,6 +548,9 @@ self: super: {
# 2022-02-14: Strict upper bound: https://github.com/psibi/streamly-bytestring/issues/30
streamly-bytestring = dontCheck (doJailbreak super.streamly-bytestring);
# 2024-05-18: Upstream tests against a different pandoc version
pandoc-crossref = dontCheck super.pandoc-crossref;
# base bound
digit = doJailbreak super.digit;
@@ -2997,7 +2990,7 @@ self: super: {
}) super.kmonad;
ghc-syntax-highlighter_0_0_11_0 = super.ghc-syntax-highlighter_0_0_11_0.overrideScope(self: super: {
ghc-lib-parser = self.ghc-lib-parser_9_8_2_20240223;
ghc-lib-parser = self.ghc-lib-parser_9_10_1_20240511;
});
# 2024-03-17: broken
@@ -3102,6 +3095,12 @@ self: super: {
tasty-quickcheck = super.tasty-quickcheck_0_10_3;
});
# Fixes build on some platforms: https://github.com/obsidiansystems/commutative-semigroups/pull/18
commutative-semigroups = appendPatch (fetchpatch {
url = "https://github.com/obsidiansystems/commutative-semigroups/commit/e031495dd24ae73ffb808eca34e993f5df8e8d76.patch";
hash = "sha256-d7AwvGGUJlh/sOXaAbfQLCay6+JyNInb73TTGKkBDz8=";
}) super.commutative-semigroups;
# Too strict bounds on text. Can be removed after https://github.com/alx741/currencies/pull/3 is merged
currencies = doJailbreak super.currencies;
@@ -317,11 +317,13 @@ self: super: ({
# Tests fail on macOS https://github.com/mrkkrp/zip/issues/112
zip = dontCheck super.zip;
# cabal lib set as unbuildable in linux so callCabal2nix generates a dummy derivation
jsaddle-wkwebview = overrideCabal (drv: {
libraryFrameworkDepends = with pkgs.buildPackages.darwin.apple_sdk.frameworks; [ Cocoa WebKit ];
libraryHaskellDepends = with self; [ aeson data-default jsaddle ];
libraryHaskellDepends = with self; [ aeson data-default jsaddle ]; # cabal2nix doesn't add darwin-only deps
}) super.jsaddle-wkwebview;
reflex-dom = overrideCabal (drv: {
libraryHaskellDepends = with self; [ base bytestring jsaddle-wkwebview reflex reflex-dom-core text ]; # cabal2nix doesn't add darwin-only deps
}) super.reflex-dom;
} // lib.optionalAttrs pkgs.stdenv.isAarch64 { # aarch64-darwin
@@ -55,7 +55,7 @@ self: super: {
th-abstraction = doDistribute self.th-abstraction_0_7_0_0;
ghc-lib-parser = doDistribute self.ghc-lib-parser_9_8_2_20240223;
ghc-lib-parser-ex = doDistribute self.ghc-lib-parser-ex_9_8_0_2;
ghc-lib = doDistribute self.ghc-lib_9_8_2_20240223;
ghc-lib = doDistribute self.ghc-lib_9_10_1_20240511;
megaparsec = doDistribute self.megaparsec_9_6_1;
# TODO: remove when aeson updates or launches a revision
# see https://github.com/haskell/aeson/issues/1089 and https://github.com/haskell/aeson/pulls/1088
@@ -384,6 +384,7 @@ broken-packages:
- beam-newtype-field # failure in job https://hydra.nixos.org/build/233206317 at 2023-09-02
- bech32 # failure in job https://hydra.nixos.org/build/233194823 at 2023-09-02
- bed-and-breakfast # failure in job https://hydra.nixos.org/build/233221152 at 2023-09-02
- beeminder-api # failure in job https://hydra.nixos.org/build/259970664 at 2024-05-19
- Befunge93 # failure in job https://hydra.nixos.org/build/233226751 at 2023-09-02
- benc # failure in job https://hydra.nixos.org/build/241434046 at 2023-11-19
- bench-graph # failure in job https://hydra.nixos.org/build/233239830 at 2023-09-02
@@ -594,6 +595,7 @@ broken-packages:
- bytestring-substring # failure in job https://hydra.nixos.org/build/233244318 at 2023-09-02
- bytestring-time # failure in job https://hydra.nixos.org/build/233190686 at 2023-09-02
- bytestring-typenats # failure in job https://hydra.nixos.org/build/233211815 at 2023-09-02
- bytezap # failure in job https://hydra.nixos.org/build/259967564 at 2024-05-19
- bzlib-conduit-jappie # failure in job https://hydra.nixos.org/build/233210179 at 2023-09-02
- c10k # failure in job https://hydra.nixos.org/build/233213264 at 2023-09-02
- c2ats # failure in job https://hydra.nixos.org/build/233220801 at 2023-09-02
@@ -693,6 +695,7 @@ broken-packages:
- cassava-records # failure in job https://hydra.nixos.org/build/233259049 at 2023-09-02
- cassava-streams # failure in job https://hydra.nixos.org/build/233222669 at 2023-09-02
- cassette # failure in job https://hydra.nixos.org/build/233201251 at 2023-09-02
- caster # failure in job https://hydra.nixos.org/build/259966347 at 2024-05-19
- castle # failure in job https://hydra.nixos.org/build/233204027 at 2023-09-02
- catamorphism # failure in job https://hydra.nixos.org/build/233208488 at 2023-09-02
- Catana # failure in job https://hydra.nixos.org/build/233196550 at 2023-09-02
@@ -738,6 +741,7 @@ broken-packages:
- changelog-d # failure in job https://hydra.nixos.org/build/255671571 at 2024-04-16
- changelog-d # failure in job https://hydra.nixos.org/build/257082502 at 2024-04-27
- changelog-d # failure in job https://hydra.nixos.org/build/259607598 at 2024-05-15
- changelog-d # failure in job https://hydra.nixos.org/build/259957724 at 2024-05-19
- changelogged # failure in job https://hydra.nixos.org/build/233211675 at 2023-09-02
- character-cases # failure in job https://hydra.nixos.org/build/233197636 at 2023-09-02
- charter # failure in job https://hydra.nixos.org/build/233237264 at 2023-09-02
@@ -760,6 +764,7 @@ broken-packages:
- ChristmasTree # failure in job https://hydra.nixos.org/build/233259648 at 2023-09-02
- chronograph # failure in job https://hydra.nixos.org/build/233232822 at 2023-09-02
- chr-parse # failure in job https://hydra.nixos.org/build/233243933 at 2023-09-02
- chs-cabal # failure in job https://hydra.nixos.org/build/259964491 at 2024-05-19
- chunky # failure in job https://hydra.nixos.org/build/233216440 at 2023-09-02
- church # failure in job https://hydra.nixos.org/build/233223920 at 2023-09-02
- church-maybe # failure in job https://hydra.nixos.org/build/233258572 at 2023-09-02
@@ -1023,6 +1028,7 @@ broken-packages:
- cql-io # failure in job https://hydra.nixos.org/build/233245286 at 2023-09-02
- cqrs-core # failure in job https://hydra.nixos.org/build/233192102 at 2023-09-02
- crack # failure in job https://hydra.nixos.org/build/233229111 at 2023-09-02
- cradle # failure in job https://hydra.nixos.org/build/259974954 at 2024-05-19
- Craft3e # failure in job https://hydra.nixos.org/build/233255152 at 2023-09-02
- craftwerk # failure in job https://hydra.nixos.org/build/233221392 at 2023-09-02
- crawlchain # failure in job https://hydra.nixos.org/build/233192450 at 2023-09-02
@@ -1241,6 +1247,7 @@ broken-packages:
- deriveJsonNoPrefix # failure in job https://hydra.nixos.org/build/233242453 at 2023-09-02
- derive-lifted-instances # failure in job https://hydra.nixos.org/build/233194868 at 2023-09-02
- derive-monoid # failure in job https://hydra.nixos.org/build/233205670 at 2023-09-02
- derive-prim # failure in job https://hydra.nixos.org/build/259957765 at 2024-05-19
- derive-trie # failure in job https://hydra.nixos.org/build/233207961 at 2023-09-02
- deriving-openapi3 # failure in job https://hydra.nixos.org/build/252718489 at 2024-03-16
- derp-lib # failure in job https://hydra.nixos.org/build/233199053 at 2023-09-02
@@ -1568,7 +1575,6 @@ broken-packages:
- ethereum-analyzer-deps # failure in job https://hydra.nixos.org/build/252732846 at 2024-03-16
- ethereum-rlp # failure in job https://hydra.nixos.org/build/233236392 at 2023-09-02
- eurofxref # failure in job https://hydra.nixos.org/build/233230942 at 2023-09-02
- evdev # failure in job https://hydra.nixos.org/build/236692293 at 2023-10-04
- eve-cli # failure in job https://hydra.nixos.org/build/233254555 at 2023-09-02
- eved # failure in job https://hydra.nixos.org/build/233194319 at 2023-09-02
- eve # failure in job https://hydra.nixos.org/build/252715362 at 2024-03-16
@@ -1877,6 +1883,7 @@ broken-packages:
- fused-effects-exceptions # failure in job https://hydra.nixos.org/build/233203744 at 2023-09-02
- fused-effects-mwc-random # failure in job https://hydra.nixos.org/build/233253228 at 2023-09-02
- fused-effects-resumable # failure in job https://hydra.nixos.org/build/233242479 at 2023-09-02
- fused-effects-squeal # failure in job https://hydra.nixos.org/build/259962088 at 2024-05-19
- fused-effects-th # failure in job https://hydra.nixos.org/build/233192186 at 2023-09-02
- fusion # failure in job https://hydra.nixos.org/build/233204359 at 2023-09-02
- futhask # failure in job https://hydra.nixos.org/build/233229281 at 2023-09-02
@@ -2311,6 +2318,7 @@ broken-packages:
- haskell2020 # failure in job https://hydra.nixos.org/build/233251111 at 2023-09-02
- haskell98 # failure in job https://hydra.nixos.org/build/233231799 at 2023-09-02
- haskell98libraries # failure in job https://hydra.nixos.org/build/233255099 at 2023-09-02
- haskell-abci # failure in job https://hydra.nixos.org/build/259980321 at 2024-05-19
- haskell-admin-core # failure in job https://hydra.nixos.org/build/233242655 at 2023-09-02
- HaskellAnalysisProgram # failure in job https://hydra.nixos.org/build/233235074 at 2023-09-02
- haskell-awk # failure in job https://hydra.nixos.org/build/233235921 at 2023-09-02
@@ -2897,7 +2905,7 @@ broken-packages:
- hts # failure in job https://hydra.nixos.org/build/233256407 at 2023-09-02
- htsn # failure in job https://hydra.nixos.org/build/233197004 at 2023-09-02
- htssets # failure in job https://hydra.nixos.org/build/233195420 at 2023-09-02
- http2-client # failure in job https://hydra.nixos.org/build/233214193 at 2023-09-02
- http2-client-exe # failure in job https://hydra.nixos.org/build/260189666 at 2024-05-19
- http2-grpc-types # failure in job https://hydra.nixos.org/build/233197769 at 2023-09-02
- http2-tls # failure in job https://hydra.nixos.org/build/233227095 at 2023-09-02
- http-attoparsec # failure in job https://hydra.nixos.org/build/233233534 at 2023-09-02
@@ -3031,7 +3039,6 @@ broken-packages:
- ihaskell-hvega # failure in job https://hydra.nixos.org/build/241514418 at 2023-11-20
- ihaskell-parsec # failure in job https://hydra.nixos.org/build/233244271 at 2023-09-02
- ihaskell-plot # failure in job https://hydra.nixos.org/build/233255936 at 2023-09-02
- ihp-hsx # failure in job https://hydra.nixos.org/build/233211401 at 2023-09-02
- illuminate # failure in job https://hydra.nixos.org/build/233219478 at 2023-09-02
- imagemagick # failure in job https://hydra.nixos.org/build/233598237 at 2023-09-02
- imagepaste # failure in job https://hydra.nixos.org/build/233211716 at 2023-09-02
@@ -3381,7 +3388,6 @@ broken-packages:
- language-sh # failure in job https://hydra.nixos.org/build/233249709 at 2023-09-02
- language-sqlite # failure in job https://hydra.nixos.org/build/233248845 at 2023-09-02
- language-sygus # failure in job https://hydra.nixos.org/build/233192608 at 2023-09-02
- language-thrift # failure in job https://hydra.nixos.org/build/252721081 at 2024-03-16
- language-typescript # failure in job https://hydra.nixos.org/build/233247703 at 2023-09-02
- language-webidl # failure in job https://hydra.nixos.org/build/233194656 at 2023-09-02
- laop # failure in job https://hydra.nixos.org/build/233204106 at 2023-09-02
@@ -3418,6 +3424,7 @@ broken-packages:
- learn # failure in job https://hydra.nixos.org/build/233247385 at 2023-09-02
- Learning # failure in job https://hydra.nixos.org/build/233237137 at 2023-09-02
- learn-physics-examples # failure in job https://hydra.nixos.org/build/234444204 at 2023-09-13
- learn-physics # failure in job https://hydra.nixos.org/build/260189711 at 2024-05-19
- leb128 # failure in job https://hydra.nixos.org/build/252731801 at 2024-03-16
- leetify # failure in job https://hydra.nixos.org/build/233200752 at 2023-09-02
- lendingclub # failure in job https://hydra.nixos.org/build/233239123 at 2023-09-02
@@ -3429,6 +3436,7 @@ broken-packages:
- lens-process # failure in job https://hydra.nixos.org/build/233242948 at 2023-09-02
- lensref # failure in job https://hydra.nixos.org/build/233205479 at 2023-09-02
- lens-simple # failure in job https://hydra.nixos.org/build/233245452 at 2023-09-02
- lens-sop # failure in job https://hydra.nixos.org/build/259961739 at 2024-05-19
- lens-tell # failure in job https://hydra.nixos.org/build/233234619 at 2023-09-02
- lens-text-encoding # failure in job https://hydra.nixos.org/build/233222713 at 2023-09-02
- lens-th-rewrite # failure in job https://hydra.nixos.org/build/233201025 at 2023-09-02
@@ -3590,6 +3598,7 @@ broken-packages:
- louis # failure in job https://hydra.nixos.org/build/233227705 at 2023-09-02
- lowgl # failure in job https://hydra.nixos.org/build/233216216 at 2023-09-02
- lp-diagrams-svg # failure in job https://hydra.nixos.org/build/233220097 at 2023-09-02
- LPFP # failure in job https://hydra.nixos.org/build/260189697 at 2024-05-19
- lrucaching # failure in job https://hydra.nixos.org/build/233252034 at 2023-09-02
- LRU # failure in job https://hydra.nixos.org/build/233206273 at 2023-09-02
- lscabal # failure in job https://hydra.nixos.org/build/233253536 at 2023-09-02
@@ -4803,6 +4812,7 @@ broken-packages:
- pusher-ws # failure in job https://hydra.nixos.org/build/233204133 at 2023-09-02
- pushme # failure in job https://hydra.nixos.org/build/233212481 at 2023-09-02
- push-notifications # failure in job https://hydra.nixos.org/build/233199364 at 2023-09-02
- push-notify-apn # failure in job https://hydra.nixos.org/build/260189652 at 2024-05-19
- pushover # failure in job https://hydra.nixos.org/build/252739908 at 2024-03-16
- putlenses # failure in job https://hydra.nixos.org/build/233197372 at 2023-09-02
- puzzle-draw # failure in job https://hydra.nixos.org/build/233204953 at 2023-09-02
@@ -4960,6 +4970,7 @@ broken-packages:
- reflex-dom-retractable # failure in job https://hydra.nixos.org/build/233198362 at 2023-09-02
- reflex-dom-svg # failure in job https://hydra.nixos.org/build/233193544 at 2023-09-02
- reflex-external-ref # failure in job https://hydra.nixos.org/build/233215834 at 2023-09-02
- reflex-gadt-api # failure in job https://hydra.nixos.org/build/260124380 at 2024-05-19
- reflex-gi-gtk # failure in job https://hydra.nixos.org/build/253683412 at 2024-03-31
- reflex-gloss # failure in job https://hydra.nixos.org/build/234457448 at 2023-09-13
- reflex-jsx # failure in job https://hydra.nixos.org/build/233207137 at 2023-09-02
@@ -5284,6 +5295,7 @@ broken-packages:
- servant-github # failure in job https://hydra.nixos.org/build/233231566 at 2023-09-02
- servant-github-webhook # failure in job https://hydra.nixos.org/build/233234237 at 2023-09-02
- servant-htmx # failure in job https://hydra.nixos.org/build/233214786 at 2023-09-02
- servant-http2-client # failure in job https://hydra.nixos.org/build/260189694 at 2024-05-19
- servant-http-streams # failure in job https://hydra.nixos.org/build/233242852 at 2023-09-02
- servant-iCalendar # failure in job https://hydra.nixos.org/build/233200493 at 2023-09-02
- servant-jquery # failure in job https://hydra.nixos.org/build/233238796 at 2023-09-02
@@ -5389,6 +5401,7 @@ broken-packages:
- sifflet # failure in job https://hydra.nixos.org/build/233210515 at 2023-09-02
- sifflet-lib # failure in job https://hydra.nixos.org/build/233222675 at 2023-09-02
- sigmacord # failure in job https://hydra.nixos.org/build/233194491 at 2023-09-02
- signable # failure in job https://hydra.nixos.org/build/259979871 at 2024-05-19
- signable-haskell-protoc # failure in job https://hydra.nixos.org/build/252734188 at 2024-03-16
- signal-messaging-dbus # failure in job https://hydra.nixos.org/build/252723131 at 2024-03-16
- simd # failure in job https://hydra.nixos.org/build/233206642 at 2023-09-02
@@ -6401,6 +6414,7 @@ broken-packages:
- verify # failure in job https://hydra.nixos.org/build/233239874 at 2023-09-02
- verilog # failure in job https://hydra.nixos.org/build/233211999 at 2023-09-02
- versioning # failure in job https://hydra.nixos.org/build/233205892 at 2023-09-02
- vessel # failure in job https://hydra.nixos.org/build/260124469 at 2024-05-19
- vformat # failure in job https://hydra.nixos.org/build/233222840 at 2023-09-02
- vgrep # failure in job https://hydra.nixos.org/build/233210982 at 2023-09-02
- vhd # failure in job https://hydra.nixos.org/build/233230229 at 2023-09-02
@@ -6411,6 +6425,7 @@ broken-packages:
- Villefort # failure in job https://hydra.nixos.org/build/233224994 at 2023-09-02
- vimus # failure in job https://hydra.nixos.org/build/233227980 at 2023-09-02
- vintage-basic # failure in job https://hydra.nixos.org/build/233241073 at 2023-09-02
- vinyl-generics # failure in job https://hydra.nixos.org/build/259973897 at 2024-05-19
- vinyl-json # failure in job https://hydra.nixos.org/build/233207036 at 2023-09-02
- vinyl-named-sugar # failure in job https://hydra.nixos.org/build/233205326 at 2023-09-02
- vinyl-plus # failure in job https://hydra.nixos.org/build/233237873 at 2023-09-02
@@ -28,10 +28,15 @@ default-package-overrides:
- gi-gdkx11 < 4
# 2021-11-09: ghc-bignum is bundled starting with 9.0.1; only 1.0 builds with GHCs prior to 9.2.1
- ghc-bignum == 1.0
- hie-bios == 0.13.1
# 2024-05-18: Various overrides for hls compatibility
- lsp < 2.5
- lsp-types < 2.2
- lsp-test < 0.17.0.1
- extensions < 0.1.0.2 # Incompatible with Cabal < 3.12, the newest extensions version is only needed on ghc 9.10
# 2024-05-10: need to match hlegder from stackage
- hledger-ui < 1.33
extra-packages:
- Cabal-syntax == 3.6.* # Dummy package that ensures packages depending on Cabal-syntax can work for Cabal < 3.8
- Cabal == 3.2.* # Used for packages needing newer Cabal on ghc 8.6 and 8.8
@@ -61,7 +66,9 @@ extra-packages:
- ghc-exactprint == 1.6.* # 2023-03-30: needed for GHC == 9.4
- ghc-lib == 9.2.* # 2022-02-17: preserve for GHC 9.2
- ghc-lib-parser == 9.2.* # 2022-02-17: preserve for GHC 9.2
- ghc-lib-parser == 9.8.* # 2024-05-19: preserve for GHC 9.8
- ghc-lib-parser-ex == 9.2.* # 2022-07-13: preserve for GHC 9.2
- ghc-lib-parser-ex == 9.8.* # 2024-05-19: preserve for GHC 9.8
- ghc-syntax-highlighter == 0.0.10.* # 2023-11-20:
- gi-soup == 2.4.28 # 2023-04-05: the last version to support libsoup-2.4 (and thus be compatible with our other gi- packages)
- haddock == 2.23.* # required on GHC < 8.10.x
@@ -673,7 +680,6 @@ unsupported-platforms:
Raincat: [ platforms.darwin ]
reactive-balsa: [ platforms.darwin ] # depends on alsa-core
reflex-dom-fragment-shader-canvas: [ platforms.darwin, aarch64-linux ]
reflex-dom: [ platforms.darwin ]
reflex-localize-dom: [ platforms.darwin, aarch64-linux ]
rsi-break: [ platforms.darwin ] # depends on monomer
rtlsdr: [ platforms.darwin ]
@@ -723,6 +729,7 @@ supported-platforms:
dx9base: [ platforms.windows ]
dx9d3d: [ platforms.windows ]
dx9d3dx: [ platforms.windows ]
erebos-tester: [ platforms.linux ] # depends on linux-namespaces
evdev: [ platforms.linux ]
evdev-streamly: [ platforms.linux ]
geomancy: [ platforms.x86 ] # x86 intrinsics
@@ -1,4 +1,4 @@
# Stackage LTS 22.18
# Stackage LTS 22.22
# This file is auto-generated by
# maintainers/scripts/haskell/update-stackage.sh
default-package-overrides:
@@ -11,7 +11,7 @@ default-package-overrides:
- acid-state ==0.16.1.3
- action-permutations ==0.0.0.1
- active ==0.2.1
- ad ==4.5.5
- ad ==4.5.6
- ad-delcont ==0.5.0.0
- adjunctions ==4.4.2
- adler32 ==0.1.2.0
@@ -384,7 +384,7 @@ default-package-overrides:
- asn1-parse ==0.9.5
- asn1-types ==0.3.4
- assert-failure ==0.1.3.0
- assoc ==1.1
- assoc ==1.1.1
- astro ==0.4.3.0
- async ==2.2.5
- async-extra ==0.2.0.0
@@ -442,7 +442,7 @@ default-package-overrides:
- base-compat ==0.13.1
- base-compat-batteries ==0.13.1
- basement ==0.0.16
- base-orphans ==0.9.1
- base-orphans ==0.9.2
- base-prelude ==1.6.1.1
- base-unicode-symbols ==0.2.4.2
- basic-prelude ==0.7.0
@@ -453,8 +453,8 @@ default-package-overrides:
- bcp47-orphans ==0.1.0.6
- bcrypt ==0.0.11
- beam-core ==0.10.1.0
- bech32 ==1.1.5
- bech32-th ==1.1.5
- bech32 ==1.1.6
- bech32-th ==1.1.6
- benchpress ==0.2.2.23
- bencode ==0.6.1.1
- benri-hspec ==0.1.0.2
@@ -487,9 +487,10 @@ default-package-overrides:
- bits ==0.6
- bitset-word8 ==0.1.1.2
- bitvec ==1.1.5.0
- bitwise ==1.0.0.1
- bitwise-enum ==1.0.1.2
- blake2 ==0.3.0.1
- Blammo ==1.1.2.2
- Blammo ==1.1.2.3
- blank-canvas ==0.7.4
- blanks ==0.5.0
- blas-carray ==0.1.0.2
@@ -515,7 +516,7 @@ default-package-overrides:
- boltzmann-samplers ==0.1.1.0
- Boolean ==0.2.4
- boolsimplifier ==0.1.8
- boomerang ==1.4.9.1
- boomerang ==1.4.9.2
- boomwhacker ==0.0.1
- bordacount ==0.1.0.0
- boring ==0.2.1
@@ -543,9 +544,10 @@ default-package-overrides:
- bugsnag-wai ==1.0.0.1
- bugsnag-yesod ==1.0.1.0
- bugzilla-redhat ==1.0.1.1
- burrito ==2.0.1.8
- burrito ==2.0.1.9
- bv ==0.5
- bv-little ==1.3.2
- bv-sized ==1.0.5
- byteable ==0.1.1
- bytebuild ==0.3.16.2
- byte-count-reader ==0.10.1.11
@@ -559,11 +561,11 @@ default-package-overrides:
- bytesmith ==0.3.11.1
- bytestring-builder ==0.10.8.2.0
- bytestring-conversion ==0.3.2
- bytestring-lexing ==0.5.0.11
- bytestring-lexing ==0.5.0.12
- bytestring-strict-builder ==0.4.5.7
- bytestring-to-vector ==0.3.0.1
- bytestring-tree-builder ==0.2.7.12
- bytestring-trie ==0.2.7.2
- bytestring-trie ==0.2.7.3
- bz2 ==1.0.1.2
- bzip2-clib ==1.0.8
- bzlib ==0.5.2.0
@@ -571,7 +573,7 @@ default-package-overrides:
- c14n ==0.1.0.3
- c2hs ==0.28.8
- cabal2spec ==2.7.1
- cabal-appimage ==0.4.0.2
- cabal-appimage ==0.4.0.4
- cabal-clean ==0.2.20230609
- cabal-debian ==5.2.3
- cabal-doctest ==1.0.9
@@ -600,7 +602,7 @@ default-package-overrides:
- case-insensitive ==1.2.1.0
- cases ==0.1.4.3
- casing ==0.1.4.1
- cassava ==0.5.3.0
- cassava ==0.5.3.1
- cassava-conduit ==0.6.6
- cassava-megaparsec ==2.0.4
- cast ==0.1.0.2
@@ -624,7 +626,7 @@ default-package-overrides:
- Chart-cairo ==1.9.4.1
- Chart-diagrams ==1.9.5.1
- chart-svg ==0.5.2.0
- ChasingBottoms ==1.3.1.13
- ChasingBottoms ==1.3.1.14
- check-email ==1.0.2
- checkers ==0.6.0
- checksum ==0.0.0.1
@@ -687,7 +689,7 @@ default-package-overrides:
- commutative-semigroups ==0.1.1.0
- comonad ==5.0.8
- compact ==0.2.0.0
- compactmap ==0.1.4.3
- compactmap ==0.1.4.4
- companion ==0.1.0
- compdata ==0.13.1
- compensated ==0.8.3
@@ -706,7 +708,7 @@ default-package-overrides:
- concise ==0.1.0.1
- concurrency ==1.11.0.3
- concurrent-extra ==0.7.0.12
- concurrent-output ==1.10.20
- concurrent-output ==1.10.21
- concurrent-split ==0.0.1.1
- concurrent-supply ==0.1.8
- cond ==0.5.1
@@ -725,7 +727,8 @@ default-package-overrides:
- configurator ==0.3.0.0
- configurator-export ==0.1.0.1
- configurator-pg ==0.2.10
- constraints ==0.14
- config-value ==0.8.3
- constraints ==0.14.2
- constraints-extras ==0.4.0.0
- constraint-tuples ==0.1.2
- construct ==0.3.1.2
@@ -742,6 +745,14 @@ default-package-overrides:
- control-monad-omega ==0.3.2
- convertible ==1.1.1.1
- cookie ==0.4.6
- copilot ==3.19.1
- copilot-c99 ==3.19.1
- copilot-core ==3.19.1
- copilot-interpreter ==3.19.1
- copilot-language ==3.19.1
- copilot-libraries ==3.19.1
- copilot-prettyprinter ==3.19.1
- copilot-theorem ==3.19.1
- copr-api ==0.2.0
- core-data ==0.3.9.1
- core-program ==0.7.0.0
@@ -759,7 +770,7 @@ default-package-overrides:
- crc32c ==0.1.0
- credential-store ==0.1.2
- criterion ==1.6.3.0
- criterion-measurement ==0.2.1.0
- criterion-measurement ==0.2.2.0
- crypto-api ==0.13.3
- crypto-api-tests ==0.3
- crypto-cipher-tests ==0.0.11
@@ -783,7 +794,7 @@ default-package-overrides:
- crypton-x509-validation ==1.6.12
- crypto-pubkey-types ==0.4.3
- crypto-random-api ==0.2.0
- cryptostore ==0.3.0.1
- cryptostore ==0.3.1.0
- crypt-sha512 ==0
- csp ==1.4.0
- css-syntax ==0.1.0.1
@@ -826,7 +837,7 @@ default-package-overrides:
- datadog ==0.3.0.0
- data-dword ==0.3.2.1
- data-endian ==0.1.1
- data-fix ==0.3.2
- data-fix ==0.3.3
- data-forest ==0.1.0.12
- data-functor-logistic ==0.0
- data-has ==0.4.0.0
@@ -849,7 +860,7 @@ default-package-overrides:
- DAV ==1.3.4
- dbcleaner ==0.1.3
- DBFunctor ==0.1.2.1
- dbus ==1.3.2
- dbus ==1.3.3
- dbus-hslogger ==0.1.0.1
- debian ==4.0.5
- debian-build ==0.10.2.1
@@ -873,7 +884,7 @@ default-package-overrides:
- deriving-compat ==0.6.6
- deriving-trans ==0.9.1.0
- detour-via-sci ==1.0.0
- df1 ==0.4.2
- df1 ==0.4.3
- dhall ==1.42.1
- dhall-bash ==1.0.41
- di ==1.3
@@ -885,7 +896,7 @@ default-package-overrides:
- diagrams-core ==1.5.1.1
- diagrams-gtk ==1.4
- diagrams-html5 ==1.4.2
- diagrams-lib ==1.4.6.1
- diagrams-lib ==1.4.6.2
- diagrams-postscript ==1.5.1.1
- diagrams-rasterific ==1.4.2.3
- diagrams-solve ==0.1.3
@@ -928,7 +939,7 @@ default-package-overrides:
- doctest-driver-gen ==0.3.0.8
- doctest-exitcode-stdio ==0.0
- doctest-extract ==0.1.2
- doctest-lib ==0.1.1
- doctest-lib ==0.1.1.1
- doctest-parallel ==0.3.1.1
- doldol ==0.4.1.2
- do-list ==1.0.1
@@ -1039,7 +1050,7 @@ default-package-overrides:
- extensible ==0.9
- extensible-effects ==5.0.0.1
- extensible-exceptions ==0.1.1.4
- extra ==1.7.14
- extra ==1.7.16
- extractable-singleton ==0.0.1
- extra-data-yj ==0.1.0.0
- extrapolate ==0.4.6
@@ -1212,13 +1223,13 @@ default-package-overrides:
- ghc-core ==0.5.6
- ghc-events ==0.19.0.1
- ghc-exactprint ==1.7.1.0
- ghc-hs-meta ==0.1.3.0
- ghc-hs-meta ==0.1.4.0
- ghcid ==0.8.9
- ghci-hexcalc ==0.1.1.0
- ghcjs-codemirror ==0.0.0.2
- ghcjs-perch ==0.3.3.3
- ghc-lib ==9.6.4.20240109
- ghc-lib-parser ==9.6.4.20240109
- ghc-lib ==9.6.5.20240423
- ghc-lib-parser ==9.6.5.20240423
- ghc-lib-parser-ex ==9.6.0.2
- ghc-parser ==0.2.6.0
- ghc-paths ==0.1.0.12
@@ -1347,14 +1358,14 @@ default-package-overrides:
- hasktags ==0.73.0
- hasql ==1.6.4.4
- hasql-dynamic-statements ==0.3.1.5
- hasql-implicits ==0.1.1.2
- hasql-interpolate ==0.2.1.0
- hasql-implicits ==0.1.1.3
- hasql-interpolate ==0.2.2.0
- hasql-listen-notify ==0.1.0.1
- hasql-migration ==0.3.0
- hasql-notifications ==0.2.1.1
- hasql-notifications ==0.2.2.0
- hasql-optparse-applicative ==0.7.1.3
- hasql-pool ==0.10.1
- hasql-th ==0.4.0.19
- hasql-th ==0.4.0.21
- hasql-transaction ==1.0.1.4
- has-transformers ==0.1.0.4
- hasty-hamiltonian ==1.3.4
@@ -1400,7 +1411,7 @@ default-package-overrides:
- histogram-fill ==0.9.1.0
- hjsmin ==0.2.1
- hkd-default ==1.1.0.0
- hkgr ==0.4.3.2
- hkgr ==0.4.4
- hledger ==1.32.3
- hledger-iadd ==1.3.20
- hledger-interest ==1.6.6
@@ -1470,7 +1481,7 @@ default-package-overrides:
- hslua-module-system ==1.1.1
- hslua-module-text ==1.1.1
- hslua-module-version ==1.1.1
- hslua-module-zip ==1.1.1
- hslua-module-zip ==1.1.3
- hslua-objectorientation ==2.3.1
- hslua-packaging ==2.3.1
- hslua-repl ==0.1.2
@@ -1479,13 +1490,13 @@ default-package-overrides:
- hsndfile-vector ==0.5.2
- HsOpenSSL ==0.11.7.6
- HsOpenSSL-x509-system ==0.1.0.4
- hspec ==2.11.7
- hspec-api ==2.11.7
- hspec ==2.11.8
- hspec-api ==2.11.8
- hspec-attoparsec ==0.1.0.2
- hspec-checkers ==0.1.0.2
- hspec-contrib ==0.5.2
- hspec-core ==2.11.7
- hspec-discover ==2.11.7
- hspec-core ==2.11.8
- hspec-discover ==2.11.8
- hspec-expectations ==0.8.4
- hspec-expectations-json ==1.0.2.1
- hspec-expectations-lifted ==0.10.0
@@ -1496,7 +1507,7 @@ default-package-overrides:
- hspec-junit-formatter ==1.1.0.2
- hspec-leancheck ==0.0.6
- hspec-megaparsec ==2.2.1
- hspec-meta ==2.11.7
- hspec-meta ==2.11.8
- hspec-parsec ==0
- hspec-smallcheck ==0.5.3
- hspec-tmp-proc ==0.5.2.0
@@ -1507,16 +1518,17 @@ default-package-overrides:
- hstatistics ==0.3.1
- HStringTemplate ==0.8.8
- HSvm ==0.1.2.3.32
- HsYAML ==0.2.1.3
- HsYAML ==0.2.1.4
- HsYAML-aeson ==0.2.0.1
- hsyslog ==5.0.2
- htaglib ==1.2.1
- HTF ==0.15.0.1
- HTF ==0.15.0.2
- html ==1.0.1.2
- html-conduit ==1.3.2.2
- html-email-validate ==0.2.0.0
- html-entities ==1.1.4.7
- html-entity-map ==0.1.0.0
- html-parse ==0.2.1.0
- http2 ==5.0.1
- HTTP ==4000.4.1
- http-api-data ==0.5.1
@@ -1684,7 +1696,7 @@ default-package-overrides:
- junit-xml ==0.1.0.3
- justified-containers ==0.3.0.0
- jwt ==0.11.0
- kan-extensions ==5.2.5
- kan-extensions ==5.2.6
- kansas-comet ==0.4.2
- katip ==0.8.8.0
- katip-logstash ==0.1.0.2
@@ -1709,6 +1721,7 @@ default-package-overrides:
- knob ==0.2.2
- koji ==0.0.2
- koji-tool ==1.1.1
- kvitable ==1.0.3.0
- labels ==0.3.3
- lackey ==2.0.0.7
- lambdabot-core ==5.3.1.2
@@ -1717,13 +1730,16 @@ default-package-overrides:
- lame ==0.2.2
- language-avro ==0.1.4.0
- language-c ==0.9.3
- language-c99 ==0.2.0
- language-c99-simple ==0.3.0
- language-c99-util ==0.2.0
- language-c-quote ==0.13.0.1
- language-docker ==12.1.0
- language-dot ==0.1.2
- language-glsl ==0.3.0
- language-java ==0.2.9
- language-javascript ==0.7.1.0
- language-lua ==0.11.0.1
- language-lua ==0.11.0.2
- language-protobuf ==1.0.1
- language-python ==0.5.8
- lapack ==0.5.1.1
@@ -1743,7 +1759,6 @@ default-package-overrides:
- leancheck ==1.0.2
- leancheck-instances ==0.0.5
- leapseconds-announced ==2017.1.0.1
- learn-physics ==0.6.6
- leb128-cereal ==1.2
- lens ==5.2.3
- lens-action ==0.2.6
@@ -1808,16 +1823,16 @@ default-package-overrides:
- logstash ==0.1.0.4
- loop ==0.3.0
- lpeg ==1.0.4
- LPFP ==1.1.1
- LPFP-core ==1.1.1
- lrucache ==1.2.0.1
- lua ==2.3.2
- lua-arbitrary ==1.0.1.1
- lucid2 ==0.0.20230706
- lucid2 ==0.0.20240424
- lucid ==2.11.20230408
- lucid-cdn ==0.2.2.0
- lucid-extras ==0.2.2
- lukko ==0.1.1.3
- lumberjack ==1.0.3.0
- lz4 ==0.2.3.1
- lz4-frame-conduit ==0.1.0.1
- lzma ==0.0.1.0
@@ -1903,7 +1918,7 @@ default-package-overrides:
- min-max-pqueue ==0.1.0.2
- mintty ==0.1.4
- misfortune ==0.1.2.1
- miso ==1.8.3.0
- miso ==1.8.4.0
- missing-foreign ==0.1.1
- MissingH ==1.6.0.1
- mixed-types-num ==0.5.12
@@ -2085,7 +2100,7 @@ default-package-overrides:
- once ==0.4
- one-liner ==2.1
- one-liner-instances ==0.1.3.0
- OneTuple ==0.4.1.1
- OneTuple ==0.4.2
- Only ==0.1
- oo-prototypes ==0.1.0.0
- oops ==0.2.0.1
@@ -2123,28 +2138,30 @@ default-package-overrides:
- OrderedBits ==0.0.2.0
- ordered-containers ==0.2.3
- ormolu ==0.7.2.0
- os-string ==2.0.2
- os-string ==2.0.2.2
- overhang ==1.0.0
- packcheck ==0.6.0
- pager ==0.1.1.0
- pagination ==0.2.2
- pagure ==0.1.1
- pagure ==0.1.2
- pagure-cli ==0.2.1
- palette ==0.3.0.3
- pandoc ==3.1.11.1
- pandoc-cli ==3.1.11.1
- pandoc-dhall-decoder ==0.1.0.1
- pandoc-lua-engine ==0.2.1.2
- pandoc-lua-marshal ==0.2.6
- pandoc-lua-marshal ==0.2.7
- pandoc-plot ==1.8.0
- pandoc-server ==0.1.0.5
- pandoc-throw ==0.1.0.0
- pandoc-types ==1.23.1
- pango ==0.13.10.0
- panic ==0.4.0.1
- pantry ==0.9.3.2
- parallel ==3.2.2.0
- parallel-io ==0.3.5
- parameterized ==0.5.0.0
- parameterized-utils ==2.1.8.0
- park-bench ==0.1.1.0
- parseargs ==0.2.0.9
- parsec-class ==1.0.1.0
@@ -2281,7 +2298,7 @@ default-package-overrides:
- pretty-hex ==1.1
- prettyprinter ==1.7.1
- prettyprinter-ansi-terminal ==1.1.3
- prettyprinter-combinators ==0.1.2
- prettyprinter-combinators ==0.1.3
- prettyprinter-compat-annotated-wl-pprint ==1.1
- prettyprinter-compat-ansi-wl-pprint ==1.0.2
- prettyprinter-compat-wl-pprint ==1.0.1
@@ -2295,7 +2312,7 @@ default-package-overrides:
- primes ==0.2.1.0
- primitive ==0.8.0.0
- primitive-addr ==0.1.0.3
- primitive-extras ==0.10.1.10
- primitive-extras ==0.10.2
- primitive-offset ==0.2.0.1
- primitive-serial ==0.1
- primitive-unaligned ==0.1.1.2
@@ -2350,11 +2367,11 @@ default-package-overrides:
- quickcheck-assertions ==0.3.0
- quickcheck-classes ==0.6.5.0
- quickcheck-classes-base ==0.6.2.0
- quickcheck-groups ==0.0.1.1
- quickcheck-groups ==0.0.1.2
- quickcheck-higherorder ==0.1.0.1
- quickcheck-instances ==0.3.30
- quickcheck-io ==0.2.0
- quickcheck-monoid-subclasses ==0.3.0.2
- quickcheck-monoid-subclasses ==0.3.0.3
- quickcheck-simple ==0.1.1.1
- quickcheck-special ==0.1.0.6
- quickcheck-state-machine ==0.8.0
@@ -2420,8 +2437,8 @@ default-package-overrides:
- reducers ==3.12.4
- refact ==0.3.0.2
- ref-fd ==0.5.0.1
- refined ==0.8.1
- reflection ==2.1.7
- refined ==0.8.2
- reflection ==2.1.8
- RefSerialize ==0.4.0
- ref-tf ==0.5.0.1
- regex ==1.1.0.2
@@ -2468,7 +2485,7 @@ default-package-overrides:
- rio-orphans ==0.1.2.0
- rio-prettyprint ==0.1.8.0
- rng-utils ==0.3.1
- roc-id ==0.2.0.1
- roc-id ==0.2.0.2
- rocksdb-haskell ==1.0.1
- rocksdb-haskell-jprupp ==2.1.6
- rocksdb-query ==0.4.2
@@ -2524,6 +2541,7 @@ default-package-overrides:
- scalpel-core ==0.6.2.2
- scanf ==0.1.0.0
- scanner ==0.3.1
- s-cargot ==0.1.6.0
- scheduler ==2.0.0.1
- SciBaseTypes ==0.1.1.0
- scientific ==0.3.7.0
@@ -2541,7 +2559,7 @@ default-package-overrides:
- selections ==0.3.0.0
- selective ==0.7.0.1
- semialign ==1.3
- semigroupoids ==6.0.0.1
- semigroupoids ==6.0.1
- semigroups ==0.20
- semirings ==0.6
- semiring-simple ==1.0.0.1
@@ -2642,7 +2660,7 @@ default-package-overrides:
- since ==0.0.0
- singleton-bool ==0.1.7
- singleton-nats ==0.4.7
- singletons ==3.0.2
- singletons ==3.0.3
- singletons-base ==3.2
- singletons-presburger ==0.7.3.0
- singletons-th ==3.2
@@ -2653,8 +2671,8 @@ default-package-overrides:
- skein ==1.0.9.4
- skews ==0.1.0.3
- skip-var ==0.1.1.0
- skylighting ==0.14.1.1
- skylighting-core ==0.14.1.1
- skylighting ==0.14.1.2
- skylighting-core ==0.14.1.2
- skylighting-format-ansi ==0.1
- skylighting-format-blaze-html ==0.1.1.2
- skylighting-format-context ==0.1.0.2
@@ -2720,10 +2738,10 @@ default-package-overrides:
- stitch ==0.6.0.0
- stm-chans ==3.0.0.9
- stm-conduit ==4.0.1
- stm-containers ==1.2.0.3
- stm-containers ==1.2.1
- stm-delay ==0.1.1.1
- stm-extras ==0.1.0.3
- stm-hamt ==1.2.0.14
- stm-hamt ==1.2.1
- STMonadTrans ==0.4.8
- stm-split ==0.0.2.1
- stm-supply ==0.2.0.0
@@ -2751,7 +2769,7 @@ default-package-overrides:
- strict-lens ==0.4.0.3
- strict-list ==0.1.7.4
- strict-tuple ==0.1.5.3
- strict-wrapper ==0.0.0.0
- strict-wrapper ==0.0.1.0
- stringable ==0.1.3
- stringbuilder ==0.5.1
- string-class ==0.1.7.1
@@ -2778,7 +2796,7 @@ default-package-overrides:
- SVGFonts ==1.8.0.1
- svg-tree ==0.6.2.4
- swagger2 ==2.8.8
- swish ==0.10.7.0
- swish ==0.10.8.0
- syb ==0.7.2.4
- sydtest ==0.15.1.1
- sydtest-aeson ==0.1.0.0
@@ -2832,6 +2850,7 @@ default-package-overrides:
- tasty-autocollect ==0.4.2
- tasty-bench ==0.3.5
- tasty-bench-fit ==0.1
- tasty-checklist ==1.0.6.0
- tasty-dejafu ==2.1.0.1
- tasty-discover ==5.0.0
- tasty-expected-failure ==0.12.3
@@ -2853,6 +2872,7 @@ default-package-overrides:
- tasty-rerun ==1.1.19
- tasty-silver ==3.3.1.3
- tasty-smallcheck ==0.8.2
- tasty-sugar ==2.2.1.0
- tasty-tap ==0.1.0
- tasty-th ==0.1.7
- tasty-wai ==0.1.2.0
@@ -2903,7 +2923,7 @@ default-package-overrides:
- text-printer ==0.5.0.2
- text-regex-replace ==0.1.1.5
- text-rope ==0.2
- text-short ==0.1.5
- text-short ==0.1.6
- text-show ==3.10.5
- text-show-instances ==3.9.8
- text-zipper ==0.13
@@ -2919,7 +2939,7 @@ default-package-overrides:
- these ==1.2
- these-lens ==1.0.1.3
- these-optics ==1.0.1.2
- these-skinny ==0.7.5
- these-skinny ==0.7.6
- th-expand-syns ==0.4.11.0
- th-extras ==0.0.0.8
- th-lego ==0.3.0.3
@@ -2944,7 +2964,7 @@ default-package-overrides:
- tidal-link ==1.0.3
- tile ==0.3.0.0
- time-compat ==1.9.6.1
- time-domain ==0.1.0.3
- time-domain ==0.1.0.4
- timeit ==2.0
- timelens ==0.2.0.2
- time-lens ==0.4.0.2
@@ -3009,7 +3029,7 @@ default-package-overrides:
- typecheck-plugin-nat-simple ==0.1.0.9
- typed-process ==0.2.11.1
- typed-uuid ==0.2.0.0
- type-equality ==1
- type-equality ==1.0.1
- type-errors ==0.2.0.2
- type-flip ==0.1.0.0
- type-fun ==0.1.3
@@ -3059,6 +3079,8 @@ default-package-overrides:
- unique-logic ==0.4.0.1
- unique-logic-tf ==0.5.1
- unit-constraint ==0.0.0
- units ==2.4.1.5
- units-defs ==2.2.1
- units-parser ==0.1.1.5
- universe ==1.2.2
- universe-base ==1.1.3.1
@@ -3122,7 +3144,7 @@ default-package-overrides:
- vector-builder ==0.3.8.5
- vector-bytes-instances ==0.1.1
- vector-extras ==0.2.8.1
- vector-hashtables ==0.1.1.4
- vector-hashtables ==0.1.2.0
- vector-instances ==3.4.2
- vector-mmap ==0.0.3
- vector-rotcev ==0.1.0.2
@@ -3139,7 +3161,7 @@ default-package-overrides:
- ViennaRNAParser ==1.3.3
- vinyl ==0.14.3
- vinyl-loeb ==0.0.1.0
- Vis ==0.7.7.0
- Vis ==0.7.7.1
- vivid-osc ==0.5.0.0
- vivid-supercollider ==0.4.1.2
- void ==0.7.3
@@ -3192,6 +3214,7 @@ default-package-overrides:
- websockets-snap ==0.10.3.1
- weigh ==0.0.17
- welford-online-mean-variance ==0.2.0.0
- what4 ==1.5.1
- wide-word ==0.1.6.0
- Win32-notify ==0.3.0.3
- windns ==0.1.0.1
@@ -3230,7 +3253,7 @@ default-package-overrides:
- xdg-basedir ==0.2.2
- xdg-userdirs ==0.1.0.2
- xeno ==0.6
- xlsx ==1.1.2.1
- xlsx ==1.1.2.2
- xml ==1.3.14
- xml-basic ==0.1.3.2
- xmlbf ==0.7
@@ -3268,7 +3291,7 @@ default-package-overrides:
- yesod-form-bootstrap4 ==3.0.1.1
- yesod-gitrepo ==0.3.0
- yesod-gitrev ==0.2.2
- yesod-markdown ==0.12.6.13
- yesod-markdown ==0.12.6.14
- yesod-middleware-csp ==1.2.0
- yesod-newsfeed ==1.7.0.0
- yesod-page-cursor ==2.0.1.0
@@ -3288,6 +3311,7 @@ default-package-overrides:
- youtube ==0.2.1.1
- zenacy-html ==2.1.0
- zenacy-unicode ==1.0.2
- zenc ==0.1.2
- zeromq4-haskell ==0.8.0
- zeromq4-patterns ==0.3.1.0
- zigzag ==0.0.1.0
@@ -246,7 +246,6 @@ dont-distribute-packages:
- KiCS-debugger
- KiCS-prophecy
- LDAPv3
- LPFP
- LPPaver
- LambdaINet
- LambdaPrettyQuote
@@ -403,7 +402,6 @@ dont-distribute-packages:
- UTFTConverter
- UrlDisp
- ViennaRNA-extras
- Vis
- WEditorBrick
- WEditorHyphen
- WL500gPControl
@@ -467,6 +465,7 @@ dont-distribute-packages:
- agda-snippets-hakyll
- agentx
- aip
- airgql
- aivika-distributed
- alg
- algebra-checkers
@@ -533,6 +532,7 @@ dont-distribute-packages:
- apotiki
- approx-rand-test
- arbor-monad-metric-datadog
- archive-libarchive
- archive-tar-bytestring
- archlinux-web
- arduino-copilot
@@ -637,7 +637,6 @@ dont-distribute-packages:
- bearriver
- beautifHOL
- bech32-th
- bech32-th_1_1_6
- bein
- belka
- bff
@@ -695,6 +694,7 @@ dont-distribute-packages:
- blink1
- blip
- blogination
- bloohm
- bloxorz
- blubber
- bluetile
@@ -1245,7 +1245,7 @@ dont-distribute-packages:
- electrs-client
- elerea-examples
- eliminators
- eliminators_0_9_4
- eliminators_0_9_5
- elliptic-curve
- elsa
- ema-extra
@@ -2238,7 +2238,6 @@ dont-distribute-packages:
- http-exchange
- http-exchange-instantiations
- http-response-decoder
- http2-client-exe
- http2-client-grpc
- http2-grpc-proto-lens
- http2-grpc-proto3-wire
@@ -2266,6 +2265,7 @@ dont-distribute-packages:
- hw-json-simple-cursor
- hw-json-standard-cursor
- hw-kafka-avro
- hw-polysemy
- hw-uri
- hworker-ses
- hwormhole
@@ -2422,6 +2422,7 @@ dont-distribute-packages:
- json-query
- json-rpc-client
- json-schema
- json-sop
- json-spec-elm
- json-spec-elm-servant
- json-spec-openapi
@@ -2549,7 +2550,6 @@ dont-distribute-packages:
- ldapply
- leaky
- lean
- learn-physics
- learning-hmm
- legion
- legion-discovery
@@ -2567,6 +2567,7 @@ dont-distribute-packages:
- lha
- lhae
- lhe
- libarchive
- libconfig
- libcspm
- libgraph
@@ -3256,7 +3257,6 @@ dont-distribute-packages:
- purescript-tsd-gen
- pursuit-client
- push-notify
- push-notify-apn
- push-notify-ccs
- push-notify-general
- puzzle-draw-cmdline
@@ -3615,7 +3615,6 @@ dont-distribute-packages:
- servant-ekg
- servant-examples
- servant-haxl-client
- servant-http2-client
- servant-js
- servant-jsonrpc-client
- servant-jsonrpc-server
@@ -3906,6 +3905,8 @@ dont-distribute-packages:
- target
- task
- task-distribution
- tasklite
- tasklite-core
- tasty-bdd
- tasty-groundhog-converters
- tasty-integrate
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -229,7 +229,7 @@ in {
buildTargetLlvmPackages = pkgsBuildTarget.llvmPackages_12;
llvmPackages = pkgs.llvmPackages_12;
};
ghc948 = callPackage ../development/compilers/ghc/9.4.8.nix {
ghc948 = callPackage ../development/compilers/ghc/9.4.8.fixme.nix {
bootPkgs =
# Building with 9.2 is broken due to
# https://gitlab.haskell.org/ghc/ghc/-/issues/21914