mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 12:54:52 +08:00
Use failsafe for SPC_EXTRA_PHP_VARS
This commit is contained in:
parent
018dfae15e
commit
897cb00351
@ -34,6 +34,7 @@
|
|||||||
; SPC_LINUX_DEFAULT_CC: the default compiler for linux. (For alpine linux: `gcc`, default: `$GNU_ARCH-linux-musl-gcc`)
|
; SPC_LINUX_DEFAULT_CC: the default compiler for linux. (For alpine linux: `gcc`, default: `$GNU_ARCH-linux-musl-gcc`)
|
||||||
; SPC_LINUX_DEFAULT_CXX: the default c++ compiler for linux. (For alpine linux: `g++`, default: `$GNU_ARCH-linux-musl-g++`)
|
; SPC_LINUX_DEFAULT_CXX: the default c++ compiler for linux. (For alpine linux: `g++`, default: `$GNU_ARCH-linux-musl-g++`)
|
||||||
; SPC_LINUX_DEFAULT_AR: the default archiver for linux. (For alpine linux: `ar`, default: `$GNU_ARCH-linux-musl-ar`)
|
; SPC_LINUX_DEFAULT_AR: the default archiver for linux. (For alpine linux: `ar`, default: `$GNU_ARCH-linux-musl-ar`)
|
||||||
|
; SPC_EXTRA_PHP_VARS: the extra vars for building php, used in `configure` and `make` command.
|
||||||
|
|
||||||
[global]
|
[global]
|
||||||
; Build concurrency for make -jN, default is CPU_COUNT, this value are used in every libs.
|
; Build concurrency for make -jN, default is CPU_COUNT, this value are used in every libs.
|
||||||
|
|||||||
@ -427,13 +427,15 @@ class Extension
|
|||||||
logger()->info("Extension [{$this->getName()}] patched before shared configure");
|
logger()->info("Extension [{$this->getName()}] patched before shared configure");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$phpvars = getenv('SPC_EXTRA_PHP_VARS') ?: '';
|
||||||
|
|
||||||
shell()->cd($this->source_dir)
|
shell()->cd($this->source_dir)
|
||||||
->setEnv($env)
|
->setEnv($env)
|
||||||
->appendEnv($this->getExtraEnv())
|
->appendEnv($this->getExtraEnv())
|
||||||
->exec(
|
->exec(
|
||||||
'./configure ' . $this->getUnixConfigureArg(true) .
|
'./configure ' . $this->getUnixConfigureArg(true) .
|
||||||
' --with-php-config=' . BUILD_BIN_PATH . '/php-config ' .
|
' --with-php-config=' . BUILD_BIN_PATH . '/php-config ' .
|
||||||
'--enable-shared --disable-static ' . getenv('SPC_EXTRA_PHP_VARS')
|
"--enable-shared --disable-static {$phpvars}"
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($this->patchBeforeSharedMake()) {
|
if ($this->patchBeforeSharedMake()) {
|
||||||
|
|||||||
@ -95,6 +95,8 @@ class LinuxBuilder extends UnixBuilderBase
|
|||||||
// 'LIBS' => SPCTarget::getRuntimeLibs(), // do not pass static libraries here yet, they may contain polyfills for libc functions!
|
// 'LIBS' => SPCTarget::getRuntimeLibs(), // do not pass static libraries here yet, they may contain polyfills for libc functions!
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$phpvars = getenv('SPC_EXTRA_PHP_VARS') ?: '';
|
||||||
|
|
||||||
$embed_type = getenv('SPC_CMD_VAR_PHP_EMBED_TYPE') ?: 'static';
|
$embed_type = getenv('SPC_CMD_VAR_PHP_EMBED_TYPE') ?: 'static';
|
||||||
if ($embed_type !== 'static' && SPCTarget::isStatic()) {
|
if ($embed_type !== 'static' && SPCTarget::isStatic()) {
|
||||||
throw new WrongUsageException(
|
throw new WrongUsageException(
|
||||||
@ -116,7 +118,7 @@ class LinuxBuilder extends UnixBuilderBase
|
|||||||
$json_74 .
|
$json_74 .
|
||||||
$zts .
|
$zts .
|
||||||
$maxExecutionTimers .
|
$maxExecutionTimers .
|
||||||
getenv('SPC_EXTRA_PHP_VARS') . ' ' .
|
"{$phpvars} " .
|
||||||
$this->makeStaticExtensionArgs() . ' '
|
$this->makeStaticExtensionArgs() . ' '
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|||||||
@ -67,7 +67,7 @@ class ZigToolchain implements ToolchainInterface
|
|||||||
$cflags = getenv('SPC_DEFAULT_C_FLAGS') ?: getenv('CFLAGS') ?: '';
|
$cflags = getenv('SPC_DEFAULT_C_FLAGS') ?: getenv('CFLAGS') ?: '';
|
||||||
$has_avx512 = str_contains($cflags, '-mavx512') || str_contains($cflags, '-march=x86-64-v4');
|
$has_avx512 = str_contains($cflags, '-mavx512') || str_contains($cflags, '-march=x86-64-v4');
|
||||||
if (!$has_avx512) {
|
if (!$has_avx512) {
|
||||||
f_putenv('SPC_EXTRA_PHP_VARS=php_cv_have_avx512=no php_cv_have_avx512vbmi=no');
|
GlobalEnvManager::putenv('SPC_EXTRA_PHP_VARS=php_cv_have_avx512=no php_cv_have_avx512vbmi=no');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user