Skip to content

Commit

Permalink
Set CABAL_DIR and make sure config is adjusted
Browse files Browse the repository at this point in the history
The config adjustment usually includes adding msys2 directories,
so cabal can find `pkg-config` and libraries, e.g.:

+ C: \ghcup\msys64\mingw64\bin
+ extra-include-dirs: C:\ghcup\msys64\mingw64\include
+ extra-lib-dirs: C:\ghcup\msys64\mingw64\lib
- extra-prog-path: C:\cabal\bin
+ extra-prog-path: C:\ghcup\bin,
  • Loading branch information
hasufell committed Oct 12, 2021
1 parent 8b1ede4 commit 7a0460b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion images/win/scripts/Installers/Install-Haskell.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ Invoke-PesterTests -TestFile 'Haskell'
# install minimal ghcup, utilizing pre-installed msys2 at C:\msys64
$msysPath = "C:\msys64"
$ghcupPrefix = "C:\"
Invoke-Command -ScriptBlock ([ScriptBlock]::Create($bootstrapHaskell)) -ArgumentList $false, $true, $true, $false, $false, $false, $false, $ghcupPrefix, "", $msysPath, C:\cabal
$appdata = [Environment]::GetEnvironmentVariable('APPDATA', [System.EnvironmentVariableTarget]::Machine)
$cabalDir = "$appdata\cabal"
Invoke-Command -ScriptBlock ([ScriptBlock]::Create($bootstrapHaskell)) -ArgumentList $false, $true, $true, $false, $false, $false, $false, $ghcupPrefix, "", $msysPath, $cabalDir
[Environment]::SetEnvironmentVariable("GHCUP_INSTALL_BASE_PREFIX", $ghcupPrefix, [System.EnvironmentVariableTarget]::Machine)
[Environment]::SetEnvironmentVariable("GHCUP_MSYS2", $msysPath, [System.EnvironmentVariableTarget]::Machine)
[Environment]::SetEnvironmentVariable("CABAL_DIR", $cabalDir, [System.EnvironmentVariableTarget]::Machine)
Add-MachinePathItem "$ghcupPrefix\ghcup\bin"
5 changes: 5 additions & 0 deletions images/win/scripts/Tests/Haskell.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ Describe "Haskell" {
"cabal --version" | Should -ReturnZeroExitCode
}

It "cabal config was modified and exists" {
[Environment]::GetEnvironmentVariable('CABAL_DIR', [System.EnvironmentVariableTarget]::Machine) | Should -Exist
"cabal user-config diff" | Should -Not -BeNullOrEmpty
}

It "ghcup is installed" {
"ghcup --version" | Should -ReturnZeroExitCode
}
Expand Down

0 comments on commit 7a0460b

Please sign in to comment.