Merge pull request #107549 from NixOS/haskell-updates

Update Haskell package set to ghc-8.10.3 (plus other fixes)
This commit is contained in:
Peter Simons 2020-12-25 20:53:40 +01:00 committed by GitHub
commit 520d00dd7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 1450 additions and 366 deletions

View File

@ -1,6 +1,6 @@
{ fetchurl }:
fetchurl {
url = "https://github.com/commercialhaskell/all-cabal-hashes/archive/13d33ba1a0ce6acd583dee6a8a2c7e7398fa30cd.tar.gz";
sha256 = "0ggm1iv2ilxj39icqjx4dk9p3sbndvrf90v2qssz9h49xsv9w0j7";
url = "https://github.com/commercialhaskell/all-cabal-hashes/archive/f20dd1d767313d653d6f0c6dd9a82f92d36ecb4c.tar.gz";
sha256 = "1prawfbp6390dlgfvd3hxvgdab7rfkr88j35m5cbk3a4hxghkyj3";
}

View File

@ -0,0 +1,256 @@
{ stdenv, pkgsBuildTarget, targetPackages
# build-tools
, bootPkgs
, autoconf, automake, coreutils, fetchpatch, fetchurl, perl, python3, m4, sphinx
, bash
, libiconv ? null, ncurses
, # GHC can be built with system libffi or a bundled one.
libffi ? null
, useLLVM ? !stdenv.targetPlatform.isx86
, # LLVM is conceptually a run-time-only depedendency, but for
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
# build-time dependency too.
buildLlvmPackages, llvmPackages
, # If enabled, GHC will be built with the GPL-free but slower integer-simple
# library instead of the faster but GPLed integer-gmp library.
enableIntegerSimple ? !(stdenv.lib.any (stdenv.lib.meta.platformMatch stdenv.hostPlatform) gmp.meta.platforms), gmp
, # If enabled, use -fPIC when compiling static libs.
enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
# aarch64 outputs otherwise exceed 2GB limit
, enableProfiledLibs ? !stdenv.targetPlatform.isAarch64
, # Whether to build dynamic libs for the standard library (on the target
# platform). Static libs are always built.
enableShared ? !stdenv.targetPlatform.isWindows && !stdenv.targetPlatform.useiOSPrebuilt
, # 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 ? stdenv.lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
(if useLLVM then "perf-cross" else "perf-cross-ncg")
, # 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.isDarwin && stdenv.targetPlatform.isAarch64
}:
assert !enableIntegerSimple -> gmp != null;
let
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
inherit (bootPkgs) ghc;
# TODO(@Ericson2314) Make unconditional
targetPrefix = stdenv.lib.optionalString
(targetPlatform != hostPlatform)
"${targetPlatform.config}-";
buildMK = ''
BuildFlavour = ${ghcFlavour}
ifneq \"\$(BuildFlavour)\" \"\"
include mk/flavours/\$(BuildFlavour).mk
endif
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
INTEGER_LIBRARY = ${if enableIntegerSimple then "integer-simple" else "integer-gmp"}
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
CrossCompilePrefix = ${targetPrefix}
HADDOCK_DOCS = NO
BUILD_SPHINX_HTML = NO
BUILD_SPHINX_PDF = NO
'' + stdenv.lib.optionalString (!enableProfiledLibs) ''
GhcLibWays = "v dyn"
'' + stdenv.lib.optionalString enableRelocatedStaticLibs ''
GhcLibHcOpts += -fPIC
GhcRtsHcOpts += -fPIC
'' + stdenv.lib.optionalString targetPlatform.useAndroidPrebuilt ''
EXTRA_CC_OPTS += -std=gnu99
'';
# Splicer will pull out correct variations
libDeps = platform: stdenv.lib.optional enableTerminfo ncurses
++ [libffi]
++ stdenv.lib.optional (!enableIntegerSimple) gmp
++ stdenv.lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
toolsForTarget = [
pkgsBuildTarget.targetPackages.stdenv.cc
] ++ stdenv.lib.optional useLLVM buildLlvmPackages.llvm;
targetCC = builtins.head toolsForTarget;
# ld.gold is disabled for musl libc due to https://sourceware.org/bugzilla/show_bug.cgi?id=23856
# see #84670 and #49071 for more background.
useLdGold = targetPlatform.isLinux && !(targetPlatform.useLLVM or false) && !targetPlatform.isMusl;
in
stdenv.mkDerivation (rec {
version = "8.10.3";
name = "${targetPrefix}ghc-${version}";
src = fetchurl {
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
sha256 = "0cdrdvs5qnqr93cr9zvrlfjv2xr671kjjghnsw4afa4hahcq7p6c";
};
enableParallelBuilding = true;
outputs = [ "out" "doc" ];
patches = stdenv.lib.optionals stdenv.isDarwin [
# Make Block.h compile with c++ compilers. Remove with the next release
(fetchpatch {
url = "https://gitlab.haskell.org/ghc/ghc/-/commit/97d0b0a367e4c6a52a17c3299439ac7de129da24.patch";
sha256 = "0r4zjj0bv1x1m2dgxp3adsf2xkr94fjnyj1igsivd9ilbs5ja0b5";
})
];
postPatch = "patchShebangs .";
# GHC is a bit confused on its cross terminology.
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}cxx"
# Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.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="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip"
echo -n "${buildMK}" > mk/build.mk
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
'' + stdenv.lib.optionalString stdenv.isDarwin ''
export NIX_LDFLAGS+=" -no_dtrace_dof"
'' + stdenv.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
'' + stdenv.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" ]
++ stdenv.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"
] ++ stdenv.lib.optionals (libffi != null) [
"--with-system-libffi"
"--with-ffi-includes=${targetPackages.libffi.dev}/include"
"--with-ffi-libraries=${targetPackages.libffi.out}/lib"
] ++ stdenv.lib.optionals (targetPlatform == hostPlatform && !enableIntegerSimple) [
"--with-gmp-includes=${targetPackages.gmp.dev}/include"
"--with-gmp-libraries=${targetPackages.gmp.out}/lib"
] ++ stdenv.lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
"--with-iconv-includes=${libiconv}/include"
"--with-iconv-libraries=${libiconv}/lib"
] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [
"--enable-bootstrap-with-devel-snapshot"
] ++ stdenv.lib.optionals useLdGold [
"CFLAGS=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
] ++ stdenv.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 sphinx
ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
];
# For building runtime libs
depsBuildTarget = toolsForTarget;
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
propagatedBuildInputs = [ targetPackages.stdenv.cc ]
++ stdenv.lib.optional useLLVM llvmPackages.llvm;
depsTargetTarget = map stdenv.lib.getDev (libDeps targetPlatform);
depsTargetTargetPropagated = map (stdenv.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" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
checkTarget = "test";
hardeningDisable = [ "format" ] ++ stdenv.lib.optional stdenv.targetPlatform.isMusl "pie";
postInstall = ''
# Install the bash completion file.
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
# Patch scripts to include "readelf" and "cat" in $PATH.
for i in "$out/bin/"*; do
test ! -h $i || continue
egrep --quiet '^#!' <(head -n 1 $i) || continue
sed -i -e '2i export PATH="$PATH:${stdenv.lib.makeBinPath [ targetPackages.stdenv.cc.bintools coreutils ]}"' $i
done
'';
passthru = {
inherit bootPkgs targetPrefix;
inherit llvmPackages;
inherit enableShared;
# Our Cabal compiler name
haskellCompilerName = "ghc-${version}";
};
meta = {
homepage = "http://haskell.org/ghc";
description = "The Glasgow Haskell Compiler";
maintainers = with stdenv.lib.maintainers; [ marcweber andres peti ];
timeout = 24 * 3600;
inherit (ghc.meta) license platforms;
};
} // stdenv.lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
dontStrip = true;
dontPatchELF = true;
noAuditTmpdir = true;
})

View File

@ -1164,8 +1164,10 @@ self: super: {
# $HOME, which we don't have in our build sandbox.
cabal-install-parsers = dontCheck super.cabal-install-parsers;
# gitit is unbroken in the latest release
gitit = markUnbroken super.gitit;
# version constraints break the build, so we jailbreak
# can be removed at a new release which also fixes
# https://github.com/jgm/gitit/issues/665
gitit = doJailbreak super.gitit;
# Test suite requires database
persistent-mysql = dontCheck super.persistent-mysql;
@ -1541,4 +1543,9 @@ self: super: {
# https://github.com/yesodweb/yesod/issues/1714
yesod-core = dontCheck super.yesod-core;
# Add ApplicationServices on darwin
# use 0.4.5 instead of 0.4.4 to fix build with glibc >= 2.32
apecs-physics = addPkgconfigDepends super.apecs-physics_0_4_5
(pkgs.lib.optional pkgs.stdenv.isDarwin pkgs.darwin.apple_sdk.frameworks.ApplicationServices);
} // import ./configuration-tensorflow.nix {inherit pkgs haskellLib;} self super

View File

@ -83,6 +83,12 @@ self: super: {
sha256 = "0rgzrq0513nlc1vw7nw4km4bcwn4ivxcgi33jly4a7n3c1r32v1f";
});
# Version 4.7.2 is broken by the bytestring library shipped by ghc-8.10.3.
ListLike = appendPatch super.ListLike (pkgs.fetchpatch {
url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/master/patches/ListLike-4.7.2.patch";
sha256 = "1v392a74w0sxyn6x0bqixpmjbgla0i2b5hxzkcn1vaa3gaya7ag4";
});
# hnix 0.9.0 does not provide an executable for ghc < 8.10, so define completions here for now.
hnix = generateOptparseApplicativeCompletion "hnix"
(overrideCabal super.hnix (drv: {

View File

@ -1,29 +1,29 @@
# pkgs/development/haskell-modules/configuration-hackage2nix.yaml
compiler: ghc-8.10.2
compiler: ghc-8.10.3
core-packages:
- array-0.5.4.0
- base-4.14.1.0
- binary-0.8.8.0
- bytestring-0.10.10.0
- Cabal-3.2.0.0
- bytestring-0.10.12.0
- Cabal-3.2.1.0
- containers-0.6.2.1
- deepseq-1.4.4.0
- directory-1.3.6.0
- exceptions-0.10.4
- filepath-1.4.2.1
- ghc-8.10.2
- ghc-boot-8.10.2
- ghc-boot-th-8.10.2
- ghc-8.10.3
- ghc-boot-8.10.3
- ghc-boot-th-8.10.3
- ghc-compact-0.1.0.0
- ghc-heap-8.10.2
- ghc-heap-8.10.3
- ghc-prim-0.6.1
- ghci-8.10.2
- ghci-8.10.3
- haskeline-0.8.0.1
- hpc-0.6.1.0
- integer-gmp-1.0.3.0
- libiserv-8.10.2
- libiserv-8.10.3
- mtl-2.2.2
- parsec-3.1.14.0
- pretty-1.1.3.6
@ -32,7 +32,7 @@ core-packages:
- stm-2.5.0.0
- template-haskell-2.16.0.0
- terminfo-0.4.1.4
- text-1.2.3.2
- text-1.2.4.1
- time-1.9.3
- transformers-0.5.6.2
- unix-2.7.2.2
@ -3150,9 +3150,6 @@ broken-packages:
- aos-signature
- aosd
- apart
- apecs-gloss
- apecs-physics
- apecs-physics-gloss
- apecs-stm
- apelsin
- api-builder
@ -5091,7 +5088,9 @@ broken-packages:
- fei-base
- fei-cocoapi
- fei-dataiter
- fei-datasets
- fei-examples
- fei-modelzoo
- fei-nn
- feldspar-compiler
- feldspar-language
@ -5178,7 +5177,6 @@ broken-packages:
- flamethrower
- flamingra
- flashblast
- flat
- flat-maybe
- flatbuffers
- flay
@ -5541,7 +5539,6 @@ broken-packages:
- github-webhook-handler-snap
- githud
- gitignore
- gitit
- gitlab-api
- gitlib
- gitlib-cmdline
@ -5700,7 +5697,6 @@ broken-packages:
- gray-code
- greencard
- greencard-lib
- greenclip
- greg-client
- gremlin-haskell
- Grempa
@ -7712,6 +7708,7 @@ broken-packages:
- mahoro
- maid
- mail-pool
- mail-reports
- mailchimp
- mailchimp-subscribe
- MailchimpSimple
@ -10394,7 +10391,6 @@ broken-packages:
- Tablify
- tabloid
- tabs
- taffybar
- tag-bits
- tag-stream
- tagged-exception-core
@ -11516,6 +11512,7 @@ broken-packages:
- yxdb-utils
- Z-Data
- Z-IO
- Z-YAML
- z3-encoding
- z85
- zabt

View File

@ -662,33 +662,9 @@ self: super: builtins.intersectAttrs super {
spago =
let
# Spago needs a small patch to work with the latest versions of rio.
# https://github.com/purescript/spago/pull/647
spagoWithPatches = overrideCabal (appendPatch super.spago (
# Spago-0.17 needs a small patch to work with the latest version of dhall.
# This can probably be removed with Spago-0.18.
# https://github.com/purescript/spago/pull/695
pkgs.fetchpatch {
url = "https://github.com/purescript/spago/commit/6258ac601480e776c215c989cc5faae46d5ca9f7.patch";
sha256 = "02zy4jf24qlqz9fkcs2rqg64ijd8smncmra8s5yp2mln4dmmii1k";
}
)) (old: {
# The above patch contains a completely new spago.cabal file, but our
# source tree from Hackage already contains a cabal file. Delete the
# local cabal file and just take the one from the patch.
#
# WARNING: The empty line above the `rm` needs to be kept.
prePatch = old.prePatch or "" + ''
rm spago.cabal
'';
# The above patch also adds a dependency on the stringsearch package.
libraryHaskellDepends = old.libraryHaskellDepends or [] ++ [ self.stringsearch ];
});
# spago requires an older version of megaparsec, but it appears to work
# fine with newer versions.
spagoWithOverrides = doJailbreak spagoWithPatches;
spagoWithOverrides = doJailbreak super.spago;
# This defines the version of the purescript-docs-search release we are using.
# This is defined in the src/Spago/Prelude.hs file in the spago source.

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,9 @@
{ haskell
, haskellPackages
, lib
# The following are only needed for the passthru.tests:
, git
, nodejs
, purescript
, runCommand
@ -32,6 +35,7 @@ spago.overrideAttrs (oldAttrs: {
{
__noChroot = true;
nativeBuildInputs = [
git
nodejs
purescript
spago

View File

@ -1,21 +1,22 @@
{ mkDerivation, aeson, aeson-pretty, ansi-terminal, async-pool
, base, bower-json, bytestring, Cabal, containers, dhall, directory
, either, exceptions, extra, fetchgit, file-embed, filepath, foldl
, fsnotify, github, Glob, hpack, hspec, hspec-discover
, hspec-megaparsec, http-client, http-conduit, http-types
, lens-family-core, megaparsec, mtl, network-uri, open-browser
, optparse-applicative, prettyprinter, process, QuickCheck, retry
, rio, rio-orphans, safe, semver-range, stdenv, stm, tar
, template-haskell, temporary, text, time, transformers, turtle
, unliftio, unordered-containers, vector, versions, with-utf8, zlib
, fsnotify, generic-lens, github, Glob, hpack, hspec
, hspec-discover, hspec-megaparsec, http-client, http-conduit
, http-types, lens-family-core, megaparsec, mtl, network-uri
, open-browser, optparse-applicative, prettyprinter, process
, QuickCheck, retry, rio, rio-orphans, safe, semver-range, stdenv
, stm, stringsearch, tar, template-haskell, temporary, text, time
, transformers, turtle, unliftio, unordered-containers, utf8-string
, vector, versions, with-utf8, zlib
}:
mkDerivation {
pname = "spago";
version = "0.17.0";
version = "0.18.0";
src = fetchgit {
url = "https://github.com/purescript/spago.git";
sha256 = "1w9y1gvk307f92gixs5g02zbg0xwhrshwmc5j97pxhbzzg9qjidy";
rev = "3309afdef25e3e77f991a079eed78ff2f750e463";
sha256 = "03ww7qhrggwsbm0kcnvcr3ifb8rm860ajimzr81isiw46ykwrl38";
rev = "a4d39c21cae2f2c6d43fa204853c8e17c72904d2";
fetchSubmodules = true;
};
isLibrary = true;
@ -23,12 +24,12 @@ mkDerivation {
libraryHaskellDepends = [
aeson aeson-pretty ansi-terminal async-pool base bower-json
bytestring Cabal containers dhall directory either exceptions
file-embed filepath foldl fsnotify github Glob http-client
http-conduit http-types lens-family-core megaparsec mtl network-uri
open-browser optparse-applicative prettyprinter process retry rio
rio-orphans safe semver-range stm tar template-haskell temporary
text time transformers turtle unliftio unordered-containers vector
versions with-utf8 zlib
file-embed filepath foldl fsnotify generic-lens github Glob
http-client http-conduit http-types lens-family-core megaparsec mtl
network-uri open-browser optparse-applicative prettyprinter process
retry rio rio-orphans safe semver-range stm stringsearch tar
template-haskell temporary text time transformers turtle unliftio
unordered-containers utf8-string vector versions with-utf8 zlib
];
libraryToolDepends = [ hpack ];
executableHaskellDepends = [ base text turtle with-utf8 ];

View File

@ -9440,7 +9440,7 @@ in
# Please update doc/languages-frameworks/haskell.section.md, “Our
# current default compiler is”, if you bump this:
haskellPackages = dontRecurseIntoAttrs haskell.packages.ghc8102;
haskellPackages = dontRecurseIntoAttrs haskell.packages.ghc8103;
inherit (haskellPackages) ghc;

View File

@ -104,6 +104,16 @@ in {
buildLlvmPackages = buildPackages.llvmPackages_9;
llvmPackages = pkgs.llvmPackages_9;
};
ghc8103 = callPackage ../development/compilers/ghc/8.10.3.nix {
# aarch64 ghc865Binary gets SEGVs due to haskell#15449 or similar
bootPkgs = if stdenv.isAarch64 || stdenv.isAarch32 then
packages.ghc8102BinaryMinimal
else
packages.ghc865Binary;
inherit (buildPackages.python3Packages) sphinx;
buildLlvmPackages = buildPackages.llvmPackages_9;
llvmPackages = pkgs.llvmPackages_9;
};
ghc901 = callPackage ../development/compilers/ghc/9.0.1.nix {
bootPkgs = packages.ghc8102Binary;
inherit (buildPackages.python3Packages) sphinx;
@ -206,6 +216,11 @@ in {
ghc = bh.compiler.ghc8102;
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.10.x.nix { };
};
ghc8103 = callPackage ../development/haskell-modules {
buildHaskellPackages = bh.packages.ghc8103;
ghc = bh.compiler.ghc8103;
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.10.x.nix { };
};
ghc901 = callPackage ../development/haskell-modules {
buildHaskellPackages = bh.packages.ghc901;
ghc = bh.compiler.ghc901;