summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-02-17 16:55:59 -0500
committerBen Gamari <ben@smart-cactus.org>2020-02-20 13:16:58 -0500
commit8a35f134296c23553330e3876db242d7c5fa9d3f (patch)
tree0aee1e0f374b8a150ef72217aaa8006fde3cf9ed
parent36d6466eaf1697737c80ba8c377b097bebf67326 (diff)
downloadhaskell-wip/numa-path.tar.gz
hadrian: Tell Cabal about integer-gmp library locationwip/numa-path
-rw-r--r--hadrian/src/Settings/Packages.hs21
1 files changed, 17 insertions, 4 deletions
diff --git a/hadrian/src/Settings/Packages.hs b/hadrian/src/Settings/Packages.hs
index bbd5217cf9..aafd8714ff 100644
--- a/hadrian/src/Settings/Packages.hs
+++ b/hadrian/src/Settings/Packages.hs
@@ -171,14 +171,27 @@ packageArgs = do
gmpPackageArgs :: Args
gmpPackageArgs = do
+ -- These are only used for non-in-tree builds.
+ librariesGmp <- getSetting GmpLibDir
+ includesGmp <- getSetting GmpIncludeDir
+
+ -- Windows is always built with inplace GMP until we have dynamic
+ -- linking working.
+ inTreeFlag <- getFlag GmpInTree
+ let inTree = inTreeFlag || windowsHost
+
package integerGmp ? mconcat
[ builder (Cabal Setup) ? mconcat
- [ flag GmpInTree ? arg "--configure-option=--with-intree-gmp"
- -- Windows is always built with inplace GMP until we have dynamic
- -- linking working.
- , windowsHost ? arg "--configure-option=--with-intree-gmp"
+ [ inTree ? arg "--configure-option=--with-intree-gmp"
, flag GmpFrameworkPref ?
arg "--configure-option=--with-gmp-framework-preferred"
+
+ -- Ensure that the integer-gmp package registration includes
+ -- knowledge of the system gmp's library and include directories.
+ , notM (flag GmpInTree) ? mconcat
+ [ if not (null librariesGmp) then arg ("--extra-lib-dirs=" ++ librariesGmp) else mempty
+ , if not (null includesGmp) then arg ("--extra-include-dirs=" ++ includesGmp) else mempty
+ ]
]
]