haskellPackages: allow configuring gmp when cross compiling

Fixes error:
  linux: iserv-proxy-interpreter: Failed to lookup symbol: __gmpn_cmp
This commit is contained in:
Alexandre Esteves
2026-01-31 00:08:18 +00:00
parent e7136c1529
commit b6af0dc28e
@@ -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"
]