mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +08:00
Use isStatic instead of isStaticTarget
This commit is contained in:
parent
956688d9f4
commit
e1e48922de
@ -534,7 +534,7 @@ class Extension
|
||||
}
|
||||
}
|
||||
// move static libstdc++ to shared if we are on non-full-static build target
|
||||
if (!SPCTarget::isStaticTarget() && in_array(SPCTarget::getLibc(), SPCTarget::LIBC_LIST)) {
|
||||
if (!SPCTarget::isStatic() && in_array(SPCTarget::getLibc(), SPCTarget::LIBC_LIST)) {
|
||||
$staticLibString .= ' -lstdc++';
|
||||
$sharedLibString = str_replace('-lstdc++', '', $sharedLibString);
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ class icu extends LinuxLibraryBase
|
||||
{
|
||||
$cppflags = 'CPPFLAGS="-DU_CHARSET_IS_UTF8=1 -DU_USING_ICU_NAMESPACE=1 -DU_STATIC_IMPLEMENTATION=1 -DPIC -fPIC"';
|
||||
$cxxflags = 'CXXFLAGS="-std=c++17 -DPIC -fPIC -fno-ident"';
|
||||
$ldflags = SPCTarget::isStaticTarget() ? 'LDFLAGS="-static"' : '';
|
||||
$ldflags = SPCTarget::isStatic() ? 'LDFLAGS="-static"' : '';
|
||||
shell()->cd($this->source_dir . '/source')->initializeEnv($this)
|
||||
->exec(
|
||||
"{$cppflags} {$cxxflags} {$ldflags} " .
|
||||
|
||||
@ -201,7 +201,7 @@ abstract class UnixBuilderBase extends BuilderBase
|
||||
$util = new SPCConfigUtil($this);
|
||||
$config = $util->config($this->ext_list, $this->lib_list, $this->getOption('with-suggested-exts'), $this->getOption('with-suggested-libs'));
|
||||
$lens = "{$config['cflags']} {$config['ldflags']} {$config['libs']}";
|
||||
if (SPCTarget::isStaticTarget()) {
|
||||
if (SPCTarget::isStatic()) {
|
||||
$lens .= ' -static';
|
||||
}
|
||||
[$ret, $out] = shell()->cd($sample_file_path)->execWithResult(getenv('CC') . ' -o embed embed.c ' . $lens);
|
||||
@ -335,7 +335,7 @@ abstract class UnixBuilderBase extends BuilderBase
|
||||
$debugFlags = $this->getOption('no-strip') ? "'-w -s' " : '';
|
||||
$extLdFlags = "-extldflags '-pie'";
|
||||
$muslTags = '';
|
||||
if (SPCTarget::isStaticTarget()) {
|
||||
if (SPCTarget::isStatic()) {
|
||||
$extLdFlags = "-extldflags '-static-pie -Wl,-z,stack-size=0x80000'";
|
||||
$muslTags = 'static_build,';
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ trait imagemagick
|
||||
);
|
||||
|
||||
// special: linux-static target needs `-static`
|
||||
$ldflags = SPCTarget::isStaticTarget() ? ('-static -ldl') : '-ldl';
|
||||
$ldflags = SPCTarget::isStatic() ? ('-static -ldl') : '-ldl';
|
||||
|
||||
// special: macOS needs -iconv
|
||||
$libs = SPCTarget::getTargetOS() === 'Darwin' ? '-liconv' : '';
|
||||
|
||||
@ -14,7 +14,7 @@ trait pkgconfig
|
||||
UnixAutoconfExecutor::create($this)
|
||||
->appendEnv([
|
||||
'CFLAGS' => PHP_OS_FAMILY !== 'Linux' ? '-Wimplicit-function-declaration -Wno-int-conversion' : '',
|
||||
'LDFLAGS' => SPCTarget::isStaticTarget() ? '--static' : '',
|
||||
'LDFLAGS' => SPCTarget::isStatic() ? '--static' : '',
|
||||
])
|
||||
->configure(
|
||||
'--with-internal-glib',
|
||||
|
||||
@ -51,7 +51,7 @@ trait postgresql
|
||||
$error_exec_cnt += $output[0] === 0 ? 0 : 1;
|
||||
if (!empty($output[1][0])) {
|
||||
$ldflags = $output[1][0];
|
||||
$envs .= SPCTarget::isStaticTarget() ? " LDFLAGS=\"{$ldflags} -static\" " : " LDFLAGS=\"{$ldflags}\" ";
|
||||
$envs .= SPCTarget::isStatic() ? " LDFLAGS=\"{$ldflags} -static\" " : " LDFLAGS=\"{$ldflags}\" ";
|
||||
}
|
||||
$output = shell()->execWithResult("pkg-config --libs-only-l --static {$packages}");
|
||||
$error_exec_cnt += $output[0] === 0 ? 0 : 1;
|
||||
|
||||
@ -64,7 +64,7 @@ class BuildPHPCommand extends BuildCommand
|
||||
|
||||
// check dynamic extension build env
|
||||
// linux must build with glibc
|
||||
if (!empty($shared_extensions) && SPCTarget::isStaticTarget()) {
|
||||
if (!empty($shared_extensions) && SPCTarget::isStatic()) {
|
||||
$this->output->writeln('Linux does not support dynamic extension loading with musl-libc full-static build, please build with shared target!');
|
||||
return static::FAILURE;
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ class SPCTarget
|
||||
/**
|
||||
* Returns whether the target is a full-static target.
|
||||
*/
|
||||
public static function isStaticTarget(): bool
|
||||
public static function isStatic(): bool
|
||||
{
|
||||
$env = getenv('SPC_TARGET');
|
||||
$libc = getenv('SPC_LIBC');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user