Skip to content

Commit c4ba139

Browse files
committed
Add GHC 9.4.7
1 parent 789253a commit c4ba139

File tree

3 files changed

+251
-0
lines changed

3 files changed

+251
-0
lines changed

9.4.7/ghc/ghc.nuspec

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Do not remove this test for UTF-8: if ??? doesn?t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
3+
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
4+
<metadata>
5+
<!-- Read this before publishing packages to chocolatey.org: https://github.com/chocolatey/chocolatey/wiki/CreatePackages -->
6+
<id>ghc</id>
7+
<title>GHC</title>
8+
<version>9.4.7</version>
9+
<authors>GHC Team</authors>
10+
<owners>Tamar Christina</owners>
11+
<summary>GHC is a state-of-the-art, open source, compiler and interactive environment for the functional language Haskell.</summary>
12+
<description>Highlights:
13+
• GHC supports the entire Haskell 2010 language plus a wide variety of extensions.
14+
• GHC has particularly good support for concurrency and parallelism, including support for Software Transactional Memory (STM).
15+
• GHC generates fast code, particularly for concurrent programs. Take a look at GHC's performance on The Computer Language Benchmarks Game.
16+
• GHC works on several platforms including Windows, Mac, Linux, most varieties of Unix, and several different processor architectures. There are detailed instructions for porting GHC to a new platform.
17+
• GHC has extensive optimisation capabilities, including inter-module optimisation.
18+
• GHC compiles Haskell code either directly to native code or using LLVM as a back-end. GHC can also generate C code as an intermediate target for porting to new platforms. The interactive environment compiles Haskell to bytecode, and supports execution of mixed bytecode/compiled programs.
19+
• Profiling is supported, both by time/allocation and various kinds of heap profiling.
20+
• GHC comes with several libraries, and thousands more are available on Hackage.
21+
22+
There's an important change to path handling for Windows starting with 8.6.1.
23+
These changes mean that Haskell programs are no longer constraint to `MAX_PATH`. So passing a long path to `openFile` will just work.
24+
There are a few caveats to this such as you can't access `COM` devices via `COM1` etc anymore and instead need to use the full path `\\.\COM1` etc.
25+
This is all documented https://downloads.haskell.org/~ghc/8.8.4/docs/html/users_guide/win32-dlls.html#windows-file-paths
26+
27+
*32-bit Windows is no longer supported and installing this package on 32-bit Windows will install GHC 8.6.5.*
28+
29+
GHC 9.0 contains a new I/O manager for Windows as a technical preview. See changelog for more information.
30+
31+
### Package Specific
32+
### changes
33+
34+
* Adds support for Azure Pipelines.
35+
36+
#### Package Parameters
37+
The following package parameters can be set:
38+
39+
* `/installdir:` - The location to install package to. Note that installing to a directory with spaces will likely lead to difficulties.
40+
* `/globalinstall:` - Indicates whether package should be installed for current user or all users.
41+
* `/integer-simple:` - Indicates to use the GHC bignum package instead of the GMP one, for compatibility reasons the flag is kept the same.
42+
* `/no-workarounds:` - Don't apply any package specific workarounds that may be needed to make the compiler work.
43+
44+
To pass parameters, use `--params "''"` (e.g. `choco install packageID [other options] --params="'/ITEM:value /ITEM2:value2 /FLAG_BOOLEAN'"`).
45+
To have choco remember parameters on upgrade, be sure to set `choco feature enable -n=useRememberedArgumentsForUpgrades`.
46+
47+
</description>
48+
<projectUrl>https://www.haskell.org/ghc/</projectUrl>
49+
<tags>ghc haskell</tags>
50+
<copyright>Copyright 2022, The University Court of the University of Glasgow.</copyright>
51+
<licenseUrl>https://www.haskell.org/ghc/license</licenseUrl>
52+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
53+
<!-- Important note about https://cdn.rawgit.com: Files are cached permanently after the first request. Use commit URLs when updating the icon. -->
54+
<iconUrl>http://upload.wikimedia.org/wikipedia/commons/thumb/1/1c/Haskell-Logo.svg/2000px-Haskell-Logo.svg.png</iconUrl>
55+
<dependencies>
56+
<dependency id="cabal" version="3.8.1.0" />
57+
<dependency id="chocolatey-core.extension" version="1.1.0" />
58+
</dependencies>
59+
<releaseNotes>https://github.com/ghc/ghc/blob/ghc-9.4/docs/users_guide/9.4.7-notes.rst</releaseNotes>
60+
<docsUrl>https://downloads.haskell.org/~ghc/9.4.7/docs/</docsUrl>
61+
<mailingListUrl>https://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</mailingListUrl>
62+
<bugTrackerUrl>https://ghc.haskell.org/trac/ghc/</bugTrackerUrl>
63+
<projectSourceUrl>https://www.haskell.org/ghc/</projectSourceUrl>
64+
</metadata>
65+
<files>
66+
<file src="tools\**" target="tools" />
67+
</files>
68+
</package>

9.4.7/ghc/tools/chocolateyInstall.ps1

+154
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
$version = '9.4.7'
2+
$packageName = 'ghc'
3+
$url = 'https://downloads.haskell.org/~ghc/8.6.5/ghc-8.6.5-i386-unknown-mingw32.tar.xz'
4+
$binSha256 = '415e6adebd764d278ecfe4ebf656ff96902953b8b669fba7dae2525af6665172'
5+
$variant = ''
6+
$pp = Get-PackageParameters
7+
if ($pp['integer-simple']) {
8+
$variant = '-int_native'
9+
$binSha256 = 'f46a9c1ce07d99abc9285dd00b7f2630e71e906cf4234c8150aeb9441cdee9b7'
10+
}
11+
$baseTarget = 'ghc-' + $version + '-x86_64-unknown-mingw32'
12+
$target = $baseTarget + $variant
13+
$url64 = 'https://downloads.haskell.org/~ghc/9.4.7/' + $target + '.tar.xz'
14+
$is32 = (Get-OSArchitectureWidth 32) -or $env:chocolateyForceX86 -eq 'true'
15+
16+
if($is32)
17+
{
18+
Write-Host "# # ####### ####### ### ##### #######"
19+
Write-Host "## # # # # # # # # "
20+
Write-Host "# # # # # # # # # "
21+
Write-Host "# # # # # # # # ##### "
22+
Write-Host "# # # # # # # # # "
23+
Write-Host "# ## # # # # # # # "
24+
Write-Host "# # ####### # ### ##### #######"
25+
Write-Host ""
26+
Write-Host " 32 bit binary for Windows is no longer supported."
27+
Write-Host "GHC 8.6.5 will be installed instead."
28+
Write-Host ""
29+
# rewrite the version to 8.6.5 so installer works
30+
$version = '8.6.5'
31+
}
32+
33+
# Fixes issue #4
34+
if ($pp['installdir']) {
35+
$binRoot = $pp['installdir']
36+
} else {
37+
$binRoot = Get-ToolsLocation
38+
}
39+
$packageFullName = Join-Path $binRoot ($packageName + '-' + $version)
40+
$binPackageDir = Join-Path $packageFullName "bin"
41+
42+
$tmpPath = Join-Path $packageFullName "tmp"
43+
$tarFile = $packageName + "Install"
44+
$tarPath = Join-Path $tmpPath $tarFile
45+
$tmpFile = Join-Path $binRoot ($tarFile + "~")
46+
47+
Get-ChocolateyWebFile -PackageName $packageName -FileFullPath $tarPath `
48+
-Url $url -ChecksumType sha256 -Checksum 2a8fb73080ed4335f7a172fe6cf9da1a2faa51fdb72817c50088292f497fc57a `
49+
-Url64bit $url64 -ChecksumType64 sha256 -Checksum64 $binSha256
50+
Get-ChocolateyUnzip -fileFullPath $tarPath -destination $binRoot
51+
Get-ChocolateyUnzip -fileFullPath $tmpFile -destination $binRoot
52+
rm $tmpFile # Clean up temporary file
53+
54+
# new folders are stupidly long and verbose and break convention.
55+
# let's normalize them
56+
$longBinPackageDir = Join-Path $binRoot $baseTarget
57+
if (Test-Path $longBinPackageDir) {
58+
# Now delete the extract dir
59+
Remove-Item -Force -Recurse $packageFullName
60+
Rename-Item -fo $longBinPackageDir $packageFullName
61+
Write-Host "Renamed $longBinPackageDir to $packageFullName"
62+
}
63+
64+
if (Test-Path $tmpPath) {
65+
# Now delete the tmp path
66+
Remove-Item -Force -Recurse $tmpPath
67+
}
68+
69+
# FIxes issue #8
70+
$installScope = 'User'
71+
if ($pp['globalinstall'] -eq 'true') {
72+
$installScope = 'Machine'
73+
Write-Host "Install scope set to global."
74+
}
75+
Install-ChocolateyPath "$binPackageDir" -Machine "$installScope"
76+
77+
# Patch the content of files at a certain line
78+
function Write-Patch {
79+
param( [string] $key
80+
, [string] $fileName
81+
, [string] $template
82+
)
83+
84+
(Get-Content $fileName) |
85+
Foreach-Object {
86+
if ($_ -match "$key")
87+
{
88+
#Add Lines after the selected pattern
89+
"$template"
90+
}
91+
$_ # send the current line to output
92+
} | Set-Content $fileName
93+
94+
}
95+
96+
if (-Not $is32 -and -not $pp['no-workarounds']) {
97+
# HACK: Work around that GHC 9.2.x is missing some components
98+
# See each individual ticket.
99+
# Write-Host "`nApplying workarounds for GHC 9.2.3: `
100+
# * Broken depencencies: https://gitlab.haskell.org/ghc/ghc/-/issues/21196 `
101+
# `
102+
# These workarounds do not change the compiler only the packaging, to disable re-run with --params=`"'/no-workarounds'`"`n"
103+
}
104+
105+
Write-Host "Hiding shims for `'$binRoot`'."
106+
$files = get-childitem $binRoot -include *.exe -recurse
107+
108+
foreach ($file in $files) {
109+
#generate an ignore file
110+
New-Item "$file.ignore" -type file -force | Out-Null
111+
}
112+
113+
# Detect Github Actions
114+
if (($null -ne $Env:GITHUB_ACTIONS) -and ("" -ne $Env:GITHUB_ACTIONS)) {
115+
echo "$binPackageDir" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
116+
}
117+
118+
# Detect Azure Pipelines (Fixes issue #9)
119+
if (($null -ne $Env:TF_BUILD) -and ("" -ne $Env:TF_BUILD)) {
120+
Write-Host "##vso[task.prependpath]$binPackageDir"
121+
}
122+
123+
if (($null -ne $Env:TRAVIS) -and ("" -ne $Env:TRAVIS)) {
124+
Write-Host "Configuring Travis aliases."
125+
# We need to fix up refreshenv for Travis
126+
$rc = $Env:HOME + "/.bashrc"
127+
128+
Add-Content $rc "function refreshenv
129+
{
130+
powershell -NonInteractive - <<\EOF
131+
Import-Module -Force `"`$env:ChocolateyInstall\helpers\chocolateyProfile.psm1`"
132+
`$pref = `$ErrorActionPreference
133+
`$ErrorActionPreference = 'SilentlyContinue'
134+
Update-SessionEnvironment
135+
`$ErrorActionPreference = `$pref
136+
# Round brackets in variable names cause problems with bash
137+
Get-ChildItem env:* | %{
138+
if (!(`$_.Name.Contains('('))) {
139+
`$value = `$_.Value
140+
if (`$_.Name -eq 'PATH') {
141+
`$value = `$value -replace ';',':'
142+
}
143+
Write-Output (`"export `" + `$_.Name + `"='`" + `$value + `"'`")
144+
}
145+
} | Out-File -Encoding ascii $env:TEMP\refreshenv.sh
146+
EOF
147+
148+
source `"$env:TEMP/refreshenv.sh`"
149+
}
150+
151+
alias RefreshEnv=refreshenv"
152+
153+
Write-Host "Ok, updated ~/.bashrc, source to use refreshenv."
154+
}
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
$version = '9.4.7'
2+
$packageName = 'ghc'
3+
$url = 'https://downloads.haskell.org/~ghc/8.6.5/ghc-8.6.5-i386-unknown-mingw32.tar.xz'
4+
$binSha256 = '415e6adebd764d278ecfe4ebf656ff96902953b8b669fba7dae2525af6665172'
5+
$variant = ''
6+
$pp = Get-PackageParameters
7+
if ($pp['integer-simple']) {
8+
$variant = '-integer-simple'
9+
$binSha256 = 'f46a9c1ce07d99abc9285dd00b7f2630e71e906cf4234c8150aeb9441cdee9b7'
10+
}
11+
$baseTarget = 'ghc-' + $version + '-x86_64-unknown-mingw32'
12+
$target = $baseTarget + $variant
13+
$url64 = 'https://downloads.haskell.org/~ghc/9.4.6/' + $target + '.tar.xz'
14+
$is32 = (Get-OSArchitectureWidth 32) -or $env:chocolateyForceX86 -eq 'true'
15+
16+
# Fixes issue #4
17+
if ($pp['installdir']) {
18+
$binRoot = $pp['installdir']
19+
} else {
20+
$binRoot = Get-ToolsLocation
21+
}
22+
$packageFullName = Join-Path $binRoot ($packageName + '-' + $version)
23+
$binPackageDir = Join-Path $packageFullName "bin"
24+
25+
if (-Not $is32) {
26+
27+
}
28+
29+
Remove-Item -Force -Recurse $packageFullName

0 commit comments

Comments
 (0)