File tree Expand file tree Collapse file tree 3 files changed +16
-17
lines changed
Expand file tree Collapse file tree 3 files changed +16
-17
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 ;
1315use SPC \util \SPCConfigUtil ;
1416use SPC \util \SPCTarget ;
1517
@@ -427,13 +429,18 @@ public function buildUnixShared(): void
427429 logger ()->info ("Extension [ {$ this ->getName ()}] patched before shared configure " );
428430 }
429431
432+ $ has_avx512 = str_contains ($ this ->builder ->arch_c_flags ?? '' , '-mavx512 ' ) ||
433+ str_contains ($ this ->builder ->arch_c_flags ?? '' , '-march=x86-64-v3 ' ) ||
434+ str_contains ($ this ->arch_c_flags ?? '' , '-march=x86-64-v4 ' ) ||
435+ ToolchainManager::getToolchainClass () !== ZigToolchain::class;
436+
430437 shell ()->cd ($ this ->source_dir )
431438 ->setEnv ($ env )
432439 ->appendEnv ($ this ->getExtraEnv ())
433440 ->exec (
434441 './configure ' . $ this ->getUnixConfigureArg (true ) .
435442 ' --with-php-config= ' . BUILD_BIN_PATH . '/php-config ' .
436- '--enable-shared --disable-static '
443+ '--enable-shared --disable-static ' . (! $ has_avx512 ? ' php_cv_have_avx512=no ' : '' )
437444 );
438445
439446 if ($ this ->patchBeforeSharedMake ()) {
Original file line number Diff line number Diff line change 66
77use SPC \builder \Extension ;
88use SPC \store \FileSystem ;
9- use SPC \toolchain \ToolchainManager ;
10- use SPC \toolchain \ZigToolchain ;
119use SPC \util \CustomExt ;
1210
1311#[CustomExt('simdjson ' )]
@@ -33,18 +31,4 @@ public function patchBeforeBuildconf(): bool
3331 );
3432 return true ;
3533 }
36-
37- public function getSharedExtensionEnv (): array
38- {
39- $ env = parent ::getSharedExtensionEnv ();
40- if (ToolchainManager::getToolchainClass () === ZigToolchain::class) {
41- $ extra = getenv ('SPC_COMPILER_EXTRA ' );
42- if (!str_contains ((string ) $ extra , '-lstdc++ ' )) {
43- f_putenv ('SPC_COMPILER_EXTRA= ' . clean_spaces ($ extra . ' -lstdc++ ' ));
44- }
45- $ env ['CFLAGS ' ] .= ' -Xclang -target-feature -Xclang +evex512 ' ;
46- $ env ['CXXFLAGS ' ] .= ' -Xclang -target-feature -Xclang +evex512 ' ;
47- }
48- return $ env ;
49- }
5034}
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 ;
1214use SPC \util \GlobalEnvManager ;
1315use SPC \util \SPCConfigUtil ;
1416use SPC \util \SPCTarget ;
@@ -103,6 +105,11 @@ public function buildPHP(int $build_target = BUILD_TARGET_NONE): void
103105 );
104106 }
105107
108+ $ has_avx512 = str_contains ($ this ->arch_c_flags , '-mavx512 ' ) ||
109+ str_contains ($ this ->arch_c_flags , '-march=x86-64-v3 ' ) ||
110+ str_contains ($ this ->arch_c_flags , '-march=x86-64-v4 ' ) ||
111+ ToolchainManager::getToolchainClass () !== ZigToolchain::class;
112+
106113 $ this ->seekPhpSrcLogFileOnException (fn () => shell ()->cd (SOURCE_PATH . '/php-src ' )->exec (
107114 $ php_configure_env . ' ' .
108115 getenv ('SPC_CMD_PREFIX_PHP_CONFIGURE ' ) . ' ' .
@@ -116,6 +123,7 @@ public function buildPHP(int $build_target = BUILD_TARGET_NONE): void
116123 $ json_74 .
117124 $ zts .
118125 $ maxExecutionTimers .
126+ (!$ has_avx512 ? 'php_cv_have_avx512=no ' : '' ) .
119127 $ this ->makeStaticExtensionArgs () . ' '
120128 ));
121129
You can’t perform that action at this time.
0 commit comments