mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
fix zig runtime
This commit is contained in:
parent
f6c6011061
commit
27f57cc23a
@ -37,7 +37,7 @@ done
|
|||||||
TARGET=""
|
TARGET=""
|
||||||
if [ -n "$SPC_TARGET" ]; then
|
if [ -n "$SPC_TARGET" ]; then
|
||||||
TARGET="-target $SPC_TARGET"
|
TARGET="-target $SPC_TARGET"
|
||||||
else
|
fi
|
||||||
|
|
||||||
output=$(zig cc $TARGET -lstdc++ $COMPILER_EXTRA "${PARSED_ARGS[@]}" 2>&1)
|
output=$(zig cc $TARGET -lstdc++ $COMPILER_EXTRA "${PARSED_ARGS[@]}" 2>&1)
|
||||||
status=$?
|
status=$?
|
||||||
|
|||||||
@ -30,5 +30,6 @@ class ZigToolchain implements ToolchainInterface
|
|||||||
if (!is_dir(Zig::getEnvironment()['PATH'])) {
|
if (!is_dir(Zig::getEnvironment()['PATH'])) {
|
||||||
throw new WrongUsageException('You are building with zig, but zig is not installed, please install zig first. (You can use `doctor` command to install it)');
|
throw new WrongUsageException('You are building with zig, but zig is not installed, please install zig first. (You can use `doctor` command to install it)');
|
||||||
}
|
}
|
||||||
|
GlobalEnvManager::addPathIfNotExists(Zig::getEnvironment()['PATH']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -96,11 +96,11 @@ class SPCTarget
|
|||||||
if ($target === false) {
|
if ($target === false) {
|
||||||
return PHP_OS_FAMILY;
|
return PHP_OS_FAMILY;
|
||||||
}
|
}
|
||||||
// TODO: zig target parser like below?
|
|
||||||
return match (true) {
|
return match (true) {
|
||||||
str_contains($target, 'linux') => 'Linux',
|
str_contains($target, '-linux') => 'Linux',
|
||||||
str_contains($target, 'macos') => 'Darwin',
|
str_contains($target, '-macos') => 'Darwin',
|
||||||
str_contains($target, 'windows') => 'Windows',
|
str_contains($target, '-windows') => 'Windows',
|
||||||
|
str_contains($target, '-native') => PHP_OS_FAMILY,
|
||||||
default => throw new WrongUsageException('Cannot parse target.'),
|
default => throw new WrongUsageException('Cannot parse target.'),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user