summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-05-09 18:23:15 +0100
committerBen Gamari <ben@smart-cactus.org>2022-05-18 11:16:59 -0400
commit4b944d8175cc65b531194a08882842ca41a8e767 (patch)
treed8011b26cde38847d846a65e8727b38af3c06b8c
parenta3d8ccd7383c32a8944b327f16cd30a253426b79 (diff)
downloadhaskell-4b944d8175cc65b531194a08882842ca41a8e767.tar.gz
hadrian: Only copy and install libffi headers when using in-tree libffi
When passed `--use-system-libffi` then we shouldn't copy and install the headers from the system package. Instead the headers are expected to be available as a runtime dependency on the users system. Fixes #21485 #21487 (cherry picked from commit fec3e7aa72bee69ef3a3f363709377990650a5d3)
-rw-r--r--hadrian/src/Rules/Generate.hs4
-rw-r--r--hadrian/src/Rules/Rts.hs2
-rw-r--r--rts/rts.cabal.in5
3 files changed, 8 insertions, 3 deletions
diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs
index db220a98c4..3a1acb011c 100644
--- a/hadrian/src/Rules/Generate.hs
+++ b/hadrian/src/Rules/Generate.hs
@@ -40,13 +40,15 @@ rtsDependencies :: Expr [FilePath]
rtsDependencies = do
stage <- getStage
rtsPath <- expr (rtsBuildPath stage)
+ useSystemFfi <- expr (flag UseSystemFfi)
+
let headers =
[ "ghcautoconf.h", "ghcplatform.h"
, "DerivedConstants.h"
, "rts" -/- "EventTypes.h"
, "rts" -/- "EventLogConstants.h"
]
- ++ libffiHeaderFiles
+ ++ (if useSystemFfi then [] else libffiHeaderFiles)
pure $ ((rtsPath -/- "include") -/-) <$> headers
genapplyDependencies :: Expr [FilePath]
diff --git a/hadrian/src/Rules/Rts.hs b/hadrian/src/Rules/Rts.hs
index 4e6b4f7532..abc9947f4a 100644
--- a/hadrian/src/Rules/Rts.hs
+++ b/hadrian/src/Rules/Rts.hs
@@ -121,7 +121,7 @@ needRtsLibffiTargets stage = do
let headers = fmap ((rtsPath -/- "include") -/-) libffiHeaderFiles
if useSystemFfi
- then return headers
+ then return []
else do
-- Need Libffi
-- This returns the dynamic library files (in the Libffi build dir).
diff --git a/rts/rts.cabal.in b/rts/rts.cabal.in
index 5e53b38be2..83badbe8b9 100644
--- a/rts/rts.cabal.in
+++ b/rts/rts.cabal.in
@@ -73,6 +73,9 @@ library
extra-bundled-libraries: Cffi-6
else
extra-bundled-libraries: Cffi
+ install-includes: ffi.h ffitarget.h
+ -- ^ see Note [Packaging libffi headers] in
+ -- GHC.Driver.CodeOutput.
-- The make build system does something special in config.mk.in
-- for generating profiled, debugged, etc builds of those
@@ -163,7 +166,7 @@ library
install-includes: Cmm.h HsFFI.h MachDeps.h Rts.h RtsAPI.h Stg.h
ghcautoconf.h ghcconfig.h ghcplatform.h ghcversion.h
-- ^ from include
- DerivedConstants.h ffi.h ffitarget.h
+ DerivedConstants.h
rts/EventLogConstants.h
rts/EventTypes.h
-- ^ generated