@@ -525,7 +525,7 @@ ensureMsys sopts getSetupInfo' = do
525
525
Just x -> return x
526
526
Nothing -> throwString $ " MSYS2 not found for " ++ T. unpack osKey
527
527
let tool = Tool (PackageIdentifier (mkPackageName " msys2" ) version)
528
- Just <$> downloadAndInstallTool (configLocalPrograms config) info tool (installMsys2Windows osKey si)
528
+ Just <$> downloadAndInstallTool (configLocalPrograms config) info tool (installMsys2Windows si)
529
529
| otherwise -> do
530
530
logWarn " Continuing despite missing tool: msys2"
531
531
return Nothing
@@ -875,8 +875,8 @@ buildGhcFromSource getSetupInfo' installed (CompilerRepository url) commitId fla
875
875
}
876
876
ghcdlinfo = GHCDownloadInfo mempty mempty dlinfo
877
877
installer
878
- | osIsWindows = installGHCWindows Nothing
879
- | otherwise = installGHCPosix Nothing ghcdlinfo
878
+ | osIsWindows = installGHCWindows
879
+ | otherwise = installGHCPosix ghcdlinfo
880
880
si <- runMemoized getSetupInfo'
881
881
_ <- downloadAndInstallTool
882
882
(configLocalPrograms config)
@@ -1139,8 +1139,8 @@ downloadAndInstallCompiler ghcBuild si wanted@(WCGhc version) versionCheck mbind
1139
1139
config <- view configL
1140
1140
let installer =
1141
1141
case configPlatform config of
1142
- Platform _ Cabal. Windows -> installGHCWindows ( Just selectedVersion)
1143
- _ -> installGHCPosix ( Just selectedVersion) downloadInfo
1142
+ Platform _ Cabal. Windows -> installGHCWindows
1143
+ _ -> installGHCPosix downloadInfo
1144
1144
logInfo $
1145
1145
" Preparing to install GHC" <>
1146
1146
(case ghcVariant of
@@ -1312,15 +1312,14 @@ data ArchiveType
1312
1312
| SevenZ
1313
1313
1314
1314
installGHCPosix :: HasConfig env
1315
- => Maybe Version
1316
- -> GHCDownloadInfo
1315
+ => GHCDownloadInfo
1317
1316
-> SetupInfo
1318
1317
-> Path Abs File
1319
1318
-> ArchiveType
1320
1319
-> Path Abs Dir
1321
1320
-> Path Abs Dir
1322
1321
-> RIO env ()
1323
- installGHCPosix mversion downloadInfo _ archiveFile archiveType tempDir destDir = do
1322
+ installGHCPosix downloadInfo _ archiveFile archiveType tempDir destDir = do
1324
1323
platform <- view platformL
1325
1324
menv0 <- view processContextL
1326
1325
menv <- mkProcessContext (removeHaskellEnvVars (view envVarsL menv0))
@@ -1383,11 +1382,7 @@ installGHCPosix mversion downloadInfo _ archiveFile archiveType tempDir destDir
1383
1382
logDebug $ " Unpacking " <> fromString (toFilePath archiveFile)
1384
1383
runStep " unpacking" tempDir mempty tarTool [compOpt : " xf" , toFilePath archiveFile]
1385
1384
1386
- dir <- case mversion of
1387
- Just version -> do
1388
- relDir <- parseRelDir $ " ghc-" ++ versionString version
1389
- return (tempDir </> relDir)
1390
- Nothing -> expectSingleUnpackedDir archiveFile tempDir
1385
+ dir <- expectSingleUnpackedDir archiveFile tempDir
1391
1386
1392
1387
logSticky " Configuring GHC ..."
1393
1388
runStep " configuring" dir
@@ -1433,36 +1428,32 @@ instance Alternative (CheckDependency env) where
1433
1428
Right x' -> return $ Right x'
1434
1429
1435
1430
installGHCWindows :: HasBuildConfig env
1436
- => Maybe Version
1437
- -> SetupInfo
1431
+ => SetupInfo
1438
1432
-> Path Abs File
1439
1433
-> ArchiveType
1440
1434
-> Path Abs Dir
1441
1435
-> Path Abs Dir
1442
1436
-> RIO env ()
1443
- installGHCWindows mversion si archiveFile archiveType _tempDir destDir = do
1444
- tarComponent <- mapM (\ v -> parseRelDir $ " ghc-" ++ versionString v) mversion
1445
- withUnpackedTarball7z " GHC" si archiveFile archiveType tarComponent destDir
1437
+ installGHCWindows si archiveFile archiveType _tempDir destDir = do
1438
+ withUnpackedTarball7z " GHC" si archiveFile archiveType destDir
1446
1439
logInfo $ " GHC installed to " <> fromString (toFilePath destDir)
1447
1440
1448
1441
installMsys2Windows :: HasBuildConfig env
1449
- => Text -- ^ OS Key
1450
- -> SetupInfo
1442
+ => SetupInfo
1451
1443
-> Path Abs File
1452
1444
-> ArchiveType
1453
1445
-> Path Abs Dir
1454
1446
-> Path Abs Dir
1455
1447
-> RIO env ()
1456
- installMsys2Windows osKey si archiveFile archiveType _tempDir destDir = do
1448
+ installMsys2Windows si archiveFile archiveType _tempDir destDir = do
1457
1449
exists <- liftIO $ D. doesDirectoryExist $ toFilePath destDir
1458
1450
when exists $ liftIO (D. removeDirectoryRecursive $ toFilePath destDir) `catchIO` \ e -> do
1459
1451
logError $
1460
1452
" Could not delete existing msys directory: " <>
1461
1453
fromString (toFilePath destDir)
1462
1454
throwM e
1463
1455
1464
- msys <- parseRelDir $ " msys" ++ T. unpack (fromMaybe " 32" $ T. stripPrefix " windows" osKey)
1465
- withUnpackedTarball7z " MSYS2" si archiveFile archiveType (Just msys) destDir
1456
+ withUnpackedTarball7z " MSYS2" si archiveFile archiveType destDir
1466
1457
1467
1458
1468
1459
-- I couldn't find this officially documented anywhere, but you need to run
@@ -1491,10 +1482,9 @@ withUnpackedTarball7z :: HasBuildConfig env
1491
1482
-> SetupInfo
1492
1483
-> Path Abs File -- ^ Path to archive file
1493
1484
-> ArchiveType
1494
- -> Maybe (Path Rel Dir ) -- ^ Name of directory expected in archive. If Nothing, expects a single folder.
1495
1485
-> Path Abs Dir -- ^ Destination directory.
1496
1486
-> RIO env ()
1497
- withUnpackedTarball7z name si archiveFile archiveType msrcDir destDir = do
1487
+ withUnpackedTarball7z name si archiveFile archiveType destDir = do
1498
1488
suffix <-
1499
1489
case archiveType of
1500
1490
TarXz -> return " .xz"
@@ -1512,9 +1502,7 @@ withUnpackedTarball7z name si archiveFile archiveType msrcDir destDir = do
1512
1502
liftIO $ ignoringAbsence (removeDirRecur destDir)
1513
1503
run7z tmpDir archiveFile
1514
1504
run7z tmpDir (tmpDir </> tarFile)
1515
- absSrcDir <- case msrcDir of
1516
- Just srcDir -> return $ tmpDir </> srcDir
1517
- Nothing -> expectSingleUnpackedDir archiveFile tmpDir
1505
+ absSrcDir <- expectSingleUnpackedDir archiveFile tmpDir
1518
1506
renameDir absSrcDir destDir
1519
1507
1520
1508
expectSingleUnpackedDir :: (MonadIO m , MonadThrow m ) => Path Abs File -> Path Abs Dir -> m (Path Abs Dir )
0 commit comments