Skip to content

Commit a08da83

Browse files
committed
Add the --skip-msys flag #377
1 parent 985eb18 commit a08da83

File tree

5 files changed

+23
-4
lines changed

5 files changed

+23
-4
lines changed

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* 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/))
1313
* Add the __`--file-watch`__ flag to auto-rebuild on file changes [#113](https://github.com/commercialhaskell/stack/issues/113)
1414
* Rename `stack docker exec` to `stack exec --plain`
15+
* Add the `--skip-msys` flag [#377](https://github.com/commercialhaskell/stack/issues/377)
1516

1617
## 0.1.1.0
1718

src/Stack/Config.hs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ configFromConfigMonoid configStackRoot mproject configMonoid@ConfigMonoid{..} =
116116
configSystemGHC = fromMaybe True configMonoidSystemGHC
117117
configInstallGHC = fromMaybe False configMonoidInstallGHC
118118
configSkipGHCCheck = fromMaybe False configMonoidSkipGHCCheck
119+
configSkipMsys = fromMaybe False configMonoidSkipMsys
119120

120121
configExtraIncludeDirs = configMonoidExtraIncludeDirs
121122
configExtraLibDirs = configMonoidExtraLibDirs
@@ -159,7 +160,7 @@ configFromConfigMonoid configStackRoot mproject configMonoid@ConfigMonoid{..} =
159160
-- | Command-line arguments parser for configuration.
160161
configOptsParser :: Bool -> Parser ConfigMonoid
161162
configOptsParser docker =
162-
(\opts systemGHC installGHC arch os jobs includes libs skipGHCCheck -> mempty
163+
(\opts systemGHC installGHC arch os jobs includes libs skipGHCCheck skipMsys -> mempty
163164
{ configMonoidDockerOpts = opts
164165
, configMonoidSystemGHC = systemGHC
165166
, configMonoidInstallGHC = installGHC
@@ -169,6 +170,7 @@ configOptsParser docker =
169170
, configMonoidJobs = jobs
170171
, configMonoidExtraIncludeDirs = includes
171172
, configMonoidExtraLibDirs = libs
173+
, configMonoidSkipMsys = skipMsys
172174
})
173175
<$> Docker.dockerOptsParser docker
174176
<*> maybeBoolFlags
@@ -209,6 +211,10 @@ configOptsParser docker =
209211
"skip-ghc-check"
210212
"skipping the GHC version and architecture check"
211213
idm
214+
<*> maybeBoolFlags
215+
"skip-msys"
216+
"skipping the local MSYS installation (Windows only)"
217+
idm
212218

213219
-- | Get the directory on Windows where we should install extra programs. For
214220
-- more information, see discussion at:

src/Stack/Setup.hs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ data SetupOpts = SetupOpts
7575
-- ^ Run a sanity check on the selected GHC
7676
, soptsSkipGhcCheck :: !Bool
7777
-- ^ Don't check for a compatible GHC version/architecture
78+
, soptsSkipMsys :: !Bool
79+
-- ^ Do not use a custom msys installation on Windows
7880
}
7981
deriving Show
8082
data SetupException = UnsupportedSetupCombo OS Arch
@@ -125,6 +127,7 @@ setupEnv = do
125127
, soptsForceReinstall = False
126128
, soptsSanityCheck = False
127129
, soptsSkipGhcCheck = configSkipGHCCheck $ bcConfig bconfig
130+
, soptsSkipMsys = configSkipMsys $ bcConfig bconfig
128131
}
129132
mghcBin <- ensureGHC sopts
130133
menv0 <- getMinimalEnvOverride
@@ -262,9 +265,10 @@ ensureGHC sopts = do
262265
let tools =
263266
case configPlatform config of
264267
Platform _ Windows ->
265-
[ ($(mkPackageName "ghc"), Just expected)
266-
, ($(mkPackageName "git"), Nothing)
267-
]
268+
($(mkPackageName "ghc"), Just expected)
269+
: (if soptsSkipMsys sopts
270+
then []
271+
else [($(mkPackageName "git"), Nothing)])
268272
_ ->
269273
[ ($(mkPackageName "ghc"), Just expected)
270274
]

src/Stack/Types/Config.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ data Config =
8787
-- version is available? Can be overridden by command line options.
8888
,configSkipGHCCheck :: !Bool
8989
-- ^ Don't bother checking the GHC version or architecture.
90+
,configSkipMsys :: !Bool
91+
-- ^ On Windows: don't use a locally installed MSYS
9092
,configLocalBin :: !(Path Abs Dir)
9193
-- ^ Directory we should install executables into
9294
,configRequireStackVersion :: !VersionRange
@@ -416,6 +418,8 @@ data ConfigMonoid =
416418
-- ^ See: 'configInstallGHC'
417419
,configMonoidSkipGHCCheck :: !(Maybe Bool)
418420
-- ^ See: 'configSkipGHCCheck'
421+
,configMonoidSkipMsys :: !(Maybe Bool)
422+
-- ^ See: 'configSkipMsys'
419423
,configMonoidRequireStackVersion :: !VersionRange
420424
-- ^ See: 'configRequireStackVersion'
421425
,configMonoidOS :: !(Maybe String)
@@ -441,6 +445,7 @@ instance Monoid ConfigMonoid where
441445
, configMonoidSystemGHC = Nothing
442446
, configMonoidInstallGHC = Nothing
443447
, configMonoidSkipGHCCheck = Nothing
448+
, configMonoidSkipMsys = Nothing
444449
, configMonoidRequireStackVersion = anyVersion
445450
, configMonoidOS = Nothing
446451
, configMonoidArch = Nothing
@@ -457,6 +462,7 @@ instance Monoid ConfigMonoid where
457462
, configMonoidSystemGHC = configMonoidSystemGHC l <|> configMonoidSystemGHC r
458463
, configMonoidInstallGHC = configMonoidInstallGHC l <|> configMonoidInstallGHC r
459464
, configMonoidSkipGHCCheck = configMonoidSkipGHCCheck l <|> configMonoidSkipGHCCheck r
465+
, configMonoidSkipMsys = configMonoidSkipMsys l <|> configMonoidSkipMsys r
460466
, configMonoidRequireStackVersion = intersectVersionRanges (configMonoidRequireStackVersion l)
461467
(configMonoidRequireStackVersion r)
462468
, configMonoidOS = configMonoidOS l <|> configMonoidOS r
@@ -478,6 +484,7 @@ instance FromJSON ConfigMonoid where
478484
configMonoidSystemGHC <- obj .:? "system-ghc"
479485
configMonoidInstallGHC <- obj .:? "install-ghc"
480486
configMonoidSkipGHCCheck <- obj .:? "skip-ghc-check"
487+
configMonoidSkipMsys <- obj .:? "skip-msys"
481488
configMonoidRequireStackVersion <- unVersionRangeJSON <$>
482489
obj .:? "require-stack-version"
483490
.!= VersionRangeJSON anyVersion

src/main/Main.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ setupCmd SetupCmdOpts{..} go@GlobalOpts{..} = do
431431
, soptsForceReinstall = scoForceReinstall
432432
, soptsSanityCheck = True
433433
, soptsSkipGhcCheck = False
434+
, soptsSkipMsys = configSkipMsys $ lcConfig lc
434435
}
435436
case mpaths of
436437
Nothing -> $logInfo "GHC on PATH would be used"

0 commit comments

Comments
 (0)