@@ -158,7 +158,8 @@ import Stack.Types.Platform
158
158
, platformOnlyRelDir )
159
159
import Stack.Types.Runner ( HasRunner (.. ) )
160
160
import Stack.Types.SetupInfo ( SetupInfo (.. ) )
161
- import Stack.Types.SourceMap ( SMActual (.. ), SourceMap (.. ) )
161
+ import Stack.Types.SourceMap
162
+ ( SMActual (.. ), SMWanted (.. ), SourceMap (.. ) )
162
163
import Stack.Types.Version
163
164
( VersionCheck , stackMinorVersion , stackVersion )
164
165
import Stack.Types.VersionedDownloadInfo
@@ -198,7 +199,7 @@ data SetupPrettyException
198
199
| InvalidGhcAt ! (Path Abs File ) ! SomeException
199
200
| ExecutableNotFound ! [Path Abs File ]
200
201
| SandboxedCompilerNotFound ! [String ] ! [Path Abs Dir ]
201
- | UnsupportedSetupCombo ! OS ! Arch
202
+ | UnsupportedSetupCombo ! OS ! Arch ! StyleDoc ! ( Path Rel Dir ) ! ( Path Abs Dir )
202
203
| MissingDependencies ! [String ]
203
204
| UnknownCompilerVersion
204
205
! (Set. Set Text )
@@ -310,17 +311,34 @@ instance Pretty SetupPrettyException where
310
311
\tools, see the output of"
311
312
, style Shell (flow " stack uninstall" ) <> " ."
312
313
]
313
- pretty (UnsupportedSetupCombo os arch) =
314
+ pretty (UnsupportedSetupCombo os arch tool toolDir programsDir ) =
314
315
" [S-1852]"
315
316
<> line
316
317
<> fillSep
317
- [ flow " Stack does not know how to install GHC for the combination of \
318
- \operating system"
318
+ [ flow " Stack does not know how to install"
319
+ , tool
320
+ , flow " for the combination of operating system"
319
321
, style Shell (pretty os)
320
322
, " and architecture"
321
323
, style Shell (pretty arch) <> " ."
322
324
, flow " Please install manually."
323
325
]
326
+ <> blankLine
327
+ <> fillSep
328
+ [ flow " To install manually the version of"
329
+ , tool <> " ,"
330
+ , flow " its root directory should be named"
331
+ , pretty toolDir
332
+ , flow " and the directory should be accompanied by a file with the \
333
+ \same name and extension"
334
+ , style File " .installed"
335
+ , flow " (which marks the"
336
+ , tool
337
+ , flow " version as installed). Both items should be located in the \
338
+ \subdirectory for the specified platform in Stack's directory \
339
+ \for local tools"
340
+ , parens (pretty programsDir) <> " ."
341
+ ]
324
342
pretty (MissingDependencies tools) =
325
343
" [S-2126]"
326
344
<> line
@@ -1081,7 +1099,8 @@ ensureMsys sopts getSetupInfo' = do
1081
1099
Nothing
1082
1100
| soptsInstallIfMissing sopts -> do
1083
1101
si <- runMemoized getSetupInfo'
1084
- osKey <- getOSKey platform
1102
+ msysDir <- parseRelDir " msys2-yyyymmdd"
1103
+ osKey <- getOSKey " MSYS2" msysDir
1085
1104
config <- view configL
1086
1105
VersionedDownloadInfo version info <-
1087
1106
case Map. lookup osKey $ siMsys2 si of
@@ -1094,7 +1113,7 @@ ensureMsys sopts getSetupInfo' = do
1094
1113
tool
1095
1114
(installMsys2Windows si)
1096
1115
| otherwise -> do
1097
- prettyWarnS " Continuing despite missing tool: msys2 "
1116
+ prettyWarnS " Continuing despite missing tool: MSYS2. "
1098
1117
pure Nothing
1099
1118
_ -> pure Nothing
1100
1119
@@ -2065,23 +2084,37 @@ downloadAndInstallPossibleCompilers possibleCompilers si wanted versionCheck mbi
2065
2084
Right r -> pure (r, b)
2066
2085
2067
2086
getGhcKey ::
2068
- (MonadReader env m , HasPlatform env , HasGHCVariant env , MonadThrow m )
2087
+ (HasBuildConfig env , HasGHCVariant env )
2069
2088
=> CompilerBuild
2070
- -> m Text
2089
+ -> RIO env Text
2071
2090
getGhcKey ghcBuild = do
2072
2091
ghcVariant <- view ghcVariantL
2073
- platform <- view platformL
2074
- osKey <- getOSKey platform
2075
- pure $
2076
- osKey
2077
- <> T. pack (ghcVariantSuffix ghcVariant)
2078
- <> T. pack (compilerBuildSuffix ghcBuild)
2092
+ wantedComiler <- view $ buildConfigL. to (smwCompiler . bcSMWanted)
2093
+ ghcVersion <- case wantedComiler of
2094
+ WCGhc version -> pure version
2095
+ WCGhcjs _ _ -> throwIO GhcjsNotSupported
2096
+ WCGhcGit _ _ -> throwIO DownloadAndInstallCompilerError
2097
+ let variantSuffix = ghcVariantSuffix ghcVariant
2098
+ buildSuffix = compilerBuildSuffix ghcBuild
2099
+ ghcDir <- parseRelDir $
2100
+ " ghc"
2101
+ <> variantSuffix
2102
+ <> buildSuffix
2103
+ <> " -"
2104
+ <> versionString ghcVersion
2105
+ osKey <- getOSKey " GHC" ghcDir
2106
+ pure $ osKey <> T. pack variantSuffix <> T. pack buildSuffix
2079
2107
2080
2108
getOSKey ::
2081
- (MonadThrow m )
2082
- => Platform
2083
- -> m Text
2084
- getOSKey platform =
2109
+ (HasConfig env , HasPlatform env )
2110
+ => StyleDoc
2111
+ -- ^ Description of the tool that is being set up.
2112
+ -> Path Rel Dir
2113
+ -- ^ Root directory of tool.
2114
+ -> RIO env Text
2115
+ getOSKey tool toolDir = do
2116
+ programsDir <- view $ configL. to configLocalPrograms
2117
+ platform <- view platformL
2085
2118
case platform of
2086
2119
Platform I386 Cabal. Linux -> pure " linux32"
2087
2120
Platform X86_64 Cabal. Linux -> pure " linux64"
@@ -2098,7 +2131,8 @@ getOSKey platform =
2098
2131
Platform Sparc Cabal. Linux -> pure " linux-sparc"
2099
2132
Platform AArch64 Cabal. OSX -> pure " macosx-aarch64"
2100
2133
Platform AArch64 Cabal. FreeBSD -> pure " freebsd-aarch64"
2101
- Platform arch os -> prettyThrowM $ UnsupportedSetupCombo os arch
2134
+ Platform arch os ->
2135
+ prettyThrowM $ UnsupportedSetupCombo os arch tool toolDir programsDir
2102
2136
2103
2137
downloadOrUseLocal ::
2104
2138
(HasTerm env , HasBuildConfig env )
0 commit comments