Skip to content
Snippets Groups Projects
Commit 4b944d81 authored by Matthew Pickering's avatar Matthew Pickering Committed by Ben Gamari
Browse files

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 fec3e7aa)
parent a3d8ccd7
No related branches found
No related tags found
No related merge requests found
...@@ -40,13 +40,15 @@ rtsDependencies :: Expr [FilePath] ...@@ -40,13 +40,15 @@ rtsDependencies :: Expr [FilePath]
rtsDependencies = do rtsDependencies = do
stage <- getStage stage <- getStage
rtsPath <- expr (rtsBuildPath stage) rtsPath <- expr (rtsBuildPath stage)
useSystemFfi <- expr (flag UseSystemFfi)
let headers = let headers =
[ "ghcautoconf.h", "ghcplatform.h" [ "ghcautoconf.h", "ghcplatform.h"
, "DerivedConstants.h" , "DerivedConstants.h"
, "rts" -/- "EventTypes.h" , "rts" -/- "EventTypes.h"
, "rts" -/- "EventLogConstants.h" , "rts" -/- "EventLogConstants.h"
] ]
++ libffiHeaderFiles ++ (if useSystemFfi then [] else libffiHeaderFiles)
pure $ ((rtsPath -/- "include") -/-) <$> headers pure $ ((rtsPath -/- "include") -/-) <$> headers
genapplyDependencies :: Expr [FilePath] genapplyDependencies :: Expr [FilePath]
......
...@@ -121,7 +121,7 @@ needRtsLibffiTargets stage = do ...@@ -121,7 +121,7 @@ needRtsLibffiTargets stage = do
let headers = fmap ((rtsPath -/- "include") -/-) libffiHeaderFiles let headers = fmap ((rtsPath -/- "include") -/-) libffiHeaderFiles
if useSystemFfi if useSystemFfi
then return headers then return []
else do else do
-- Need Libffi -- Need Libffi
-- This returns the dynamic library files (in the Libffi build dir). -- This returns the dynamic library files (in the Libffi build dir).
......
...@@ -73,6 +73,9 @@ library ...@@ -73,6 +73,9 @@ library
extra-bundled-libraries: Cffi-6 extra-bundled-libraries: Cffi-6
else else
extra-bundled-libraries: Cffi 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 -- The make build system does something special in config.mk.in
-- for generating profiled, debugged, etc builds of those -- for generating profiled, debugged, etc builds of those
...@@ -163,7 +166,7 @@ library ...@@ -163,7 +166,7 @@ library
install-includes: Cmm.h HsFFI.h MachDeps.h Rts.h RtsAPI.h Stg.h install-includes: Cmm.h HsFFI.h MachDeps.h Rts.h RtsAPI.h Stg.h
ghcautoconf.h ghcconfig.h ghcplatform.h ghcversion.h ghcautoconf.h ghcconfig.h ghcplatform.h ghcversion.h
-- ^ from include -- ^ from include
DerivedConstants.h ffi.h ffitarget.h DerivedConstants.h
rts/EventLogConstants.h rts/EventLogConstants.h
rts/EventTypes.h rts/EventTypes.h
-- ^ generated -- ^ generated
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment