Configure.hs 1.44 KB
Newer Older
1 2
module Rules.Configure (configureRules) where

3
import qualified System.Info as System
4 5

import Base
6
import CommandLine
7
import Context
8
import GHC
9
import Target
10
import Utilities
11 12 13 14

configureRules :: Rules ()
configureRules = do
    [configFile, "settings", configH] &%> \outs -> do
15 16
        skip <- cmdSkipConfigure
        if skip
17
        then unlessM (doesFileExist configFile) $
18
            error $ "Configuration file " ++ configFile ++ " is missing."
19 20 21 22
                ++ "\nRun the configure script manually or do not use the "
                ++ "--skip-configure flag."
        else do
            -- We cannot use windowsHost here due to a cyclic dependency.
23
            when (System.os == "mingw32") $ do
24
                putBuild "| Checking for Windows tarballs..."
25
                quietly $ cmd ["bash", "mk/get-win32-tarballs.sh", "download", System.arch]
26 27 28
            let srcs    = map (<.> "in") outs
                context = vanillaContext Stage0 compiler
            need srcs
29
            build $ target context (Configure ".") srcs outs
30 31

    ["configure", configH <.> "in"] &%> \_ -> do
32 33
        skip <- cmdSkipConfigure
        if skip
34
        then unlessM (doesFileExist "configure") $
35
            error $ "The configure script is missing.\nRun the boot script"
36 37 38 39
                ++ " manually or do not use the --skip-configure flag."
        else do
            need ["configure.ac"]
            putBuild "| Running boot..."
40
            quietly $ cmd "perl boot"