99use SPC \doctor \CheckResult ;
1010use SPC \doctor \OptionalCheck ;
1111use SPC \store \PackageManager ;
12- use SPC \store \ pkg \ PkgConfig ;
12+ use SPC \util \ PkgConfigUtil ;
1313
1414#[OptionalCheck([self ::class, 'optionalCheck ' ])]
1515class PkgConfigCheck
@@ -20,26 +20,19 @@ public static function optionalCheck(): bool
2020 }
2121
2222 /** @noinspection PhpUnused */
23- #[AsCheckItem('if pkg-config is installed ' , level: 800 )]
23+ #[AsCheckItem('if pkg-config is installed or built ' , level: 800 )]
2424 public function checkPkgConfig (): CheckResult
2525 {
26- if (PkgConfig:: isInstalled ( )) {
27- return CheckResult::ok ( );
26+ if (!( $ pkgconf = PkgConfigUtil:: findPkgConfig () )) {
27+ return CheckResult::fail ( ' pkg-config is not installed ' , ' install-pkgconfig ' );
2828 }
29- return CheckResult::fail ( ' pkg-config is not installed ' , ' install-pkgconfig ' );
29+ return CheckResult::ok ( $ pkgconf );
3030 }
3131
3232 #[AsFixItem('install-pkgconfig ' )]
3333 public function installPkgConfig (): bool
3434 {
35- $ arch = arch2gnu (php_uname ('m ' ));
36- $ os = match (PHP_OS_FAMILY ) {
37- 'Windows ' => 'win ' ,
38- 'Darwin ' => 'macos ' ,
39- 'BSD ' => 'freebsd ' ,
40- default => 'linux ' ,
41- };
42- PackageManager::installPackage ("pkg-config- {$ arch }- {$ os }" );
43- return PkgConfig::isInstalled ();
35+ PackageManager::installPackage ('pkg-config ' );
36+ return true ;
4437 }
4538}
0 commit comments