forked from WebKitForWindows/WebKitRequirements
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPatch-RequirementSource.ps1
More file actions
63 lines (50 loc) · 1.76 KB
/
Copy pathPatch-RequirementSource.ps1
File metadata and controls
63 lines (50 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<#
.Synopsis
Patches the source code so it can build successfully.
.Details
The patching process will make any changes necessary to the build
system to get things working.
.Parameter Root
The root directory of the source code. Defaults to current directory.
#>
Param(
[string] $root = '.',
[string] $patchPath = 'patches'
)
#----------------------------------------------------------------------
# Patch function
#----------------------------------------------------------------------
Function Patch-Requirement {
Param(
[Parameter(Mandatory)]
[string] $name
)
$sourcePath = Join-Path $patchPath $name;
$substringLength = $sourcePath.Length + 1;
$destinationPath = Join-Path $root $name;
$items = Get-ChildItem $sourcePath -Recurse;
Write-Host ('Copying files from {0} to {1}' -f $sourcePath, $destinationPath)
foreach ($item in $items) {
$itemName = $item.FullName;
$relativePath = $itemName.Substring($substringLength);
$target = Join-Path $destinationPath $relativePath;
if (!($item -is [System.IO.DirectoryInfo])) {
Write-Host ('Copying {0}' -f $relativePath);
Copy-Item $itemName -Destination $target;
} elseif (!(Test-Path $target)) {
Write-Host ('Creating directory {0}' -f $relativePath);
New-Item $target -Type Directory
}
}
}
#----------------------------------------------------------------------
# Patch all
#----------------------------------------------------------------------
$root = (Resolve-Path -Path $root).Path;
$patchPath = (Resolve-Path -Path $patchPath).Path;
Patch-Requirement -Name 'libwebp';
Patch-Requirement -Name 'sqlite';
Patch-Requirement -Name 'libxml2';
Patch-Requirement -Name 'pixman';
Patch-Requirement -Name 'cairo';
Patch-Requirement -Name 'icu';