mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-19 05:14: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": [
|
"static-libs-unix": [
|
||||||
"libiconv.a",
|
"libiconv.a",
|
||||||
"libcharset.a"
|
"libcharset.a"
|
||||||
],
|
|
||||||
"headers": [
|
|
||||||
"iconv.h",
|
|
||||||
"libcharset.h",
|
|
||||||
"localcharset.h"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"libiconv-win": {
|
"libiconv-win": {
|
||||||
@ -1011,32 +1006,21 @@
|
|||||||
},
|
},
|
||||||
"zlib": {
|
"zlib": {
|
||||||
"source": "zlib",
|
"source": "zlib",
|
||||||
"static-libs-unix": [
|
"pkg-configs": [
|
||||||
"libz.a"
|
"zlib"
|
||||||
],
|
],
|
||||||
"static-libs-windows": [
|
"static-libs-windows": [
|
||||||
"zlib_a.lib"
|
"zlib_a.lib"
|
||||||
],
|
|
||||||
"headers": [
|
|
||||||
"zlib.h",
|
|
||||||
"zconf.h"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"zstd": {
|
"zstd": {
|
||||||
"source": "zstd",
|
"source": "zstd",
|
||||||
"static-libs-unix": [
|
"pkg-configs": [
|
||||||
"libzstd.a"
|
"libzstd"
|
||||||
],
|
],
|
||||||
"static-libs-windows": [
|
"static-libs-windows": [
|
||||||
[
|
"zstd.lib",
|
||||||
"zstd.lib",
|
"zstd_static.lib"
|
||||||
"zstd_static.lib"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"headers-unix": [
|
|
||||||
"zdict.h",
|
|
||||||
"zstd.h",
|
|
||||||
"zstd_errors.h"
|
|
||||||
],
|
],
|
||||||
"headers-windows": [
|
"headers-windows": [
|
||||||
"zstd.h",
|
"zstd.h",
|
||||||
|
|||||||
@ -376,7 +376,7 @@ abstract class LibraryBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$pkg_config_path = getenv('PKG_CONFIG_PATH') ?: '';
|
$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) {
|
foreach (Config::getLib(static::NAME, 'pkg-configs', []) as $name) {
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ($search_paths as $path) {
|
foreach ($search_paths as $path) {
|
||||||
|
|||||||
@ -10,7 +10,8 @@ trait zlib
|
|||||||
{
|
{
|
||||||
protected function build(): void
|
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']);
|
$this->patchPkgconfPrefix(['zlib.pc']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,10 +13,10 @@ trait zstd
|
|||||||
UnixCMakeExecutor::create($this)
|
UnixCMakeExecutor::create($this)
|
||||||
->setBuildDir("{$this->source_dir}/build/cmake/build")
|
->setBuildDir("{$this->source_dir}/build/cmake/build")
|
||||||
->addConfigureArgs(
|
->addConfigureArgs(
|
||||||
'-DZSTD_BUILD_STATIC=ON',
|
'-DZSTD_BUILD_STATIC=' . (getenv('SPC_STATIC_LIBS') ? 'ON' : 'OFF'),
|
||||||
'-DZSTD_BUILD_SHARED=OFF',
|
'-DZSTD_BUILD_SHARED='. (getenv('SPC_STATIC_LIBS') ? 'OFF' : 'ON'),
|
||||||
)
|
)
|
||||||
->build();
|
->build();
|
||||||
$this->patchPkgconfPrefix(['libzstd.pc']);
|
$this->patchPkgconfPrefix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,7 @@ class PkgConfigUtil
|
|||||||
{
|
{
|
||||||
$static = getenv('SPC_STATIC_LIBS') ? '--static' : '';
|
$static = getenv('SPC_STATIC_LIBS') ? '--static' : '';
|
||||||
// get other things
|
// 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);
|
return trim($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,11 +80,11 @@ class PkgConfigUtil
|
|||||||
{
|
{
|
||||||
// Use this instead of shell() to avoid unnecessary outputs
|
// Use this instead of shell() to avoid unnecessary outputs
|
||||||
$static = getenv('SPC_STATIC_LIBS') ? '--static' : '';
|
$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));
|
$libs = explode(' ', trim($result));
|
||||||
|
|
||||||
// get other things
|
// 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
|
// convert libxxx.a to -L{path} -lxxx
|
||||||
$exp = explode(' ', trim($result));
|
$exp = explode(' ', trim($result));
|
||||||
foreach ($exp as $item) {
|
foreach ($exp as $item) {
|
||||||
|
|||||||
@ -134,7 +134,7 @@ class UnixAutoconfExecutor extends Executor
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
getenv('SPC_STATIC_LIBS') ? '--disable-shared' : '--enable-shared',
|
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()}",
|
"--prefix={$this->library->getBuildRootPath()}",
|
||||||
'--with-pic',
|
'--with-pic',
|
||||||
'--enable-pic',
|
'--enable-pic',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user