mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 12:54:52 +08:00
need static libs because of lib.json
This commit is contained in:
parent
cf69c02624
commit
179626f989
@ -470,11 +470,6 @@
|
||||
"static-libs-unix": [
|
||||
"libiconv.a",
|
||||
"libcharset.a"
|
||||
],
|
||||
"headers": [
|
||||
"iconv.h",
|
||||
"libcharset.h",
|
||||
"localcharset.h"
|
||||
]
|
||||
},
|
||||
"libiconv-win": {
|
||||
@ -1011,32 +1006,21 @@
|
||||
},
|
||||
"zlib": {
|
||||
"source": "zlib",
|
||||
"static-libs-unix": [
|
||||
"libz.a"
|
||||
"pkg-configs": [
|
||||
"zlib"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
"zlib_a.lib"
|
||||
],
|
||||
"headers": [
|
||||
"zlib.h",
|
||||
"zconf.h"
|
||||
]
|
||||
},
|
||||
"zstd": {
|
||||
"source": "zstd",
|
||||
"static-libs-unix": [
|
||||
"libzstd.a"
|
||||
"pkg-configs": [
|
||||
"libzstd"
|
||||
],
|
||||
"static-libs-windows": [
|
||||
[
|
||||
"zstd.lib",
|
||||
"zstd_static.lib"
|
||||
]
|
||||
],
|
||||
"headers-unix": [
|
||||
"zdict.h",
|
||||
"zstd.h",
|
||||
"zstd_errors.h"
|
||||
"zstd.lib",
|
||||
"zstd_static.lib"
|
||||
],
|
||||
"headers-windows": [
|
||||
"zstd.h",
|
||||
|
||||
@ -376,7 +376,7 @@ abstract class LibraryBase
|
||||
}
|
||||
}
|
||||
$pkg_config_path = getenv('PKG_CONFIG_PATH') ?: '';
|
||||
$search_paths = array_filter(explode(is_unix() ? ':' : ';', $pkg_config_path));
|
||||
$search_paths = array_unique(array_filter(explode(is_unix() ? ':' : ';', $pkg_config_path)));
|
||||
foreach (Config::getLib(static::NAME, 'pkg-configs', []) as $name) {
|
||||
$found = false;
|
||||
foreach ($search_paths as $path) {
|
||||
|
||||
@ -10,7 +10,8 @@ trait zlib
|
||||
{
|
||||
protected function build(): void
|
||||
{
|
||||
UnixAutoconfExecutor::create($this)->exec("./configure --static --prefix={$this->getBuildRootPath()}")->make();
|
||||
$static = getenv('SPC_STATIC_LIBS') ? '--static' : '';
|
||||
UnixAutoconfExecutor::create($this)->exec("./configure {$static} --prefix={$this->getBuildRootPath()}")->make();
|
||||
$this->patchPkgconfPrefix(['zlib.pc']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,10 +13,10 @@ trait zstd
|
||||
UnixCMakeExecutor::create($this)
|
||||
->setBuildDir("{$this->source_dir}/build/cmake/build")
|
||||
->addConfigureArgs(
|
||||
'-DZSTD_BUILD_STATIC=ON',
|
||||
'-DZSTD_BUILD_SHARED=OFF',
|
||||
'-DZSTD_BUILD_STATIC=' . (getenv('SPC_STATIC_LIBS') ? 'ON' : 'OFF'),
|
||||
'-DZSTD_BUILD_SHARED='. (getenv('SPC_STATIC_LIBS') ? 'OFF' : 'ON'),
|
||||
)
|
||||
->build();
|
||||
$this->patchPkgconfPrefix(['libzstd.pc']);
|
||||
$this->patchPkgconfPrefix();
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ class PkgConfigUtil
|
||||
{
|
||||
$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);
|
||||
}
|
||||
|
||||
@ -80,11 +80,11 @@ class PkgConfigUtil
|
||||
{
|
||||
// Use this instead of shell() to avoid unnecessary outputs
|
||||
$static = getenv('SPC_STATIC_LIBS') ? '--static' : '';
|
||||
$result = self::execWithResult("pkg-config $static --libs-only-l {$pkg_config_str}");
|
||||
$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) {
|
||||
|
||||
@ -134,7 +134,7 @@ class UnixAutoconfExecutor extends Executor
|
||||
{
|
||||
return [
|
||||
getenv('SPC_STATIC_LIBS') ? '--disable-shared' : '--enable-shared',
|
||||
getenv('SPC_STATIC_LIBS') ? '--enable-static' : '--disable-static',
|
||||
getenv('SPC_STATIC_LIBS') ? '--enable-static' : '--enable-static', // TODO: not always static
|
||||
"--prefix={$this->library->getBuildRootPath()}",
|
||||
'--with-pic',
|
||||
'--enable-pic',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user