Skip to content

Commit 0f5f60e

Browse files
committed
Fix gnu static extension build test
1 parent 9fe09f5 commit 0f5f60e

File tree

2 files changed

+49
-27
lines changed

2 files changed

+49
-27
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,5 +197,5 @@ jobs:
197197
run: php src/globals/test-extensions.php build_cmd ${{ matrix.os }} ${{ matrix.php }}
198198

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

src/globals/test-extensions.php

Lines changed: 48 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,39 @@ function quote2(string $param): string
132132
$install_upx_cmd = 'install-pkg upx';
133133
}
134134

135+
$prefix = match ($argv[2] ?? null) {
136+
'windows-latest', 'windows-2022', 'windows-2019', 'windows-2025' => 'powershell.exe -file .\bin\spc.ps1 ',
137+
'ubuntu-latest' => 'bin/spc-alpine-docker ',
138+
'ubuntu-24.04', 'ubuntu-24.04-arm' => './bin/spc ',
139+
'ubuntu-22.04', 'ubuntu-22.04-arm' => 'bin/spc-gnu-docker ',
140+
default => 'bin/spc ',
141+
};
142+
143+
// shared_extension build
144+
if ($shared_extensions) {
145+
switch ($argv[2] ?? null) {
146+
case 'ubuntu-22.04':
147+
case 'ubuntu-22.04-arm':
148+
$shared_cmd = ' --build-shared=' . quote2($shared_extensions) . ' ';
149+
break;
150+
case 'macos-13':
151+
case 'macos-14':
152+
$shared_cmd = ' --build-shared=' . quote2($shared_extensions) . ' ';
153+
$no_strip = true;
154+
break;
155+
default:
156+
$shared_cmd = '';
157+
break;
158+
}
159+
} else {
160+
$shared_cmd = '';
161+
}
162+
135163
// generate build command
136164
if ($argv[1] === 'build_cmd' || $argv[1] === 'build_embed_cmd') {
137165
$build_cmd = 'build ';
138166
$build_cmd .= quote2($final_extensions) . ' ';
139-
$build_cmd .= $shared_extensions && getenv('SPC_LIBC') === 'glibc' ? '--build-shared=' . quote2($shared_extensions) . ' ' : '';
167+
$build_cmd .= $shared_cmd;
140168
$build_cmd .= $zts ? '--enable-zts ' : '';
141169
$build_cmd .= $no_strip ? '--no-strip ' : '';
142170
$build_cmd .= $upx ? '--with-upx-pack ' : '';
@@ -164,31 +192,25 @@ function quote2(string $param): string
164192
default => '',
165193
};
166194

167-
$prefix = match ($argv[2] ?? null) {
168-
'windows-latest', 'windows-2022', 'windows-2019', 'windows-2025' => 'powershell.exe -file .\bin\spc.ps1 ',
169-
'ubuntu-latest' => 'bin/spc-alpine-docker ',
170-
'ubuntu-24.04', 'ubuntu-24.04-arm' => './bin/spc ',
171-
'ubuntu-22.04', 'ubuntu-22.04-arm' => 'bin/spc-gnu-docker ',
172-
default => 'bin/spc ',
173-
};
174-
175-
if ($argv[1] === 'download_cmd') {
176-
passthru($prefix . $down_cmd, $retcode);
177-
} elseif ($argv[1] === 'build_cmd') {
178-
passthru($prefix . $build_cmd . ' --build-cli --build-micro', $retcode);
179-
} elseif ($argv[1] === 'build_embed_cmd') {
180-
if (str_starts_with($argv[2], 'windows-')) {
181-
// windows does not accept embed SAPI
182-
passthru($prefix . $build_cmd . ' --build-cli', $retcode);
183-
} else {
184-
passthru($prefix . $build_cmd . ' --build-embed', $retcode);
185-
}
186-
} elseif ($argv[1] === 'doctor_cmd') {
187-
passthru($prefix . $doctor_cmd, $retcode);
188-
} elseif ($argv[1] === 'install_upx_cmd') {
189-
passthru($prefix . $install_upx_cmd, $retcode);
190-
} else {
191-
$retcode = 0;
195+
switch ($argv[1] ?? null) {
196+
case 'download_cmd':
197+
passthru($prefix . $down_cmd, $retcode);
198+
break;
199+
case 'build_cmd':
200+
passthru($prefix . $build_cmd . ' --build-cli --build-micro', $retcode);
201+
break;
202+
case 'build_embed_cmd':
203+
passthru($prefix . $build_cmd . (str_starts_with($argv[2], 'windows-') ? ' --build-cli' : ' --build-embed'), $retcode);
204+
break;
205+
case 'doctor_cmd':
206+
passthru($prefix . $doctor_cmd, $retcode);
207+
break;
208+
case 'install_upx_cmd':
209+
passthru($prefix . $install_upx_cmd, $retcode);
210+
break;
211+
default:
212+
$retcode = 0;
213+
break;
192214
}
193215

194216
exit($retcode);

0 commit comments

Comments
 (0)