Commit a8cfbde5 authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Remove user.config file, rename default.config to system.config.

parent 5a4a443a
......@@ -2,5 +2,5 @@
*.hi
_shake/
_build/
cfg/default.config
cfg/system.config
arg/*/*.txt
......@@ -978,7 +978,7 @@ if grep ' ' compiler/ghc.cabal.in 2>&1 >/dev/null; then
AC_MSG_ERROR([compiler/ghc.cabal.in contains tab characters; please remove them])
fi
AC_CONFIG_FILES([shake/cfg/default.config mk/config.mk mk/install.mk mk/project.mk compiler/ghc.cabal ghc/ghc-bin.cabal utils/runghc/runghc.cabal settings docs/users_guide/ug-book.xml docs/users_guide/ug-ent.xml docs/index.html libraries/prologue.txt distrib/configure.ac])
AC_CONFIG_FILES([shake/cfg/system.config mk/config.mk mk/install.mk mk/project.mk compiler/ghc.cabal ghc/ghc-bin.cabal utils/runghc/runghc.cabal settings docs/users_guide/ug-book.xml docs/users_guide/ug-ent.xml docs/index.html libraries/prologue.txt distrib/configure.ac])
AC_OUTPUT
# We got caught by
......
# Override default settings (stored in default.config file):
#===========================================================
lax-dependencies = YES
......@@ -17,7 +17,7 @@ autoconfRules = do
configureRules :: Rules ()
configureRules = do
cfgPath </> "default.config" %> \out -> do
need [cfgPath </> "default.config.in", "configure"]
cfgPath </> "system.config" %> \out -> do
need [cfgPath </> "system.config.in", "configure"]
putColoured White "Running configure..."
cmd "bash configure" -- TODO: get rid of 'bash'
......@@ -6,45 +6,25 @@ module Oracles (
import Development.Shake.Config
import Development.Shake.Util
import qualified Data.HashMap.Strict as M
-- TODO: get rid of Bifunctor dependency
import Data.Bifunctor
import Base
import Util
import Config
import Control.Monad.Extra
import Oracles.Base
import Oracles.PackageData
import Control.Monad.Extra
import Oracles.DependencyList
defaultConfig, userConfig :: FilePath
defaultConfig = cfgPath </> "default.config"
userConfig = cfgPath </> "user.config"
-- Oracle for configuration files
configOracle :: Rules ()
configOracle = do
let configFile = cfgPath </> "system.config"
cfg <- newCache $ \() -> do
unlessM (doesFileExist $ defaultConfig <.> "in") $
redError_ $ "\nDefault configuration file '"
++ (defaultConfig <.> "in")
unlessM (doesFileExist $ configFile <.> "in") $
redError_ $ "\nConfiguration file '" ++ (configFile <.> "in")
++ "' is missing; unwilling to proceed."
need [defaultConfig]
putOracle $ "Reading " ++ unifyPath defaultConfig ++ "..."
cfgDefault <- liftIO $ readConfigFile defaultConfig
existsUser <- doesFileExist userConfig
cfgUser <- if existsUser
then do
putOracle $ "Reading "
++ unifyPath userConfig ++ "..."
liftIO $ readConfigFile userConfig
else do
putColoured Red $
"\nUser defined configuration file '"
++ userConfig ++ "' is missing; "
++ "proceeding with default configuration.\n"
return M.empty
putColoured Green $ "Finished processing configuration files."
return $ cfgUser `M.union` cfgDefault
need [configFile]
putOracle $ "Reading " ++ unifyPath configFile ++ "..."
liftIO $ readConfigFile configFile
addOracle $ \(ConfigKey key) -> M.lookup key <$> cfg ()
return ()
......@@ -59,6 +39,9 @@ packageDataOracle = do
M.lookup key <$> pkgData (unifyPath file)
return ()
bimap :: (a -> b) -> (c -> d) -> (a, c) -> (b, d)
bimap f g (x, y) = (f x, g y)
-- Oracle for 'path/dist/*.deps' files
dependencyOracle :: Rules ()
dependencyOracle = do
......
......@@ -5,8 +5,8 @@ module Oracles.Option (
import Base
import Oracles.Base
-- For each Option the files {default.config, user.config} contain
-- a line of the form 'target-os = mingw32'.
-- For each Option the file default.config contains a line of the
-- form 'target-os = mingw32'.
-- (showArg TargetOs) is an action that consults the config files
-- and returns "mingw32".
--
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment