haskellPackages: allow configuring gmp when cross compiling (#481162)

This commit is contained in:
Wolfgang Walther
2026-02-02 08:48:25 +00:00
committed by GitHub
@@ -50,8 +50,9 @@
# 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 && lib.meta.availableOn stdenv.targetPlatform gmp)
|| stdenv.targetPlatform.isGhcjs,
stdenv.targetPlatform.isGhcjs
|| !(lib.meta.availableOn stdenv.hostPlatform gmp)
|| !(lib.meta.availableOn stdenv.targetPlatform gmp),
gmp,
# If enabled, use -fPIC when compiling static libs.
@@ -668,7 +669,7 @@ stdenv.mkDerivation (
"--with-ffi-includes=${targetLibs.libffi.dev}/include"
"--with-ffi-libraries=${targetLibs.libffi.out}/lib"
]
++ lib.optionals (targetPlatform == hostPlatform && !enableNativeBignum) [
++ lib.optionals (!enableNativeBignum) [
"--with-gmp-includes=${targetLibs.gmp.dev}/include"
"--with-gmp-libraries=${targetLibs.gmp.out}/lib"
]