Skip to content

Commit 24b2426

Browse files
committed
Add patch to portfile
1 parent 7556272 commit 24b2426

File tree

4 files changed

+58
-0
lines changed

4 files changed

+58
-0
lines changed

src/VcpkgPortOverlay/CreatePortOverlay.ps1

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,58 @@ function Select-DirectoryInPatch
9999
return $result
100100
}
101101

102+
# Adds a patch to a portfile.cmake
103+
function Add-PatchToPortFile
104+
{
105+
param(
106+
[Parameter(Mandatory)]
107+
[string]$Port,
108+
[Parameter(Mandatory)]
109+
[string]$PatchName
110+
)
111+
112+
<#
113+
We're looking for a section that looks like this:
114+
115+
vcpkg_from_github(
116+
OUT_SOURCE_PATH SOURCE_PATH
117+
REPO <user/repo>
118+
REF <commith hash>
119+
SHA512 <hash>
120+
HEAD_REF master
121+
PATCHES
122+
patch-1.patch
123+
patch-2.patch
124+
)
125+
126+
We look for the line that says "PATCHES" and add the new patch before the closing parenthesis
127+
#>
128+
129+
$portFilePath = Join-Path $OverlayRoot $Port "portfile.cmake"
130+
$originalPortFile = Get-Content $portFilePath
131+
132+
$modifiedPortFile = @()
133+
foreach ($line in $originalPortFile)
134+
{
135+
if (-not $foundParen)
136+
{
137+
if ($line.EndsWith("PATCHES"))
138+
{
139+
$foundPatches = $true
140+
}
141+
elseif ($line -eq ")")
142+
{
143+
$modifiedPortFile += " $PatchName"
144+
$foundParen = $true
145+
}
146+
}
147+
148+
$modifiedPortFile += $line
149+
}
150+
151+
$modifiedPortFile | Out-File $portFilePath
152+
}
153+
102154
# Adds a patch to a port
103155
function Add-PatchToPort
104156
{
@@ -123,6 +175,8 @@ function Add-PatchToPort
123175

124176
$portDir = Join-Path $OverlayRoot $Port
125177
$patch | Out-File (Join-Path $portDir $PatchName)
178+
179+
Add-PatchToPortFile -Port $Port -PatchName $PatchName
126180
}
127181

128182
New-PortOverlay cpprestsdk

src/VcpkgPortOverlay/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
This directory contains an overlay for vcpkg ports, for cases where we need to apply local patches.
44
In all cases, most of the recipe is taken from the [official vcpkg registry](https://github.com/Microsoft/vcpkg), and we only add a patch.
55

6+
The whole directory can be re-created with `.\CreatePortOverlay.ps1`
7+
68
## cpprestsdk
79

810
We add support for certificate pinning.

src/VcpkgPortOverlay/cpprestsdk/portfile.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ vcpkg_from_github(
1111
fix-clang-dllimport.patch # workaround for https://github.com/microsoft/cpprestsdk/issues/1710
1212
silence-stdext-checked-array-iterators-warning.patch
1313
fix-asio-error.patch
14+
add-server-certificate-validation.patch
1415
)
1516

1617
vcpkg_check_features(

src/VcpkgPortOverlay/libyaml/portfile.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ vcpkg_from_github(
1111
PATCHES
1212
${PATCHES}
1313
export-pkgconfig.patch
14+
fix-parser-nesting.patch
1415
)
1516

1617
vcpkg_cmake_configure(

0 commit comments

Comments
 (0)