suggestions

This commit is contained in:
henderkes 2025-10-11 10:38:51 +02:00
parent 31a4498056
commit 018dfae15e
3 changed files with 7 additions and 14 deletions

View File

@ -10,8 +10,6 @@ use SPC\exception\ValidationException;
use SPC\exception\WrongUsageException;
use SPC\store\Config;
use SPC\store\FileSystem;
use SPC\toolchain\ToolchainManager;
use SPC\toolchain\ZigToolchain;
use SPC\util\SPCConfigUtil;
use SPC\util\SPCTarget;
@ -429,17 +427,13 @@ class Extension
logger()->info("Extension [{$this->getName()}] patched before shared configure");
}
$has_avx512 = str_contains($this->builder->arch_c_flags ?? '', '-mavx512') ||
str_contains($this->arch_c_flags ?? '', '-march=x86-64-v4') ||
ToolchainManager::getToolchainClass() !== ZigToolchain::class;
shell()->cd($this->source_dir)
->setEnv($env)
->appendEnv($this->getExtraEnv())
->exec(
'./configure ' . $this->getUnixConfigureArg(true) .
' --with-php-config=' . BUILD_BIN_PATH . '/php-config ' .
'--enable-shared --disable-static' . (!$has_avx512 ? ' php_cv_have_avx512=no php_cv_have_avx512vbmi=no' : '')
'--enable-shared --disable-static ' . getenv('SPC_EXTRA_PHP_VARS')
);
if ($this->patchBeforeSharedMake()) {

View File

@ -9,8 +9,6 @@ use SPC\exception\PatchException;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem;
use SPC\store\SourcePatcher;
use SPC\toolchain\ToolchainManager;
use SPC\toolchain\ZigToolchain;
use SPC\util\GlobalEnvManager;
use SPC\util\SPCConfigUtil;
use SPC\util\SPCTarget;
@ -105,10 +103,6 @@ class LinuxBuilder extends UnixBuilderBase
);
}
$has_avx512 = str_contains($this->arch_c_flags, '-mavx512') ||
str_contains($this->arch_c_flags, '-march=x86-64-v4') ||
ToolchainManager::getToolchainClass() !== ZigToolchain::class;
$this->seekPhpSrcLogFileOnException(fn () => shell()->cd(SOURCE_PATH . '/php-src')->exec(
$php_configure_env . ' ' .
getenv('SPC_CMD_PREFIX_PHP_CONFIGURE') . ' ' .
@ -122,7 +116,7 @@ class LinuxBuilder extends UnixBuilderBase
$json_74 .
$zts .
$maxExecutionTimers .
(!$has_avx512 ? 'php_cv_have_avx512=no php_cv_have_avx512vbmi=no ' : '') .
getenv('SPC_EXTRA_PHP_VARS') . ' ' .
$this->makeStaticExtensionArgs() . ' '
));

View File

@ -64,6 +64,11 @@ class ZigToolchain implements ToolchainInterface
$extra_libs = trim($extra_libs . ' -lunwind');
GlobalEnvManager::putenv("SPC_EXTRA_LIBS={$extra_libs}");
}
$cflags = getenv('SPC_DEFAULT_C_FLAGS') ?: getenv('CFLAGS') ?: '';
$has_avx512 = str_contains($cflags, '-mavx512') || str_contains($cflags, '-march=x86-64-v4');
if (!$has_avx512) {
f_putenv('SPC_EXTRA_PHP_VARS=php_cv_have_avx512=no php_cv_have_avx512vbmi=no');
}
}
public function getCompilerInfo(): ?string