Skip to content

Commit d9679cb

Browse files
committed
Revert "CI: Remove patch wrapper from Azure pipeline"
This reverts commit 2bc8f4e.
1 parent 2bc8f4e commit d9679cb

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

azure-pipelines.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
ARCHITECTURE: x64
3838
CONFIGURATION: Release
3939
WINSTORE: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0.22621.0"
40+
USE_PATCH_WRAPPER: 'true'
4041

4142
workspace:
4243
clean: all
@@ -53,12 +54,68 @@ jobs:
5354
echo $(app_id) . . > definition/$(app_id)/$(app_id).txt
5455
mklink /J "$(Pipeline.Workspace)/$(app_id)" "$(Build.SourcesDirectory)"
5556
57+
- powershell: |
58+
$patchDir = 'C:\Strawberry\c\bin'
59+
$patchExe = Join-Path $patchDir 'patch.exe'
60+
$realExe = Join-Path $patchDir 'patch-real.exe'
61+
$src = Join-Path $env:TEMP 'patch-wrapper.cs'
62+
$out = Join-Path $patchDir 'patch.exe'
63+
64+
if (-not (Test-Path $realExe)) {
65+
Rename-Item $patchExe 'patch-real.exe'
66+
}
67+
68+
@'
69+
using System;
70+
using System.Diagnostics;
71+
72+
class PatchWrapper
73+
{
74+
static int Main(string[] args)
75+
{
76+
var psi = new ProcessStartInfo();
77+
psi.FileName = @"C:\Strawberry\c\bin\patch-real.exe";
78+
psi.UseShellExecute = false;
79+
80+
var quoted = new string[args.Length];
81+
for (int i = 0; i < args.Length; i++)
82+
quoted[i] = "\"" + args[i].Replace("\"", "\\\"") + "\"";
83+
84+
bool useBinary = false;
85+
for (int i = 0; i < args.Length; i++)
86+
{
87+
if (args[i].IndexOf("dlfcn-win32", StringComparison.OrdinalIgnoreCase) >= 0)
88+
{
89+
useBinary = true;
90+
break;
91+
}
92+
}
93+
94+
psi.Arguments =
95+
(useBinary ? "--binary " : "") + string.Join(" ", quoted);
96+
97+
var p = Process.Start(psi);
98+
p.WaitForExit();
99+
return p.ExitCode;
100+
}
101+
}
102+
'@ | Set-Content $src -Encoding Ascii
103+
104+
& "$env:WINDIR\Microsoft.NET\Framework64\v4.0.30319\csc.exe" `
105+
/nologo /target:exe /out:$out $src
106+
displayName: "Replace Strawberry patch.exe with --binary wrapper"
107+
condition: and(succeeded(), eq(variables['USE_PATCH_WRAPPER'], 'true'))
108+
56109
- task: CMake@1
110+
env:
111+
PATHEXT: $(PATHEXT)
57112
inputs:
58113
workingDirectory: 'build'
59114
cmakeArgs: '-T host=x64 -G "$(GENERATOR)" -A $(ARCHITECTURE) $(WINSTORE) -DADDONS_TO_BUILD=$(app_id) -DCMAKE_BUILD_TYPE=$(CONFIGURATION) -DADDONS_DEFINITION_DIR=$(Pipeline.Workspace)/$(app_id)/build/definition -DADDON_SRC_PREFIX=../.. -DCMAKE_INSTALL_PREFIX=../../kodi/addons -DPACKAGE_ZIP=1 ../../kodi/cmake/addons'
60115

61116
- task: CMake@1
117+
env:
118+
PATHEXT: $(PATHEXT)
62119
inputs:
63120
workingDirectory: 'build'
64121
cmakeArgs: '--build . --config $(CONFIGURATION) --target $(app_id)'

0 commit comments

Comments
 (0)