Skip to content

Commit 38cb7b3

Browse files
committed
ghc: Add GHC 8.2.6
1 parent 6b01577 commit 38cb7b3

File tree

3 files changed

+252
-0
lines changed

3 files changed

+252
-0
lines changed

9.2.6/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.2.6</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 integer simple package instead of the GMP one.
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.6.0.0" />
57+
<dependency id="chocolatey-core.extension" version="1.1.0" />
58+
</dependencies>
59+
<releaseNotes>https://github.com/ghc/ghc/blob/ghc-9.2/docs/users_guide/9.2.6-notes.rst</releaseNotes>
60+
<docsUrl>https://downloads.haskell.org/~ghc/9.2.6/docs/html/</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.2.6/ghc/tools/chocolateyInstall.ps1

+155
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
$version = '9.2.6'
2+
$packageName = 'ghc'
3+
$url = 'https://downloads.haskell.org/~ghc/8.6.5/ghc-8.6.5-i386-unknown-mingw32.tar.xz'
4+
$binSha256 = 'bd13aadeeadb3454199eb797961350f0a19275ec74002b2816d1b63093dfd55f'
5+
$variant = ''
6+
$pp = Get-PackageParameters
7+
if ($pp['integer-simple']) {
8+
$variant = '-integer-simple'
9+
$binSha256 = 'dd169952cfbd0ae88f811b0b7318676ee5b2f037cb8220ff0082c3c94bbc7d05'
10+
}
11+
$baseTarget = 'ghc-' + $version + '-x86_64-unknown-mingw32'
12+
$target = $baseTarget + $variant
13+
$url64 = 'https://downloads.haskell.org/~ghc/9.2.6/' + $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+
70+
# FIxes issue #8
71+
$installScope = 'User'
72+
if ($pp['globalinstall'] -eq 'true') {
73+
$installScope = 'Machine'
74+
Write-Host "Install scope set to global."
75+
}
76+
Install-ChocolateyPath "$binPackageDir" -Machine "$installScope"
77+
78+
# Patch the content of files at a certain line
79+
function Write-Patch {
80+
param( [string] $key
81+
, [string] $fileName
82+
, [string] $template
83+
)
84+
85+
(Get-Content $fileName) |
86+
Foreach-Object {
87+
if ($_ -match "$key")
88+
{
89+
#Add Lines after the selected pattern
90+
"$template"
91+
}
92+
$_ # send the current line to output
93+
} | Set-Content $fileName
94+
95+
}
96+
97+
if (-Not $is32 -and -not $pp['no-workarounds']) {
98+
# HACK: Work around that GHC 9.2.x is missing some components
99+
# See each individual ticket.
100+
# Write-Host "`nApplying workarounds for GHC 9.2.3: `
101+
# * Broken depencencies: https://gitlab.haskell.org/ghc/ghc/-/issues/21196 `
102+
# `
103+
# These workarounds do not change the compiler only the packaging, to disable re-run with --params=`"'/no-workarounds'`"`n"
104+
}
105+
106+
Write-Host "Hiding shims for `'$binRoot`'."
107+
$files = get-childitem $binRoot -include *.exe -recurse
108+
109+
foreach ($file in $files) {
110+
#generate an ignore file
111+
New-Item "$file.ignore" -type file -force | Out-Null
112+
}
113+
114+
# Detect Github Actions
115+
if (($null -ne $Env:GITHUB_ACTIONS) -and ("" -ne $Env:GITHUB_ACTIONS)) {
116+
echo "$binPackageDir" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
117+
}
118+
119+
# Detect Azure Pipelines (Fixes issue #9)
120+
if (($null -ne $Env:TF_BUILD) -and ("" -ne $Env:TF_BUILD)) {
121+
Write-Host "##vso[task.prependpath]$binPackageDir"
122+
}
123+
124+
if (($null -ne $Env:TRAVIS) -and ("" -ne $Env:TRAVIS)) {
125+
Write-Host "Configuring Travis aliases."
126+
# We need to fix up refreshenv for Travis
127+
$rc = $Env:HOME + "/.bashrc"
128+
129+
Add-Content $rc "function refreshenv
130+
{
131+
powershell -NonInteractive - <<\EOF
132+
Import-Module -Force `"`$env:ChocolateyInstall\helpers\chocolateyProfile.psm1`"
133+
`$pref = `$ErrorActionPreference
134+
`$ErrorActionPreference = 'SilentlyContinue'
135+
Update-SessionEnvironment
136+
`$ErrorActionPreference = `$pref
137+
# Round brackets in variable names cause problems with bash
138+
Get-ChildItem env:* | %{
139+
if (!(`$_.Name.Contains('('))) {
140+
`$value = `$_.Value
141+
if (`$_.Name -eq 'PATH') {
142+
`$value = `$value -replace ';',':'
143+
}
144+
Write-Output (`"export `" + `$_.Name + `"='`" + `$value + `"'`")
145+
}
146+
} | Out-File -Encoding ascii $env:TEMP\refreshenv.sh
147+
EOF
148+
149+
source `"$env:TEMP/refreshenv.sh`"
150+
}
151+
152+
alias RefreshEnv=refreshenv"
153+
154+
Write-Host "Ok, updated ~/.bashrc, source to use refreshenv."
155+
}
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
$version = '9.2.5'
2+
$packageName = 'ghc'
3+
$url = 'https://downloads.haskell.org/~ghc/8.6.5/ghc-8.6.5-i386-unknown-mingw32.tar.xz'
4+
$binSha256 = '6dc0e79a37510905074bcf7e8af9014bd5f899791a6739876ef703de9011e0e6'
5+
$variant = ''
6+
$pp = Get-PackageParameters
7+
if ($pp['integer-simple']) {
8+
$variant = '-integer-simple'
9+
$binSha256 = '7abcff01e7cd390860e7f7a64d070b613819a2c21314cadeddac452b2ca03a32'
10+
}
11+
$baseTarget = 'ghc-' + $version + '-x86_64-unknown-mingw32'
12+
$target = $baseTarget + $variant
13+
$url64 = 'https://downloads.haskell.org/~ghc/9.2.5/' + $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)