Merge branch 'windows-bootstrap-fixes'
This commit is contained in:
commit
8a632eb3b4
@ -66,6 +66,14 @@ variables:
|
||||
ARCH: "64"
|
||||
CABAL_DIR: "$CI_PROJECT_DIR/cabal"
|
||||
|
||||
.darwin:aarch64:
|
||||
tags:
|
||||
- aarch64-darwin-m1
|
||||
variables:
|
||||
OS: "DARWIN"
|
||||
ARCH: "ARM64"
|
||||
CABAL_DIR: "$CI_PROJECT_DIR/cabal"
|
||||
|
||||
.freebsd:
|
||||
tags:
|
||||
- x86_64-freebsd
|
||||
@ -133,6 +141,14 @@ variables:
|
||||
before_script:
|
||||
- ./.gitlab/before_script/darwin/install_deps.sh
|
||||
|
||||
.test_ghcup_version:darwin:aarch64:
|
||||
extends:
|
||||
- .test_ghcup_version
|
||||
- .darwin:aarch64
|
||||
- .root_cleanup
|
||||
before_script:
|
||||
- ./.gitlab/before_script/darwin/install_deps.sh
|
||||
|
||||
.test_ghcup_version:freebsd:
|
||||
extends:
|
||||
- .test_ghcup_version
|
||||
@ -255,6 +271,14 @@ test:mac:latest:
|
||||
CABAL_VERSION: "3.4.0.0"
|
||||
needs: []
|
||||
|
||||
test:mac:recommended:aarch64:
|
||||
stage: test
|
||||
extends: .test_ghcup_version:darwin:aarch64
|
||||
variables:
|
||||
GHC_VERSION: "8.10.5"
|
||||
CABAL_VERSION: "3.4.0.0"
|
||||
needs: []
|
||||
|
||||
|
||||
######## freebsd test ########
|
||||
|
||||
|
@ -208,7 +208,7 @@ validateTarballs (TarballFilter etool versionRegex) dls gt = do
|
||||
-- download/verify all tarballs
|
||||
let dlis = either (const []) (\tool -> nubOrd $ dls ^.. each %& indices (maybe (const True) (==) tool) %> each %& indices (matchTest versionRegex . T.unpack . prettyVer) % (viSourceDL % _Just `summing` viArch % each % each % each)) etool
|
||||
let gdlis = nubOrd $ gt ^.. each
|
||||
let allDls = dlis ++ gdlis
|
||||
let allDls = either (const gdlis) (const dlis) etool
|
||||
when (null allDls) $ $(logError) [i|no tarballs selected by filter|] *> addError
|
||||
forM_ allDls downloadAll
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
plat="$(uname -s)"
|
||||
arch=$(uname -m)
|
||||
ghver="0.1.15"
|
||||
ghver="0.1.14.1"
|
||||
base_url="https://downloads.haskell.org/~ghcup"
|
||||
|
||||
case "${plat}" in
|
||||
@ -24,6 +24,7 @@ case "${plat}" in
|
||||
: "${GHCUP_INSTALL_BASE_PREFIX:=/c}"
|
||||
GHCUP_DIR=${GHCUP_INSTALL_BASE_PREFIX}/ghcup
|
||||
GHCUP_BIN=${GHCUP_INSTALL_BASE_PREFIX}/ghcup/bin
|
||||
: "${GHCUP_MSYS2:=${GHCUP_DIR}/msys64}"
|
||||
;;
|
||||
*)
|
||||
: "${GHCUP_INSTALL_BASE_PREFIX:=$HOME}"
|
||||
@ -272,7 +273,7 @@ eghcup set ghc "${BOOTSTRAP_HASKELL_GHC_VERSION}"
|
||||
eghcup --cache install cabal "${BOOTSTRAP_HASKELL_CABAL_VERSION}"
|
||||
|
||||
adjust_cabal_config() {
|
||||
edo cabal user-config -a "extra-prog-path: $(cygpath -w $GHCUP_BIN), $(cygpath -w "$HOME"/AppData/Roaming/cabal/bin), $(cygpath -w "$GHCUP_DIR"/msys64/usr/bin), $(cygpath -w "$GHCUP_DIR"/msys64/mingw64/bin)" -a "extra-include-dirs: $(cygpath -w "$GHCUP_DIR"/msys64/mingw64/include)" -a "extra-lib-dirs: $(cygpath -w "$GHCUP_DIR"/msys64/mingw64/lib)" -f init
|
||||
edo cabal user-config -a "extra-prog-path: $(cygpath -w $GHCUP_BIN), $(cygpath -w "$HOME"/AppData/Roaming/cabal/bin), $(cygpath -w "$GHCUP_MSYS2"/usr/bin), $(cygpath -w "$GHCUP_MSYS2"/mingw64/bin)" -a "extra-include-dirs: $(cygpath -w "$GHCUP_MSYS2"/mingw64/include)" -a "extra-lib-dirs: $(cygpath -w "$GHCUP_MSYS2"/mingw64/lib)" -f init
|
||||
}
|
||||
|
||||
case "${plat}" in
|
||||
@ -290,6 +291,7 @@ case "${plat}" in
|
||||
break ;;
|
||||
[Nn]*)
|
||||
echo "Make sure that your global cabal.config references the correct mingw64 paths (extra-prog-path, extra-include-dirs and extra-lib-dirs)."
|
||||
echo "And set the environment variable GHCUP_MSYS2 to the root path of your msys2 installation."
|
||||
sleep 5
|
||||
break ;;
|
||||
*)
|
||||
|
@ -1,6 +1,6 @@
|
||||
function Print-Msg {
|
||||
param ( [Parameter(Mandatory=$true, HelpMessage='String to output')][string]$msg )
|
||||
Write-Host ('{0}' -f $msg) -ForegroundColor Green
|
||||
param ( [Parameter(Mandatory=$true, HelpMessage='String to output')][string]$msg, [string]$color = "Green" )
|
||||
Write-Host ('{0}' -f $msg) -ForegroundColor $color
|
||||
}
|
||||
|
||||
function Create-Shortcut {
|
||||
@ -96,15 +96,17 @@ $ErrorActionPreference = 'Stop'
|
||||
$GhcupDir = "C:\ghcup"
|
||||
$MsysDir = ('{0}\msys64' -f $GhcupDir)
|
||||
$Bash = ('{0}\usr\bin\bash' -f $MsysDir)
|
||||
$Msys2Shell = ('{0}\msys2_shell.cmd' -f $MsysDir)
|
||||
$BootstrapUrl = 'https://www.haskell.org/ghcup/sh/bootstrap-haskell-windows'
|
||||
$GhcupMsys2 = [System.Environment]::GetEnvironmentVariable('GHCUP_MSYS2', 'user')
|
||||
|
||||
Print-Msg -msg 'Preparing for GHCup installation...'
|
||||
|
||||
if (Test-Path -Path ('{0}' -f $GhcupDir)) {
|
||||
$decision = $Host.UI.PromptForChoice('Install', 'GHCup is already installed, what do you want to do?', @('&Reinstall'
|
||||
'&Continue'
|
||||
'&Abort'), 1)
|
||||
$decision = $Host.UI.PromptForChoice('Install GHCup'
|
||||
, 'GHCup is already installed, what do you want to do?'
|
||||
, @('&Reinstall'
|
||||
'&Continue'
|
||||
'&Abort'), 1)
|
||||
if ($decision -eq 0) {
|
||||
$suffix = [IO.Path]::GetRandomFileName()
|
||||
Print-Msg -msg ('Backing up {0} to {0}-{1} ...' -f $GhcupDir, $suffix)
|
||||
@ -112,7 +114,7 @@ if (Test-Path -Path ('{0}' -f $GhcupDir)) {
|
||||
} elseif ($decision -eq 1) {
|
||||
Print-Msg -msg 'Continuing installation...'
|
||||
} elseif ($decision -eq 2) {
|
||||
Exit
|
||||
Break
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,7 +124,12 @@ $null = New-Item -Path ('{0}' -f $GhcupDir) -Name 'bin' -ItemType 'directory' -E
|
||||
|
||||
Print-Msg -msg 'First checking for Msys2...'
|
||||
|
||||
if (!(Test-Path -Path ('{0}' -f $MsysDir))) {
|
||||
if (!(Test-Path -Path ('{0}' -f $MsysDir)) -And !($GhcupMsys2)) {
|
||||
$msys2Decision = $Host.UI.PromptForChoice('Install MSys2'
|
||||
, 'Do you want GHCup to install a default MSys2 toolchain (recommended)?'
|
||||
, @('&Yes'
|
||||
'&No'), 0)
|
||||
if ($msys2Decision -eq 0) {
|
||||
Print-Msg -msg ('...Msys2 doesn''t exist, installing into {0} ...this may take a while' -f $MsysDir)
|
||||
|
||||
# Download the archive
|
||||
@ -158,6 +165,32 @@ if (!(Test-Path -Path ('{0}' -f $MsysDir))) {
|
||||
|
||||
Print-Msg -msg 'Setting default home directory...'
|
||||
& "$Bash" -lc "sed -i -e 's/db_home:.*$/db_home: windows/' /etc/nsswitch.conf"
|
||||
} elseif ($msys2Decision -eq 1) {
|
||||
Print-Msg -color Magenta -msg 'Skipping MSys2 installation.'
|
||||
if ($GhcupMsys2) {
|
||||
Print-Msg -msg 'GHCUP_MSYS2 env var set, using existing installation...'
|
||||
$MsysDir = $GhcupMsys2
|
||||
} else {
|
||||
$MsysDir = Read-Host -Prompt 'Input existing MSys2 toolchain directory'
|
||||
}
|
||||
|
||||
if (!(Test-Path -Path ('{0}' -f $MsysDir))) {
|
||||
Print-Msg -color Red -msg ('MSys2 installation at ''{0}'' could not be found, aborting!' -f $MsysDir)
|
||||
Break
|
||||
}
|
||||
Print-Msg -msg 'Making MSys2 discoverable for GHCup...'
|
||||
$null = [Environment]::SetEnvironmentVariable("GHCUP_MSYS2", $MsysDir, [System.EnvironmentVariableTarget]::User)
|
||||
$Bash = ('{0}\usr\bin\bash' -f $MsysDir)
|
||||
}
|
||||
} elseif ($GhcupMsys2) {
|
||||
if (!(Test-Path -Path ('{0}' -f $GhcupMsys2))) {
|
||||
Print-Msg -color Red -msg ('MSys2 installation at ''{0}'' could not be found, aborting!' -f $GhcupMsys2)
|
||||
Break
|
||||
}
|
||||
$MsysDir = $GhcupMsys2
|
||||
Print-Msg -msg 'Making MSys2 discoverable for GHCup...'
|
||||
$null = [Environment]::SetEnvironmentVariable("GHCUP_MSYS2", $MsysDir, [System.EnvironmentVariableTarget]::User)
|
||||
$Bash = ('{0}\usr\bin\bash' -f $MsysDir)
|
||||
} else {
|
||||
Print-Msg -msg ('...Msys2 found in {0} ...skipping Msys2 installation.' -f $MsysDir)
|
||||
}
|
||||
@ -171,10 +204,12 @@ Add-EnvPath -Path ('{0}\bin' -f $GhcupDir) -Container 'User'
|
||||
|
||||
Print-Msg -msg 'Starting GHCup installer...'
|
||||
|
||||
$Msys2Shell = ('{0}\msys2_shell.cmd' -f $MsysDir)
|
||||
|
||||
if ((Get-Process -ID $PID).ProcessName.StartsWith("bootstrap-haskell")) {
|
||||
& "$Bash" -lc ('export PATH="/c/ghcup/bin:$PATH" ; curl --proto ''=https'' --tlsv1.2 -sSf {0} | bash' -f $BootstrapUrl)
|
||||
& "$Bash" -lc ('[ -n ''{1}'' ] && export GHCUP_MSYS2=$(cygpath -w ''{1}'') ; export PATH="/c/ghcup/bin:$PATH" ; curl --proto ''=https'' --tlsv1.2 -sSf {0} | bash' -f $BootstrapUrl, $MsysDir)
|
||||
} else {
|
||||
& "$Msys2Shell" -mingw64 -mintty -c ('export PATH="/c/ghcup/bin:$PATH" ; trap ''echo Press any key to exit && read -n 1 && exit'' 2 ; curl --proto =https --tlsv1.2 -sSf -k {0} | bash ; echo ''Press any key to exit'' && read -n 1' -f $BootstrapUrl)
|
||||
& "$Msys2Shell" -mingw64 -mintty -c ('[ -n ''{1}'' ] && export GHCUP_MSYS2=$(cygpath -w ''{1}'') ; export PATH="/c/ghcup/bin:$PATH" ; trap ''echo Press any key to exit && read -n 1 && exit'' 2 ; curl --proto =https --tlsv1.2 -sSf -k {0} | bash ; echo ''Press any key to exit'' && read -n 1' -f $BootstrapUrl, $MsysDir)
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,11 +11,6 @@ source-repository-package
|
||||
location: https://github.com/Bodigrim/tar
|
||||
tag: ac197ec7ea4838dc2b4e22b9b888b080cedf29cf
|
||||
|
||||
source-repository-package
|
||||
type: git
|
||||
location: https://github.com/hasufell/zip
|
||||
tag: 6f02aa48622b8ba764d0cc0e6900f480a107aa96
|
||||
|
||||
constraints: http-io-streams -brotli
|
||||
|
||||
package libarchive
|
||||
|
@ -1538,11 +1538,11 @@ ghcupDownloads:
|
||||
unknown_versioning: *ghc-8105-32-deb9
|
||||
Linux_UnknownLinux:
|
||||
unknown_versioning: *ghc-8105-32-deb9
|
||||
# Linux_Alpine:
|
||||
# unknown_versioning:
|
||||
# dlUri: https://downloads.haskell.org/ghcup/unofficial-bindists/ghc/8.10.5/ghc-8.10.5-i386-alpine-linux.tar.xz
|
||||
# dlSubdir: ghc-8.10.5
|
||||
# dlHash: 9161a98bed763692101854d83af69c1316030cfe5ee6f6acde283d04ef139735
|
||||
Linux_Alpine:
|
||||
unknown_versioning:
|
||||
dlUri: https://downloads.haskell.org/~ghcup/unofficial-bindists/ghc/8.10.5/ghc-8.10.5-i386-alpine-linux.tar.xz
|
||||
dlSubdir: ghc-8.10.5
|
||||
dlHash: 0e91abe61607f9375d4e252ee9c261e4856df396f60641bb1b880ab8a3a83ea7
|
||||
A_ARM64:
|
||||
Linux_UnknownLinux:
|
||||
unknown_versioning:
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
globalTools:
|
||||
ShimGen:
|
||||
dlUri: https://downloads.haskell.org/~ghcup/tmp/gs.exe
|
||||
dlUri: https://downloads.haskell.org/~ghcup/shimgen/gs.exe
|
||||
dlHash: 9ce8b7dad7ff4e5017dbd63d6f6f3d16412b889560cb6ccd3903dbcab0bf4f0d
|
||||
toolRequirements:
|
||||
GHC:
|
||||
@ -1654,11 +1654,11 @@ ghcupDownloads:
|
||||
unknown_versioning: *ghc-8105-32-deb9
|
||||
Linux_UnknownLinux:
|
||||
unknown_versioning: *ghc-8105-32-deb9
|
||||
# Linux_Alpine:
|
||||
# unknown_versioning:
|
||||
# dlUri: https://downloads.haskell.org/ghcup/unofficial-bindists/ghc/8.10.5/ghc-8.10.5-i386-alpine-linux.tar.xz
|
||||
# dlSubdir: ghc-8.10.5
|
||||
# dlHash: 9161a98bed763692101854d83af69c1316030cfe5ee6f6acde283d04ef139735
|
||||
Linux_Alpine:
|
||||
unknown_versioning:
|
||||
dlUri: https://downloads.haskell.org/~ghcup/unofficial-bindists/ghc/8.10.5/ghc-8.10.5-i386-alpine-linux.tar.xz
|
||||
dlSubdir: ghc-8.10.5
|
||||
dlHash: 0e91abe61607f9375d4e252ee9c261e4856df396f60641bb1b880ab8a3a83ea7
|
||||
A_ARM64:
|
||||
Linux_UnknownLinux:
|
||||
unknown_versioning:
|
||||
|
@ -145,7 +145,7 @@ library
|
||||
, versions ^>=4.0.1
|
||||
, word8 ^>=0.1.3
|
||||
, yaml ^>=0.11.4.0
|
||||
, zip ^>=1.7.0
|
||||
, zip ^>=1.7.1
|
||||
, zlib ^>=0.6.2.2
|
||||
|
||||
if (flag(internal-downloader) && !os(windows))
|
||||
|
@ -44,6 +44,7 @@ import Prelude hiding ( abs
|
||||
import System.Info
|
||||
import System.Directory
|
||||
import System.OsRelease
|
||||
import Text.PrettyPrint.HughesPJClass ( prettyShow )
|
||||
import Text.Regex.Posix
|
||||
|
||||
import qualified Data.Text as T
|
||||
@ -108,7 +109,7 @@ getPlatform = do
|
||||
pure $ PlatformResult { _platform = FreeBSD, _distroVersion = ver }
|
||||
"mingw32" -> pure PlatformResult { _platform = Windows, _distroVersion = Nothing }
|
||||
what -> throwE $ NoCompatiblePlatform what
|
||||
lift $ $(logDebug) [i|Identified Platform as: #{pfr}|]
|
||||
lift $ $(logDebug) [i|Identified Platform as: #{prettyShow pfr}|]
|
||||
pure pfr
|
||||
where
|
||||
getMajorVersion = T.intercalate "." . take 2 . T.split (== '.')
|
||||
|
@ -214,10 +214,10 @@ createProcessWithMingwPath :: MonadIO m
|
||||
=> CreateProcess
|
||||
-> m CreateProcess
|
||||
createProcessWithMingwPath cp = do
|
||||
baseDir <- liftIO ghcupBaseDir
|
||||
msys2Dir <- liftIO ghcupMsys2Dir
|
||||
cEnv <- Map.fromList <$> maybe (liftIO getEnvironment) pure (env cp)
|
||||
let mingWPaths = [baseDir </> "msys64" </> "usr" </> "bin"
|
||||
,baseDir </> "msys64" </> "mingw64" </> "bin"]
|
||||
let mingWPaths = [msys2Dir </> "usr" </> "bin"
|
||||
,msys2Dir </> "mingw64" </> "bin"]
|
||||
paths = ["PATH", "Path"]
|
||||
curPaths = (\x -> maybe [] splitSearchPath (Map.lookup x cEnv)) =<< paths
|
||||
newPath = intercalate [searchPathSeparator] (mingWPaths ++ curPaths)
|
||||
@ -226,6 +226,13 @@ createProcessWithMingwPath cp = do
|
||||
liftIO $ setEnv "Path" newPath
|
||||
pure $ cp { env = Just $ Map.toList envWithNewPath }
|
||||
|
||||
ghcupMsys2Dir :: IO FilePath
|
||||
ghcupMsys2Dir =
|
||||
lookupEnv "GHCUP_MSYS2" >>= \case
|
||||
Just fp -> pure fp
|
||||
Nothing -> do
|
||||
baseDir <- liftIO ghcupBaseDir
|
||||
pure (baseDir </> "msys64")
|
||||
|
||||
-- | Checks whether the binary is a broken link.
|
||||
isBrokenSymlink :: FilePath -> IO Bool
|
||||
|
@ -37,6 +37,7 @@ extra-deps:
|
||||
- streamly-posix-0.1.0.1@sha256:5d89b806281035d34020387ed99dde1ddab282c7ed66df3b7cd010b38fd3517b,2138
|
||||
- strict-base-0.4.0.0@sha256:2ff4e43cb95eedf2995558d7fc34d19362846413dd39e6aa6a5b3ea8228fef9f,1248
|
||||
- xor-0.0.1.0@sha256:f8362b4a68562b9afbcd727ff64c1a303970df3a032e0033d2f4c094c3501df3,2243
|
||||
- zip-1.7.1@sha256:0ce03d0fbffba47c1ab6fbb9166f8ba5373d828d78587df21b7e9d7bb150f929,3918
|
||||
|
||||
flags:
|
||||
http-io-streams:
|
||||
|
Loading…
Reference in New Issue
Block a user