summaryrefslogtreecommitdiff
path: root/hadrian/src
diff options
context:
space:
mode:
authorAlec Theriault <alec.theriault@gmail.com>2018-12-05 20:46:21 -0800
committerBen Gamari <ben@well-typed.com>2019-01-23 14:07:28 -0500
commitefc95841503a78504c0aa00925fb22c4ec4627af (patch)
tree88ccd49a18f83f19418131e8cb31b635bb8cfddb /hadrian/src
parentdaff24bc74c1fed7efb1acde2d8f90dc9621a308 (diff)
downloadhaskell-efc95841503a78504c0aa00925fb22c4ec4627af.tar.gz
Hadrian: support in-tree GMP
Summary: This adds top-level configure flags '--with-intree-gmp' and '--with-framework-preferred', both of which are especially relevant on MacOS. Besides gaining two new flags, Hadrian also had to be taught what to do with the 'framework' in .cabal files. Test Plan: ./boot && ./configure --with-intree-gmp && ./hadrian/build.sh ./boot && ./configure --with-gmp-framework-preferred && ./hadrian/build.sh # on macos Reviewers: carter, snowleopard, alpmestan, hvr, goldfire, bgamari Subscribers: rwbarton, erikd GHC Trac Issues: #16001 Differential Revision: https://phabricator.haskell.org/D5417
Diffstat (limited to 'hadrian/src')
-rw-r--r--hadrian/src/Hadrian/Haskell/Cabal/Parse.hs3
-rw-r--r--hadrian/src/Hadrian/Haskell/Cabal/Type.hs1
-rw-r--r--hadrian/src/Oracles/Flag.hs4
-rw-r--r--hadrian/src/Settings/Builders/Ghc.hs2
-rw-r--r--hadrian/src/Settings/Packages.hs12
5 files changed, 13 insertions, 9 deletions
diff --git a/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs b/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
index 995270184b..8df343b423 100644
--- a/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
+++ b/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
@@ -280,7 +280,8 @@ resolveContextData context@Context {..} = do
, depIncludeDirs = forDeps Installed.includeDirs
, depCcOpts = forDeps Installed.ccOptions
, depLdOpts = forDeps Installed.ldOptions
- , buildGhciLib = C.withGHCiLib lbi' }
+ , buildGhciLib = C.withGHCiLib lbi'
+ , frameworks = C.frameworks buildInfo }
-- | Look for a @.buildinfo@ in all of the specified directories, stopping on
-- the first one we find.
diff --git a/hadrian/src/Hadrian/Haskell/Cabal/Type.hs b/hadrian/src/Hadrian/Haskell/Cabal/Type.hs
index dd6e4bdcc6..b2a7002d6c 100644
--- a/hadrian/src/Hadrian/Haskell/Cabal/Type.hs
+++ b/hadrian/src/Hadrian/Haskell/Cabal/Type.hs
@@ -64,6 +64,7 @@ data ContextData = ContextData
, depCcOpts :: [String]
, depLdOpts :: [String]
, buildGhciLib :: Bool
+ , frameworks :: [String]
} deriving (Eq, Generic, Show, Typeable)
instance Binary PackageData
diff --git a/hadrian/src/Oracles/Flag.hs b/hadrian/src/Oracles/Flag.hs
index 57dbf2decb..b294cebc93 100644
--- a/hadrian/src/Oracles/Flag.hs
+++ b/hadrian/src/Oracles/Flag.hs
@@ -13,6 +13,8 @@ data Flag = ArSupportsAtFile
| CrossCompiling
| GccIsClang
| GhcUnregisterised
+ | GmpInTree
+ | GmpFrameworkPref
| LeadingUnderscore
| SolarisBrokenShld
| SplitObjectsBroken
@@ -29,6 +31,8 @@ flag f = do
CrossCompiling -> "cross-compiling"
GccIsClang -> "gcc-is-clang"
GhcUnregisterised -> "ghc-unregisterised"
+ GmpInTree -> "intree-gmp"
+ GmpFrameworkPref -> "gmp-framework-preferred"
LeadingUnderscore -> "leading-underscore"
SolarisBrokenShld -> "solaris-broken-shld"
SplitObjectsBroken -> "split-objects-broken"
diff --git a/hadrian/src/Settings/Builders/Ghc.hs b/hadrian/src/Settings/Builders/Ghc.hs
index 4957de77fe..488e551cdc 100644
--- a/hadrian/src/Settings/Builders/Ghc.hs
+++ b/hadrian/src/Settings/Builders/Ghc.hs
@@ -45,6 +45,7 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do
pkg <- getPackage
libs <- getContextData extraLibs
libDirs <- getContextData extraLibDirs
+ fmwks <- getContextData frameworks
dynamic <- requiresDynamic
darwin <- expr osxHost
@@ -71,6 +72,7 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do
, not (nonHsMainPackage pkg) ? arg "-rtsopts"
, pure [ "-l" ++ lib | lib <- libs ]
, pure [ "-L" ++ libDir | libDir <- libDirs ]
+ , darwin ? pure (concat [ ["-framework", fmwk] | fmwk <- fmwks ])
]
findHsDependencies :: Args
diff --git a/hadrian/src/Settings/Packages.hs b/hadrian/src/Settings/Packages.hs
index 5993723bee..4be0fba740 100644
--- a/hadrian/src/Settings/Packages.hs
+++ b/hadrian/src/Settings/Packages.hs
@@ -136,14 +136,10 @@ packageArgs = do
[ builder Cc ? arg includeGmp
, builder (Cabal Setup) ? mconcat
- [ -- TODO: This should respect some settings flag "InTreeGmp".
- -- Depending on @IncludeDir@ and @LibDir@ is bound to fail, since
- -- these are only set if the configure script was explicilty
- -- called with GMP include and lib dirs. Their absense as such
- -- does not imply @in-tree-gmp@.
- -- (null gmpIncludeDir && null gmpLibDir) ?
- -- arg "--configure-option=--with-intree-gmp"
- arg ("--configure-option=CFLAGS=" ++ includeGmp)
+ [ flag GmpInTree ? arg "--configure-option=--with-intree-gmp"
+ , flag GmpFrameworkPref ?
+ arg "--configure-option=--with-gmp-framework-preferred"
+ , arg ("--configure-option=CFLAGS=" ++ includeGmp)
, arg ("--gcc-options=" ++ includeGmp) ] ]
---------------------------------- rts ---------------------------------