File tree Expand file tree Collapse file tree 3 files changed +7
-14
lines changed
Expand file tree Collapse file tree 3 files changed +7
-14
lines changed Original file line number Diff line number Diff line change 1010use SPC \exception \WrongUsageException ;
1111use SPC \store \Config ;
1212use SPC \store \FileSystem ;
13- use SPC \toolchain \ToolchainManager ;
14- use SPC \toolchain \ZigToolchain ;
1513use SPC \util \SPCConfigUtil ;
1614use SPC \util \SPCTarget ;
1715
@@ -429,17 +427,13 @@ public function buildUnixShared(): void
429427 logger ()->info ("Extension [ {$ this ->getName ()}] patched before shared configure " );
430428 }
431429
432- $ has_avx512 = str_contains ($ this ->builder ->arch_c_flags ?? '' , '-mavx512 ' ) ||
433- str_contains ($ this ->arch_c_flags ?? '' , '-march=x86-64-v4 ' ) ||
434- ToolchainManager::getToolchainClass () !== ZigToolchain::class;
435-
436430 shell ()->cd ($ this ->source_dir )
437431 ->setEnv ($ env )
438432 ->appendEnv ($ this ->getExtraEnv ())
439433 ->exec (
440434 './configure ' . $ this ->getUnixConfigureArg (true ) .
441435 ' --with-php-config= ' . BUILD_BIN_PATH . '/php-config ' .
442- '--enable-shared --disable-static ' . (! $ has_avx512 ? ' php_cv_have_avx512=no php_cv_have_avx512vbmi=no ' : ' ' )
436+ '--enable-shared --disable-static ' . getenv ( ' SPC_EXTRA_PHP_VARS ' )
443437 );
444438
445439 if ($ this ->patchBeforeSharedMake ()) {
Original file line number Diff line number Diff line change 99use SPC \exception \WrongUsageException ;
1010use SPC \store \FileSystem ;
1111use SPC \store \SourcePatcher ;
12- use SPC \toolchain \ToolchainManager ;
13- use SPC \toolchain \ZigToolchain ;
1412use SPC \util \GlobalEnvManager ;
1513use SPC \util \SPCConfigUtil ;
1614use SPC \util \SPCTarget ;
@@ -105,10 +103,6 @@ public function buildPHP(int $build_target = BUILD_TARGET_NONE): void
105103 );
106104 }
107105
108- $ has_avx512 = str_contains ($ this ->arch_c_flags , '-mavx512 ' ) ||
109- str_contains ($ this ->arch_c_flags , '-march=x86-64-v4 ' ) ||
110- ToolchainManager::getToolchainClass () !== ZigToolchain::class;
111-
112106 $ this ->seekPhpSrcLogFileOnException (fn () => shell ()->cd (SOURCE_PATH . '/php-src ' )->exec (
113107 $ php_configure_env . ' ' .
114108 getenv ('SPC_CMD_PREFIX_PHP_CONFIGURE ' ) . ' ' .
@@ -122,7 +116,7 @@ public function buildPHP(int $build_target = BUILD_TARGET_NONE): void
122116 $ json_74 .
123117 $ zts .
124118 $ maxExecutionTimers .
125- (! $ has_avx512 ? ' php_cv_have_avx512=no php_cv_have_avx512vbmi=no ' : '' ) .
119+ getenv ( ' SPC_EXTRA_PHP_VARS ' ) . ' ' .
126120 $ this ->makeStaticExtensionArgs () . ' '
127121 ));
128122
Original file line number Diff line number Diff line change @@ -64,6 +64,11 @@ public function afterInit(): void
6464 $ extra_libs = trim ($ extra_libs . ' -lunwind ' );
6565 GlobalEnvManager::putenv ("SPC_EXTRA_LIBS= {$ extra_libs }" );
6666 }
67+ $ cflags = getenv ('SPC_DEFAULT_C_FLAGS ' ) ?: getenv ('CFLAGS ' ) ?: '' ;
68+ $ has_avx512 = str_contains ($ cflags , '-mavx512 ' ) || str_contains ($ cflags , '-march=x86-64-v4 ' );
69+ if (!$ has_avx512 ) {
70+ f_putenv ('SPC_EXTRA_PHP_VARS=php_cv_have_avx512=no php_cv_have_avx512vbmi=no ' );
71+ }
6772 }
6873
6974 public function getCompilerInfo (): ?string
You can’t perform that action at this time.
0 commit comments