|
|
|
@ -20,9 +20,10 @@ |
|
|
|
|
# build-time dependency too. |
|
|
|
|
buildTargetLlvmPackages, 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 ? !(lib.meta.availableOn stdenv.hostPlatform gmp), gmp |
|
|
|
|
, # If enabled, GHC will be built with the GPL-free but slightly slower native |
|
|
|
|
# bignum backend instead of the faster but GPLed gmp backend. |
|
|
|
|
enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp) |
|
|
|
|
, gmp |
|
|
|
|
|
|
|
|
|
, # If enabled, use -fPIC when compiling static libs. |
|
|
|
|
enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform |
|
|
|
@ -61,7 +62,7 @@ |
|
|
|
|
disableLargeAddressSpace ? stdenv.targetPlatform.isiOS |
|
|
|
|
}: |
|
|
|
|
|
|
|
|
|
assert !enableIntegerSimple -> gmp != null; |
|
|
|
|
assert !enableNativeBignum -> gmp != null; |
|
|
|
|
|
|
|
|
|
# Cross cannot currently build the `haddock` program for silly reasons, |
|
|
|
|
# see note [HADDOCK_DOCS]. |
|
|
|
@ -98,7 +99,7 @@ let |
|
|
|
|
'' |
|
|
|
|
HADDOCK_DOCS = ${if enableHaddockProgram then "YES" else "NO"} |
|
|
|
|
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} |
|
|
|
|
INTEGER_LIBRARY = ${if enableIntegerSimple then "integer-simple" else "integer-gmp"} |
|
|
|
|
BIGNUM_BACKEND = ${if enableNativeBignum then "native" else "gmp"} |
|
|
|
|
'' + lib.optionalString (targetPlatform != hostPlatform) '' |
|
|
|
|
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"} |
|
|
|
|
CrossCompilePrefix = ${targetPrefix} |
|
|
|
@ -114,7 +115,7 @@ let |
|
|
|
|
# Splicer will pull out correct variations |
|
|
|
|
libDeps = platform: lib.optional enableTerminfo ncurses |
|
|
|
|
++ [libffi] |
|
|
|
|
++ lib.optional (!enableIntegerSimple) gmp |
|
|
|
|
++ lib.optional (!enableNativeBignum) gmp |
|
|
|
|
++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv; |
|
|
|
|
|
|
|
|
|
# TODO(@sternenseemann): is buildTarget LLVM unnecessary? |
|
|
|
@ -152,7 +153,7 @@ let |
|
|
|
|
# Makes debugging easier to see which variant is at play in `nix-store -q --tree`. |
|
|
|
|
variantSuffix = lib.concatStrings [ |
|
|
|
|
(lib.optionalString stdenv.hostPlatform.isMusl "-musl") |
|
|
|
|
(lib.optionalString enableIntegerSimple "-integer-simple") |
|
|
|
|
(lib.optionalString enableNativeBignum "-native-bignum") |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
in |
|
|
|
@ -251,7 +252,7 @@ stdenv.mkDerivation (rec { |
|
|
|
|
"--with-system-libffi" |
|
|
|
|
"--with-ffi-includes=${targetPackages.libffi.dev}/include" |
|
|
|
|
"--with-ffi-libraries=${targetPackages.libffi.out}/lib" |
|
|
|
|
] ++ lib.optionals (targetPlatform == hostPlatform && !enableIntegerSimple) [ |
|
|
|
|
] ++ lib.optionals (targetPlatform == hostPlatform && !enableNativeBignum) [ |
|
|
|
|
"--with-gmp-includes=${targetPackages.gmp.dev}/include" |
|
|
|
|
"--with-gmp-libraries=${targetPackages.gmp.out}/lib" |
|
|
|
|
] ++ lib.optionals (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [ |
|
|
|
|