summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-05-09 18:23:15 +0100
committerGHC GitLab CI <ghc-ci@gitlab-haskell.org>2022-05-09 18:26:11 +0100
commit235474e7ae582d66081d8e44666beb2f7638fdd3 (patch)
tree80bce63d5638b1b53b8d7429894f745918ab6c9d
parent67072c31d8b6ce4f0de79fa52bc3e5cdd5a495c6 (diff)
downloadhaskell-wip/libffi-hadrian-pt100.tar.gz
hadrian: Only copy and install libffi headers when using in-tree libffiwip/libffi-hadrian-pt100
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
-rw-r--r--hadrian/src/Rules/Generate.hs4
-rw-r--r--hadrian/src/Rules/Rts.hs2
-rw-r--r--rts/rts.cabal.in6
3 files changed, 7 insertions, 5 deletions
diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs
index aaa83e0060..5653bd1d25 100644
--- a/hadrian/src/Rules/Generate.hs
+++ b/hadrian/src/Rules/Generate.hs
@@ -41,13 +41,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 59a337801f..9a18a41c46 100644
--- a/hadrian/src/Rules/Rts.hs
+++ b/hadrian/src/Rules/Rts.hs
@@ -126,7 +126,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 ff60f1b456..cc449ee522 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
@@ -160,9 +163,6 @@ library
ghcautoconf.h ghcconfig.h ghcplatform.h ghcversion.h
-- ^ from include
DerivedConstants.h
- ffi.h ffitarget.h
- -- ^ see Note [Packaging libffi headers] in
- -- GHC.Driver.CodeOutput.
rts/EventLogConstants.h
rts/EventTypes.h
-- ^ generated