Skip to content

Commit 3b9efcb

Browse files
committed
Put it into toolchain manager to skip in unit test
1 parent 022ba3d commit 3b9efcb

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/SPC/toolchain/ToolchainManager.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use SPC\builder\linux\SystemUtil;
88
use SPC\exception\WrongUsageException;
99
use SPC\util\GlobalEnvManager;
10+
use SPC\util\PkgConfigUtil;
1011
use SPC\util\SPCTarget;
1112

1213
class ToolchainManager
@@ -56,6 +57,15 @@ public static function afterInitToolchain(): void
5657
if (SPCTarget::getLibc() === 'glibc' && SystemUtil::isMuslDist()) {
5758
throw new WrongUsageException('You are linking against glibc dynamically, which is only supported on glibc distros.');
5859
}
60+
61+
// init pkg-config for unix
62+
if (is_unix()) {
63+
if (($found = PkgConfigUtil::findPkgConfig()) === null) {
64+
throw new WrongUsageException('Cannot find pkg-config executable. Please run `doctor` to fix this.');
65+
}
66+
GlobalEnvManager::putenv("PKG_CONFIG={$found}");
67+
}
68+
5969
$toolchain = getenv('SPC_TOOLCHAIN');
6070
/* @var ToolchainInterface $toolchain */
6171
$instance = new $toolchain();

src/SPC/util/GlobalEnvManager.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,6 @@ public static function afterInit(): void
122122
self::putenv("YACC={$yacc}");
123123
}
124124
}
125-
126-
// init pkg-config for unix
127-
if (is_unix()) {
128-
if (($found = PkgConfigUtil::findPkgConfig()) === null) {
129-
throw new WrongUsageException('Cannot find pkg-config executable. Please run `doctor` to fix this.');
130-
}
131-
self::putenv("PKG_CONFIG={$found}");
132-
}
133125
}
134126

135127
private static function readIniFile(): array

0 commit comments

Comments
 (0)