From a08da8388eaed6b152d9e2385df81600d8ea1f25 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Fri, 3 Jul 2015 01:15:39 +0300 Subject: [PATCH] Add the `--skip-msys` flag #377 --- ChangeLog.md | 1 + src/Stack/Config.hs | 8 +++++++- src/Stack/Setup.hs | 10 +++++++--- src/Stack/Types/Config.hs | 7 +++++++ src/main/Main.hs | 1 + 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index cc32d730a4..2ed91c110c 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -12,6 +12,7 @@ * stack can act as a script interpreter (see [Script interpreter] (https://github.com/commercialhaskell/stack/wiki/Script-interpreter) and [Reddit discussion](http://www.reddit.com/r/haskell/comments/3bd66h/stack_runghc_turtle_as_haskell_script_solution/)) * Add the __`--file-watch`__ flag to auto-rebuild on file changes [#113](https://github.com/commercialhaskell/stack/issues/113) * Rename `stack docker exec` to `stack exec --plain` +* Add the `--skip-msys` flag [#377](https://github.com/commercialhaskell/stack/issues/377) ## 0.1.1.0 diff --git a/src/Stack/Config.hs b/src/Stack/Config.hs index 25ac4cadf4..f59c201cc7 100644 --- a/src/Stack/Config.hs +++ b/src/Stack/Config.hs @@ -116,6 +116,7 @@ configFromConfigMonoid configStackRoot mproject configMonoid@ConfigMonoid{..} = configSystemGHC = fromMaybe True configMonoidSystemGHC configInstallGHC = fromMaybe False configMonoidInstallGHC configSkipGHCCheck = fromMaybe False configMonoidSkipGHCCheck + configSkipMsys = fromMaybe False configMonoidSkipMsys configExtraIncludeDirs = configMonoidExtraIncludeDirs configExtraLibDirs = configMonoidExtraLibDirs @@ -159,7 +160,7 @@ configFromConfigMonoid configStackRoot mproject configMonoid@ConfigMonoid{..} = -- | Command-line arguments parser for configuration. configOptsParser :: Bool -> Parser ConfigMonoid configOptsParser docker = - (\opts systemGHC installGHC arch os jobs includes libs skipGHCCheck -> mempty + (\opts systemGHC installGHC arch os jobs includes libs skipGHCCheck skipMsys -> mempty { configMonoidDockerOpts = opts , configMonoidSystemGHC = systemGHC , configMonoidInstallGHC = installGHC @@ -169,6 +170,7 @@ configOptsParser docker = , configMonoidJobs = jobs , configMonoidExtraIncludeDirs = includes , configMonoidExtraLibDirs = libs + , configMonoidSkipMsys = skipMsys }) <$> Docker.dockerOptsParser docker <*> maybeBoolFlags @@ -209,6 +211,10 @@ configOptsParser docker = "skip-ghc-check" "skipping the GHC version and architecture check" idm + <*> maybeBoolFlags + "skip-msys" + "skipping the local MSYS installation (Windows only)" + idm -- | Get the directory on Windows where we should install extra programs. For -- more information, see discussion at: diff --git a/src/Stack/Setup.hs b/src/Stack/Setup.hs index 21e0eec475..3729671ca8 100644 --- a/src/Stack/Setup.hs +++ b/src/Stack/Setup.hs @@ -75,6 +75,8 @@ data SetupOpts = SetupOpts -- ^ Run a sanity check on the selected GHC , soptsSkipGhcCheck :: !Bool -- ^ Don't check for a compatible GHC version/architecture + , soptsSkipMsys :: !Bool + -- ^ Do not use a custom msys installation on Windows } deriving Show data SetupException = UnsupportedSetupCombo OS Arch @@ -125,6 +127,7 @@ setupEnv = do , soptsForceReinstall = False , soptsSanityCheck = False , soptsSkipGhcCheck = configSkipGHCCheck $ bcConfig bconfig + , soptsSkipMsys = configSkipMsys $ bcConfig bconfig } mghcBin <- ensureGHC sopts menv0 <- getMinimalEnvOverride @@ -262,9 +265,10 @@ ensureGHC sopts = do let tools = case configPlatform config of Platform _ Windows -> - [ ($(mkPackageName "ghc"), Just expected) - , ($(mkPackageName "git"), Nothing) - ] + ($(mkPackageName "ghc"), Just expected) + : (if soptsSkipMsys sopts + then [] + else [($(mkPackageName "git"), Nothing)]) _ -> [ ($(mkPackageName "ghc"), Just expected) ] diff --git a/src/Stack/Types/Config.hs b/src/Stack/Types/Config.hs index f2afbbd8d6..7b338751df 100644 --- a/src/Stack/Types/Config.hs +++ b/src/Stack/Types/Config.hs @@ -87,6 +87,8 @@ data Config = -- version is available? Can be overridden by command line options. ,configSkipGHCCheck :: !Bool -- ^ Don't bother checking the GHC version or architecture. + ,configSkipMsys :: !Bool + -- ^ On Windows: don't use a locally installed MSYS ,configLocalBin :: !(Path Abs Dir) -- ^ Directory we should install executables into ,configRequireStackVersion :: !VersionRange @@ -416,6 +418,8 @@ data ConfigMonoid = -- ^ See: 'configInstallGHC' ,configMonoidSkipGHCCheck :: !(Maybe Bool) -- ^ See: 'configSkipGHCCheck' + ,configMonoidSkipMsys :: !(Maybe Bool) + -- ^ See: 'configSkipMsys' ,configMonoidRequireStackVersion :: !VersionRange -- ^ See: 'configRequireStackVersion' ,configMonoidOS :: !(Maybe String) @@ -441,6 +445,7 @@ instance Monoid ConfigMonoid where , configMonoidSystemGHC = Nothing , configMonoidInstallGHC = Nothing , configMonoidSkipGHCCheck = Nothing + , configMonoidSkipMsys = Nothing , configMonoidRequireStackVersion = anyVersion , configMonoidOS = Nothing , configMonoidArch = Nothing @@ -457,6 +462,7 @@ instance Monoid ConfigMonoid where , configMonoidSystemGHC = configMonoidSystemGHC l <|> configMonoidSystemGHC r , configMonoidInstallGHC = configMonoidInstallGHC l <|> configMonoidInstallGHC r , configMonoidSkipGHCCheck = configMonoidSkipGHCCheck l <|> configMonoidSkipGHCCheck r + , configMonoidSkipMsys = configMonoidSkipMsys l <|> configMonoidSkipMsys r , configMonoidRequireStackVersion = intersectVersionRanges (configMonoidRequireStackVersion l) (configMonoidRequireStackVersion r) , configMonoidOS = configMonoidOS l <|> configMonoidOS r @@ -478,6 +484,7 @@ instance FromJSON ConfigMonoid where configMonoidSystemGHC <- obj .:? "system-ghc" configMonoidInstallGHC <- obj .:? "install-ghc" configMonoidSkipGHCCheck <- obj .:? "skip-ghc-check" + configMonoidSkipMsys <- obj .:? "skip-msys" configMonoidRequireStackVersion <- unVersionRangeJSON <$> obj .:? "require-stack-version" .!= VersionRangeJSON anyVersion diff --git a/src/main/Main.hs b/src/main/Main.hs index badddfd9ed..c4d2080ad7 100644 --- a/src/main/Main.hs +++ b/src/main/Main.hs @@ -431,6 +431,7 @@ setupCmd SetupCmdOpts{..} go@GlobalOpts{..} = do , soptsForceReinstall = scoForceReinstall , soptsSanityCheck = True , soptsSkipGhcCheck = False + , soptsSkipMsys = configSkipMsys $ lcConfig lc } case mpaths of Nothing -> $logInfo "GHC on PATH would be used"