mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +08:00
WIP: use system libraries for grpc without building our own grpc lib
This commit is contained in:
parent
9a681a9fa6
commit
09b89a30f9
@ -375,8 +375,17 @@ abstract class LibraryBase
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$pkg_config_path = getenv('PKG_CONFIG_PATH') ?: '';
|
||||||
|
$search_paths = array_filter(explode(is_unix() ? ':' : ';', $pkg_config_path));
|
||||||
foreach (Config::getLib(static::NAME, 'pkg-configs', []) as $name) {
|
foreach (Config::getLib(static::NAME, 'pkg-configs', []) as $name) {
|
||||||
if (!file_exists(BUILD_LIB_PATH . "/pkgconfig/{$name}.pc")) {
|
$found = false;
|
||||||
|
foreach ($search_paths as $path) {
|
||||||
|
if (file_exists($path . "/{$name}.pc")) {
|
||||||
|
$found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$found) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@ trait UnixLibraryTrait
|
|||||||
$files = array_map(fn ($x) => "{$x}.pc", $conf_pc);
|
$files = array_map(fn ($x) => "{$x}.pc", $conf_pc);
|
||||||
}
|
}
|
||||||
foreach ($files as $name) {
|
foreach ($files as $name) {
|
||||||
$realpath = realpath(BUILD_ROOT_PATH . '/lib/pkgconfig/' . $name);
|
$realpath = realpath(BUILD_LIB_PATH . '/pkgconfig/' . $name);
|
||||||
if ($realpath === false) {
|
if ($realpath === false) {
|
||||||
throw new PatchException('pkg-config prefix patcher', 'Cannot find library [' . static::NAME . '] pkgconfig file [' . $name . '] in ' . BUILD_LIB_PATH . '/pkgconfig/ !');
|
throw new PatchException('pkg-config prefix patcher', 'Cannot find library [' . static::NAME . '] pkgconfig file [' . $name . '] in ' . BUILD_LIB_PATH . '/pkgconfig/ !');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -226,9 +226,17 @@ class SPCConfigUtil
|
|||||||
// parse pkg-configs
|
// parse pkg-configs
|
||||||
foreach ($libraries as $library) {
|
foreach ($libraries as $library) {
|
||||||
$pc = Config::getLib($library, 'pkg-configs', []);
|
$pc = Config::getLib($library, 'pkg-configs', []);
|
||||||
|
$pkg_config_path = getenv('PKG_CONFIG_PATH') ?: '';
|
||||||
|
$search_paths = array_filter(explode(is_unix() ? ':' : ';', $pkg_config_path));
|
||||||
foreach ($pc as $file) {
|
foreach ($pc as $file) {
|
||||||
if (!file_exists(BUILD_LIB_PATH . "/pkgconfig/{$file}.pc")) {
|
$found = false;
|
||||||
throw new WrongUsageException("pkg-config file '{$file}.pc' for lib [{$library}] does not exist in '" . BUILD_LIB_PATH . "/pkgconfig'. Please build it first.");
|
foreach ($search_paths as $path) {
|
||||||
|
if (file_exists($path . "/{$file}.pc")) {
|
||||||
|
$found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$found) {
|
||||||
|
throw new WrongUsageException("pkg-config file '{$file}.pc' for lib [{$library}] does not exist. Please build it first.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$pc_cflags = implode(' ', $pc);
|
$pc_cflags = implode(' ', $pc);
|
||||||
@ -257,9 +265,17 @@ class SPCConfigUtil
|
|||||||
foreach ($libraries as $library) {
|
foreach ($libraries as $library) {
|
||||||
// add pkg-configs libs
|
// add pkg-configs libs
|
||||||
$pkg_configs = Config::getLib($library, 'pkg-configs', []);
|
$pkg_configs = Config::getLib($library, 'pkg-configs', []);
|
||||||
foreach ($pkg_configs as $pkg_config) {
|
$pkg_config_path = getenv('PKG_CONFIG_PATH') ?: '';
|
||||||
if (!file_exists(BUILD_LIB_PATH . "/pkgconfig/{$pkg_config}.pc")) {
|
$search_paths = array_filter(explode(is_unix() ? ':' : ';', $pkg_config_path));
|
||||||
throw new WrongUsageException("pkg-config file '{$pkg_config}.pc' for lib [{$library}] does not exist in '" . BUILD_LIB_PATH . "/pkgconfig'. Please build it first.");
|
foreach ($pkg_configs as $file) {
|
||||||
|
$found = false;
|
||||||
|
foreach ($search_paths as $path) {
|
||||||
|
if (file_exists($path . "/{$file}.pc")) {
|
||||||
|
$found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$found) {
|
||||||
|
throw new WrongUsageException("pkg-config file '{$file}.pc' for lib [{$library}] does not exist. Please build it first.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$pkg_configs = implode(' ', $pkg_configs);
|
$pkg_configs = implode(' ', $pkg_configs);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user