ghc: Fix cross compilation to work with new system
This commit is contained in:
parent
bc16cfc009
commit
398ac54593
|
@ -2,15 +2,28 @@
|
|||
, buildPlatform, hostPlatform, targetPlatform
|
||||
|
||||
# build-tools
|
||||
, bootPkgs, hscolour, llvm_35
|
||||
, bootPkgs, hscolour
|
||||
, coreutils, fetchurl, fetchpatch, perl
|
||||
, 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
|
||||
# library instead of the faster but GPLed integer-gmp library.
|
||||
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;
|
||||
|
@ -28,12 +41,32 @@ let
|
|||
sha256 = "1j45z4kcd3w1rzm4hapap2xc16bbh942qnzzdbdjcwqznsccznf0";
|
||||
};
|
||||
|
||||
buildMK = stdenv.lib.optionalString enableIntegerSimple ''
|
||||
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 == "libSystem") 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
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
|
@ -45,17 +78,15 @@ stdenv.mkDerivation rec {
|
|||
sha256 = "1vsgmic8csczl62ciz51iv8nhrkm72lyhbz7p7id13y2w7fcx46g";
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
outputs = [ "out" "doc" ];
|
||||
|
||||
patches = [
|
||||
docFixes
|
||||
./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 ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
outputs = [ "out" "doc" ];
|
||||
|
||||
preConfigure = ''
|
||||
echo -n "${buildMK}" > mk/build.mk
|
||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||
|
@ -65,16 +96,44 @@ stdenv.mkDerivation rec {
|
|||
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 = [
|
||||
"--with-gcc=${stdenv.cc}/bin/cc"
|
||||
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
||||
"--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"
|
||||
] ++ stdenv.lib.optional stdenv.isDarwin [
|
||||
] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.isDarwin) [
|
||||
"--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
|
||||
# that in turn causes GHCi to abort
|
||||
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
||||
|
@ -93,6 +152,8 @@ stdenv.mkDerivation rec {
|
|||
|
||||
passthru = {
|
||||
inherit bootPkgs targetPrefix;
|
||||
|
||||
inherit llvmPackages;
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
@ -101,4 +162,5 @@ stdenv.mkDerivation rec {
|
|||
maintainers = with stdenv.lib.maintainers; [ marcweber andres peti ];
|
||||
inherit (ghc.meta) license platforms;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
# library instead of the faster but GPLed integer-gmp library.
|
||||
|
@ -9,22 +12,7 @@
|
|||
assert stdenv.targetPlatform == stdenv.hostPlatform;
|
||||
assert !enableIntegerSimple -> gmp != null;
|
||||
|
||||
stdenv.mkDerivation (rec {
|
||||
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;
|
||||
|
||||
let
|
||||
buildMK = ''
|
||||
libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-includes="${ncurses.dev}/include"
|
||||
libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="${ncurses.out}/lib"
|
||||
|
@ -40,6 +28,27 @@ stdenv.mkDerivation (rec {
|
|||
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 == "libSystem") 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 = ''
|
||||
echo -n "${buildMK}" > mk/build.mk
|
||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||
|
@ -49,6 +58,18 @@ stdenv.mkDerivation (rec {
|
|||
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
|
||||
# that in turn causes GHCi to abort
|
||||
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
|
||||
|
@ -62,7 +83,4 @@ stdenv.mkDerivation (rec {
|
|||
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
|
||||
|
||||
# build-tools
|
||||
, bootPkgs, hscolour, llvm_37
|
||||
, coreutils, fetchurl, fetchpatch, patchutils, perl, sphinx
|
||||
, bootPkgs, hscolour
|
||||
, coreutils, 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
|
||||
# library instead of the faster but GPLed integer-gmp library.
|
||||
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;
|
||||
|
@ -22,11 +35,32 @@ let
|
|||
(targetPlatform != hostPlatform)
|
||||
"${targetPlatform.config}-";
|
||||
|
||||
buildMK = stdenv.lib.optionalString enableIntegerSimple ''
|
||||
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 == "libSystem") 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
|
||||
stdenv.mkDerivation rec {
|
||||
version = "8.0.2";
|
||||
|
@ -37,16 +71,14 @@ stdenv.mkDerivation rec {
|
|||
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;
|
||||
|
||||
outputs = [ "out" "man" "doc" ];
|
||||
|
||||
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;
|
||||
|
||||
preConfigure = ''
|
||||
echo -n "${buildMK}" > mk/build.mk
|
||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||
|
@ -56,23 +88,48 @@ stdenv.mkDerivation rec {
|
|||
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 = [
|
||||
"--with-gcc=${stdenv.cc}/bin/cc"
|
||||
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
||||
"--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"
|
||||
] ++ stdenv.lib.optional stdenv.isDarwin [
|
||||
] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.isDarwin) [
|
||||
"--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 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
|
||||
# that in turn causes GHCi to abort
|
||||
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 = ''
|
||||
paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
|
||||
|
||||
|
@ -89,6 +146,8 @@ stdenv.mkDerivation rec {
|
|||
|
||||
passthru = {
|
||||
inherit bootPkgs targetPrefix;
|
||||
|
||||
inherit llvmPackages;
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
|
|
@ -2,14 +2,30 @@
|
|||
, buildPlatform, hostPlatform, targetPlatform
|
||||
|
||||
# build-tools
|
||||
, bootPkgs, alex, happy, hscolour, llvm_39
|
||||
, bootPkgs, alex, happy, hscolour
|
||||
, autoconf, automake, coreutils, fetchurl, 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
|
||||
# library instead of the faster but GPLed integer-gmp library.
|
||||
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;
|
||||
|
@ -22,11 +38,34 @@ let
|
|||
(targetPlatform != hostPlatform)
|
||||
"${targetPlatform.config}-";
|
||||
|
||||
buildMK = stdenv.lib.optionalString enableIntegerSimple ''
|
||||
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 == "libSystem") 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
|
||||
stdenv.mkDerivation rec {
|
||||
version = "8.2.2";
|
||||
|
@ -37,6 +76,10 @@ stdenv.mkDerivation rec {
|
|||
sha256 = "1z05vkpaj54xdypmaml50hgsdpw29dhbs2r7magx0cm199iw73mv";
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
outputs = [ "out" "doc" ];
|
||||
|
||||
postPatch = "patchShebangs .";
|
||||
|
||||
preConfigure = ''
|
||||
|
@ -48,28 +91,52 @@ stdenv.mkDerivation rec {
|
|||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
||||
'';
|
||||
|
||||
buildInputs = [ alex autoconf automake ghc happy hscolour perl python3 sphinx ] ++ stdenv.lib.optionals (targetPlatform.isArm || targetPlatform.isAarch64) [ llvm_39 ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
# 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 = [
|
||||
"CC=${stdenv.cc}/bin/cc"
|
||||
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
||||
"--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"
|
||||
] ++ stdenv.lib.optional stdenv.isDarwin [
|
||||
] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.isDarwin) [
|
||||
"--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib"
|
||||
] ++ stdenv.lib.optional stdenv.isArm [
|
||||
] ++ 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"
|
||||
] ++ stdenv.lib.optional targetPlatform.isArm [
|
||||
"LD=${stdenv.cc}/bin/ld.gold"
|
||||
];
|
||||
|
||||
# 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 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
|
||||
# that in turn causes GHCi to abort
|
||||
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
||||
|
||||
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 = ''
|
||||
paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
|
||||
|
||||
|
@ -84,10 +151,10 @@ stdenv.mkDerivation rec {
|
|||
done
|
||||
'';
|
||||
|
||||
outputs = [ "out" "doc" ];
|
||||
|
||||
passthru = {
|
||||
inherit bootPkgs targetPrefix;
|
||||
|
||||
inherit llvmPackages;
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
|
|
@ -5,12 +5,25 @@
|
|||
, bootPkgs, alex, happy
|
||||
, 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
|
||||
# library instead of the faster but GPLed integer-gmp library.
|
||||
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"
|
||||
}:
|
||||
|
||||
|
@ -26,11 +39,34 @@ let
|
|||
(targetPlatform != hostPlatform)
|
||||
"${targetPlatform.config}-";
|
||||
|
||||
buildMK = stdenv.lib.optionalString enableIntegerSimple ''
|
||||
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 == "libSystem") 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
|
||||
stdenv.mkDerivation rec {
|
||||
inherit version rev;
|
||||
|
@ -42,6 +78,10 @@ stdenv.mkDerivation rec {
|
|||
sha256 = "06slymbsd7vsfp4hh40v7cxf7nmp0kvlni2wfq7ag5wlqh04slgs";
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
outputs = [ "out" "doc" ];
|
||||
|
||||
postPatch = "patchShebangs .";
|
||||
|
||||
preConfigure = ''
|
||||
|
@ -56,26 +96,50 @@ stdenv.mkDerivation rec {
|
|||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
||||
'';
|
||||
|
||||
buildInputs = [ ghc perl autoconf automake happy alex python3 ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
# 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 = [
|
||||
"CC=${stdenv.cc}/bin/cc"
|
||||
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
||||
"--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"
|
||||
] ++ stdenv.lib.optional stdenv.isDarwin [
|
||||
] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.isDarwin) [
|
||||
"--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 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
|
||||
# that in turn causes GHCi to abort
|
||||
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
||||
|
||||
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 = ''
|
||||
paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
|
||||
|
||||
|
@ -90,10 +154,10 @@ stdenv.mkDerivation rec {
|
|||
done
|
||||
'';
|
||||
|
||||
outputs = [ "out" "doc" ];
|
||||
|
||||
passthru = {
|
||||
inherit bootPkgs targetPrefix;
|
||||
|
||||
inherit llvmPackages;
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
|
|
@ -5,12 +5,25 @@
|
|||
, bootPkgs, alex, happy
|
||||
, 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
|
||||
# library instead of the faster but GPLed integer-gmp library.
|
||||
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.5.20171209"
|
||||
}:
|
||||
|
||||
|
@ -26,11 +39,34 @@ let
|
|||
(targetPlatform != hostPlatform)
|
||||
"${targetPlatform.config}-";
|
||||
|
||||
buildMK = stdenv.lib.optionalString enableIntegerSimple ''
|
||||
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 == "libSystem") 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
|
||||
stdenv.mkDerivation rec {
|
||||
inherit version rev;
|
||||
|
@ -42,6 +78,10 @@ stdenv.mkDerivation rec {
|
|||
sha256 = "19csad94sk0bw2nj97ppmnwh4c193jg0jmg5w2sx9rqm9ih4yg85";
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
outputs = [ "out" "doc" ];
|
||||
|
||||
postPatch = "patchShebangs .";
|
||||
|
||||
preConfigure = ''
|
||||
|
@ -56,26 +96,50 @@ stdenv.mkDerivation rec {
|
|||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
||||
'';
|
||||
|
||||
buildInputs = [ ghc perl autoconf automake happy alex python3 ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
# 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 = [
|
||||
"CC=${stdenv.cc}/bin/cc"
|
||||
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
|
||||
"--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"
|
||||
] ++ stdenv.lib.optional stdenv.isDarwin [
|
||||
] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.isDarwin) [
|
||||
"--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 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
|
||||
# that in turn causes GHCi to abort
|
||||
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
|
||||
|
||||
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 = ''
|
||||
paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
|
||||
|
||||
|
@ -90,10 +154,10 @@ stdenv.mkDerivation rec {
|
|||
done
|
||||
'';
|
||||
|
||||
outputs = [ "out" "doc" ];
|
||||
|
||||
passthru = {
|
||||
inherit bootPkgs targetPrefix;
|
||||
|
||||
inherit llvmPackages;
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
|
|
@ -68,25 +68,35 @@ in rec {
|
|||
ghc7103 = callPackage ../development/compilers/ghc/7.10.3.nix rec {
|
||||
bootPkgs = packages.ghc7103Binary;
|
||||
inherit (bootPkgs) hscolour;
|
||||
buildLlvmPackages = buildPackages.llvmPackages_35;
|
||||
llvmPackages = pkgs.llvmPackages_35;
|
||||
};
|
||||
ghc802 = callPackage ../development/compilers/ghc/8.0.2.nix rec {
|
||||
bootPkgs = packages.ghc7103Binary;
|
||||
inherit (bootPkgs) hscolour;
|
||||
sphinx = pkgs.python27Packages.sphinx;
|
||||
buildLlvmPackages = buildPackages.llvmPackages_37;
|
||||
llvmPackages = pkgs.llvmPackages_37;
|
||||
};
|
||||
ghc822 = callPackage ../development/compilers/ghc/8.2.2.nix rec {
|
||||
bootPkgs = packages.ghc821Binary;
|
||||
inherit (bootPkgs) hscolour alex happy;
|
||||
inherit buildPlatform targetPlatform;
|
||||
sphinx = pkgs.python3Packages.sphinx;
|
||||
buildLlvmPackages = buildPackages.llvmPackages_39;
|
||||
llvmPackages = pkgs.llvmPackages_39;
|
||||
};
|
||||
ghc841 = callPackage ../development/compilers/ghc/8.4.1.nix rec {
|
||||
bootPkgs = packages.ghc821Binary;
|
||||
inherit (bootPkgs) alex happy;
|
||||
buildLlvmPackages = buildPackages.llvmPackages_5;
|
||||
llvmPackages = pkgs.llvmPackages_5;
|
||||
};
|
||||
ghcHEAD = callPackage ../development/compilers/ghc/head.nix rec {
|
||||
bootPkgs = packages.ghc821Binary;
|
||||
inherit (bootPkgs) alex happy;
|
||||
buildLlvmPackages = buildPackages.llvmPackages_5;
|
||||
llvmPackages = pkgs.llvmPackages_5;
|
||||
};
|
||||
ghcjs = packages.ghc7103.callPackage ../development/compilers/ghcjs {
|
||||
bootPkgs = packages.ghc7103;
|
||||
|
|
Loading…
Reference in New Issue