File tree Expand file tree Collapse file tree 3 files changed +34
-1
lines changed
Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change 862862 },
863863 "openssl" : {
864864 "source" : " openssl" ,
865+ "pkg-configs" : [
866+ " openssl"
867+ ],
865868 "static-libs-unix" : [
866869 " libssl.a" ,
867870 " libcrypto.a"
974977 },
975978 "unixodbc" : {
976979 "source" : " unixodbc" ,
980+ "pkg-configs" : [
981+ " odbc" ,
982+ " odbccr" ,
983+ " odbcinst"
984+ ],
977985 "static-libs-unix" : [
978986 " libodbc.a" ,
979987 " libodbccr.a" ,
10151023 },
10161024 "zlib" : {
10171025 "source" : " zlib" ,
1026+ "pkg-configs" : [
1027+ " zlib"
1028+ ],
10181029 "static-libs-unix" : [
10191030 " libz.a"
10201031 ],
10281039 },
10291040 "zstd" : {
10301041 "source" : " zstd" ,
1042+ "pkg-configs" : [
1043+ " libzstd"
1044+ ],
10311045 "static-libs-unix" : [
10321046 " libzstd.a"
10331047 ],
Original file line number Diff line number Diff line change @@ -96,7 +96,8 @@ public function getLibFilesString(): string
9696 fn ($ x ) => $ x ->getStaticLibFiles (),
9797 $ this ->getLibraryDependencies (recursive: true )
9898 );
99- return implode (' ' , $ ret );
99+ $ libs = implode (' ' , $ ret );
100+ return deduplicate_flags ($ libs );
100101 }
101102
102103 /**
Original file line number Diff line number Diff line change @@ -365,6 +365,24 @@ protected function installLicense(): void
365365
366366 protected function isLibraryInstalled (): bool
367367 {
368+ if ($ pkg_configs = Config::getLib (static ::NAME , 'pkg-configs ' , [])) {
369+ $ pkg_config_path = getenv ('PKG_CONFIG_PATH ' ) ?: '' ;
370+ $ search_paths = array_unique (array_filter (explode (is_unix () ? ': ' : '; ' , $ pkg_config_path )));
371+
372+ foreach ($ pkg_configs as $ name ) {
373+ $ found = false ;
374+ foreach ($ search_paths as $ path ) {
375+ if (file_exists ($ path . "/ {$ name }.pc " )) {
376+ $ found = true ;
377+ break ;
378+ }
379+ }
380+ if (!$ found ) {
381+ return false ;
382+ }
383+ }
384+ return true ; // allow using system dependencies if pkg_config_path is explicitly defined
385+ }
368386 foreach (Config::getLib (static ::NAME , 'static-libs ' , []) as $ name ) {
369387 if (!file_exists (BUILD_LIB_PATH . "/ {$ name }" )) {
370388 return false ;
You can’t perform that action at this time.
0 commit comments