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
|
, 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,12 +41,32 @@ let
|
|||||||
sha256 = "1j45z4kcd3w1rzm4hapap2xc16bbh942qnzzdbdjcwqznsccznf0";
|
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
|
INTEGER_LIBRARY = integer-simple
|
||||||
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
|
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
|
||||||
BuildFlavour = perf-cross
|
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
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
@ -45,17 +78,15 @@ 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 ];
|
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
|
||||||
|
|
||||||
outputs = [ "out" "doc" ];
|
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
echo -n "${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
|
||||||
@ -65,16 +96,44 @@ stdenv.mkDerivation rec {
|
|||||||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
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 = [
|
||||||
"--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.isDarwin) [
|
||||||
"--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";
|
||||||
@ -93,6 +152,8 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit bootPkgs targetPrefix;
|
inherit bootPkgs targetPrefix;
|
||||||
|
|
||||||
|
inherit llvmPackages;
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
@ -101,4 +162,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;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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,22 +12,7 @@
|
|||||||
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"
|
||||||
@ -40,6 +28,27 @@ stdenv.mkDerivation (rec {
|
|||||||
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 == "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 = ''
|
preConfigure = ''
|
||||||
echo -n "${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
|
||||||
@ -49,6 +58,18 @@ stdenv.mkDerivation (rec {
|
|||||||
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";
|
||||||
@ -62,7 +83,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, 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;
|
||||||
@ -22,11 +35,32 @@ let
|
|||||||
(targetPlatform != hostPlatform)
|
(targetPlatform != hostPlatform)
|
||||||
"${targetPlatform.config}-";
|
"${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
|
INTEGER_LIBRARY = integer-simple
|
||||||
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
|
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
|
||||||
BuildFlavour = perf-cross
|
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
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
version = "8.0.2";
|
version = "8.0.2";
|
||||||
@ -37,16 +71,14 @@ 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 ]
|
||||||
|
++ stdenv.lib.optional stdenv.isLinux ./ghc-no-madv-free.patch
|
||||||
|
++ stdenv.lib.optional stdenv.isDarwin ./ghc-8.0.2-no-cpp-warnings.patch;
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
echo -n "${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
|
||||||
@ -56,23 +88,48 @@ stdenv.mkDerivation rec {
|
|||||||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
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 = [
|
||||||
"--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.isDarwin) [
|
||||||
"--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}"}
|
||||||
|
|
||||||
@ -89,6 +146,8 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit bootPkgs targetPrefix;
|
inherit bootPkgs targetPrefix;
|
||||||
|
|
||||||
|
inherit llvmPackages;
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
@ -2,14 +2,30 @@
|
|||||||
, buildPlatform, hostPlatform, targetPlatform
|
, buildPlatform, hostPlatform, targetPlatform
|
||||||
|
|
||||||
# build-tools
|
# build-tools
|
||||||
, bootPkgs, alex, happy, hscolour, llvm_39
|
, bootPkgs, alex, happy, hscolour
|
||||||
, autoconf, automake, coreutils, fetchurl, perl, python3, sphinx
|
, 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
|
, # 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,11 +38,34 @@ let
|
|||||||
(targetPlatform != hostPlatform)
|
(targetPlatform != hostPlatform)
|
||||||
"${targetPlatform.config}-";
|
"${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
|
INTEGER_LIBRARY = integer-simple
|
||||||
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
|
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
|
||||||
BuildFlavour = perf-cross
|
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
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
version = "8.2.2";
|
version = "8.2.2";
|
||||||
@ -37,6 +76,10 @@ stdenv.mkDerivation rec {
|
|||||||
sha256 = "1z05vkpaj54xdypmaml50hgsdpw29dhbs2r7magx0cm199iw73mv";
|
sha256 = "1z05vkpaj54xdypmaml50hgsdpw29dhbs2r7magx0cm199iw73mv";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
outputs = [ "out" "doc" ];
|
||||||
|
|
||||||
postPatch = "patchShebangs .";
|
postPatch = "patchShebangs .";
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
@ -48,28 +91,52 @@ stdenv.mkDerivation rec {
|
|||||||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
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 ];
|
# 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.isDarwin) [
|
||||||
"--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib"
|
"--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"
|
"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
|
# 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}"}
|
||||||
|
|
||||||
@ -84,10 +151,10 @@ stdenv.mkDerivation rec {
|
|||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
outputs = [ "out" "doc" ];
|
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit bootPkgs targetPrefix;
|
inherit bootPkgs targetPrefix;
|
||||||
|
|
||||||
|
inherit llvmPackages;
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
@ -5,12 +5,25 @@
|
|||||||
, 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"
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@ -26,11 +39,34 @@ let
|
|||||||
(targetPlatform != hostPlatform)
|
(targetPlatform != hostPlatform)
|
||||||
"${targetPlatform.config}-";
|
"${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
|
INTEGER_LIBRARY = integer-simple
|
||||||
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
|
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
|
||||||
BuildFlavour = perf-cross
|
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
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
inherit version rev;
|
inherit version rev;
|
||||||
@ -42,6 +78,10 @@ stdenv.mkDerivation rec {
|
|||||||
sha256 = "06slymbsd7vsfp4hh40v7cxf7nmp0kvlni2wfq7ag5wlqh04slgs";
|
sha256 = "06slymbsd7vsfp4hh40v7cxf7nmp0kvlni2wfq7ag5wlqh04slgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
outputs = [ "out" "doc" ];
|
||||||
|
|
||||||
postPatch = "patchShebangs .";
|
postPatch = "patchShebangs .";
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
@ -56,26 +96,50 @@ stdenv.mkDerivation rec {
|
|||||||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
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.isDarwin) [
|
||||||
"--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 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}"}
|
||||||
|
|
||||||
@ -90,10 +154,10 @@ stdenv.mkDerivation rec {
|
|||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
outputs = [ "out" "doc" ];
|
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit bootPkgs targetPrefix;
|
inherit bootPkgs targetPrefix;
|
||||||
|
|
||||||
|
inherit llvmPackages;
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
@ -5,12 +5,25 @@
|
|||||||
, 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.5.20171209"
|
, version ? "8.5.20171209"
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@ -26,11 +39,34 @@ let
|
|||||||
(targetPlatform != hostPlatform)
|
(targetPlatform != hostPlatform)
|
||||||
"${targetPlatform.config}-";
|
"${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
|
INTEGER_LIBRARY = integer-simple
|
||||||
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
|
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
|
||||||
BuildFlavour = perf-cross
|
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
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
inherit version rev;
|
inherit version rev;
|
||||||
@ -42,6 +78,10 @@ stdenv.mkDerivation rec {
|
|||||||
sha256 = "19csad94sk0bw2nj97ppmnwh4c193jg0jmg5w2sx9rqm9ih4yg85";
|
sha256 = "19csad94sk0bw2nj97ppmnwh4c193jg0jmg5w2sx9rqm9ih4yg85";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
outputs = [ "out" "doc" ];
|
||||||
|
|
||||||
postPatch = "patchShebangs .";
|
postPatch = "patchShebangs .";
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
@ -56,26 +96,50 @@ stdenv.mkDerivation rec {
|
|||||||
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
export NIX_LDFLAGS+=" -no_dtrace_dof"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
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.isDarwin) [
|
||||||
"--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 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}"}
|
||||||
|
|
||||||
@ -90,10 +154,10 @@ stdenv.mkDerivation rec {
|
|||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
outputs = [ "out" "doc" ];
|
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit bootPkgs targetPrefix;
|
inherit bootPkgs targetPrefix;
|
||||||
|
|
||||||
|
inherit llvmPackages;
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
@ -68,25 +68,35 @@ 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;
|
||||||
|
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;
|
||||||
|
buildLlvmPackages = buildPackages.llvmPackages_5;
|
||||||
|
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;
|
||||||
|
buildLlvmPackages = buildPackages.llvmPackages_5;
|
||||||
|
llvmPackages = pkgs.llvmPackages_5;
|
||||||
};
|
};
|
||||||
ghcjs = packages.ghc7103.callPackage ../development/compilers/ghcjs {
|
ghcjs = packages.ghc7103.callPackage ../development/compilers/ghcjs {
|
||||||
bootPkgs = packages.ghc7103;
|
bootPkgs = packages.ghc7103;
|
||||||
|
Loading…
Reference in New Issue
Block a user