haskell.compiler.ghc{902,921}: Switch GHC 9.0/9.2 to bignum-native

Neither of them support integer-simple anymore.

fixes #153742
This commit is contained in:
Moritz Kiefer 2022-01-26 12:01:05 +01:00 committed by sterni
parent 7a231870c5
commit f82aeba582
3 changed files with 22 additions and 16 deletions

View file

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

View file

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

View file

@ -12,10 +12,14 @@ let
"ghcjs810" "ghcjs810"
"integer-simple" "integer-simple"
"native-bignum" "native-bignum"
"ghc902"
"ghc921"
"ghcHEAD" "ghcHEAD"
]; ];
nativeBignumIncludes = [ nativeBignumIncludes = [
"ghc902"
"ghc921"
"ghcHEAD" "ghcHEAD"
]; ];