From df6c27c98d37ab044eba354a311d00736bbb7ddc Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Mon, 8 Dec 2025 10:59:25 +0800 Subject: [PATCH] Allow absolute paths for configs --- src/StaticPHP/Package/LibraryPackage.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/StaticPHP/Package/LibraryPackage.php b/src/StaticPHP/Package/LibraryPackage.php index c8398550..2063ee89 100644 --- a/src/StaticPHP/Package/LibraryPackage.php +++ b/src/StaticPHP/Package/LibraryPackage.php @@ -33,22 +33,28 @@ class LibraryPackage extends Package public function isInstalled(): bool { 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; } } 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; } } 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; } } 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; } }