From 2f65025eeb4a79458af26d759e932d70633a64db Mon Sep 17 00:00:00 2001 From: Alec Theriault Date: Mon, 7 Jan 2019 11:38:11 -0800 Subject: Hadrian: support extra libraries + OSX rpath Summary: This fixes some of the issues that surfaced when trying to build dynamic GHC on OSX. Unfortunately, due some other `libffi` issues, this doesn't completely fix dynamic builds on OSX. - Use 'extra-libraries' from .cabal files instead of hardcoding which packages need which extra libs. Also add support for 'extra-lib-dirs'. - Make sure Hadrian looks in the right places to support both plain '.buildinfo' and '.buildinfo.in' files. - Make the '-rpath' support more robust across OS's (it previously didn't work on OSX and possibly windows either). Reviewers: angerman, alpmestan, adamse, DavidEichmann, bgamari, Phyx Subscribers: rwbarton, carter GHC Trac Issues: #15990 Differential Revision: https://phabricator.haskell.org/D5409 --- hadrian/src/Hadrian/Haskell/Cabal/Parse.hs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'hadrian/src/Hadrian') diff --git a/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs b/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs index bb2f0be3da..995270184b 100644 --- a/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs +++ b/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs @@ -208,7 +208,7 @@ resolveContextData context@Context {..} = do -- Create the @cabal_macros.h@, ... -- Note: the @cPath@ is ignored. The path that's used is the 'buildDir' path -- from the local build info @lbi@. - pdi <- liftIO $ getHookedBuildInfo (pkgPath package) + pdi <- liftIO $ getHookedBuildInfo [pkgPath package, cPath -/- "build"] let pd' = C.updatePackageDescription pdi pd lbi' = lbi { C.localPkgDescr = pd' } liftIO $ C.initialBuildSteps cPath pd' lbi' C.silent @@ -282,12 +282,12 @@ resolveContextData context@Context {..} = do , depLdOpts = forDeps Installed.ldOptions , buildGhciLib = C.withGHCiLib lbi' } -getHookedBuildInfo :: FilePath -> IO C.HookedBuildInfo -getHookedBuildInfo baseDir = do - -- TODO: We should probably better generate this in the build directory, - -- rather than in the base directory? However, @configure@ is run in the - -- base directory. +-- | Look for a @.buildinfo@ in all of the specified directories, stopping on +-- the first one we find. +getHookedBuildInfo :: [FilePath] -> IO C.HookedBuildInfo +getHookedBuildInfo [] = return C.emptyHookedBuildInfo +getHookedBuildInfo (baseDir:baseDirs) = do maybeInfoFile <- C.findHookedPackageDesc baseDir case maybeInfoFile of - Nothing -> return C.emptyHookedBuildInfo + Nothing -> getHookedBuildInfo baseDirs Just infoFile -> C.readHookedBuildInfo C.silent infoFile -- cgit v1.2.1