mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-08 01:15:37 +08:00
Add windows php cli builds, support micro patches
This commit is contained in:
@@ -99,7 +99,7 @@ class PackageBuilder
|
||||
|
||||
// ignore copy to self
|
||||
if (realpath($src) !== realpath($dst)) {
|
||||
shell()->exec('cp ' . escapeshellarg($src) . ' ' . escapeshellarg($dst));
|
||||
FileSystem::copy($src, $dst);
|
||||
}
|
||||
|
||||
// file exist
|
||||
@@ -111,7 +111,7 @@ class PackageBuilder
|
||||
$this->extractDebugInfo($dst);
|
||||
|
||||
// strip
|
||||
if (!$this->getOption('no-strip')) {
|
||||
if (!$this->getOption('no-strip') && SystemTarget::isUnix()) {
|
||||
$this->stripBinary($dst);
|
||||
}
|
||||
|
||||
@@ -123,6 +123,9 @@ class PackageBuilder
|
||||
}
|
||||
logger()->info("Compressing {$dst} with UPX");
|
||||
shell()->exec(getenv('UPX_EXEC') . " --best {$dst}");
|
||||
} elseif ($upx_option && SystemTarget::getTargetOS() === 'Windows' && $executable) {
|
||||
logger()->info("Compressing {$dst} with UPX");
|
||||
shell()->exec(getenv('UPX_EXEC') . ' --best ' . escapeshellarg($dst));
|
||||
}
|
||||
|
||||
return $dst;
|
||||
@@ -136,12 +139,13 @@ class PackageBuilder
|
||||
public function extractDebugInfo(string $binary_path): string
|
||||
{
|
||||
$target_dir = BUILD_ROOT_PATH . '/debug';
|
||||
FileSystem::createDir($target_dir);
|
||||
$basename = basename($binary_path);
|
||||
$debug_file = "{$target_dir}/{$basename}" . (SystemTarget::getTargetOS() === 'Darwin' ? '.dwarf' : '.debug');
|
||||
if (SystemTarget::getTargetOS() === 'Darwin') {
|
||||
FileSystem::createDir($target_dir);
|
||||
shell()->exec("dsymutil -f {$binary_path} -o {$debug_file}");
|
||||
} elseif (SystemTarget::getTargetOS() === 'Linux') {
|
||||
FileSystem::createDir($target_dir);
|
||||
if ($eu_strip = LinuxUtil::findCommand('eu-strip')) {
|
||||
shell()
|
||||
->exec("{$eu_strip} -f {$debug_file} {$binary_path}")
|
||||
@@ -152,7 +156,8 @@ class PackageBuilder
|
||||
->exec("objcopy --add-gnu-debuglink={$debug_file} {$binary_path}");
|
||||
}
|
||||
} else {
|
||||
throw new SPCInternalException('extractDebugInfo is only supported on Linux and macOS');
|
||||
logger()->debug('extractDebugInfo is only supported on Linux and macOS');
|
||||
return '';
|
||||
}
|
||||
return $debug_file;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user