mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 12:54:52 +08:00
Unify CGI deploy functions
This commit is contained in:
parent
b59a06face
commit
bab330b64e
@ -176,11 +176,7 @@ class WindowsBuilder extends BuilderBase
|
|||||||
|
|
||||||
cmd()->cd(SOURCE_PATH . '\php-src')->exec("{$this->sdk_prefix} nmake_cgi_wrapper.bat --task-args php-cgi.exe");
|
cmd()->cd(SOURCE_PATH . '\php-src')->exec("{$this->sdk_prefix} nmake_cgi_wrapper.bat --task-args php-cgi.exe");
|
||||||
|
|
||||||
// deploy cgi binary
|
$this->deployBinary(BUILD_TARGET_CGI);
|
||||||
logger()->info('Deploying cgi file');
|
|
||||||
FileSystem::createDir(BUILD_BIN_PATH);
|
|
||||||
|
|
||||||
cmd()->exec('copy ' . escapeshellarg(SOURCE_PATH . '\php-src\x64\Release' . ($this->zts ? '_TS' : '') . '\php-cgi.exe') . ' ' . escapeshellarg(BUILD_BIN_PATH . '\php-cgi.exe'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildEmbed(): void
|
public function buildEmbed(): void
|
||||||
@ -346,12 +342,13 @@ class WindowsBuilder extends BuilderBase
|
|||||||
$src = match ($type) {
|
$src = match ($type) {
|
||||||
BUILD_TARGET_CLI => SOURCE_PATH . "\\php-src\\x64\\Release{$ts}\\php.exe",
|
BUILD_TARGET_CLI => SOURCE_PATH . "\\php-src\\x64\\Release{$ts}\\php.exe",
|
||||||
BUILD_TARGET_MICRO => SOURCE_PATH . "\\php-src\\x64\\Release{$ts}\\micro.sfx",
|
BUILD_TARGET_MICRO => SOURCE_PATH . "\\php-src\\x64\\Release{$ts}\\micro.sfx",
|
||||||
|
BUILD_TARGET_CGI => SOURCE_PATH . "\\php-src\\x64\\Release{$ts}\\php-cgi.exe",
|
||||||
default => throw new SPCInternalException("Deployment does not accept type {$type}"),
|
default => throw new SPCInternalException("Deployment does not accept type {$type}"),
|
||||||
};
|
};
|
||||||
|
|
||||||
// with-upx-pack for cli and micro
|
// with-upx-pack for cli and micro
|
||||||
if ($this->getOption('with-upx-pack', false)) {
|
if ($this->getOption('with-upx-pack', false)) {
|
||||||
if ($type === BUILD_TARGET_CLI || ($type === BUILD_TARGET_MICRO && version_compare($this->getMicroVersion(), '0.2.0') >= 0)) {
|
if ($type === BUILD_TARGET_CLI || $type === BUILD_TARGET_CGI || ($type === BUILD_TARGET_MICRO && version_compare($this->getMicroVersion(), '0.2.0') >= 0)) {
|
||||||
cmd()->exec(getenv('UPX_EXEC') . ' --best ' . escapeshellarg($src));
|
cmd()->exec(getenv('UPX_EXEC') . ' --best ' . escapeshellarg($src));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -571,7 +571,7 @@ class SourcePatcher
|
|||||||
*/
|
*/
|
||||||
public static function patchWindowsCGITarget(): void
|
public static function patchWindowsCGITarget(): void
|
||||||
{
|
{
|
||||||
// search Makefile code line contains "$(BUILD_DIR)\php.exe:"
|
// search Makefile code line contains "$(BUILD_DIR)\php-cgi.exe:"
|
||||||
$content = FileSystem::readFile(SOURCE_PATH . '/php-src/Makefile');
|
$content = FileSystem::readFile(SOURCE_PATH . '/php-src/Makefile');
|
||||||
$lines = explode("\r\n", $content);
|
$lines = explode("\r\n", $content);
|
||||||
$line_num = 0;
|
$line_num = 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user