diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-07-21 09:22:06 -0400 |
---|---|---|
committer | Zubin <zubin.duggal@gmail.com> | 2021-10-11 15:39:42 +0000 |
commit | 3e900b64e371db94d39842bd29e880622899b0e0 (patch) | |
tree | 8b5cbf7a8349b3349321fc9a2d0ebce4e6f5821a | |
parent | d9765af2d9d1ba8f7cc9302c1939378eb2e15b62 (diff) | |
download | haskell-3e900b64e371db94d39842bd29e880622899b0e0.tar.gz |
rts: Don't declare libCffi as bundled when using system libffi
Previously the rts's cabal file would claim that it bundled libffi, even
if we are using the system's libffi. Fixes #19869.
(cherry picked from commit b89013f918295b7cac1649df095f7f7e4d7966da)
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | hadrian/src/Settings/Packages.hs | 2 | ||||
-rw-r--r-- | rts/rts.cabal.in | 14 |
3 files changed, 15 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac index ffe1ec2e34..87983802b9 100644 --- a/configure.ac +++ b/configure.ac @@ -1075,10 +1075,12 @@ AC_ARG_WITH([system-libffi], ]) AS_IF([test "x$with_system_libffi" = "xyes"], - [UseSystemLibFFI="YES"], [UseSystemLibFFI="NO"] + [UseSystemLibFFI="YES"; CabalUseSystemLibFFI="True"], + [UseSystemLibFFI="NO"; CabalUseSystemLibFFI="True"] ) AC_SUBST(UseSystemLibFFI) +AC_SUBST(CabalUseSystemLibFFI) AC_ARG_WITH([ffi-includes], [AS_HELP_STRING([--with-ffi-includes=ARG], diff --git a/hadrian/src/Settings/Packages.hs b/hadrian/src/Settings/Packages.hs index 0e7f34622f..225da5c03e 100644 --- a/hadrian/src/Settings/Packages.hs +++ b/hadrian/src/Settings/Packages.hs @@ -255,6 +255,7 @@ rtsPackageArgs = package rts ? do way <- getWay path <- getBuildPath top <- expr topDirectory + useSystemFfi <- expr $ flag UseSystemFfi libffiName <- expr libffiLibraryName ffiIncludeDir <- getSetting FfiIncludeDir ffiLibraryDir <- getSetting FfiLibDir @@ -369,6 +370,7 @@ rtsPackageArgs = package rts ? do , any (wayUnit Debug) rtsWays `cabalFlag` "debug" , any (wayUnit Logging) rtsWays `cabalFlag` "logging" , any (wayUnit Dynamic) rtsWays `cabalFlag` "dynamic" + , useSystemFfi `cabalFlag` "use-system-libffi" , useLibffiForAdjustors `cabalFlag` "libffi-adjustors" , Debug `wayUnit` way `cabalFlag` "find-ptr" ] diff --git a/rts/rts.cabal.in b/rts/rts.cabal.in index f14842a654..cb002c4ff3 100644 --- a/rts/rts.cabal.in +++ b/rts/rts.cabal.in @@ -12,6 +12,8 @@ flag libdl default: @CabalHaveLibdl@ flag ffi default: @CabalHaveLibffi@ +flag use-system-libffi + default: @CabalUseSystemLibFFI@ flag libffi-adjustors default: @CabalLibffiAdjustors@ flag need-pthread @@ -57,10 +59,14 @@ library -- expects the unit-id to be -- set without version ghc-options: -this-unit-id rts - if os(windows) - extra-bundled-libraries: Cffi-6 - else - extra-bundled-libraries: Cffi + + -- If we are using an in-tree libffi then we must declare it as a bundled + -- library to ensure that Cabal installs it. + if !flag(use-system-libffi) + if os(windows) + extra-bundled-libraries: Cffi-6 + else + extra-bundled-libraries: Cffi -- The make build system does something special in config.mk.in -- for generating profiled, debugged, etc builds of those |