Allow absolute paths for configs

This commit is contained in:
crazywhalecc 2025-12-08 10:59:25 +08:00 committed by Jerry Ma
parent 3ff762c4c8
commit df6c27c98d

View File

@ -33,22 +33,28 @@ class LibraryPackage extends Package
public function isInstalled(): bool public function isInstalled(): bool
{ {
foreach (PackageConfig::get($this->getName(), 'static-libs', []) as $lib) { foreach (PackageConfig::get($this->getName(), 'static-libs', []) as $lib) {
if (!file_exists("{$this->getLibDir()}/{$lib}")) { $path = FileSystem::isRelativePath($lib) ? "{$this->getLibDir()}/{$lib}" : $lib;
if (!file_exists($path)) {
return false; return false;
} }
} }
foreach (PackageConfig::get($this->getName(), 'headers', []) as $header) { foreach (PackageConfig::get($this->getName(), 'headers', []) as $header) {
if (!file_exists("{$this->getIncludeDir()}/{$header}")) { $path = FileSystem::isRelativePath($header) ? "{$this->getIncludeDir()}/{$header}" : $header;
if (!file_exists($path)) {
return false; return false;
} }
} }
foreach (PackageConfig::get($this->getName(), 'pkg-configs', []) as $pc) { foreach (PackageConfig::get($this->getName(), 'pkg-configs', []) as $pc) {
if (!file_exists("{$this->getLibDir()}/pkgconfig/{$pc}.pc")) { if (!str_ends_with($pc, '.pc')) {
$pc .= '.pc';
}
if (!file_exists("{$this->getLibDir()}/pkgconfig/{$pc}")) {
return false; return false;
} }
} }
foreach (PackageConfig::get($this->getName(), 'static-bins', []) as $bin) { foreach (PackageConfig::get($this->getName(), 'static-bins', []) as $bin) {
if (!file_exists("{$this->getBinDir()}/{$bin}")) { $path = FileSystem::isRelativePath($bin) ? "{$this->getBinDir()}/{$bin}" : $bin;
if (!file_exists($path)) {
return false; return false;
} }
} }