mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-06 16:25:39 +08:00
allow building and linking with shared instead of static libs
This commit is contained in:
@@ -61,8 +61,9 @@ class PkgConfigUtil
|
||||
*/
|
||||
public static function getCflags(string $pkg_config_str): string
|
||||
{
|
||||
$static = getenv('SPC_STATIC_LIBS') ? '--static' : '';
|
||||
// get other things
|
||||
$result = self::execWithResult("pkg-config --static --cflags-only-other {$pkg_config_str}");
|
||||
$result = self::execWithResult("pkg-config $static --cflags-only-other {$pkg_config_str}");
|
||||
return trim($result);
|
||||
}
|
||||
|
||||
@@ -78,11 +79,12 @@ class PkgConfigUtil
|
||||
public static function getLibsArray(string $pkg_config_str): array
|
||||
{
|
||||
// Use this instead of shell() to avoid unnecessary outputs
|
||||
$result = self::execWithResult("pkg-config --static --libs-only-l {$pkg_config_str}");
|
||||
$static = getenv('SPC_STATIC_LIBS') ? '--static' : '';
|
||||
$result = self::execWithResult("pkg-config $static --libs-only-l {$pkg_config_str}");
|
||||
$libs = explode(' ', trim($result));
|
||||
|
||||
// get other things
|
||||
$result = self::execWithResult("pkg-config --static --libs-only-other {$pkg_config_str}");
|
||||
$result = self::execWithResult("pkg-config $static --libs-only-other {$pkg_config_str}");
|
||||
// convert libxxx.a to -L{path} -lxxx
|
||||
$exp = explode(' ', trim($result));
|
||||
foreach ($exp as $item) {
|
||||
|
||||
Reference in New Issue
Block a user