Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
win32-tarballs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Glasgow Haskell Compiler
win32-tarballs
Merge requests
!5
Drop ghc-jailbreak submodule
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Drop ghc-jailbreak submodule
subtree
into
master
Overview
0
Commits
45
Pipelines
3
Changes
47
Merged
Ben Gamari
requested to merge
subtree
into
master
4 years ago
Overview
0
Commits
45
Pipelines
3
Changes
47
Expand
Turning it rather into a subtree. This should make it a bit easier to bump ghc-jailbreak.
0
0
Merge request reports
Compare
master
version 2
827b4e8b
4 years ago
version 1
e359f1aa
4 years ago
master (base)
and
latest version
latest version
0f45557a
45 commits,
4 years ago
version 2
827b4e8b
1 commit,
4 years ago
version 1
e359f1aa
1 commit,
4 years ago
47 files
+
5613
−
3
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
47
Search (e.g. *.vue) (Ctrl+P)
ghc-jailbreak/chocolatey/0.0.1/ghc/tools/Patch-GHC.psm1
0 → 100644
+
78
−
0
Options
function
Use-PatchGHC
{
param
(
[
string
]
$name
,
[
string
]
$patchtool
,
[
string
]
$redistdir
,
[
bool
]
$install
=
$true
)
$proc
=
Execute-Command
$name
'--info'
-PassThru
if
(
$proc
.
ExitCode
-ne
0
)
{
throw
(
"Command
`'
$name
--info
`'
did not complete successfully. ExitCode: "
+
$proc
.
ExitCode
)
}
$infoTable
=
$proc
.
stdout
$paths
=
$infoTable
-split
'[\r\n]'
`
|
Select-String
"C compiler command"
-SimpleMatch
`
|
ForEach-Object
{
$_
.
ToString
()
.
Split
(
'"'
)
}
`
|
Where-Object
{
$_
-notlike
$null
}
`
|
ForEach-Object
{
Split-Path
$_
-Resolve
-ErrorAction
Ignore
}
if
(
$install
-eq
$true
)
{
$action
=
"install"
}
else
{
$action
=
"uninstall"
}
foreach
(
$path
in
$paths
)
{
$lst1
=
Get-ChildItem
"
$path
/.."
-Filter
*.
exe
-Recurse
$files
=
$lst1
Write-Debug
"Inspecting
`'
$path
`'
."
$i
=
0
$ix
=
100
/
$files
.
Count
foreach
(
$file
in
$files
)
{
Write-Progress
-Activity
Patching
-Status
'Jailbreaking...'
`
-PercentComplete
$i
-CurrentOperation
$file
.
FullName
$proc
=
Execute-Command
$patchtool
@(
$action
,
$file
.FullName
)
$toolOutput
=
$proc
.
stdout
Write-Debug
$toolOutput
if
(
$proc
.
ExitCode
-ne
0
)
{
throw
(
"Could not patch
`'
$file
`'
. ExitCode: "
+
$proc
.
ExitCode
)
}
Write-Debug
(
"Patched executable. Copying runtimes."
)
Get-ChildItem
-Path
$redistdir
-Filter
*.
dll
`
|
ForEach-Object
{
Copy-Item
-Path
$_
.
FullName
-Destination
`
$file
.
Directory
.
FullName
-Force
;
}
$i
+=
$ix
Write-Progress
-Activity
Patching
-Status
'Jailbreaking...'
`
-PercentComplete
$i
-CurrentOperation
$file
.
FullName
}
}
Write-Host
"Done patching GHC's Mingw-w64 distribution. Good to go."
}
Function
Execute-Command
(
$commandPath
,
$commandArguments
)
{
Try
{
$pinfo
=
New-Object
System.Diagnostics.ProcessStartInfo
$pinfo
.
FileName
=
$commandPath
$pinfo
.
RedirectStandardError
=
$false
$pinfo
.
RedirectStandardOutput
=
$true
$pinfo
.
UseShellExecute
=
$false
$pinfo
.
WindowStyle
=
'Hidden'
$pinfo
.
CreateNoWindow
=
$true
$pinfo
.
Arguments
=
$commandArguments
$p
=
New-Object
System.Diagnostics.Process
$p
.
StartInfo
=
$pinfo
$p
.
Start
()
|
Out-Null
[
pscustomobject
]@{
stdout
=
$p
.
StandardOutput
.
ReadToEnd
()
ExitCode
=
$p
.
ExitCode
}
$p
.
WaitForExit
()
}
Catch
{
exit
}
}
Export-ModuleMember
-Function
"Use-PatchGHC"
\ No newline at end of file
Loading