Use existing pkg-config builds and pre-built contents for packages

This commit is contained in:
crazywhalecc
2025-08-31 15:04:34 +08:00
parent f2c131a2cc
commit 0fa38bad6d
14 changed files with 157 additions and 145 deletions

View File

@@ -7,7 +7,6 @@ namespace SPC\util;
use SPC\builder\macos\SystemUtil;
use SPC\exception\SPCInternalException;
use SPC\exception\WrongUsageException;
use SPC\store\pkg\PkgConfig;
use SPC\toolchain\ToolchainManager;
/**
@@ -40,7 +39,7 @@ class GlobalEnvManager
// Define env vars for unix
if (is_unix()) {
self::addPathIfNotExists(BUILD_BIN_PATH);
self::putenv('PKG_CONFIG=' . PkgConfig::getEnvironment()['PATH'] . '/pkg-config');
self::addPathIfNotExists(PKG_ROOT_PATH . '/bin');
self::putenv('PKG_CONFIG_PATH=' . BUILD_LIB_PATH . '/pkgconfig');
}
@@ -123,6 +122,14 @@ class GlobalEnvManager
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