mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-17 06:06:13 +03:00
Merge pull request #26799 from obsidiansystems/cross-haskell
haskell infra: Fix cross compilation to work with new system
This commit is contained in:
commit
ec0c4802ae
@ -96,7 +96,11 @@ stdenv.mkDerivation rec {
|
|||||||
[ $(./main) == "yes" ]
|
[ $(./main) == "yes" ]
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru = { targetPrefix = ""; };
|
passthru = {
|
||||||
|
targetPrefix = "";
|
||||||
|
# Our Cabal compiler name
|
||||||
|
haskellCompilerName = "ghc";
|
||||||
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = http://haskell.org/ghc;
|
homepage = http://haskell.org/ghc;
|
||||||
|
@ -25,7 +25,12 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
NIX_CFLAGS_COMPILE = "-fomit-frame-pointer";
|
NIX_CFLAGS_COMPILE = "-fomit-frame-pointer";
|
||||||
|
|
||||||
passthru = { targetPrefix = ""; };
|
passthru = {
|
||||||
|
targetPrefix = "";
|
||||||
|
|
||||||
|
# Our Cabal compiler name
|
||||||
|
haskellCompilerName = "ghc";
|
||||||
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = http://haskell.org/ghc;
|
homepage = http://haskell.org/ghc;
|
||||||
|
@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
echo "${buildMK}" > mk/build.mk
|
echo -n "${buildMK}" > mk/build.mk
|
||||||
'';
|
'';
|
||||||
|
|
||||||
configureFlags = [
|
configureFlags = [
|
||||||
@ -36,7 +36,12 @@ stdenv.mkDerivation rec {
|
|||||||
# that in turn causes GHCi to abort
|
# that in turn causes GHCi to abort
|
||||||
stripDebugFlags=["-S" "--keep-file-symbols"];
|
stripDebugFlags=["-S" "--keep-file-symbols"];
|
||||||
|
|
||||||
passthru = { targetPrefix = ""; };
|
passthru = {
|
||||||
|
targetPrefix = "";
|
||||||
|
|
||||||
|
# Our Cabal compiler name
|
||||||
|
haskellCompilerName = "ghc";
|
||||||
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = http://haskell.org/ghc;
|
homepage = http://haskell.org/ghc;
|
||||||
|
@ -134,7 +134,12 @@ stdenv.mkDerivation rec {
|
|||||||
[ $(./main) == "yes" ]
|
[ $(./main) == "yes" ]
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru = { targetPrefix = ""; };
|
passthru = {
|
||||||
|
targetPrefix = "";
|
||||||
|
|
||||||
|
# Our Cabal compiler name
|
||||||
|
haskellCompilerName = "ghc";
|
||||||
|
};
|
||||||
|
|
||||||
meta.license = stdenv.lib.licenses.bsd3;
|
meta.license = stdenv.lib.licenses.bsd3;
|
||||||
meta.platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"];
|
meta.platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"];
|
||||||
|
@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
echo "${buildMK}" > mk/build.mk
|
echo -n "${buildMK}" > mk/build.mk
|
||||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||||
find . -name '*.hs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|'
|
find . -name '*.hs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|'
|
||||||
@ -45,7 +45,12 @@ stdenv.mkDerivation rec {
|
|||||||
# that in turn causes GHCi to abort
|
# that in turn causes GHCi to abort
|
||||||
stripDebugFlags=["-S" "--keep-file-symbols"];
|
stripDebugFlags=["-S" "--keep-file-symbols"];
|
||||||
|
|
||||||
passthru = { targetPrefix = ""; };
|
passthru = {
|
||||||
|
targetPrefix = "";
|
||||||
|
|
||||||
|
# Our Cabal compiler name
|
||||||
|
haskellCompilerName = "ghc";
|
||||||
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = http://haskell.org/ghc;
|
homepage = http://haskell.org/ghc;
|
||||||
|
@ -2,15 +2,28 @@
|
|||||||
, buildPlatform, hostPlatform, targetPlatform
|
, buildPlatform, hostPlatform, targetPlatform
|
||||||
|
|
||||||
# build-tools
|
# build-tools
|
||||||
, bootPkgs, hscolour, llvm_35
|
, bootPkgs, hscolour
|
||||||
, coreutils, fetchurl, fetchpatch, perl
|
, coreutils, fetchurl, fetchpatch, perl
|
||||||
, docbook_xsl, docbook_xml_dtd_45, docbook_xml_dtd_42, libxml2, libxslt
|
, docbook_xsl, docbook_xml_dtd_45, docbook_xml_dtd_42, libxml2, libxslt
|
||||||
|
|
||||||
, libiconv ? null, ncurses
|
, libffi, libiconv ? null, ncurses
|
||||||
|
|
||||||
|
, useLLVM ? !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
|
, # If enabled, GHC will be built with the GPL-free but slower integer-simple
|
||||||
# library instead of the faster but GPLed integer-gmp library.
|
# library instead of the faster but GPLed integer-gmp library.
|
||||||
enableIntegerSimple ? false, gmp ? null
|
enableIntegerSimple ? false, gmp ? null
|
||||||
|
|
||||||
|
, # If enabled, use -fPIC when compiling static libs.
|
||||||
|
enableRelocatedStaticLibs ? targetPlatform != hostPlatform
|
||||||
|
|
||||||
|
, # Whether to build dynamic libs for the standard library (on the target
|
||||||
|
# platform). Static libs are always built.
|
||||||
|
enableShared ? true
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert !enableIntegerSimple -> gmp != null;
|
assert !enableIntegerSimple -> gmp != null;
|
||||||
@ -28,6 +41,32 @@ let
|
|||||||
sha256 = "1j45z4kcd3w1rzm4hapap2xc16bbh942qnzzdbdjcwqznsccznf0";
|
sha256 = "1j45z4kcd3w1rzm4hapap2xc16bbh942qnzzdbdjcwqznsccznf0";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
buildMK = ''
|
||||||
|
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
|
||||||
|
'' + stdenv.lib.optionalString enableIntegerSimple ''
|
||||||
|
INTEGER_LIBRARY = integer-simple
|
||||||
|
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
|
||||||
|
BuildFlavour = perf-cross
|
||||||
|
Stage1Only = YES
|
||||||
|
HADDOCK_DOCS = NO
|
||||||
|
'' + stdenv.lib.optionalString enableRelocatedStaticLibs ''
|
||||||
|
GhcLibHcOpts += -fPIC
|
||||||
|
GhcRtsHcOpts += -fPIC
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Splicer will pull out correct variations
|
||||||
|
libDeps = platform: [ ncurses ]
|
||||||
|
++ stdenv.lib.optional (!enableIntegerSimple) gmp
|
||||||
|
++ stdenv.lib.optional (platform.libc != "glibc") libiconv;
|
||||||
|
|
||||||
|
toolsForTarget =
|
||||||
|
if hostPlatform == buildPlatform then
|
||||||
|
[ targetPackages.stdenv.cc ] ++ stdenv.lib.optional useLLVM llvmPackages.llvm
|
||||||
|
else assert targetPlatform == hostPlatform; # build != host == target
|
||||||
|
[ stdenv.cc ] ++ stdenv.lib.optional useLLVM buildLlvmPackages.llvm;
|
||||||
|
|
||||||
|
targetCC = builtins.head toolsForTarget;
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
@ -39,37 +78,77 @@ stdenv.mkDerivation rec {
|
|||||||
sha256 = "1vsgmic8csczl62ciz51iv8nhrkm72lyhbz7p7id13y2w7fcx46g";
|
sha256 = "1vsgmic8csczl62ciz51iv8nhrkm72lyhbz7p7id13y2w7fcx46g";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
outputs = [ "out" "doc" ];
|
||||||
|
|
||||||
patches = [
|
patches = [
|
||||||
docFixes
|
docFixes
|
||||||
./relocation.patch
|
./relocation.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [ ghc perl libxml2 libxslt docbook_xsl docbook_xml_dtd_45 docbook_xml_dtd_42 hscolour ] ++ stdenv.lib.optionals targetPlatform.isArm [ llvm_35 ];
|
# GHC is a bit confused on its cross terminology.
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
|
||||||
|
|
||||||
outputs = [ "out" "doc" ];
|
|
||||||
|
|
||||||
preConfigure = ''
|
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"
|
||||||
|
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld"
|
||||||
|
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
|
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||||
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
||||||
export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}"
|
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
|
||||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
||||||
'' + stdenv.lib.optionalString enableIntegerSimple ''
|
|
||||||
echo "INTEGER_LIBRARY=integer-simple" > mk/build.mk
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# 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 = [
|
configureFlags = [
|
||||||
"--with-gcc=${stdenv.cc}/bin/cc"
|
|
||||||
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
|
||||||
"--datadir=$doc/share/doc/ghc"
|
"--datadir=$doc/share/doc/ghc"
|
||||||
] ++ stdenv.lib.optional (! enableIntegerSimple) [
|
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
||||||
|
] ++ stdenv.lib.optional (targetPlatform == hostPlatform && ! enableIntegerSimple) [
|
||||||
"--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib"
|
"--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib"
|
||||||
] ++ stdenv.lib.optional stdenv.isDarwin [
|
] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.libc != "glibc") [
|
||||||
"--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib"
|
"--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib"
|
||||||
|
] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [
|
||||||
|
"--enable-bootstrap-with-devel-snapshot"
|
||||||
|
] ++ stdenv.lib.optionals (targetPlatform.isDarwin && targetPlatform.isAarch64) [
|
||||||
|
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
|
||||||
|
"--disable-large-address-space"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Hack to make sure we never to the relaxation `$PATH` and hooks support for
|
||||||
|
# compatability. This will be replaced with something clearer in a future
|
||||||
|
# masss-rebuild.
|
||||||
|
crossConfig = true;
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
ghc perl libxml2 libxslt docbook_xsl docbook_xml_dtd_45 docbook_xml_dtd_42 hscolour
|
||||||
|
];
|
||||||
|
|
||||||
|
# For building runtime libs
|
||||||
|
depsBuildTarget = toolsForTarget;
|
||||||
|
|
||||||
|
buildInputs = 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
|
# required, because otherwise all symbols from HSffi.o are stripped, and
|
||||||
# that in turn causes GHCi to abort
|
# that in turn causes GHCi to abort
|
||||||
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
||||||
@ -88,6 +167,11 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit bootPkgs targetPrefix;
|
inherit bootPkgs targetPrefix;
|
||||||
|
|
||||||
|
inherit llvmPackages;
|
||||||
|
|
||||||
|
# Our Cabal compiler name
|
||||||
|
haskellCompilerName = "ghc";
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
@ -96,4 +180,5 @@ stdenv.mkDerivation rec {
|
|||||||
maintainers = with stdenv.lib.maintainers; [ marcweber andres peti ];
|
maintainers = with stdenv.lib.maintainers; [ marcweber andres peti ];
|
||||||
inherit (ghc.meta) license platforms;
|
inherit (ghc.meta) license platforms;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,14 +31,14 @@ stdenv.mkDerivation rec {
|
|||||||
libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib"
|
libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib"
|
||||||
''}
|
''}
|
||||||
'' + (if enableIntegerSimple then ''
|
'' + (if enableIntegerSimple then ''
|
||||||
INTEGER_LIBRARY=integer-simple
|
INTEGER_LIBRARY = integer-simple
|
||||||
'' else ''
|
'' else ''
|
||||||
libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="${gmp.out}/lib"
|
libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="${gmp.out}/lib"
|
||||||
libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp.dev}/include"
|
libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp.dev}/include"
|
||||||
'');
|
'');
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
echo "${buildMK}" > mk/build.mk
|
echo -n "${buildMK}" > mk/build.mk
|
||||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||||
find . -name '*.hs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|'
|
find . -name '*.hs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|'
|
||||||
@ -55,7 +55,12 @@ stdenv.mkDerivation rec {
|
|||||||
# that in turn causes GHCi to abort
|
# that in turn causes GHCi to abort
|
||||||
stripDebugFlags=["-S" "--keep-file-symbols"];
|
stripDebugFlags=["-S" "--keep-file-symbols"];
|
||||||
|
|
||||||
passthru = { targetPrefix = ""; };
|
passthru = {
|
||||||
|
targetPprefix = "";
|
||||||
|
|
||||||
|
# Our Cabal compiler name
|
||||||
|
haskellCompilerName = "ghc";
|
||||||
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = http://haskell.org/ghc;
|
homepage = http://haskell.org/ghc;
|
||||||
|
@ -136,7 +136,12 @@ stdenv.mkDerivation rec {
|
|||||||
[ $(./main) == "yes" ]
|
[ $(./main) == "yes" ]
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru = { targetPrefix = ""; };
|
passthru = {
|
||||||
|
targetPrefix = "";
|
||||||
|
|
||||||
|
# Our Cabal compiler name
|
||||||
|
haskellCompilerName = "ghc";
|
||||||
|
};
|
||||||
|
|
||||||
meta.license = stdenv.lib.licenses.bsd3;
|
meta.license = stdenv.lib.licenses.bsd3;
|
||||||
meta.platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"];
|
meta.platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"];
|
||||||
|
@ -32,17 +32,17 @@ stdenv.mkDerivation rec {
|
|||||||
libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib"
|
libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib"
|
||||||
''}
|
''}
|
||||||
'' + (if enableIntegerSimple then ''
|
'' + (if enableIntegerSimple then ''
|
||||||
INTEGER_LIBRARY=integer-simple
|
INTEGER_LIBRARY = integer-simple
|
||||||
'' else ''
|
'' else ''
|
||||||
libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="${gmp.out}/lib"
|
libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="${gmp.out}/lib"
|
||||||
libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp.dev}/include"
|
libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp.dev}/include"
|
||||||
'');
|
'');
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
echo "${buildMK}" > mk/build.mk
|
echo -n "${buildMK}" > mk/build.mk
|
||||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||||
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
||||||
export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}"
|
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
|
||||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||||
find . -name '*.hs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|'
|
find . -name '*.hs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|'
|
||||||
find . -name '*.lhs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|'
|
find . -name '*.lhs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|'
|
||||||
@ -56,7 +56,12 @@ stdenv.mkDerivation rec {
|
|||||||
# that in turn causes GHCi to abort
|
# that in turn causes GHCi to abort
|
||||||
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
|
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
|
||||||
|
|
||||||
passthru = { targetPrefix = ""; };
|
passthru = {
|
||||||
|
targetPrefix = "";
|
||||||
|
|
||||||
|
# Our Cabal compiler name
|
||||||
|
haskellCompilerName = "ghc";
|
||||||
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = http://haskell.org/ghc;
|
homepage = http://haskell.org/ghc;
|
||||||
|
@ -43,14 +43,14 @@ in stdenv.mkDerivation rec {
|
|||||||
SRC_HC_OPTS += ${ghcFlags}
|
SRC_HC_OPTS += ${ghcFlags}
|
||||||
SRC_CC_OPTS += ${cFlags}
|
SRC_CC_OPTS += ${cFlags}
|
||||||
'' + (if enableIntegerSimple then ''
|
'' + (if enableIntegerSimple then ''
|
||||||
INTEGER_LIBRARY=integer-simple
|
INTEGER_LIBRARY = integer-simple
|
||||||
'' else ''
|
'' else ''
|
||||||
libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="${gmp.out}/lib"
|
libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="${gmp.out}/lib"
|
||||||
libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp.dev}/include"
|
libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp.dev}/include"
|
||||||
'');
|
'');
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
echo "${buildMK}" > mk/build.mk
|
echo -n "${buildMK}" > mk/build.mk
|
||||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||||
|
|
||||||
'' + stdenv.lib.optionalString stdenv.isLinux ''
|
'' + stdenv.lib.optionalString stdenv.isLinux ''
|
||||||
@ -58,7 +58,7 @@ in stdenv.mkDerivation rec {
|
|||||||
sed -i -e 's|"\$topdir"|"\$topdir" ${ghcFlags}|' ghc/ghc.wrapper
|
sed -i -e 's|"\$topdir"|"\$topdir" ${ghcFlags}|' ghc/ghc.wrapper
|
||||||
|
|
||||||
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
||||||
export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}"
|
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
|
||||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||||
find . -name '*.hs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|'
|
find . -name '*.hs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|'
|
||||||
find . -name '*.lhs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|'
|
find . -name '*.lhs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|'
|
||||||
@ -82,7 +82,12 @@ in stdenv.mkDerivation rec {
|
|||||||
# that in turn causes GHCi to abort
|
# that in turn causes GHCi to abort
|
||||||
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
|
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
|
||||||
|
|
||||||
passthru = { targetPrefix = ""; };
|
passthru = {
|
||||||
|
targetPrefix = "";
|
||||||
|
|
||||||
|
# Our Cabal compiler name
|
||||||
|
haskellCompilerName = "ghc";
|
||||||
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = http://haskell.org/ghc;
|
homepage = http://haskell.org/ghc;
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
{ stdenv, fetchurl, ghc, perl, ncurses, libiconv
|
{ stdenv, targetPackages
|
||||||
|
|
||||||
|
, fetchurl, ghc, perl
|
||||||
|
, libffi, libiconv ? null, ncurses
|
||||||
|
|
||||||
, # If enabled, GHC will be built with the GPL-free but slower integer-simple
|
, # If enabled, GHC will be built with the GPL-free but slower integer-simple
|
||||||
# library instead of the faster but GPLed integer-gmp library.
|
# library instead of the faster but GPLed integer-gmp library.
|
||||||
@ -9,51 +12,74 @@
|
|||||||
assert stdenv.targetPlatform == stdenv.hostPlatform;
|
assert stdenv.targetPlatform == stdenv.hostPlatform;
|
||||||
assert !enableIntegerSimple -> gmp != null;
|
assert !enableIntegerSimple -> gmp != null;
|
||||||
|
|
||||||
stdenv.mkDerivation (rec {
|
let
|
||||||
version = "7.8.4";
|
|
||||||
name = "ghc-${version}";
|
|
||||||
|
|
||||||
src = fetchurl {
|
|
||||||
url = "https://downloads.haskell.org/~ghc/${version}/ghc-${version}-src.tar.xz";
|
|
||||||
sha256 = "1i4254akbb4ym437rf469gc0m40bxm31blp6s1z1g15jmnacs6f3";
|
|
||||||
};
|
|
||||||
|
|
||||||
patches = [ ./relocation.patch ];
|
|
||||||
|
|
||||||
buildInputs = [ ghc perl ncurses ]
|
|
||||||
++ stdenv.lib.optional (!enableIntegerSimple) gmp;
|
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
|
||||||
|
|
||||||
buildMK = ''
|
buildMK = ''
|
||||||
libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-includes="${ncurses.dev}/include"
|
libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-includes="${ncurses.dev}/include"
|
||||||
libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="${ncurses.out}/lib"
|
libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="${ncurses.out}/lib"
|
||||||
DYNAMIC_BY_DEFAULT = NO
|
DYNAMIC_BY_DEFAULT = NO
|
||||||
${stdenv.lib.optionalString stdenv.isDarwin ''
|
${stdenv.lib.optionalString (stdenv.hostPlatform.libc != "glibc") ''
|
||||||
libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-includes="${libiconv}/include"
|
libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-includes="${libiconv}/include"
|
||||||
libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib"
|
libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib"
|
||||||
''}
|
''}
|
||||||
'' + (if enableIntegerSimple then ''
|
'' + (if enableIntegerSimple then ''
|
||||||
INTEGER_LIBRARY=integer-simple
|
INTEGER_LIBRARY = integer-simple
|
||||||
'' else ''
|
'' else ''
|
||||||
libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="${gmp.out}/lib"
|
libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="${gmp.out}/lib"
|
||||||
libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp.dev}/include"
|
libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp.dev}/include"
|
||||||
'');
|
'');
|
||||||
|
|
||||||
|
# Splicer will pull out correct variations
|
||||||
|
libDeps = [ ncurses ]
|
||||||
|
++ stdenv.lib.optional (!enableIntegerSimple) gmp
|
||||||
|
++ stdenv.lib.optional (stdenv.hostPlatform.libc != "glibc") libiconv;
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
version = "7.8.4";
|
||||||
|
name = "ghc-${version}";
|
||||||
|
|
||||||
|
src = fetchurl {
|
||||||
|
url = "http://www.haskell.org/ghc/dist/${version}/${name}-src.tar.xz";
|
||||||
|
sha256 = "1i4254akbb4ym437rf469gc0m40bxm31blp6s1z1g15jmnacs6f3";
|
||||||
|
};
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
patches = [ ./relocation.patch ]
|
||||||
|
++ stdenv.lib.optional stdenv.isDarwin ./hpc-7.8.4.patch;
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
echo "${buildMK}" > mk/build.mk
|
echo -n "${buildMK}" > mk/build.mk
|
||||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||||
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
||||||
export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}"
|
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
|
||||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# TODO(@Ericson2314): Always pass "--target" and always prefix.
|
||||||
|
configurePlatforms = [ "build" "host" ];
|
||||||
|
|
||||||
|
nativeBuildInputs = [ ghc perl ];
|
||||||
|
depsBuildTarget = [ targetPackages.stdenv.cc ];
|
||||||
|
|
||||||
|
buildInputs = libDeps;
|
||||||
|
propagatedBuildInputs = [ targetPackages.stdenv.cc ];
|
||||||
|
|
||||||
|
depsTargetTarget = map stdenv.lib.getDev libDeps;
|
||||||
|
depsTargetTargetPropagated = map (stdenv.lib.getOutput "out") libDeps;
|
||||||
|
|
||||||
# required, because otherwise all symbols from HSffi.o are stripped, and
|
# required, because otherwise all symbols from HSffi.o are stripped, and
|
||||||
# that in turn causes GHCi to abort
|
# that in turn causes GHCi to abort
|
||||||
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
|
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
|
||||||
|
|
||||||
passthru = { targetPrefix = ""; };
|
passthru = {
|
||||||
|
targetPrefix = "";
|
||||||
|
|
||||||
|
# Our Cabal compiler name
|
||||||
|
haskellCompilerName = "ghc";
|
||||||
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = http://haskell.org/ghc;
|
homepage = http://haskell.org/ghc;
|
||||||
@ -62,7 +88,4 @@ stdenv.mkDerivation (rec {
|
|||||||
inherit (ghc.meta) license platforms;
|
inherit (ghc.meta) license platforms;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // stdenv.lib.optionalAttrs stdenv.isDarwin {
|
}
|
||||||
# https://ghc.haskell.org/trac/ghc/ticket/9762
|
|
||||||
patches = [ ./hpc-7.8.4.patch ];
|
|
||||||
})
|
|
||||||
|
@ -2,14 +2,27 @@
|
|||||||
, buildPlatform, hostPlatform, targetPlatform
|
, buildPlatform, hostPlatform, targetPlatform
|
||||||
|
|
||||||
# build-tools
|
# build-tools
|
||||||
, bootPkgs, hscolour, llvm_37
|
, bootPkgs, hscolour
|
||||||
, coreutils, fetchurl, fetchpatch, patchutils, perl, sphinx
|
, coreutils, fetchpatch, fetchurl, perl, sphinx
|
||||||
|
|
||||||
, libiconv ? null, ncurses
|
, libffi, libiconv ? null, ncurses
|
||||||
|
|
||||||
|
, useLLVM ? !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
|
, # If enabled, GHC will be built with the GPL-free but slower integer-simple
|
||||||
# library instead of the faster but GPLed integer-gmp library.
|
# library instead of the faster but GPLed integer-gmp library.
|
||||||
enableIntegerSimple ? false, gmp ? null
|
enableIntegerSimple ? false, gmp ? null
|
||||||
|
|
||||||
|
, # If enabled, use -fPIC when compiling static libs.
|
||||||
|
enableRelocatedStaticLibs ? targetPlatform != hostPlatform
|
||||||
|
|
||||||
|
, # Whether to build dynamic libs for the standard library (on the target
|
||||||
|
# platform). Static libs are always built.
|
||||||
|
enableShared ? true
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert !enableIntegerSimple -> gmp != null;
|
assert !enableIntegerSimple -> gmp != null;
|
||||||
@ -21,6 +34,33 @@ let
|
|||||||
targetPrefix = stdenv.lib.optionalString
|
targetPrefix = stdenv.lib.optionalString
|
||||||
(targetPlatform != hostPlatform)
|
(targetPlatform != hostPlatform)
|
||||||
"${targetPlatform.config}-";
|
"${targetPlatform.config}-";
|
||||||
|
|
||||||
|
buildMK = ''
|
||||||
|
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
|
||||||
|
'' + stdenv.lib.optionalString enableIntegerSimple ''
|
||||||
|
INTEGER_LIBRARY = integer-simple
|
||||||
|
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
|
||||||
|
BuildFlavour = perf-cross
|
||||||
|
Stage1Only = YES
|
||||||
|
HADDOCK_DOCS = NO
|
||||||
|
'' + stdenv.lib.optionalString enableRelocatedStaticLibs ''
|
||||||
|
GhcLibHcOpts += -fPIC
|
||||||
|
GhcRtsHcOpts += -fPIC
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Splicer will pull out correct variations
|
||||||
|
libDeps = platform: [ ncurses ]
|
||||||
|
++ stdenv.lib.optional (!enableIntegerSimple) gmp
|
||||||
|
++ stdenv.lib.optional (platform.libc != "glibc") libiconv;
|
||||||
|
|
||||||
|
toolsForTarget =
|
||||||
|
if hostPlatform == buildPlatform then
|
||||||
|
[ targetPackages.stdenv.cc ] ++ stdenv.lib.optional useLLVM llvmPackages.llvm
|
||||||
|
else assert targetPlatform == hostPlatform; # build != host == target
|
||||||
|
[ stdenv.cc ] ++ stdenv.lib.optional useLLVM buildLlvmPackages.llvm;
|
||||||
|
|
||||||
|
targetCC = builtins.head toolsForTarget;
|
||||||
|
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
version = "8.0.2";
|
version = "8.0.2";
|
||||||
@ -31,43 +71,87 @@ stdenv.mkDerivation rec {
|
|||||||
sha256 = "1c8qc4fhkycynk4g1f9hvk53dj6a1vvqi6bklqznns6hw59m8qhi";
|
sha256 = "1c8qc4fhkycynk4g1f9hvk53dj6a1vvqi6bklqznns6hw59m8qhi";
|
||||||
};
|
};
|
||||||
|
|
||||||
patches = [ ./ghc-gold-linker.patch ]
|
|
||||||
++ stdenv.lib.optional stdenv.isLinux ./ghc-no-madv-free.patch
|
|
||||||
++ stdenv.lib.optional stdenv.isDarwin ./ghc-8.0.2-no-cpp-warnings.patch;
|
|
||||||
|
|
||||||
buildInputs = [ ghc perl hscolour sphinx ] ++ stdenv.lib.optionals (stdenv.isArm || stdenv.isAarch64) [ llvm_37 ];
|
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
outputs = [ "out" "man" "doc" ];
|
outputs = [ "out" "man" "doc" ];
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
./ghc-gold-linker.patch
|
||||||
|
(fetchpatch { # Unreleased 1.24.x commit
|
||||||
|
url = "https://github.com/haskell/cabal/commit/6394cb0b6eba91a8692a3d04b2b56935aed7cccd.patch";
|
||||||
|
sha256 = "14xxjg0nb1j1pw0riac3v385ka92qhxxblfmwyvbghz7kry6axy0";
|
||||||
|
stripLen = 1;
|
||||||
|
extraPrefix = "libraries/Cabal/";
|
||||||
|
})
|
||||||
|
] ++ stdenv.lib.optional stdenv.isLinux ./ghc-no-madv-free.patch
|
||||||
|
++ stdenv.lib.optional stdenv.isDarwin ./ghc-8.0.2-no-cpp-warnings.patch;
|
||||||
|
|
||||||
|
# GHC is a bit confused on its cross terminology.
|
||||||
preConfigure = ''
|
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"
|
||||||
|
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld"
|
||||||
|
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
|
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||||
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
||||||
export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}"
|
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
|
||||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
||||||
'' + stdenv.lib.optionalString enableIntegerSimple ''
|
|
||||||
echo "INTEGER_LIBRARY=integer-simple" > mk/build.mk
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# 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 = [
|
configureFlags = [
|
||||||
"--with-gcc=${stdenv.cc}/bin/cc"
|
|
||||||
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
|
||||||
"--datadir=$doc/share/doc/ghc"
|
"--datadir=$doc/share/doc/ghc"
|
||||||
] ++ stdenv.lib.optional (! enableIntegerSimple) [
|
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
||||||
|
] ++ stdenv.lib.optional (targetPlatform == hostPlatform && ! enableIntegerSimple) [
|
||||||
"--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib"
|
"--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib"
|
||||||
] ++ stdenv.lib.optional stdenv.isDarwin [
|
] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.libc != "glibc") [
|
||||||
"--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib"
|
"--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib"
|
||||||
|
] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [
|
||||||
|
"--enable-bootstrap-with-devel-snapshot"
|
||||||
] ++ stdenv.lib.optionals (targetPlatform.isDarwin && targetPlatform.isAarch64) [
|
] ++ stdenv.lib.optionals (targetPlatform.isDarwin && targetPlatform.isAarch64) [
|
||||||
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
|
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
|
||||||
"--disable-large-address-space"
|
"--disable-large-address-space"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Hack to make sure we never to the relaxation `$PATH` and hooks support for
|
||||||
|
# compatability. This will be replaced with something clearer in a future
|
||||||
|
# masss-rebuild.
|
||||||
|
crossConfig = true;
|
||||||
|
|
||||||
|
nativeBuildInputs = [ ghc perl hscolour sphinx ];
|
||||||
|
|
||||||
|
# For building runtime libs
|
||||||
|
depsBuildTarget = toolsForTarget;
|
||||||
|
|
||||||
|
buildInputs = 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
|
# required, because otherwise all symbols from HSffi.o are stripped, and
|
||||||
# that in turn causes GHCi to abort
|
# that in turn causes GHCi to abort
|
||||||
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
||||||
|
|
||||||
|
# zsh and other shells are smart about `{ghc}` but bash isn't, and doesn't
|
||||||
|
# treat that as a unary `{x,y,z,..}` repetition.
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
|
paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
|
||||||
|
|
||||||
@ -84,6 +168,11 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit bootPkgs targetPrefix;
|
inherit bootPkgs targetPrefix;
|
||||||
|
|
||||||
|
inherit llvmPackages;
|
||||||
|
|
||||||
|
# Our Cabal compiler name
|
||||||
|
haskellCompilerName = "ghc";
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
@ -1,16 +1,31 @@
|
|||||||
{ stdenv, targetPackages
|
{ stdenv, targetPackages
|
||||||
, buildPlatform, hostPlatform, targetPlatform
|
, buildPlatform, hostPlatform, targetPlatform
|
||||||
, selfPkgs, cross ? null
|
|
||||||
|
|
||||||
# build-tools
|
# build-tools
|
||||||
, bootPkgs, alex, happy, hscolour, llvm_39
|
, bootPkgs, alex, happy, hscolour
|
||||||
, autoconf, automake, coreutils, fetchurl, perl, python3, sphinx
|
, autoconf, autoreconfHook, automake, coreutils, fetchurl, fetchpatch, perl, python3, sphinx
|
||||||
|
|
||||||
, libiconv ? null, ncurses
|
, libffi, libiconv ? null, ncurses
|
||||||
|
|
||||||
|
, useLLVM ? !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
|
, # If enabled, GHC will be built with the GPL-free but slower integer-simple
|
||||||
# library instead of the faster but GPLed integer-gmp library.
|
# library instead of the faster but GPLed integer-gmp library.
|
||||||
enableIntegerSimple ? false, gmp ? null
|
enableIntegerSimple ? false, gmp ? null
|
||||||
|
|
||||||
|
, # If enabled, use -fPIC when compiling static libs.
|
||||||
|
enableRelocatedStaticLibs ? targetPlatform != hostPlatform
|
||||||
|
|
||||||
|
, # Whether to build dynamic libs for the standard library (on the target
|
||||||
|
# platform). Static libs are always built.
|
||||||
|
enableShared ?
|
||||||
|
!(targetPlatform.isDarwin
|
||||||
|
# On iOS, dynamic linking is not supported
|
||||||
|
&& (targetPlatform.isAarch64 || targetPlatform.isArm))
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert !enableIntegerSimple -> gmp != null;
|
assert !enableIntegerSimple -> gmp != null;
|
||||||
@ -22,8 +37,37 @@ let
|
|||||||
targetPrefix = stdenv.lib.optionalString
|
targetPrefix = stdenv.lib.optionalString
|
||||||
(targetPlatform != hostPlatform)
|
(targetPlatform != hostPlatform)
|
||||||
"${targetPlatform.config}-";
|
"${targetPlatform.config}-";
|
||||||
|
|
||||||
|
buildMK = ''
|
||||||
|
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
|
||||||
|
'' + stdenv.lib.optionalString enableIntegerSimple ''
|
||||||
|
INTEGER_LIBRARY = integer-simple
|
||||||
|
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
|
||||||
|
BuildFlavour = perf-cross
|
||||||
|
Stage1Only = YES
|
||||||
|
HADDOCK_DOCS = NO
|
||||||
|
BUILD_SPHINX_HTML = NO
|
||||||
|
BUILD_SPHINX_PDF = NO
|
||||||
|
'' + stdenv.lib.optionalString enableRelocatedStaticLibs ''
|
||||||
|
GhcLibHcOpts += -fPIC
|
||||||
|
GhcRtsHcOpts += -fPIC
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Splicer will pull out correct variations
|
||||||
|
libDeps = platform: [ ncurses ]
|
||||||
|
++ stdenv.lib.optional (!enableIntegerSimple) gmp
|
||||||
|
++ stdenv.lib.optional (platform.libc != "glibc") libiconv;
|
||||||
|
|
||||||
|
toolsForTarget =
|
||||||
|
if hostPlatform == buildPlatform then
|
||||||
|
[ targetPackages.stdenv.cc ] ++ stdenv.lib.optional useLLVM llvmPackages.llvm
|
||||||
|
else assert targetPlatform == hostPlatform; # build != host == target
|
||||||
|
[ stdenv.cc ] ++ stdenv.lib.optional useLLVM buildLlvmPackages.llvm;
|
||||||
|
|
||||||
|
targetCC = builtins.head toolsForTarget;
|
||||||
|
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation (rec {
|
stdenv.mkDerivation rec {
|
||||||
version = "8.2.2";
|
version = "8.2.2";
|
||||||
name = "${targetPrefix}ghc-${version}";
|
name = "${targetPrefix}ghc-${version}";
|
||||||
|
|
||||||
@ -32,42 +76,93 @@ stdenv.mkDerivation (rec {
|
|||||||
sha256 = "1z05vkpaj54xdypmaml50hgsdpw29dhbs2r7magx0cm199iw73mv";
|
sha256 = "1z05vkpaj54xdypmaml50hgsdpw29dhbs2r7magx0cm199iw73mv";
|
||||||
};
|
};
|
||||||
|
|
||||||
postPatch = "patchShebangs .";
|
|
||||||
|
|
||||||
preConfigure = ''
|
|
||||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
|
||||||
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
|
||||||
export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}"
|
|
||||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
|
||||||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
|
||||||
'' + stdenv.lib.optionalString enableIntegerSimple ''
|
|
||||||
echo "INTEGER_LIBRARY=integer-simple" > mk/build.mk
|
|
||||||
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
|
|
||||||
sed 's|#BuildFlavour = quick-cross|BuildFlavour = perf-cross|' mk/build.mk.sample > mk/build.mk
|
|
||||||
'';
|
|
||||||
|
|
||||||
buildInputs = [ alex autoconf automake ghc happy hscolour perl python3 sphinx ] ++ stdenv.lib.optionals (targetPlatform.isArm || targetPlatform.isAarch64) [ llvm_39 ];
|
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
configureFlags = [
|
outputs = [ "out" "doc" ];
|
||||||
"CC=${stdenv.cc}/bin/cc"
|
|
||||||
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
patches = [
|
||||||
"--datadir=$doc/share/doc/ghc"
|
(fetchpatch { # Fix STRIP to be substituted from configure
|
||||||
] ++ stdenv.lib.optional (! enableIntegerSimple) [
|
url = "https://git.haskell.org/ghc.git/commitdiff_plain/2fc8ce5f0c8c81771c26266ac0b150ca9b75c5f3";
|
||||||
"--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib"
|
sha256 = "03253ci40np1v6k0wmi4aypj3nmj3rdyvb1k6rwqipb30nfc719f";
|
||||||
] ++ stdenv.lib.optional stdenv.isDarwin [
|
})
|
||||||
"--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib"
|
|
||||||
] ++ stdenv.lib.optional stdenv.isArm [
|
|
||||||
"LD=${stdenv.cc}/bin/ld.gold"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
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 targetPlatform.isArm ".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"
|
||||||
|
'';
|
||||||
|
|
||||||
|
# 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.optional (targetPlatform == hostPlatform && ! enableIntegerSimple) [
|
||||||
|
"--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib"
|
||||||
|
] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.libc != "glibc") [
|
||||||
|
"--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib"
|
||||||
|
] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [
|
||||||
|
"--enable-bootstrap-with-devel-snapshot"
|
||||||
|
] ++ stdenv.lib.optionals (targetPlatform.isArm) [
|
||||||
|
"CFLAGS=-fuse-ld=gold"
|
||||||
|
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
|
||||||
|
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
|
||||||
|
] ++ stdenv.lib.optionals (targetPlatform.isDarwin && targetPlatform.isAarch64) [
|
||||||
|
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
|
||||||
|
"--disable-large-address-space"
|
||||||
|
];
|
||||||
|
|
||||||
|
# Hack to make sure we never to the relaxation `$PATH` and hooks support for
|
||||||
|
# compatability. This will be replaced with something clearer in a future
|
||||||
|
# masss-rebuild.
|
||||||
|
crossConfig = true;
|
||||||
|
|
||||||
|
nativeBuildInputs = [ alex autoconf autoreconfHook automake ghc happy hscolour perl python3 sphinx ];
|
||||||
|
|
||||||
|
# For building runtime libs
|
||||||
|
depsBuildTarget = toolsForTarget;
|
||||||
|
|
||||||
|
buildInputs = 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
|
# required, because otherwise all symbols from HSffi.o are stripped, and
|
||||||
# that in turn causes GHCi to abort
|
# that in turn causes GHCi to abort
|
||||||
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
||||||
|
|
||||||
checkTarget = "test";
|
checkTarget = "test";
|
||||||
|
|
||||||
|
# zsh and other shells are smart about `{ghc}` but bash isn't, and doesn't
|
||||||
|
# treat that as a unary `{x,y,z,..}` repetition.
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
|
paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
|
||||||
|
|
||||||
@ -82,15 +177,13 @@ stdenv.mkDerivation (rec {
|
|||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
outputs = [ "out" "doc" ];
|
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit bootPkgs targetPrefix;
|
inherit bootPkgs targetPrefix;
|
||||||
} // stdenv.lib.optionalAttrs (targetPlatform != buildPlatform) {
|
|
||||||
crossCompiler = selfPkgs.ghc.override {
|
inherit llvmPackages;
|
||||||
cross = targetPlatform;
|
|
||||||
bootPkgs = selfPkgs;
|
# Our Cabal compiler name
|
||||||
};
|
haskellCompilerName = "ghc";
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
@ -100,24 +193,4 @@ stdenv.mkDerivation (rec {
|
|||||||
inherit (ghc.meta) license platforms;
|
inherit (ghc.meta) license platforms;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // stdenv.lib.optionalAttrs (cross != null) {
|
}
|
||||||
configureFlags = [
|
|
||||||
"CC=${stdenv.cc}/bin/${cross.config}-cc"
|
|
||||||
"LD=${stdenv.cc.bintools}/bin/${cross.config}-ld"
|
|
||||||
"AR=${stdenv.cc.bintools}/bin/${cross.config}-ar"
|
|
||||||
"NM=${stdenv.cc.bintools}/bin/${cross.config}-nm"
|
|
||||||
"RANLIB=${stdenv.cc.bintools}/bin/${cross.config}-ranlib"
|
|
||||||
"--target=${cross.config}"
|
|
||||||
"--enable-bootstrap-with-devel-snapshot"
|
|
||||||
] ++
|
|
||||||
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
|
|
||||||
stdenv.lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space";
|
|
||||||
|
|
||||||
configurePlatforms = [];
|
|
||||||
|
|
||||||
passthru = {
|
|
||||||
inherit bootPkgs cross;
|
|
||||||
cc = "${stdenv.cc}/bin/${cross.config}-cc";
|
|
||||||
ld = "${stdenv.cc}/bin/${cross.config}-ld";
|
|
||||||
};
|
|
||||||
})
|
|
||||||
|
@ -1,17 +1,29 @@
|
|||||||
{ stdenv, targetPackages
|
{ stdenv, targetPackages
|
||||||
, buildPlatform, hostPlatform, targetPlatform
|
, buildPlatform, hostPlatform, targetPlatform
|
||||||
, selfPkgs, cross ? null
|
|
||||||
|
|
||||||
# build-tools
|
# build-tools
|
||||||
, bootPkgs, alex, happy
|
, bootPkgs, alex, happy
|
||||||
, autoconf, automake, coreutils, fetchgit, perl, python3
|
, autoconf, automake, coreutils, fetchgit, perl, python3
|
||||||
|
|
||||||
, libiconv ? null, ncurses
|
, libffi, libiconv ? null, ncurses
|
||||||
|
|
||||||
|
, useLLVM ? !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
|
, # If enabled, GHC will be built with the GPL-free but slower integer-simple
|
||||||
# library instead of the faster but GPLed integer-gmp library.
|
# library instead of the faster but GPLed integer-gmp library.
|
||||||
enableIntegerSimple ? false, gmp ? null
|
enableIntegerSimple ? false, gmp ? null
|
||||||
|
|
||||||
|
, # If enabled, use -fPIC when compiling static libs.
|
||||||
|
enableRelocatedStaticLibs ? targetPlatform != hostPlatform
|
||||||
|
|
||||||
|
, # Whether to build dynamic libs for the standard library (on the target
|
||||||
|
# platform). Static libs are always built.
|
||||||
|
enableShared ? true
|
||||||
|
|
||||||
, version ? "8.4.20180115"
|
, version ? "8.4.20180115"
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@ -20,60 +32,134 @@ assert !enableIntegerSimple -> gmp != null;
|
|||||||
let
|
let
|
||||||
inherit (bootPkgs) ghc;
|
inherit (bootPkgs) ghc;
|
||||||
|
|
||||||
rev = "3e3a096885c0fcd0703edbeffb4e47f5cbd8f4cc";
|
|
||||||
|
|
||||||
# TODO(@Ericson2314) Make unconditional
|
# TODO(@Ericson2314) Make unconditional
|
||||||
targetPrefix = stdenv.lib.optionalString
|
targetPrefix = stdenv.lib.optionalString
|
||||||
(targetPlatform != hostPlatform)
|
(targetPlatform != hostPlatform)
|
||||||
"${targetPlatform.config}-";
|
"${targetPlatform.config}-";
|
||||||
|
|
||||||
|
buildMK = ''
|
||||||
|
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
|
||||||
|
'' + stdenv.lib.optionalString enableIntegerSimple ''
|
||||||
|
INTEGER_LIBRARY = integer-simple
|
||||||
|
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
|
||||||
|
BuildFlavour = perf-cross
|
||||||
|
Stage1Only = YES
|
||||||
|
HADDOCK_DOCS = NO
|
||||||
|
BUILD_SPHINX_HTML = NO
|
||||||
|
BUILD_SPHINX_PDF = NO
|
||||||
|
'' + stdenv.lib.optionalString enableRelocatedStaticLibs ''
|
||||||
|
GhcLibHcOpts += -fPIC
|
||||||
|
GhcRtsHcOpts += -fPIC
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Splicer will pull out correct variations
|
||||||
|
libDeps = platform: [ ncurses ]
|
||||||
|
++ stdenv.lib.optional (!enableIntegerSimple) gmp
|
||||||
|
++ stdenv.lib.optional (platform.libc != "glibc") libiconv;
|
||||||
|
|
||||||
|
toolsForTarget =
|
||||||
|
if hostPlatform == buildPlatform then
|
||||||
|
[ targetPackages.stdenv.cc ] ++ stdenv.lib.optional useLLVM llvmPackages.llvm
|
||||||
|
else assert targetPlatform == hostPlatform; # build != host == target
|
||||||
|
[ stdenv.cc ] ++ stdenv.lib.optional useLLVM buildLlvmPackages.llvm;
|
||||||
|
|
||||||
|
targetCC = builtins.head toolsForTarget;
|
||||||
|
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation (rec {
|
stdenv.mkDerivation rec {
|
||||||
inherit version rev;
|
inherit version;
|
||||||
|
inherit (src) rev;
|
||||||
name = "${targetPrefix}ghc-${version}";
|
name = "${targetPrefix}ghc-${version}";
|
||||||
|
|
||||||
src = fetchgit {
|
src = fetchgit {
|
||||||
url = "git://git.haskell.org/ghc.git";
|
url = "git://git.haskell.org/ghc.git";
|
||||||
inherit rev;
|
rev = "3e3a096885c0fcd0703edbeffb4e47f5cbd8f4cc";
|
||||||
sha256 = "06slymbsd7vsfp4hh40v7cxf7nmp0kvlni2wfq7ag5wlqh04slgs";
|
sha256 = "06slymbsd7vsfp4hh40v7cxf7nmp0kvlni2wfq7ag5wlqh04slgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
outputs = [ "out" "doc" ];
|
||||||
|
|
||||||
postPatch = "patchShebangs .";
|
postPatch = "patchShebangs .";
|
||||||
|
|
||||||
|
# GHC is a bit confused on its cross terminology.
|
||||||
preConfigure = ''
|
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 targetPlatform.isArm ".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
|
||||||
echo ${version} >VERSION
|
echo ${version} >VERSION
|
||||||
echo ${rev} >GIT_COMMIT_ID
|
echo ${src.rev} >GIT_COMMIT_ID
|
||||||
./boot
|
./boot
|
||||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||||
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
||||||
export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}"
|
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
|
||||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
||||||
'' + stdenv.lib.optionalString enableIntegerSimple ''
|
|
||||||
echo "INTEGER_LIBRARY=integer-simple" > mk/build.mk
|
|
||||||
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
|
|
||||||
sed 's|#BuildFlavour = quick-cross|BuildFlavour = perf-cross|' mk/build.mk.sample > mk/build.mk
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
buildInputs = [ ghc perl autoconf automake happy alex python3 ];
|
# TODO(@Ericson2314): Always pass "--target" and always prefix.
|
||||||
|
configurePlatforms = [ "build" "host" ]
|
||||||
enableParallelBuilding = true;
|
++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
|
||||||
|
# `--with` flags for libraries needed for RTS linker
|
||||||
configureFlags = [
|
configureFlags = [
|
||||||
"CC=${stdenv.cc}/bin/cc"
|
|
||||||
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
|
||||||
"--datadir=$doc/share/doc/ghc"
|
"--datadir=$doc/share/doc/ghc"
|
||||||
] ++ stdenv.lib.optional (! enableIntegerSimple) [
|
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
||||||
|
] ++ stdenv.lib.optional (targetPlatform == hostPlatform && ! enableIntegerSimple) [
|
||||||
"--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib"
|
"--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib"
|
||||||
] ++ stdenv.lib.optional stdenv.isDarwin [
|
] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.libc != "glibc") [
|
||||||
"--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib"
|
"--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib"
|
||||||
|
] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [
|
||||||
|
"--enable-bootstrap-with-devel-snapshot"
|
||||||
|
] ++ stdenv.lib.optionals (targetPlatform.isArm) [
|
||||||
|
"CFLAGS=-fuse-ld=gold"
|
||||||
|
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
|
||||||
|
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
|
||||||
|
] ++ stdenv.lib.optionals (targetPlatform.isDarwin && targetPlatform.isAarch64) [
|
||||||
|
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
|
||||||
|
"--disable-large-address-space"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Hack to make sure we never to the relaxation `$PATH` and hooks support for
|
||||||
|
# compatability. This will be replaced with something clearer in a future
|
||||||
|
# masss-rebuild.
|
||||||
|
crossConfig = true;
|
||||||
|
|
||||||
|
nativeBuildInputs = [ ghc perl autoconf automake happy alex python3 ];
|
||||||
|
|
||||||
|
# For building runtime libs
|
||||||
|
depsBuildTarget = toolsForTarget;
|
||||||
|
|
||||||
|
buildInputs = 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
|
# required, because otherwise all symbols from HSffi.o are stripped, and
|
||||||
# that in turn causes GHCi to abort
|
# that in turn causes GHCi to abort
|
||||||
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
||||||
|
|
||||||
checkTarget = "test";
|
checkTarget = "test";
|
||||||
|
|
||||||
|
# zsh and other shells are smart about `{ghc}` but bash isn't, and doesn't
|
||||||
|
# treat that as a unary `{x,y,z,..}` repetition.
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
|
paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
|
||||||
|
|
||||||
@ -88,15 +174,13 @@ stdenv.mkDerivation (rec {
|
|||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
outputs = [ "out" "doc" ];
|
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit bootPkgs targetPrefix;
|
inherit bootPkgs targetPrefix;
|
||||||
} // stdenv.lib.optionalAttrs (targetPlatform != buildPlatform) {
|
|
||||||
crossCompiler = selfPkgs.ghc.override {
|
inherit llvmPackages;
|
||||||
cross = targetPlatform;
|
|
||||||
bootPkgs = selfPkgs;
|
# Our Cabal compiler name
|
||||||
};
|
haskellCompilerName = "ghc";
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
@ -106,24 +190,4 @@ stdenv.mkDerivation (rec {
|
|||||||
inherit (ghc.meta) license platforms;
|
inherit (ghc.meta) license platforms;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // stdenv.lib.optionalAttrs (cross != null) {
|
}
|
||||||
configureFlags = [
|
|
||||||
"CC=${stdenv.cc}/bin/${cross.config}-cc"
|
|
||||||
"LD=${stdenv.cc.bintools}/bin/${cross.config}-ld"
|
|
||||||
"AR=${stdenv.cc.bintools}/bin/${cross.config}-ar"
|
|
||||||
"NM=${stdenv.cc.bintools}/bin/${cross.config}-nm"
|
|
||||||
"RANLIB=${stdenv.cc.bintools}/bin/${cross.config}-ranlib"
|
|
||||||
"--target=${cross.config}"
|
|
||||||
"--enable-bootstrap-with-devel-snapshot"
|
|
||||||
] ++
|
|
||||||
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
|
|
||||||
stdenv.lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space";
|
|
||||||
|
|
||||||
configurePlatforms = [];
|
|
||||||
|
|
||||||
passthru = {
|
|
||||||
inherit bootPkgs cross;
|
|
||||||
cc = "${stdenv.cc}/bin/${cross.config}-cc";
|
|
||||||
ld = "${stdenv.cc}/bin/${cross.config}-ld";
|
|
||||||
};
|
|
||||||
})
|
|
||||||
|
@ -1,18 +1,30 @@
|
|||||||
{ stdenv, targetPackages
|
{ stdenv, targetPackages
|
||||||
, buildPlatform, hostPlatform, targetPlatform
|
, buildPlatform, hostPlatform, targetPlatform
|
||||||
, selfPkgs, cross ? null
|
|
||||||
|
|
||||||
# build-tools
|
# build-tools
|
||||||
, bootPkgs, alex, happy
|
, bootPkgs, alex, happy
|
||||||
, autoconf, automake, coreutils, fetchgit, perl, python3
|
, autoconf, automake, coreutils, fetchgit, perl, python3
|
||||||
|
|
||||||
, libiconv ? null, ncurses
|
, libffi, libiconv ? null, ncurses
|
||||||
|
|
||||||
|
, useLLVM ? !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
|
, # If enabled, GHC will be built with the GPL-free but slower integer-simple
|
||||||
# library instead of the faster but GPLed integer-gmp library.
|
# library instead of the faster but GPLed integer-gmp library.
|
||||||
enableIntegerSimple ? false, gmp ? null
|
enableIntegerSimple ? false, gmp ? null
|
||||||
|
|
||||||
, version ? "8.5.20171209"
|
, # If enabled, use -fPIC when compiling static libs.
|
||||||
|
enableRelocatedStaticLibs ? targetPlatform != hostPlatform
|
||||||
|
|
||||||
|
, # Whether to build dynamic libs for the standard library (on the target
|
||||||
|
# platform). Static libs are always built.
|
||||||
|
enableShared ? true
|
||||||
|
|
||||||
|
, version ? "8.5.20180118"
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert !enableIntegerSimple -> gmp != null;
|
assert !enableIntegerSimple -> gmp != null;
|
||||||
@ -20,60 +32,134 @@ assert !enableIntegerSimple -> gmp != null;
|
|||||||
let
|
let
|
||||||
inherit (bootPkgs) ghc;
|
inherit (bootPkgs) ghc;
|
||||||
|
|
||||||
rev = "4335c07ca7e64624819b22644d7591853826bd75";
|
|
||||||
|
|
||||||
# TODO(@Ericson2314) Make unconditional
|
# TODO(@Ericson2314) Make unconditional
|
||||||
targetPrefix = stdenv.lib.optionalString
|
targetPrefix = stdenv.lib.optionalString
|
||||||
(targetPlatform != hostPlatform)
|
(targetPlatform != hostPlatform)
|
||||||
"${targetPlatform.config}-";
|
"${targetPlatform.config}-";
|
||||||
|
|
||||||
|
buildMK = ''
|
||||||
|
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
|
||||||
|
'' + stdenv.lib.optionalString enableIntegerSimple ''
|
||||||
|
INTEGER_LIBRARY = integer-simple
|
||||||
|
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
|
||||||
|
BuildFlavour = perf-cross
|
||||||
|
Stage1Only = YES
|
||||||
|
HADDOCK_DOCS = NO
|
||||||
|
BUILD_SPHINX_HTML = NO
|
||||||
|
BUILD_SPHINX_PDF = NO
|
||||||
|
'' + stdenv.lib.optionalString enableRelocatedStaticLibs ''
|
||||||
|
GhcLibHcOpts += -fPIC
|
||||||
|
GhcRtsHcOpts += -fPIC
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Splicer will pull out correct variations
|
||||||
|
libDeps = platform: [ ncurses ]
|
||||||
|
++ stdenv.lib.optional (!enableIntegerSimple) gmp
|
||||||
|
++ stdenv.lib.optional (platform.libc != "glibc") libiconv;
|
||||||
|
|
||||||
|
toolsForTarget =
|
||||||
|
if hostPlatform == buildPlatform then
|
||||||
|
[ targetPackages.stdenv.cc ] ++ stdenv.lib.optional useLLVM llvmPackages.llvm
|
||||||
|
else assert targetPlatform == hostPlatform; # build != host == target
|
||||||
|
[ stdenv.cc ] ++ stdenv.lib.optional useLLVM buildLlvmPackages.llvm;
|
||||||
|
|
||||||
|
targetCC = builtins.head toolsForTarget;
|
||||||
|
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation (rec {
|
stdenv.mkDerivation rec {
|
||||||
inherit version rev;
|
inherit version;
|
||||||
|
inherit (src) rev;
|
||||||
name = "${targetPrefix}ghc-${version}";
|
name = "${targetPrefix}ghc-${version}";
|
||||||
|
|
||||||
src = fetchgit {
|
src = fetchgit {
|
||||||
url = "git://git.haskell.org/ghc.git";
|
url = "git://git.haskell.org/ghc.git";
|
||||||
inherit rev;
|
rev = "e1d4140be4d2a1508015093b69e1ef53516e1eb6";
|
||||||
sha256 = "19csad94sk0bw2nj97ppmnwh4c193jg0jmg5w2sx9rqm9ih4yg85";
|
sha256 = "1gdcr10dd968d40qgljdwx9vfkva3yrvjm9a4nis7whaaac3ag58";
|
||||||
};
|
};
|
||||||
|
|
||||||
postPatch = "patchShebangs .";
|
|
||||||
|
|
||||||
preConfigure = ''
|
|
||||||
echo ${version} >VERSION
|
|
||||||
echo ${rev} >GIT_COMMIT_ID
|
|
||||||
./boot
|
|
||||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
|
||||||
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
|
||||||
export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}"
|
|
||||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
|
||||||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
|
||||||
'' + stdenv.lib.optionalString enableIntegerSimple ''
|
|
||||||
echo "INTEGER_LIBRARY=integer-simple" > mk/build.mk
|
|
||||||
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
|
|
||||||
sed 's|#BuildFlavour = quick-cross|BuildFlavour = perf-cross|' mk/build.mk.sample > mk/build.mk
|
|
||||||
'';
|
|
||||||
|
|
||||||
buildInputs = [ ghc perl autoconf automake happy alex python3 ];
|
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
outputs = [ "out" "doc" ];
|
||||||
|
|
||||||
|
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 targetPlatform.isArm ".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
|
||||||
|
echo ${version} >VERSION
|
||||||
|
echo ${src.rev} >GIT_COMMIT_ID
|
||||||
|
./boot
|
||||||
|
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"
|
||||||
|
'';
|
||||||
|
|
||||||
|
# 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 = [
|
configureFlags = [
|
||||||
"CC=${stdenv.cc}/bin/cc"
|
|
||||||
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
|
||||||
"--datadir=$doc/share/doc/ghc"
|
"--datadir=$doc/share/doc/ghc"
|
||||||
] ++ stdenv.lib.optional (! enableIntegerSimple) [
|
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
||||||
|
] ++ stdenv.lib.optional (targetPlatform == hostPlatform && ! enableIntegerSimple) [
|
||||||
"--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib"
|
"--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib"
|
||||||
] ++ stdenv.lib.optional stdenv.isDarwin [
|
] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.libc != "glibc") [
|
||||||
"--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib"
|
"--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib"
|
||||||
|
] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [
|
||||||
|
"--enable-bootstrap-with-devel-snapshot"
|
||||||
|
] ++ stdenv.lib.optionals (targetPlatform.isArm) [
|
||||||
|
"CFLAGS=-fuse-ld=gold"
|
||||||
|
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
|
||||||
|
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
|
||||||
|
] ++ stdenv.lib.optionals (targetPlatform.isDarwin && targetPlatform.isAarch64) [
|
||||||
|
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
|
||||||
|
"--disable-large-address-space"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Hack to make sure we never to the relaxation `$PATH` and hooks support for
|
||||||
|
# compatability. This will be replaced with something clearer in a future
|
||||||
|
# masss-rebuild.
|
||||||
|
crossConfig = true;
|
||||||
|
|
||||||
|
nativeBuildInputs = [ ghc perl autoconf automake happy alex python3 ];
|
||||||
|
|
||||||
|
# For building runtime libs
|
||||||
|
depsBuildTarget = toolsForTarget;
|
||||||
|
|
||||||
|
buildInputs = 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
|
# required, because otherwise all symbols from HSffi.o are stripped, and
|
||||||
# that in turn causes GHCi to abort
|
# that in turn causes GHCi to abort
|
||||||
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
||||||
|
|
||||||
checkTarget = "test";
|
checkTarget = "test";
|
||||||
|
|
||||||
|
# zsh and other shells are smart about `{ghc}` but bash isn't, and doesn't
|
||||||
|
# treat that as a unary `{x,y,z,..}` repetition.
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
|
paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
|
||||||
|
|
||||||
@ -88,15 +174,13 @@ stdenv.mkDerivation (rec {
|
|||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
outputs = [ "out" "doc" ];
|
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit bootPkgs targetPrefix;
|
inherit bootPkgs targetPrefix;
|
||||||
} // stdenv.lib.optionalAttrs (targetPlatform != buildPlatform) {
|
|
||||||
crossCompiler = selfPkgs.ghc.override {
|
inherit llvmPackages;
|
||||||
cross = targetPlatform;
|
|
||||||
bootPkgs = selfPkgs;
|
# Our Cabal compiler name
|
||||||
};
|
haskellCompilerName = "ghc";
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
@ -106,24 +190,4 @@ stdenv.mkDerivation (rec {
|
|||||||
inherit (ghc.meta) license platforms;
|
inherit (ghc.meta) license platforms;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // stdenv.lib.optionalAttrs (cross != null) {
|
}
|
||||||
configureFlags = [
|
|
||||||
"CC=${stdenv.cc}/bin/${cross.config}-cc"
|
|
||||||
"LD=${stdenv.cc.bintools}/bin/${cross.config}-ld"
|
|
||||||
"AR=${stdenv.cc.bintools}/bin/${cross.config}-ar"
|
|
||||||
"NM=${stdenv.cc.bintools}/bin/${cross.config}-nm"
|
|
||||||
"RANLIB=${stdenv.cc.bintools}/bin/${cross.config}-ranlib"
|
|
||||||
"--target=${cross.config}"
|
|
||||||
"--enable-bootstrap-with-devel-snapshot"
|
|
||||||
] ++
|
|
||||||
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
|
|
||||||
stdenv.lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space";
|
|
||||||
|
|
||||||
configurePlatforms = [];
|
|
||||||
|
|
||||||
passthru = {
|
|
||||||
inherit bootPkgs cross;
|
|
||||||
cc = "${stdenv.cc}/bin/${cross.config}-cc";
|
|
||||||
ld = "${stdenv.cc}/bin/${cross.config}-ld";
|
|
||||||
};
|
|
||||||
})
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
{ pkgs, stdenv, lib, haskellLib, ghc, all-cabal-hashes
|
{ pkgs, stdenv, lib, haskellLib, ghc, all-cabal-hashes
|
||||||
|
, buildHaskellPackages
|
||||||
, compilerConfig ? (self: super: {})
|
, compilerConfig ? (self: super: {})
|
||||||
, packageSetConfig ? (self: super: {})
|
, packageSetConfig ? (self: super: {})
|
||||||
, overrides ? (self: super: {})
|
, overrides ? (self: super: {})
|
||||||
@ -14,7 +15,7 @@ let
|
|||||||
|
|
||||||
haskellPackages = pkgs.callPackage makePackageSet {
|
haskellPackages = pkgs.callPackage makePackageSet {
|
||||||
package-set = initialPackages;
|
package-set = initialPackages;
|
||||||
inherit stdenv haskellLib ghc extensible-self;
|
inherit stdenv haskellLib ghc buildHaskellPackages extensible-self;
|
||||||
};
|
};
|
||||||
|
|
||||||
commonConfiguration = configurationCommon { inherit pkgs haskellLib; };
|
commonConfiguration = configurationCommon { inherit pkgs haskellLib; };
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ stdenv, buildPackages, ghc
|
{ stdenv, buildPackages, buildHaskellPackages, ghc
|
||||||
, jailbreak-cabal, hscolour, cpphs, nodejs
|
, jailbreak-cabal, hscolour, cpphs, nodejs
|
||||||
, buildPlatform, hostPlatform
|
, buildPlatform, hostPlatform
|
||||||
}:
|
}:
|
||||||
@ -81,7 +81,11 @@ let
|
|||||||
then "package-db"
|
then "package-db"
|
||||||
else "package-conf";
|
else "package-conf";
|
||||||
|
|
||||||
nativeGhc = if isCross || isGhcjs then ghc.bootPkgs.ghc else ghc;
|
# GHC used for building Setup.hs
|
||||||
|
#
|
||||||
|
# Same as our GHC, unless we're cross, in which case it is native GHC with the
|
||||||
|
# same version, or ghcjs, in which case its the ghc used to build ghcjs.
|
||||||
|
nativeGhc = buildHaskellPackages.ghc;
|
||||||
nativePackageDbFlag = if versionOlder "7.6" nativeGhc.version
|
nativePackageDbFlag = if versionOlder "7.6" nativeGhc.version
|
||||||
then "package-db"
|
then "package-db"
|
||||||
else "package-conf";
|
else "package-conf";
|
||||||
@ -147,8 +151,7 @@ let
|
|||||||
] ++ crossCabalFlags);
|
] ++ crossCabalFlags);
|
||||||
|
|
||||||
setupCompileFlags = [
|
setupCompileFlags = [
|
||||||
(optionalString (!coreSetup) "-${packageDbFlag}=$packageConfDir")
|
(optionalString (!coreSetup) "-${nativePackageDbFlag}=$packageConfDir")
|
||||||
(optionalString isGhcjs "-build-runner")
|
|
||||||
(optionalString (isGhcjs || isHaLVM || versionOlder "7.8" ghc.version) "-j$NIX_BUILD_CORES")
|
(optionalString (isGhcjs || isHaLVM || versionOlder "7.8" ghc.version) "-j$NIX_BUILD_CORES")
|
||||||
# https://github.com/haskell/cabal/issues/2398
|
# https://github.com/haskell/cabal/issues/2398
|
||||||
(optionalString (versionOlder "7.10" ghc.version && !isHaLVM) "-threaded")
|
(optionalString (versionOlder "7.10" ghc.version && !isHaLVM) "-threaded")
|
||||||
@ -160,14 +163,12 @@ let
|
|||||||
allPkgconfigDepends = pkgconfigDepends ++ libraryPkgconfigDepends ++ executablePkgconfigDepends ++
|
allPkgconfigDepends = pkgconfigDepends ++ libraryPkgconfigDepends ++ executablePkgconfigDepends ++
|
||||||
optionals doCheck testPkgconfigDepends ++ optionals doBenchmark benchmarkPkgconfigDepends;
|
optionals doCheck testPkgconfigDepends ++ optionals doBenchmark benchmarkPkgconfigDepends;
|
||||||
|
|
||||||
nativeBuildInputs = optional (allPkgconfigDepends != []) pkgconfig ++
|
nativeBuildInputs = [ ghc nativeGhc removeReferencesTo ] ++ optional (allPkgconfigDepends != []) pkgconfig ++
|
||||||
buildTools ++ libraryToolDepends ++ executableToolDepends ++ [ removeReferencesTo ];
|
buildTools ++ libraryToolDepends ++ executableToolDepends;
|
||||||
propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends;
|
propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends;
|
||||||
otherBuildInputs = setupHaskellDepends ++ extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++
|
otherBuildInputs = setupHaskellDepends ++ extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++
|
||||||
optionals (allPkgconfigDepends != []) allPkgconfigDepends ++
|
optionals (allPkgconfigDepends != []) allPkgconfigDepends ++
|
||||||
optionals doCheck (testDepends ++ testHaskellDepends ++ testSystemDepends ++ testToolDepends) ++
|
optionals doCheck (testDepends ++ testHaskellDepends ++ testSystemDepends ++ testToolDepends) ++
|
||||||
# ghcjs's hsc2hs calls out to the native hsc2hs
|
|
||||||
optional isGhcjs nativeGhc ++
|
|
||||||
optionals doBenchmark (benchmarkDepends ++ benchmarkHaskellDepends ++ benchmarkSystemDepends ++ benchmarkToolDepends);
|
optionals doBenchmark (benchmarkDepends ++ benchmarkHaskellDepends ++ benchmarkSystemDepends ++ benchmarkToolDepends);
|
||||||
allBuildInputs = propagatedBuildInputs ++ otherBuildInputs;
|
allBuildInputs = propagatedBuildInputs ++ otherBuildInputs;
|
||||||
|
|
||||||
@ -176,12 +177,14 @@ let
|
|||||||
|
|
||||||
ghcEnv = ghc.withPackages (p: haskellBuildInputs);
|
ghcEnv = ghc.withPackages (p: haskellBuildInputs);
|
||||||
|
|
||||||
setupBuilder = if isCross then "${nativeGhc}/bin/ghc" else ghcCommand;
|
|
||||||
setupCommand = "./Setup";
|
setupCommand = "./Setup";
|
||||||
|
|
||||||
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
|
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
|
||||||
ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
|
ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
|
||||||
ghcCommandCaps= toUpper ghcCommand';
|
ghcCommandCaps= toUpper ghcCommand';
|
||||||
|
|
||||||
|
nativeGhcCommand = "${nativeGhc.targetPrefix}ghc";
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
assert allPkgconfigDepends != [] -> pkgconfig != null;
|
assert allPkgconfigDepends != [] -> pkgconfig != null;
|
||||||
@ -220,7 +223,6 @@ stdenv.mkDerivation ({
|
|||||||
runHook preSetupCompilerEnvironment
|
runHook preSetupCompilerEnvironment
|
||||||
|
|
||||||
echo "Build with ${ghc}."
|
echo "Build with ${ghc}."
|
||||||
export PATH="${ghc}/bin:$PATH"
|
|
||||||
${optionalString (hasActiveLibrary && hyperlinkSource) "export PATH=${hscolour}/bin:$PATH"}
|
${optionalString (hasActiveLibrary && hyperlinkSource) "export PATH=${hscolour}/bin:$PATH"}
|
||||||
|
|
||||||
packageConfDir="$TMPDIR/package.conf.d"
|
packageConfDir="$TMPDIR/package.conf.d"
|
||||||
@ -271,11 +273,13 @@ stdenv.mkDerivation ({
|
|||||||
done
|
done
|
||||||
|
|
||||||
echo setupCompileFlags: $setupCompileFlags
|
echo setupCompileFlags: $setupCompileFlags
|
||||||
${setupBuilder} $setupCompileFlags --make -o Setup -odir $TMPDIR -hidir $TMPDIR $i
|
${nativeGhcCommand} $setupCompileFlags --make -o Setup -odir $TMPDIR -hidir $TMPDIR $i
|
||||||
|
|
||||||
runHook postCompileBuildDriver
|
runHook postCompileBuildDriver
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# Cabal takes flags like `--configure-option=--host=...` instead
|
||||||
|
configurePlatforms = [];
|
||||||
inherit configureFlags;
|
inherit configureFlags;
|
||||||
|
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
|
@ -4,6 +4,10 @@
|
|||||||
{ # package-set used for build tools (all of nixpkgs)
|
{ # package-set used for build tools (all of nixpkgs)
|
||||||
buildPackages
|
buildPackages
|
||||||
|
|
||||||
|
, # A haskell package set for Setup.hs, compiler plugins, and similar
|
||||||
|
# build-time uses.
|
||||||
|
buildHaskellPackages
|
||||||
|
|
||||||
, # package-set used for non-haskell dependencies (all of nixpkgs)
|
, # package-set used for non-haskell dependencies (all of nixpkgs)
|
||||||
pkgs
|
pkgs
|
||||||
|
|
||||||
@ -18,8 +22,8 @@
|
|||||||
, # compiler to use
|
, # compiler to use
|
||||||
ghc
|
ghc
|
||||||
|
|
||||||
, # A function that takes `{ pkgs, stdenv, callPackage }` as the first arg and `self`
|
, # A function that takes `{ pkgs, stdenv, callPackage }` as the first arg and
|
||||||
# as second, and returns a set of haskell packages
|
# `self` as second, and returns a set of haskell packages
|
||||||
package-set
|
package-set
|
||||||
|
|
||||||
, # The final, fully overriden package set usable with the nixpkgs fixpoint
|
, # The final, fully overriden package set usable with the nixpkgs fixpoint
|
||||||
@ -36,15 +40,12 @@ let
|
|||||||
inherit (stdenv.lib) fix' extends makeOverridable;
|
inherit (stdenv.lib) fix' extends makeOverridable;
|
||||||
inherit (haskellLib) overrideCabal;
|
inherit (haskellLib) overrideCabal;
|
||||||
|
|
||||||
buildHaskellPackages = if hostPlatform != buildPlatform
|
|
||||||
then self.ghc.bootPkgs
|
|
||||||
else self;
|
|
||||||
|
|
||||||
mkDerivationImpl = pkgs.callPackage ./generic-builder.nix {
|
mkDerivationImpl = pkgs.callPackage ./generic-builder.nix {
|
||||||
inherit stdenv;
|
inherit stdenv;
|
||||||
nodejs = buildPackages.nodejs-slim;
|
nodejs = buildPackages.nodejs-slim;
|
||||||
inherit (buildHaskellPackages) jailbreak-cabal;
|
inherit buildHaskellPackages;
|
||||||
inherit (self) ghc;
|
inherit (self) ghc;
|
||||||
|
inherit (buildHaskellPackages) jailbreak-cabal;
|
||||||
hscolour = overrideCabal buildHaskellPackages.hscolour (drv: {
|
hscolour = overrideCabal buildHaskellPackages.hscolour (drv: {
|
||||||
isLibrary = false;
|
isLibrary = false;
|
||||||
doHaddock = false;
|
doHaddock = false;
|
||||||
@ -119,7 +120,7 @@ let
|
|||||||
installPhase = ''
|
installPhase = ''
|
||||||
export HOME="$TMP"
|
export HOME="$TMP"
|
||||||
mkdir -p "$out"
|
mkdir -p "$out"
|
||||||
cabal2nix --compiler=${self.ghc.name} --system=${stdenv.system} ${sha256Arg} "${src}" > "$out/default.nix"
|
cabal2nix --compiler=${ghc.haskellCompilerName} --system=${stdenv.system} ${sha256Arg} "${src}" > "$out/default.nix"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
{ pkgs, lib, newScope, stdenv, buildPlatform, targetPlatform, cabal-install }:
|
{ buildPackages, pkgs
|
||||||
|
, newScope, stdenv
|
||||||
|
, buildPlatform, targetPlatform
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
# These are attributes in compiler and packages that don't support integer-simple.
|
# These are attributes in compiler and packages that don't support integer-simple.
|
||||||
@ -65,38 +68,43 @@ in rec {
|
|||||||
ghc7103 = callPackage ../development/compilers/ghc/7.10.3.nix rec {
|
ghc7103 = callPackage ../development/compilers/ghc/7.10.3.nix rec {
|
||||||
bootPkgs = packages.ghc7103Binary;
|
bootPkgs = packages.ghc7103Binary;
|
||||||
inherit (bootPkgs) hscolour;
|
inherit (bootPkgs) hscolour;
|
||||||
|
buildLlvmPackages = buildPackages.llvmPackages_35;
|
||||||
|
llvmPackages = pkgs.llvmPackages_35;
|
||||||
};
|
};
|
||||||
ghc802 = callPackage ../development/compilers/ghc/8.0.2.nix rec {
|
ghc802 = callPackage ../development/compilers/ghc/8.0.2.nix rec {
|
||||||
bootPkgs = packages.ghc7103Binary;
|
bootPkgs = packages.ghc7103Binary;
|
||||||
inherit (bootPkgs) hscolour;
|
inherit (bootPkgs) hscolour;
|
||||||
sphinx = pkgs.python27Packages.sphinx;
|
sphinx = pkgs.python27Packages.sphinx;
|
||||||
|
buildLlvmPackages = buildPackages.llvmPackages_37;
|
||||||
|
llvmPackages = pkgs.llvmPackages_37;
|
||||||
};
|
};
|
||||||
ghc822 = callPackage ../development/compilers/ghc/8.2.2.nix rec {
|
ghc822 = callPackage ../development/compilers/ghc/8.2.2.nix rec {
|
||||||
bootPkgs = packages.ghc821Binary;
|
bootPkgs = packages.ghc821Binary;
|
||||||
inherit (bootPkgs) hscolour alex happy;
|
inherit (bootPkgs) hscolour alex happy;
|
||||||
inherit buildPlatform targetPlatform;
|
inherit buildPlatform targetPlatform;
|
||||||
sphinx = pkgs.python3Packages.sphinx;
|
sphinx = pkgs.python3Packages.sphinx;
|
||||||
selfPkgs = packages.ghc822;
|
buildLlvmPackages = buildPackages.llvmPackages_39;
|
||||||
|
llvmPackages = pkgs.llvmPackages_39;
|
||||||
};
|
};
|
||||||
ghc841 = callPackage ../development/compilers/ghc/8.4.1.nix rec {
|
ghc841 = callPackage ../development/compilers/ghc/8.4.1.nix rec {
|
||||||
bootPkgs = packages.ghc821Binary;
|
bootPkgs = packages.ghc821Binary;
|
||||||
inherit (bootPkgs) alex happy;
|
inherit (bootPkgs) alex happy;
|
||||||
inherit buildPlatform targetPlatform;
|
buildLlvmPackages = buildPackages.llvmPackages_5;
|
||||||
selfPkgs = packages.ghc841;
|
llvmPackages = pkgs.llvmPackages_5;
|
||||||
};
|
};
|
||||||
ghcHEAD = callPackage ../development/compilers/ghc/head.nix rec {
|
ghcHEAD = callPackage ../development/compilers/ghc/head.nix rec {
|
||||||
bootPkgs = packages.ghc821Binary;
|
bootPkgs = packages.ghc821Binary;
|
||||||
inherit (bootPkgs) alex happy;
|
inherit (bootPkgs) alex happy;
|
||||||
inherit buildPlatform targetPlatform;
|
buildLlvmPackages = buildPackages.llvmPackages_5;
|
||||||
selfPkgs = packages.ghcHEAD;
|
llvmPackages = pkgs.llvmPackages_5;
|
||||||
};
|
};
|
||||||
ghcjs = packages.ghc7103.callPackage ../development/compilers/ghcjs {
|
ghcjs = packages.ghc7103.callPackage ../development/compilers/ghcjs {
|
||||||
bootPkgs = packages.ghc7103;
|
bootPkgs = packages.ghc7103;
|
||||||
inherit cabal-install;
|
inherit (pkgs) cabal-install;
|
||||||
};
|
};
|
||||||
ghcjsHEAD = packages.ghc802.callPackage ../development/compilers/ghcjs/head.nix {
|
ghcjsHEAD = packages.ghc802.callPackage ../development/compilers/ghcjs/head.nix {
|
||||||
bootPkgs = packages.ghc802;
|
bootPkgs = packages.ghc802;
|
||||||
inherit cabal-install;
|
inherit (pkgs) cabal-install;
|
||||||
};
|
};
|
||||||
ghcHaLVM240 = callPackage ../development/compilers/halvm/2.4.0.nix rec {
|
ghcHaLVM240 = callPackage ../development/compilers/halvm/2.4.0.nix rec {
|
||||||
bootPkgs = packages.ghc7103Binary;
|
bootPkgs = packages.ghc7103Binary;
|
||||||
@ -110,80 +118,83 @@ in rec {
|
|||||||
|
|
||||||
# The integer-simple attribute set contains all the GHC compilers
|
# The integer-simple attribute set contains all the GHC compilers
|
||||||
# build with integer-simple instead of integer-gmp.
|
# build with integer-simple instead of integer-gmp.
|
||||||
integer-simple =
|
integer-simple = let
|
||||||
let integerSimpleGhcNames =
|
integerSimpleGhcNames = pkgs.lib.filter
|
||||||
pkgs.lib.filter (name: ! builtins.elem name integerSimpleExcludes)
|
(name: ! builtins.elem name integerSimpleExcludes)
|
||||||
(pkgs.lib.attrNames compiler);
|
(pkgs.lib.attrNames compiler);
|
||||||
integerSimpleGhcs = pkgs.lib.genAttrs integerSimpleGhcNames
|
in pkgs.recurseIntoAttrs (pkgs.lib.genAttrs
|
||||||
(name: compiler."${name}".override { enableIntegerSimple = true; });
|
integerSimpleGhcNames
|
||||||
in pkgs.recurseIntoAttrs (integerSimpleGhcs // {
|
(name: compiler."${name}".override { enableIntegerSimple = true; }));
|
||||||
ghcHEAD = integerSimpleGhcs.ghcHEAD.override { selfPkgs = packages.integer-simple.ghcHEAD; };
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
packages = {
|
# Always get compilers from `buildPackages`
|
||||||
|
packages = let bh = buildPackages.haskell; in {
|
||||||
|
|
||||||
ghc7103 = callPackage ../development/haskell-modules {
|
ghc7103 = callPackage ../development/haskell-modules {
|
||||||
ghc = compiler.ghc7103;
|
buildHaskellPackages = bh.packages.ghc7103;
|
||||||
|
ghc = bh.compiler.ghc7103;
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-7.10.x.nix { };
|
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-7.10.x.nix { };
|
||||||
};
|
};
|
||||||
ghc7103Binary = callPackage ../development/haskell-modules {
|
ghc7103Binary = callPackage ../development/haskell-modules {
|
||||||
ghc = compiler.ghc7103Binary;
|
buildHaskellPackages = bh.packages.ghc7103Binary;
|
||||||
|
ghc = bh.compiler.ghc7103Binary;
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-7.10.x.nix { };
|
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-7.10.x.nix { };
|
||||||
};
|
};
|
||||||
ghc802 = callPackage ../development/haskell-modules {
|
ghc802 = callPackage ../development/haskell-modules {
|
||||||
ghc = compiler.ghc802;
|
buildHaskellPackages = bh.packages.ghc802;
|
||||||
|
ghc = bh.compiler.ghc802;
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.0.x.nix { };
|
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.0.x.nix { };
|
||||||
};
|
};
|
||||||
ghc822 = callPackage ../development/haskell-modules {
|
ghc821Binary = callPackage ../development/haskell-modules {
|
||||||
ghc = compiler.ghc822;
|
buildHaskellPackages = bh.packages.ghc821Binary;
|
||||||
|
ghc = bh.compiler.ghc821Binary;
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.2.x.nix { };
|
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.2.x.nix { };
|
||||||
};
|
};
|
||||||
ghc821Binary = callPackage ../development/haskell-modules {
|
ghc822 = callPackage ../development/haskell-modules {
|
||||||
ghc = compiler.ghc821Binary;
|
buildHaskellPackages = bh.packages.ghc822;
|
||||||
|
ghc = bh.compiler.ghc822;
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.2.x.nix { };
|
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.2.x.nix { };
|
||||||
};
|
};
|
||||||
ghc841 = callPackage ../development/haskell-modules {
|
ghc841 = callPackage ../development/haskell-modules {
|
||||||
ghc = compiler.ghc841;
|
buildHaskellPackages = bh.packages.ghc841;
|
||||||
|
ghc = bh.compiler.ghc841;
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.4.x.nix { };
|
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.4.x.nix { };
|
||||||
};
|
};
|
||||||
ghcHEAD = callPackage ../development/haskell-modules {
|
ghcHEAD = callPackage ../development/haskell-modules {
|
||||||
ghc = compiler.ghcHEAD;
|
buildHaskellPackages = bh.packages.ghcHEAD;
|
||||||
|
ghc = bh.compiler.ghcHEAD;
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-head.nix { };
|
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-head.nix { };
|
||||||
};
|
};
|
||||||
# TODO Support for multiple variants here
|
ghcjs = callPackage ../development/haskell-modules rec {
|
||||||
ghcCross = callPackage ../development/haskell-modules {
|
buildHaskellPackages = ghc.bootPkgs;
|
||||||
ghc = compiler.ghcHEAD.crossCompiler;
|
ghc = bh.compiler.ghcjs;
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-head.nix { };
|
|
||||||
};
|
|
||||||
ghcjs = callPackage ../development/haskell-modules {
|
|
||||||
ghc = compiler.ghcjs;
|
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-7.10.x.nix { };
|
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-7.10.x.nix { };
|
||||||
packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { };
|
packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { };
|
||||||
};
|
};
|
||||||
ghcjsHEAD = callPackage ../development/haskell-modules {
|
ghcjsHEAD = callPackage ../development/haskell-modules rec {
|
||||||
ghc = compiler.ghcjsHEAD;
|
buildHaskellPackages = ghc.bootPkgs;
|
||||||
|
ghc = bh.compiler.ghcjsHEAD;
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.0.x.nix { };
|
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.0.x.nix { };
|
||||||
packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { };
|
packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { };
|
||||||
};
|
};
|
||||||
ghcHaLVM240 = callPackage ../development/haskell-modules {
|
ghcHaLVM240 = callPackage ../development/haskell-modules {
|
||||||
ghc = compiler.ghcHaLVM240;
|
buildHaskellPackages = bh.packages.ghcHaLVM240;
|
||||||
|
ghc = bh.compiler.ghcHaLVM240;
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-halvm-2.4.0.nix { };
|
compilerConfig = callPackage ../development/haskell-modules/configuration-halvm-2.4.0.nix { };
|
||||||
};
|
};
|
||||||
|
|
||||||
# The integer-simple attribute set contains package sets for all the GHC compilers
|
# The integer-simple attribute set contains package sets for all the GHC compilers
|
||||||
# using integer-simple instead of integer-gmp.
|
# using integer-simple instead of integer-gmp.
|
||||||
integer-simple =
|
integer-simple = let
|
||||||
let integerSimpleGhcNames =
|
integerSimpleGhcNames = pkgs.lib.filter
|
||||||
pkgs.lib.filter (name: ! builtins.elem name integerSimpleExcludes)
|
(name: ! builtins.elem name integerSimpleExcludes)
|
||||||
(pkgs.lib.attrNames packages);
|
(pkgs.lib.attrNames packages);
|
||||||
in pkgs.lib.genAttrs integerSimpleGhcNames (name: packages."${name}".override {
|
in pkgs.lib.genAttrs integerSimpleGhcNames (name: packages."${name}".override {
|
||||||
ghc = compiler.integer-simple."${name}";
|
ghc = compiler.integer-simple."${name}";
|
||||||
overrides = _self : _super : {
|
overrides = _self : _super : {
|
||||||
integer-simple = null;
|
integer-simple = null;
|
||||||
integer-gmp = null;
|
integer-gmp = null;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -21,6 +21,8 @@ let
|
|||||||
gnuCommon = lib.recursiveUpdate common {
|
gnuCommon = lib.recursiveUpdate common {
|
||||||
buildPackages.gcc = nativePlatforms;
|
buildPackages.gcc = nativePlatforms;
|
||||||
coreutils = nativePlatforms;
|
coreutils = nativePlatforms;
|
||||||
|
haskell.packages.ghcHEAD.hello = nativePlatforms;
|
||||||
|
haskell.packages.ghc822.hello = nativePlatforms;
|
||||||
};
|
};
|
||||||
|
|
||||||
linuxCommon = lib.recursiveUpdate gnuCommon {
|
linuxCommon = lib.recursiveUpdate gnuCommon {
|
||||||
@ -119,6 +121,9 @@ in
|
|||||||
mpg123 = nativePlatforms;
|
mpg123 = nativePlatforms;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* Linux on Aarch64 (TODO make android for real) */
|
||||||
|
android = mapTestOnCross lib.systems.examples.aarch64-multiplatform (linuxCommon // {
|
||||||
|
});
|
||||||
|
|
||||||
/* Cross-built bootstrap tools for every supported platform */
|
/* Cross-built bootstrap tools for every supported platform */
|
||||||
bootstrapTools = let
|
bootstrapTools = let
|
||||||
|
Loading…
Reference in New Issue
Block a user