Skip to content

Commit 7be9fa2

Browse files
committed
Use official commit after finding it
1 parent 3c57ee3 commit 7be9fa2

File tree

6 files changed

+58
-4337
lines changed

6 files changed

+58
-4337
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ settings.json
2020
[Rr]eleases/
2121
x64/
2222
x86/
23+
arm64/
2324
AnyCPU/
2425
Fuzzing/
2526
bld/

src/VcpkgPortOverlay/CreatePortOverlay.ps1

Lines changed: 43 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,44 @@ function Add-PatchToPortFile
208208
$modifiedPortFile | Out-File $portFilePath
209209
}
210210

211+
# Removes all patches from portfile.cmake
212+
function Remove-PortPatches
213+
{
214+
param(
215+
[Parameter(Mandatory)]
216+
[string]$Port
217+
)
218+
219+
# Look for the line that says "PATCHES"
220+
221+
$portFilePath = Join-Path $OverlayRoot $Port "portfile.cmake"
222+
$originalPortFile = Get-Content $portFilePath
223+
224+
$modifiedPortFile = @()
225+
foreach ($line in $originalPortFile)
226+
{
227+
if ($line.TrimEnd().EndsWith("PATCHES"))
228+
{
229+
$foundPatches = $true
230+
}
231+
elseif ($line -eq ")")
232+
{
233+
$foundParen = $true
234+
$modifiedPortFile += $line
235+
}
236+
elseif ($foundPatches -and -not $foundParen)
237+
{
238+
# Drop line
239+
}
240+
else
241+
{
242+
$modifiedPortFile += $line
243+
}
244+
}
245+
246+
$modifiedPortFile | Out-File $portFilePath
247+
}
248+
211249
# Adds a patch to a port
212250
function Add-PatchToPort
213251
{
@@ -236,26 +274,6 @@ function Add-PatchToPort
236274
Add-PatchToPortFile -Port $Port -PatchName $PatchName
237275
}
238276

239-
# Copies a patch to a port
240-
function Copy-PatchToPort
241-
{
242-
param(
243-
[Parameter(Mandatory)]
244-
[string]$Port,
245-
[Parameter(Mandatory)]
246-
[string]$PatchPath, # overlay relative directory
247-
[Parameter(Mandatory)]
248-
[string]$PatchName
249-
)
250-
251-
$portSource = Join-Path $OverlayRoot $PatchPath $PatchName
252-
253-
$portDir = Join-Path $OverlayRoot $Port
254-
Copy-Item -Path $portSource -Destination (Join-Path $portDir $PatchName)
255-
256-
Add-PatchToPortFile -Port $Port -PatchName $PatchName
257-
}
258-
259277
# Sets the value of an existing function parameter.
260278
# For example, REF in vcpkg_from_github
261279
function Set-ParameterInPortFile
@@ -295,13 +313,12 @@ function Update-PortSource
295313
[Parameter(Mandatory)]
296314
[string]$Commit,
297315
[Parameter(Mandatory)]
298-
[string]$SourceHash
316+
[string]$SourceHash,
317+
[string]$RefPattern = '[0-9a-f]{40}( #.*)?$'
299318
)
300319

301-
$portDir = Join-Path $OverlayRoot $Port
302-
303320
# For the REF, we also delete any comments after it that may say the wrong version
304-
Set-ParameterInPortFile $Port -ParameterName 'REF' -CurrentValuePattern '[0-9a-f]{40}( #.*)?$' -NewValue "$Commit # Unreleased"
321+
Set-ParameterInPortFile $Port -ParameterName 'REF' -CurrentValuePattern $RefPattern -NewValue "$Commit # Unreleased"
305322
Set-ParameterInPortFile $Port -ParameterName 'SHA512' -CurrentValuePattern '[0-9a-f]{128}' -NewValue $SourceHash
306323
}
307324

@@ -323,7 +340,8 @@ New-PortOverlay cpprestsdk -Version 2.10.18 -PortVersion 4
323340
Add-PatchToPort cpprestsdk -PatchRepo 'microsoft/winget-cli' -PatchCommit '888b4ed8f4f7d25cb05a47210e083fe29348163b' -PatchName 'add-server-certificate-validation.patch' -PatchRoot 'src/cpprestsdk/cpprestsdk'
324341

325342
New-PortOverlay detours -Version 4.0.1 -PortVersion 8
326-
Copy-PatchToPort detours -PatchPath 'detours_manual' -PatchName 'undockedregfreewinrt-version.patch'
343+
Update-PortSource detours -RefPattern 'v4.0.1' -Commit '404c153ff390cb14f1787c7feeb4908c6d79b0ab' -SourceHash '1f3f26657927fa153116dce13dbfa3319ea368e6c9017f4999b6ec24d6356c335b3d5326718d3ec707b92832763ffea092088df52596f016d7ca9b8127f7033d'
344+
Remove-PortPatches detours
327345

328346
New-PortOverlay libyaml -Version 0.2.5 -PortVersion 5
329347
Update-PortSource libyaml -Commit '840b65c40675e2d06bf40405ad3f12dec7f35923' -SourceHash 'de85560312d53a007a2ddf1fe403676bbd34620480b1ba446b8c16bb366524ba7a6ed08f6316dd783bf980d9e26603a9efc82f134eb0235917b3be1d3eb4b302'

src/VcpkgPortOverlay/README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,18 @@ Note that we use v2.10.18, which is not the latest.
1212

1313
Changes:
1414
* Add patch file: `add-server-certificate-validation.patch`
15-
Patch source: https://github.com/microsoft/winget-cli/commit/888b4ed8f4f7d25cb05a47210e083fe29348163b
15+
* Patch source: https://github.com/microsoft/winget-cli/commit/888b4ed8f4f7d25cb05a47210e083fe29348163b
16+
17+
## detours
18+
19+
We use the version used by UndockedRegFreeWinRT (https://github.com/microsoft/winget-cli/tree/release-v1.10/src/Xlang/UndockedRegFreeWinRT/src/UndockedRegFreeWinRT/detours).
20+
The only official release of detours (4.0.1) does not include complete support for ARM64.
21+
While the exact version that we pulled from UndockedRegFreeWinRT is unclear (https://github.com/microsoft/xlang/pull/644), through manually comparing versions it is equivalent to
22+
https://github.com/microsoft/Detours/commit/404c153ff390cb14f1787c7feeb4908c6d79b0ab (only some whitespace changes are present).
23+
24+
Changes:
25+
* New source commit: https://github.com/microsoft/Detours/commit/404c153ff390cb14f1787c7feeb4908c6d79b0ab
26+
* Remove the patch on the official port as it is already present in the newer commit
1627

1728
## libyaml
1829

src/VcpkgPortOverlay/detours/portfile.cmake

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
33
vcpkg_from_github(
44
OUT_SOURCE_PATH SOURCE_PATH
55
REPO microsoft/Detours
6-
REF v4.0.1
7-
SHA512 0a9c21b8222329add2de190d2e94d99195dfa55de5a914b75d380ffe0fb787b12e016d0723ca821001af0168fd1643ffd2455298bf3de5fdc155b3393a3ccc87
6+
REF 404c153ff390cb14f1787c7feeb4908c6d79b0ab # Unreleased
7+
SHA512 1f3f26657927fa153116dce13dbfa3319ea368e6c9017f4999b6ec24d6356c335b3d5326718d3ec707b92832763ffea092088df52596f016d7ca9b8127f7033d
88
HEAD_REF master
9-
PATCHES
10-
find-jmp-bounds-arm64.patch
11-
undockedregfreewinrt-version.patch
129
)
1310

1411
vcpkg_build_nmake(

0 commit comments

Comments
 (0)