Skip to content

Commit df6c27c

Browse files
committed
Allow absolute paths for configs
1 parent 3ff762c commit df6c27c

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/StaticPHP/Package/LibraryPackage.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,28 @@ public function addBuildFunction(string $platform, callable $func): void
3333
public function isInstalled(): bool
3434
{
3535
foreach (PackageConfig::get($this->getName(), 'static-libs', []) as $lib) {
36-
if (!file_exists("{$this->getLibDir()}/{$lib}")) {
36+
$path = FileSystem::isRelativePath($lib) ? "{$this->getLibDir()}/{$lib}" : $lib;
37+
if (!file_exists($path)) {
3738
return false;
3839
}
3940
}
4041
foreach (PackageConfig::get($this->getName(), 'headers', []) as $header) {
41-
if (!file_exists("{$this->getIncludeDir()}/{$header}")) {
42+
$path = FileSystem::isRelativePath($header) ? "{$this->getIncludeDir()}/{$header}" : $header;
43+
if (!file_exists($path)) {
4244
return false;
4345
}
4446
}
4547
foreach (PackageConfig::get($this->getName(), 'pkg-configs', []) as $pc) {
46-
if (!file_exists("{$this->getLibDir()}/pkgconfig/{$pc}.pc")) {
48+
if (!str_ends_with($pc, '.pc')) {
49+
$pc .= '.pc';
50+
}
51+
if (!file_exists("{$this->getLibDir()}/pkgconfig/{$pc}")) {
4752
return false;
4853
}
4954
}
5055
foreach (PackageConfig::get($this->getName(), 'static-bins', []) as $bin) {
51-
if (!file_exists("{$this->getBinDir()}/{$bin}")) {
56+
$path = FileSystem::isRelativePath($bin) ? "{$this->getBinDir()}/{$bin}" : $bin;
57+
if (!file_exists($path)) {
5258
return false;
5359
}
5460
}

0 commit comments

Comments
 (0)