turn pkg-config into a package instead of a library

This commit is contained in:
DubbleClick
2025-08-27 14:33:39 +07:00
parent a5351e1546
commit 694fd2f1e0
13 changed files with 168 additions and 100 deletions

View File

@@ -7,6 +7,7 @@ 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;
/**
@@ -39,8 +40,8 @@ class GlobalEnvManager
// Define env vars for unix
if (is_unix()) {
self::addPathIfNotExists(BUILD_BIN_PATH);
self::putenv('PKG_CONFIG=' . BUILD_BIN_PATH . '/pkg-config');
self::putenv('PKG_CONFIG_PATH=' . BUILD_ROOT_PATH . '/lib/pkgconfig');
self::putenv('PKG_CONFIG=' . PkgConfig::getEnvironment()['PATH'] . '/pkg-config');
self::putenv('PKG_CONFIG_PATH=' . BUILD_LIB_PATH . '/pkgconfig');
}
$ini = self::readIniFile();

View File

@@ -8,6 +8,7 @@ use SPC\builder\freebsd\library\BSDLibraryBase;
use SPC\builder\linux\library\LinuxLibraryBase;
use SPC\builder\macos\library\MacOSLibraryBase;
use SPC\store\FileSystem;
use SPC\store\pkg\PkgConfig;
use SPC\util\shell\UnixShell;
/**
@@ -184,6 +185,7 @@ class UnixCMakeExecutor extends Executor
$cxx = getenv('CCX');
logger()->debug("making cmake tool chain file for {$os} {$target_arch} with CFLAGS='{$cflags}'");
$root = BUILD_ROOT_PATH;
$pkgConfig = PkgConfig::getEnvironment()['PATH'];
$ccLine = '';
if ($cc) {
$ccLine = 'SET(CMAKE_C_COMPILER ' . $cc . ')';
@@ -202,7 +204,7 @@ SET(CMAKE_PREFIX_PATH "{$root}")
SET(CMAKE_INSTALL_PREFIX "{$root}")
SET(CMAKE_INSTALL_LIBDIR "lib")
set(PKG_CONFIG_EXECUTABLE "{$root}/bin/pkg-config")
set(PKG_CONFIG_EXECUTABLE "{$pkgConfig}/pkg-config")
list(APPEND PKG_CONFIG_EXECUTABLE "--static")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)