From f6e00c67ccf3d7f1fbdab4431665c07efdbeaca7 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sat, 21 Mar 2026 00:32:02 +0800 Subject: [PATCH] Refactor LibraryPackage to skip pkg-config and static-bin checks on Windows --- src/StaticPHP/Package/LibraryPackage.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/StaticPHP/Package/LibraryPackage.php b/src/StaticPHP/Package/LibraryPackage.php index aa24f057..769612b9 100644 --- a/src/StaticPHP/Package/LibraryPackage.php +++ b/src/StaticPHP/Package/LibraryPackage.php @@ -44,18 +44,20 @@ class LibraryPackage extends Package return false; } } - foreach (PackageConfig::get($this->getName(), 'pkg-configs', []) as $pc) { - if (!str_ends_with($pc, '.pc')) { - $pc .= '.pc'; + if (SystemTarget::getTargetOS() !== 'Windows') { + foreach (PackageConfig::get($this->getName(), 'pkg-configs', []) as $pc) { + if (!str_ends_with($pc, '.pc')) { + $pc .= '.pc'; + } + if (!file_exists("{$this->getLibDir()}/pkgconfig/{$pc}")) { + return false; + } } - if (!file_exists("{$this->getLibDir()}/pkgconfig/{$pc}")) { - return false; - } - } - foreach (PackageConfig::get($this->getName(), 'static-bins', []) as $bin) { - $path = FileSystem::isRelativePath($bin) ? "{$this->getBinDir()}/{$bin}" : $bin; - if (!file_exists($path)) { - return false; + foreach (PackageConfig::get($this->getName(), 'static-bins', []) as $bin) { + $path = FileSystem::isRelativePath($bin) ? "{$this->getBinDir()}/{$bin}" : $bin; + if (!file_exists($path)) { + return false; + } } } return true;