mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 12:54:52 +08:00
bring back setting, some libraries don't build a static version if the shared one should also be built...
This commit is contained in:
parent
cc69a169a8
commit
ed1e02823a
@ -25,8 +25,8 @@ class pgsql extends Extension
|
||||
{
|
||||
if ($this->builder->getPHPVersionID() >= 80400) {
|
||||
$libfiles = $this->getLibFilesString();
|
||||
$libfiles = str_replace(BUILD_LIB_PATH . '/lib', '-l', $libfiles);
|
||||
$libfiles = str_replace('.a', '', $libfiles);
|
||||
$libfiles = deduplicate_flags($libfiles);
|
||||
$libfiles = clean_spaces($libfiles);
|
||||
return '--with-pgsql' . ($shared ? '=shared' : '') .
|
||||
' PGSQL_CFLAGS=-I' . BUILD_INCLUDE_PATH .
|
||||
' PGSQL_LIBS="-L' . BUILD_LIB_PATH . ' ' . $libfiles . '"';
|
||||
|
||||
@ -56,10 +56,11 @@ class openssl extends LinuxLibraryBase
|
||||
// TODO: in v3 use the following: $openssl_dir ??= SystemUtil::getOSRelease()['dist'] === 'redhat' ? '/etc/pki/tls' : '/etc/ssl';
|
||||
$openssl_dir ??= '/etc/ssl';
|
||||
$ex_lib = trim($ex_lib);
|
||||
$noShared = getenv('SPC_LINK_STATIC') ? 'no-shared' : '';
|
||||
|
||||
shell()->cd($this->source_dir)->initializeEnv($this)
|
||||
->exec(
|
||||
"./Configure {$extra} " .
|
||||
"./Configure {$noShared} {$extra} " .
|
||||
'--prefix=' . BUILD_ROOT_PATH . ' ' .
|
||||
'--libdir=' . BUILD_LIB_PATH . ' ' .
|
||||
"--openssldir={$openssl_dir} " .
|
||||
|
||||
@ -15,7 +15,7 @@ trait UnixLibraryTrait
|
||||
{
|
||||
$libs = $include_self ? [$this] : [];
|
||||
array_unshift($libs, ...array_values($this->getDependencies(recursive: true)));
|
||||
$config = new SPCConfigUtil($this->builder, options: ['libs_only_deps' => true, 'absolute_libs' => true]);
|
||||
$config = new SPCConfigUtil($this->builder, options: ['libs_only_deps' => true]);
|
||||
$res = $config->config(libraries: array_map(fn ($x) => $x->getName(), $libs));
|
||||
return $res['libs'];
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ trait libuv
|
||||
protected function build(): void
|
||||
{
|
||||
UnixCMakeExecutor::create($this)
|
||||
->addConfigureArgs('-DLIBUV_BUILD_SHARED=ON')
|
||||
->addConfigureArgs('-DLIBUV_BUILD_SHARED=' . (getenv('SPC_LINK_STATIC') ? 'OFF' : 'ON'))
|
||||
->build();
|
||||
// patch pkgconfig
|
||||
$this->patchPkgconfPrefix(['libuv-static.pc']);
|
||||
|
||||
@ -13,7 +13,7 @@ trait mimalloc
|
||||
{
|
||||
$cmake = UnixCMakeExecutor::create($this)
|
||||
->addConfigureArgs(
|
||||
'-DMI_BUILD_SHARED=ON',
|
||||
'-DMI_BUILD_SHARED=' . (getenv('SPC_LINK_STATIC') ? 'OFF' : 'ON'),
|
||||
'-DMI_BUILD_OBJECT=OFF',
|
||||
'-DMI_INSTALL_TOPLEVEL=ON',
|
||||
);
|
||||
|
||||
@ -14,7 +14,7 @@ trait tidy
|
||||
->setBuildDir("{$this->source_dir}/build-dir")
|
||||
->addConfigureArgs(
|
||||
'-DSUPPORT_CONSOLE_APP=OFF',
|
||||
'-DBUILD_SHARED_LIB=ON'
|
||||
'-DBUILD_SHARED_LIB=' . (getenv('SPC_LINK_STATIC') ? 'OFF' : 'ON')
|
||||
);
|
||||
if (version_compare(get_cmake_version(), '4.0.0', '>=')) {
|
||||
$cmake->addConfigureArgs('-DCMAKE_POLICY_VERSION_MINIMUM=3.5');
|
||||
|
||||
@ -14,7 +14,7 @@ trait zstd
|
||||
->setBuildDir("{$this->source_dir}/build/cmake/build")
|
||||
->addConfigureArgs(
|
||||
'-DZSTD_BUILD_STATIC=ON',
|
||||
'-DZSTD_BUILD_SHARED=ON',
|
||||
'-DZSTD_BUILD_SHARED=' . (getenv('SPC_LINK_STATIC') ? 'OFF' : 'ON'),
|
||||
)
|
||||
->build();
|
||||
$this->patchPkgconfPrefix();
|
||||
|
||||
@ -39,7 +39,6 @@ class SPCConfigCommand extends BaseCommand
|
||||
$util = new SPCConfigUtil(options: [
|
||||
'no_php' => $this->getOption('no-php'),
|
||||
'libs_only_deps' => $this->getOption('libs-only-deps'),
|
||||
'absolute_libs' => $this->getOption('absolute-libs'),
|
||||
]);
|
||||
$config = $util->config($extensions, $libraries, $include_suggest_ext, $include_suggest_lib);
|
||||
|
||||
|
||||
@ -134,7 +134,7 @@ class UnixAutoconfExecutor extends Executor
|
||||
{
|
||||
return [
|
||||
'--enable-static',
|
||||
'--enable-shared',
|
||||
(getenv('SPC_LINK_STATIC') ? '--disable-shared' : '--enable-shared'),
|
||||
"--prefix={$this->library->getBuildRootPath()}",
|
||||
'--with-pic',
|
||||
'--enable-pic',
|
||||
|
||||
@ -151,7 +151,7 @@ class UnixCMakeExecutor extends Executor
|
||||
'-DCMAKE_INSTALL_LIBDIR=lib',
|
||||
'-DCMAKE_INSTALL_INCLUDEDIR=include',
|
||||
'-DPOSITION_INDEPENDENT_CODE=ON',
|
||||
'-DBUILD_SHARED_LIBS=ON',
|
||||
'-DBUILD_SHARED_LIBS=' . (getenv('SPC_LINK_STATIC') ? 'OFF' : 'ON'),
|
||||
"-DCMAKE_TOOLCHAIN_FILE={$this->makeCmakeToolchainFile()}",
|
||||
]);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user