From 408b3b406076e16d1e1cfd978d1b71f2f42c9e51 Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Tue, 1 Jul 2025 16:21:57 +0700 Subject: [PATCH] try to test with zig? --- src/SPC/store/scripts/zig-cc.sh | 11 ++++++++--- src/SPC/toolchain/ToolchainManager.php | 2 +- src/globals/test-extensions.php | 5 +++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/SPC/store/scripts/zig-cc.sh b/src/SPC/store/scripts/zig-cc.sh index 72900e72..fe9e2c83 100644 --- a/src/SPC/store/scripts/zig-cc.sh +++ b/src/SPC/store/scripts/zig-cc.sh @@ -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 diff --git a/src/SPC/toolchain/ToolchainManager.php b/src/SPC/toolchain/ToolchainManager.php index 72f1d250..8192175b 100644 --- a/src/SPC/toolchain/ToolchainManager.php +++ b/src/SPC/toolchain/ToolchainManager.php @@ -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) { diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index d9940974..f5dd882f 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -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) . ' '; }