Don't optimize cabal stage0 build (#357)
authorBen Gamari <ben@smart-cactus.org>
Tue, 11 Jul 2017 21:24:01 +0000 (17:24 -0400)
committerAndrey Mokhov <andrey.mokhov@gmail.com>
Tue, 11 Jul 2017 21:24:01 +0000 (22:24 +0100)
hadrian.cabal
src/Settings/Default.hs
src/Settings/Packages/Cabal.hs [new file with mode: 0644]

index fbda4b0..1178cb4 100644 (file)
@@ -91,6 +91,7 @@ executable hadrian
                        , Settings.Flavours.Quick
                        , Settings.Flavours.Quickest
                        , Settings.Packages.Base
+                       , Settings.Packages.Cabal
                        , Settings.Packages.Compiler
                        , Settings.Packages.Ghc
                        , Settings.Packages.GhcCabal
index 3ad1fab..19c6937 100644 (file)
@@ -30,6 +30,7 @@ import Settings.Builders.Ld
 import Settings.Builders.Make
 import Settings.Builders.Tar
 import Settings.Packages.Base
+import Settings.Packages.Cabal
 import Settings.Packages.Compiler
 import Settings.Packages.Ghc
 import Settings.Packages.GhcCabal
@@ -268,6 +269,7 @@ disableWarningArgsLibs = do
 defaultPackageArgs :: Args
 defaultPackageArgs = mconcat
     [ basePackageArgs
+    , cabalPackageArgs
     , compilerPackageArgs
     , ghcPackageArgs
     , ghcCabalPackageArgs
@@ -279,4 +281,5 @@ defaultPackageArgs = mconcat
     , runGhcPackageArgs
     , disableWarningArgsStage0
     , disableWarningArgsStage1
-    , disableWarningArgsLibs ]
+    , disableWarningArgsLibs
+    ]
diff --git a/src/Settings/Packages/Cabal.hs b/src/Settings/Packages/Cabal.hs
new file mode 100644 (file)
index 0000000..eddee75
--- /dev/null
@@ -0,0 +1,11 @@
+module Settings.Packages.Cabal where
+
+import GHC
+import Predicate
+
+cabalPackageArgs :: Args
+cabalPackageArgs = package cabal ? do
+    -- Cabal is a rather large library and quite slow to compile. Moreover, we
+    -- build it for stage0 only so we can link ghc-pkg against it, so there is
+    -- little reason to spend the effort to optimize it.
+    stage Stage0 ? builder Ghc ? append [ "-O0" ]