summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-02-17 16:55:59 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-02-26 15:08:47 -0500
commit09b8838422d5dde32af7b09c8adcb4dff4cd00fb (patch)
treedf53b21cb22f8a9c220b885829a3b3b0660a03af
parented03d4e76ead6384e38bb742fee73905d92d1545 (diff)
downloadhaskell-09b8838422d5dde32af7b09c8adcb4dff4cd00fb.tar.gz
hadrian: Tell Cabal about integer-gmp library location
-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 929dac994f..39fb92f7f5 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
+ ]
]
]