try to test with zig?

This commit is contained in:
DubbleClick 2025-07-01 16:21:57 +07:00
parent 55fd7ba8e6
commit 408b3b4060
3 changed files with 12 additions and 6 deletions

View File

@ -34,7 +34,12 @@ while [[ $# -gt 0 ]]; do
esac
done
output=$(zig cc -target ${SPC_TARGET} -lstdc++ ${COMPILER_EXTRA} "${PARSED_ARGS[@]}" 2>&1)
TARGET=""
if [ -n "$SPC_TARGET" ]; then
TARGET="-target $SPC_TARGET"
else
output=$(zig cc $TARGET -lstdc++ $COMPILER_EXTRA "${PARSED_ARGS[@]}" 2>&1)
status=$?
if [ $status -eq 0 ]; then
@ -43,8 +48,8 @@ if [ $status -eq 0 ]; then
fi
if echo "$output" | grep -q "version '.*' in target triple"; then
echo "$output" | grep -v "version '.*' in target triple"
echo "$output" | grep -v "version '.*' in target triple"
exit 0
else
exec zig cc -target ${SPC_TARGET} ${COMPILER_EXTRA} "${PARSED_ARGS[@]}"
exec zig cc $TARGET $COMPILER_EXTRA "${PARSED_ARGS[@]}"
fi

View File

@ -20,7 +20,7 @@ class ToolchainManager
public static function getToolchainClass(): string
{
$libc = getenv('SPC_LIBC');
if ($libc !== false && !getenv('SPC_TARGET')) {
if ($libc && !getenv('SPC_TARGET')) {
// TODO: @crazywhalecc this breaks tests
// logger()->warning('SPC_LIBC is deprecated, please use SPC_TARGET instead.');
return match ($libc) {

View File

@ -27,8 +27,8 @@ $test_os = [
// 'ubuntu-latest', // bin/spc-alpine-docker for x86_64
'ubuntu-22.04', // bin/spc-gnu-docker for x86_64
'ubuntu-24.04', // bin/spc for x86_64
// 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64
// 'ubuntu-24.04-arm', // bin/spc for arm64
'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64
'ubuntu-24.04-arm', // bin/spc for arm64
// 'windows-latest', // .\bin\spc.ps1
];
@ -158,6 +158,7 @@ if ($shared_extensions) {
break;
case 'ubuntu-24.04':
case 'ubuntu-24.04-arm':
putenv('SPC_TARGET=native-linux-gnu');
if (str_contains((string) getenv('SPC_TARGET'), '-gnu')) {
$shared_cmd = ' --build-shared=' . quote2($shared_extensions) . ' ';
}