Refactor package-specific settings (#622)
[hadrian.git] / src / Settings / Builders / Configure.hs
index 45bca37..37442d4 100644 (file)
@@ -1,25 +1,25 @@
-module Settings.Builders.Configure (configureArgs) where
+module Settings.Builders.Configure (configureBuilderArgs) where
 
-import Base
-import Expression
-import Oracles.Config.Setting
-import Predicates (builder)
-import Settings
+import GHC
+import Rules.Gmp
+import Settings.Builders.Common
 
-configureArgs :: Args
-configureArgs = mconcat
-    [ builder (Configure libffiBuildPath) ? do
-        top            <- getTopDirectory
-        targetPlatform <- getSetting TargetPlatform
-        mconcat [ arg $ "--prefix=" ++ top -/- libffiBuildPath -/- "inst"
-                , arg $ "--libdir=" ++ top -/- libffiBuildPath -/- "inst/lib"
-                , arg $ "--enable-static=yes"
-                , arg $ "--enable-shared=no" -- TODO: add support for yes
-                , arg $ "--host=" ++ targetPlatform ]
+configureBuilderArgs :: Args
+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 $ gmpBuildPath -/- "lib") ? do
-        hostPlatform  <- getSetting HostPlatform
-        buildPlatform <- getSetting BuildPlatform
-        mconcat [ arg $ "--enable-shared=no"
-                , arg $ "--host=" ++ hostPlatform
-                , arg $ "--build=" ++ buildPlatform ] ]
+            , 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 ] ]