mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
conflicts with shared tests
This commit is contained in:
parent
ba7f994a71
commit
bebcb978f6
@ -6,6 +6,8 @@ namespace SPC\builder\linux;
|
|||||||
|
|
||||||
use SPC\builder\traits\UnixSystemUtilTrait;
|
use SPC\builder\traits\UnixSystemUtilTrait;
|
||||||
use SPC\exception\RuntimeException;
|
use SPC\exception\RuntimeException;
|
||||||
|
use SPC\toolchain\ToolchainManager;
|
||||||
|
use SPC\toolchain\ZigToolchain;
|
||||||
|
|
||||||
class SystemUtil
|
class SystemUtil
|
||||||
{
|
{
|
||||||
@ -231,8 +233,7 @@ class SystemUtil
|
|||||||
|
|
||||||
public static function getExtraRuntimeObjects(): string
|
public static function getExtraRuntimeObjects(): string
|
||||||
{
|
{
|
||||||
$cc = getenv('CC');
|
if (ToolchainManager::getToolchainClass() !== ZigToolchain::class) {
|
||||||
if (!$cc || !str_contains($cc, 'zig')) {
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,11 +20,11 @@ class ToolchainManager
|
|||||||
public static function getToolchainClass(): string
|
public static function getToolchainClass(): string
|
||||||
{
|
{
|
||||||
$libc = getenv('SPC_LIBC');
|
$libc = getenv('SPC_LIBC');
|
||||||
if ($libc !== false) {
|
if ($libc !== false && !getenv('SPC_TARGET')) {
|
||||||
logger()->warning('SPC_LIBC is deprecated, please use SPC_TARGET instead.');
|
logger()->warning('SPC_LIBC is deprecated, please use SPC_TARGET instead.');
|
||||||
return match ($libc) {
|
return match ($libc) {
|
||||||
'musl' => SystemUtil::isMuslDist() ? GccNativeToolchain::class : MuslToolchain::class,
|
'musl' => SystemUtil::isMuslDist() ? GccNativeToolchain::class : MuslToolchain::class,
|
||||||
'glibc' => !SystemUtil::isMuslDist() ? GccNativeToolchain::class : throw new WrongUsageException('SPC_TARGET must be musl for musl dist.'),
|
'glibc' => !SystemUtil::isMuslDist() ? GccNativeToolchain::class : throw new WrongUsageException('SPC_LIBC must be musl for musl dist.'),
|
||||||
default => throw new WrongUsageException('Unsupported SPC_LIBC value: ' . $libc),
|
default => throw new WrongUsageException('Unsupported SPC_LIBC value: ' . $libc),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,12 +6,13 @@ namespace SPC\util;
|
|||||||
|
|
||||||
use SPC\builder\BuilderBase;
|
use SPC\builder\BuilderBase;
|
||||||
use SPC\builder\BuilderProvider;
|
use SPC\builder\BuilderProvider;
|
||||||
use SPC\builder\linux\SystemUtil;
|
|
||||||
use SPC\builder\macos\MacOSBuilder;
|
use SPC\builder\macos\MacOSBuilder;
|
||||||
use SPC\exception\FileSystemException;
|
use SPC\exception\FileSystemException;
|
||||||
use SPC\exception\RuntimeException;
|
use SPC\exception\RuntimeException;
|
||||||
use SPC\exception\WrongUsageException;
|
use SPC\exception\WrongUsageException;
|
||||||
use SPC\store\Config;
|
use SPC\store\Config;
|
||||||
|
use SPC\toolchain\ToolchainManager;
|
||||||
|
use SPC\toolchain\ZigToolchain;
|
||||||
use Symfony\Component\Console\Input\ArgvInput;
|
use Symfony\Component\Console\Input\ArgvInput;
|
||||||
|
|
||||||
class SPCConfigUtil
|
class SPCConfigUtil
|
||||||
@ -71,7 +72,7 @@ class SPCConfigUtil
|
|||||||
if ($this->builder->hasCpp()) {
|
if ($this->builder->hasCpp()) {
|
||||||
$libs .= $this->builder instanceof MacOSBuilder ? ' -lc++' : ' -lstdc++';
|
$libs .= $this->builder instanceof MacOSBuilder ? ' -lc++' : ' -lstdc++';
|
||||||
}
|
}
|
||||||
if (SystemUtil::getCCType() === 'clang') {
|
if (ToolchainManager::getToolchainClass() === ZigToolchain::class) {
|
||||||
$libs .= ' -lunwind';
|
$libs .= ' -lunwind';
|
||||||
}
|
}
|
||||||
// mimalloc must come first
|
// mimalloc must come first
|
||||||
|
|||||||
@ -72,7 +72,7 @@ $with_libs = match (PHP_OS_FAMILY) {
|
|||||||
// You can use `common`, `bulk`, `minimal` or `none`.
|
// You can use `common`, `bulk`, `minimal` or `none`.
|
||||||
// note: combination is only available for *nix platform. Windows must use `none` combination
|
// note: combination is only available for *nix platform. Windows must use `none` combination
|
||||||
$base_combination = match (PHP_OS_FAMILY) {
|
$base_combination = match (PHP_OS_FAMILY) {
|
||||||
'Linux', 'Darwin' => 'common',
|
'Linux', 'Darwin' => 'minimal',
|
||||||
'Windows' => 'none',
|
'Windows' => 'none',
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -214,9 +214,6 @@ switch ($argv[1] ?? null) {
|
|||||||
passthru($prefix . $down_cmd, $retcode);
|
passthru($prefix . $down_cmd, $retcode);
|
||||||
break;
|
break;
|
||||||
case 'build_cmd':
|
case 'build_cmd':
|
||||||
if ($zig) {
|
|
||||||
passthru("{$prefix}install-pkg zig --debug", $retcode);
|
|
||||||
}
|
|
||||||
passthru($prefix . $build_cmd . ' --build-cli --build-micro', $retcode);
|
passthru($prefix . $build_cmd . ' --build-cli --build-micro', $retcode);
|
||||||
break;
|
break;
|
||||||
case 'build_embed_cmd':
|
case 'build_embed_cmd':
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user