mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 21:04:52 +08:00
fix dependency sort
This commit is contained in:
parent
bff1a6168f
commit
daf0d2eb32
@ -327,12 +327,12 @@
|
|||||||
"libxml2"
|
"libxml2"
|
||||||
],
|
],
|
||||||
"lib-depends": [
|
"lib-depends": [
|
||||||
"libiconv",
|
"libiconv"
|
||||||
"zlib"
|
|
||||||
],
|
],
|
||||||
"lib-suggests": [
|
"lib-suggests": [
|
||||||
"xz",
|
"xz",
|
||||||
"icu"
|
"icu",
|
||||||
|
"zlib"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"libxslt": {
|
"libxslt": {
|
||||||
|
|||||||
@ -33,12 +33,12 @@ abstract class BuilderBase
|
|||||||
/**
|
/**
|
||||||
* Build libraries
|
* Build libraries
|
||||||
*
|
*
|
||||||
* @param array<string> $libraries Libraries to build
|
* @param array<string> $sorted_libraries Libraries to build (if not empty, must sort first)
|
||||||
* @throws FileSystemException
|
* @throws FileSystemException
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
* @throws WrongUsageException
|
* @throws WrongUsageException
|
||||||
*/
|
*/
|
||||||
public function buildLibs(array $libraries): void
|
public function buildLibs(array $sorted_libraries): void
|
||||||
{
|
{
|
||||||
// search all supported libs
|
// search all supported libs
|
||||||
$support_lib_list = [];
|
$support_lib_list = [];
|
||||||
@ -53,20 +53,18 @@ abstract class BuilderBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if no libs specified, compile all supported libs
|
// if no libs specified, compile all supported libs
|
||||||
if ($libraries === [] && $this->isLibsOnly()) {
|
if ($sorted_libraries === [] && $this->isLibsOnly()) {
|
||||||
$libraries = array_keys($support_lib_list);
|
$libraries = array_keys($support_lib_list);
|
||||||
|
$sorted_libraries = DependencyUtil::getLibsByDeps($libraries);
|
||||||
}
|
}
|
||||||
|
|
||||||
// pkg-config must be compiled first, whether it is specified or not
|
// pkg-config must be compiled first, whether it is specified or not
|
||||||
if (!in_array('pkg-config', $libraries)) {
|
if (!in_array('pkg-config', $sorted_libraries)) {
|
||||||
array_unshift($libraries, 'pkg-config');
|
array_unshift($sorted_libraries, 'pkg-config');
|
||||||
}
|
}
|
||||||
|
|
||||||
// append dependencies
|
|
||||||
$libraries = DependencyUtil::getLibsByDeps($libraries);
|
|
||||||
|
|
||||||
// add lib object for builder
|
// add lib object for builder
|
||||||
foreach ($libraries as $library) {
|
foreach ($sorted_libraries as $library) {
|
||||||
// if some libs are not supported (but in config "lib.json", throw exception)
|
// if some libs are not supported (but in config "lib.json", throw exception)
|
||||||
if (!isset($support_lib_list[$library])) {
|
if (!isset($support_lib_list[$library])) {
|
||||||
throw new WrongUsageException('library [' . $library . '] is in the lib.json list but not supported to compile, but in the future I will support it!');
|
throw new WrongUsageException('library [' . $library . '] is in the lib.json list but not supported to compile, but in the future I will support it!');
|
||||||
@ -81,7 +79,7 @@ abstract class BuilderBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
// extract sources
|
// extract sources
|
||||||
SourceExtractor::initSource(libs: $libraries);
|
SourceExtractor::initSource(libs: $sorted_libraries);
|
||||||
|
|
||||||
// build all libs
|
// build all libs
|
||||||
foreach ($this->libs as $lib) {
|
foreach ($this->libs as $lib) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user