mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-10 02:15:36 +08:00
Put it into toolchain manager to skip in unit test
This commit is contained in:
@@ -7,6 +7,7 @@ namespace SPC\toolchain;
|
|||||||
use SPC\builder\linux\SystemUtil;
|
use SPC\builder\linux\SystemUtil;
|
||||||
use SPC\exception\WrongUsageException;
|
use SPC\exception\WrongUsageException;
|
||||||
use SPC\util\GlobalEnvManager;
|
use SPC\util\GlobalEnvManager;
|
||||||
|
use SPC\util\PkgConfigUtil;
|
||||||
use SPC\util\SPCTarget;
|
use SPC\util\SPCTarget;
|
||||||
|
|
||||||
class ToolchainManager
|
class ToolchainManager
|
||||||
@@ -56,6 +57,15 @@ class ToolchainManager
|
|||||||
if (SPCTarget::getLibc() === 'glibc' && SystemUtil::isMuslDist()) {
|
if (SPCTarget::getLibc() === 'glibc' && SystemUtil::isMuslDist()) {
|
||||||
throw new WrongUsageException('You are linking against glibc dynamically, which is only supported on glibc distros.');
|
throw new WrongUsageException('You are linking against glibc dynamically, which is only supported on glibc distros.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// init pkg-config for unix
|
||||||
|
if (is_unix()) {
|
||||||
|
if (($found = PkgConfigUtil::findPkgConfig()) === null) {
|
||||||
|
throw new WrongUsageException('Cannot find pkg-config executable. Please run `doctor` to fix this.');
|
||||||
|
}
|
||||||
|
GlobalEnvManager::putenv("PKG_CONFIG={$found}");
|
||||||
|
}
|
||||||
|
|
||||||
$toolchain = getenv('SPC_TOOLCHAIN');
|
$toolchain = getenv('SPC_TOOLCHAIN');
|
||||||
/* @var ToolchainInterface $toolchain */
|
/* @var ToolchainInterface $toolchain */
|
||||||
$instance = new $toolchain();
|
$instance = new $toolchain();
|
||||||
|
|||||||
@@ -122,14 +122,6 @@ class GlobalEnvManager
|
|||||||
self::putenv("YACC={$yacc}");
|
self::putenv("YACC={$yacc}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// init pkg-config for unix
|
|
||||||
if (is_unix()) {
|
|
||||||
if (($found = PkgConfigUtil::findPkgConfig()) === null) {
|
|
||||||
throw new WrongUsageException('Cannot find pkg-config executable. Please run `doctor` to fix this.');
|
|
||||||
}
|
|
||||||
self::putenv("PKG_CONFIG={$found}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function readIniFile(): array
|
private static function readIniFile(): array
|
||||||
|
|||||||
Reference in New Issue
Block a user