mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-07 08:45:40 +08:00
Forward-port #1006 changes
This commit is contained in:
@@ -314,12 +314,7 @@ class FileSystem
|
||||
continue;
|
||||
}
|
||||
$sub_file = self::convertPath($dir . '/' . $v);
|
||||
if (is_dir($sub_file)) {
|
||||
# 如果是 目录 且 递推 , 则递推添加下级文件
|
||||
if (!self::removeDir($sub_file)) {
|
||||
return false;
|
||||
}
|
||||
} elseif (is_link($sub_file) || is_file($sub_file)) {
|
||||
if (is_link($sub_file) || is_file($sub_file)) {
|
||||
if (!unlink($sub_file)) {
|
||||
$cmd = PHP_OS_FAMILY === 'Windows' ? 'del /f /q' : 'rm -f';
|
||||
f_exec("{$cmd} " . escapeshellarg($sub_file), $out, $ret);
|
||||
@@ -328,6 +323,11 @@ class FileSystem
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} elseif (is_dir($sub_file)) {
|
||||
# 如果是 目录 且 递推 , 则递推添加下级文件
|
||||
if (!self::removeDir($sub_file)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_link($dir)) {
|
||||
|
||||
@@ -291,9 +291,18 @@ class SPCConfigUtil
|
||||
// parse pkg-configs
|
||||
foreach ($packages as $package) {
|
||||
$pc = PackageConfig::get($package, 'pkg-configs', []);
|
||||
$pkg_config_path = getenv('PKG_CONFIG_PATH') ?: '';
|
||||
$search_paths = array_filter(explode(SystemTarget::isUnix() ? ':' : ';', $pkg_config_path));
|
||||
foreach ($pc as $file) {
|
||||
if (!file_exists(BUILD_LIB_PATH . "/pkgconfig/{$file}.pc")) {
|
||||
throw new WrongUsageException("pkg-config file '{$file}.pc' for lib [{$package}] does not exist in '" . BUILD_LIB_PATH . "/pkgconfig'. Please build it first.");
|
||||
$found = false;
|
||||
foreach ($search_paths as $path) {
|
||||
if (file_exists($path . "/{$file}.pc")) {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$found) {
|
||||
throw new WrongUsageException("pkg-config file '{$file}.pc' for lib [{$package}] does not exist. Please build it first.");
|
||||
}
|
||||
}
|
||||
$pc_cflags = implode(' ', $pc);
|
||||
@@ -324,9 +333,18 @@ class SPCConfigUtil
|
||||
if (SystemTarget::isUnix()) {
|
||||
// add pkg-configs libs
|
||||
$pkg_configs = PackageConfig::get($package, 'pkg-configs', []);
|
||||
$pkg_config_path = getenv('PKG_CONFIG_PATH') ?: '';
|
||||
$search_paths = array_filter(explode(':', $pkg_config_path));
|
||||
foreach ($pkg_configs as $pkg_config) {
|
||||
if (!file_exists(BUILD_LIB_PATH . "/pkgconfig/{$pkg_config}.pc")) {
|
||||
throw new WrongUsageException("pkg-config file '{$pkg_config}.pc' for lib [{$package}] does not exist in '" . BUILD_LIB_PATH . "/pkgconfig'. Please build it first.");
|
||||
$found = false;
|
||||
foreach ($search_paths as $path) {
|
||||
if (file_exists($path . "/{$pkg_config}.pc")) {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$found) {
|
||||
throw new WrongUsageException("pkg-config file '{$pkg_config}.pc' for lib [{$package}] does not exist. Please build it first.");
|
||||
}
|
||||
}
|
||||
$pkg_configs = implode(' ', $pkg_configs);
|
||||
|
||||
Reference in New Issue
Block a user