Refactor package-specific settings (#622)
[hadrian.git] / src / Settings / Builders / Configure.hs
index 40a3657..37442d4 100644 (file)
@@ -1,21 +1,25 @@
 module Settings.Builders.Configure (configureBuilderArgs) where
 
+import GHC
+import Rules.Gmp
 import Settings.Builders.Common
 
 configureBuilderArgs :: Args
-configureBuilderArgs = mconcat
-    [ builder (Configure gmpBuildPath) ? do
-        hostPlatform  <- getSetting HostPlatform
-        buildPlatform <- getSetting BuildPlatform
-        pure [ "--enable-shared=no"
-             , "--host=" ++ hostPlatform
-             , "--build=" ++ buildPlatform ]
+configureBuilderArgs = do
+    gmpPath    <- expr gmpBuildPath
+    libffiPath <- expr libffiBuildPath
+    mconcat [ builder (Configure gmpPath) ? do
+                hostPlatform  <- getSetting HostPlatform
+                buildPlatform <- getSetting BuildPlatform
+                pure [ "--enable-shared=no"
+                     , "--host=" ++ hostPlatform
+                     , "--build=" ++ buildPlatform ]
 
-    , builder (Configure libffiBuildPath) ? do
-        top            <- expr topDirectory
-        targetPlatform <- getSetting TargetPlatform
-        pure [ "--prefix=" ++ top -/- libffiBuildPath -/- "inst"
-             , "--libdir=" ++ top -/- libffiBuildPath -/- "inst/lib"
-             , "--enable-static=yes"
-             , "--enable-shared=no" -- TODO: add support for yes
-             , "--host=" ++ targetPlatform ] ]
+            , builder (Configure libffiPath) ? do
+                top            <- expr topDirectory
+                targetPlatform <- getSetting TargetPlatform
+                pure [ "--prefix=" ++ top -/- libffiPath -/- "inst"
+                     , "--libdir=" ++ top -/- libffiPath -/- "inst/lib"
+                     , "--enable-static=yes"
+                     , "--enable-shared=no" -- TODO: add support for yes
+                     , "--host=" ++ targetPlatform ] ]