Skip to content

Commit bab330b

Browse files
committed
Unify CGI deploy functions
1 parent b59a06f commit bab330b

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/SPC/builder/windows/WindowsBuilder.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,7 @@ public function buildCgi(): void
176176

177177
cmd()->cd(SOURCE_PATH . '\php-src')->exec("{$this->sdk_prefix} nmake_cgi_wrapper.bat --task-args php-cgi.exe");
178178

179-
// deploy cgi binary
180-
logger()->info('Deploying cgi file');
181-
FileSystem::createDir(BUILD_BIN_PATH);
182-
183-
cmd()->exec('copy ' . escapeshellarg(SOURCE_PATH . '\php-src\x64\Release' . ($this->zts ? '_TS' : '') . '\php-cgi.exe') . ' ' . escapeshellarg(BUILD_BIN_PATH . '\php-cgi.exe'));
179+
$this->deployBinary(BUILD_TARGET_CGI);
184180
}
185181

186182
public function buildEmbed(): void
@@ -346,12 +342,13 @@ public function deployBinary(int $type): bool
346342
$src = match ($type) {
347343
BUILD_TARGET_CLI => SOURCE_PATH . "\\php-src\\x64\\Release{$ts}\\php.exe",
348344
BUILD_TARGET_MICRO => SOURCE_PATH . "\\php-src\\x64\\Release{$ts}\\micro.sfx",
345+
BUILD_TARGET_CGI => SOURCE_PATH . "\\php-src\\x64\\Release{$ts}\\php-cgi.exe",
349346
default => throw new SPCInternalException("Deployment does not accept type {$type}"),
350347
};
351348

352349
// with-upx-pack for cli and micro
353350
if ($this->getOption('with-upx-pack', false)) {
354-
if ($type === BUILD_TARGET_CLI || ($type === BUILD_TARGET_MICRO && version_compare($this->getMicroVersion(), '0.2.0') >= 0)) {
351+
if ($type === BUILD_TARGET_CLI || $type === BUILD_TARGET_CGI || ($type === BUILD_TARGET_MICRO && version_compare($this->getMicroVersion(), '0.2.0') >= 0)) {
355352
cmd()->exec(getenv('UPX_EXEC') . ' --best ' . escapeshellarg($src));
356353
}
357354
}

src/SPC/store/SourcePatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ public static function patchWindowsCLITarget(): void
571571
*/
572572
public static function patchWindowsCGITarget(): void
573573
{
574-
// search Makefile code line contains "$(BUILD_DIR)\php.exe:"
574+
// search Makefile code line contains "$(BUILD_DIR)\php-cgi.exe:"
575575
$content = FileSystem::readFile(SOURCE_PATH . '/php-src/Makefile');
576576
$lines = explode("\r\n", $content);
577577
$line_num = 0;

0 commit comments

Comments
 (0)