Fix gnu static extension build test

This commit is contained in:
crazywhalecc 2025-04-19 15:18:48 +08:00
parent 9fe09f57f6
commit 0f5f60e477
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
2 changed files with 49 additions and 27 deletions

View File

@ -197,5 +197,5 @@ jobs:
run: php src/globals/test-extensions.php build_cmd ${{ matrix.os }} ${{ matrix.php }} run: php src/globals/test-extensions.php build_cmd ${{ matrix.os }} ${{ matrix.php }}
- name: "Run Build Tests (build - embed for non-windows)" - name: "Run Build Tests (build - embed for non-windows)"
if: matrix.os != 'windows-latest' if: ${{ !startsWith(matrix.os, 'windows-') }}
run: php src/globals/test-extensions.php build_embed_cmd ${{ matrix.os }} ${{ matrix.php }} run: php src/globals/test-extensions.php build_embed_cmd ${{ matrix.os }} ${{ matrix.php }}

View File

@ -132,11 +132,39 @@ if ($argv[1] === 'install_upx_cmd') {
$install_upx_cmd = 'install-pkg upx'; $install_upx_cmd = 'install-pkg upx';
} }
$prefix = match ($argv[2] ?? null) {
'windows-latest', 'windows-2022', 'windows-2019', 'windows-2025' => 'powershell.exe -file .\bin\spc.ps1 ',
'ubuntu-latest' => 'bin/spc-alpine-docker ',
'ubuntu-24.04', 'ubuntu-24.04-arm' => './bin/spc ',
'ubuntu-22.04', 'ubuntu-22.04-arm' => 'bin/spc-gnu-docker ',
default => 'bin/spc ',
};
// shared_extension build
if ($shared_extensions) {
switch ($argv[2] ?? null) {
case 'ubuntu-22.04':
case 'ubuntu-22.04-arm':
$shared_cmd = ' --build-shared=' . quote2($shared_extensions) . ' ';
break;
case 'macos-13':
case 'macos-14':
$shared_cmd = ' --build-shared=' . quote2($shared_extensions) . ' ';
$no_strip = true;
break;
default:
$shared_cmd = '';
break;
}
} else {
$shared_cmd = '';
}
// generate build command // generate build command
if ($argv[1] === 'build_cmd' || $argv[1] === 'build_embed_cmd') { if ($argv[1] === 'build_cmd' || $argv[1] === 'build_embed_cmd') {
$build_cmd = 'build '; $build_cmd = 'build ';
$build_cmd .= quote2($final_extensions) . ' '; $build_cmd .= quote2($final_extensions) . ' ';
$build_cmd .= $shared_extensions && getenv('SPC_LIBC') === 'glibc' ? '--build-shared=' . quote2($shared_extensions) . ' ' : ''; $build_cmd .= $shared_cmd;
$build_cmd .= $zts ? '--enable-zts ' : ''; $build_cmd .= $zts ? '--enable-zts ' : '';
$build_cmd .= $no_strip ? '--no-strip ' : ''; $build_cmd .= $no_strip ? '--no-strip ' : '';
$build_cmd .= $upx ? '--with-upx-pack ' : ''; $build_cmd .= $upx ? '--with-upx-pack ' : '';
@ -164,31 +192,25 @@ echo match ($argv[1]) {
default => '', default => '',
}; };
$prefix = match ($argv[2] ?? null) { switch ($argv[1] ?? null) {
'windows-latest', 'windows-2022', 'windows-2019', 'windows-2025' => 'powershell.exe -file .\bin\spc.ps1 ', case 'download_cmd':
'ubuntu-latest' => 'bin/spc-alpine-docker ', passthru($prefix . $down_cmd, $retcode);
'ubuntu-24.04', 'ubuntu-24.04-arm' => './bin/spc ', break;
'ubuntu-22.04', 'ubuntu-22.04-arm' => 'bin/spc-gnu-docker ', case 'build_cmd':
default => 'bin/spc ', passthru($prefix . $build_cmd . ' --build-cli --build-micro', $retcode);
}; break;
case 'build_embed_cmd':
if ($argv[1] === 'download_cmd') { passthru($prefix . $build_cmd . (str_starts_with($argv[2], 'windows-') ? ' --build-cli' : ' --build-embed'), $retcode);
passthru($prefix . $down_cmd, $retcode); break;
} elseif ($argv[1] === 'build_cmd') { case 'doctor_cmd':
passthru($prefix . $build_cmd . ' --build-cli --build-micro', $retcode); passthru($prefix . $doctor_cmd, $retcode);
} elseif ($argv[1] === 'build_embed_cmd') { break;
if (str_starts_with($argv[2], 'windows-')) { case 'install_upx_cmd':
// windows does not accept embed SAPI passthru($prefix . $install_upx_cmd, $retcode);
passthru($prefix . $build_cmd . ' --build-cli', $retcode); break;
} else { default:
passthru($prefix . $build_cmd . ' --build-embed', $retcode); $retcode = 0;
} break;
} elseif ($argv[1] === 'doctor_cmd') {
passthru($prefix . $doctor_cmd, $retcode);
} elseif ($argv[1] === 'install_upx_cmd') {
passthru($prefix . $install_upx_cmd, $retcode);
} else {
$retcode = 0;
} }
exit($retcode); exit($retcode);