Skip to content

Commit f75c58b

Browse files
committed
revert to double array_reverse, because static libs with dependencies are backwards
1 parent f8970a2 commit f75c58b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/SPC/util/SPCConfigUtil.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,19 @@ public function config(array $extensions = [], array $libraries = [], bool $incl
9393
return [
9494
'cflags' => trim(getenv('CFLAGS') . ' ' . $cflags),
9595
'ldflags' => trim(getenv('LDFLAGS') . ' ' . $ldflags),
96-
'libs' => trim(getenv('LIBS') . ' ' . $libs),
96+
'libs' => trim(getenv('LIBS') . ' ' . $libs),
9797
];
9898
}
9999

100100
// embed
101101
if (!$this->no_php) {
102102
$libs = "-lphp -lc {$libs}";
103103
}
104+
$libs = '-L' . BUILD_LIB_PATH . ' ' . $libs;
104105
// mimalloc must come first
105106
if (str_contains($libs, BUILD_LIB_PATH . '/mimalloc.o')) {
106107
$libs = BUILD_LIB_PATH . '/mimalloc.o ' . str_replace(BUILD_LIB_PATH . '/mimalloc.o', '', $libs);
107108
}
108-
$libs = '-L' . BUILD_LIB_PATH . ' ' . $libs;
109109
return [
110110
'cflags' => trim(getenv('CFLAGS') . ' ' . $cflags),
111111
'ldflags' => trim(getenv('LDFLAGS') . ' ' . $ldflags),
@@ -180,13 +180,13 @@ private function getLibsString(array $libraries, bool $use_short_libs = true): s
180180
}
181181
$pkg_configs = implode(' ', $pkg_configs);
182182
if ($pkg_configs !== '') {
183-
$pc_libs = PkgConfigUtil::getLibsArray($pkg_configs);
183+
$pc_libs = array_reverse(PkgConfigUtil::getLibsArray($pkg_configs));
184184
$lib_names = [...$lib_names, ...$pc_libs];
185185
}
186186
}
187187

188188
// post-process
189-
$lib_names = array_reverse(array_unique(array_reverse($lib_names)));
189+
$lib_names = array_unique(array_reverse(array_filter($lib_names, fn ($x) => $x !== '')));
190190
$frameworks = array_unique($frameworks);
191191

192192
// process frameworks to short_name

0 commit comments

Comments
 (0)