1111use StaticPHP \Attribute \PatchDescription ;
1212use StaticPHP \Package \PackageInstaller ;
1313use StaticPHP \Package \PhpExtensionPackage ;
14- use StaticPHP \Util \GlobalEnvManager ;
1514use StaticPHP \Util \SourcePatcher ;
1615
1716#[Extension('xlswriter ' )]
@@ -21,20 +20,14 @@ class xlswriter extends PhpExtensionPackage
2120 #[CustomPhpConfigureArg('Linux ' )]
2221 public function getUnixConfigureArg (bool $ shared , PackageInstaller $ installer ): string
2322 {
24- $ arg = '--with-xlswriter --enable-reader ' ;
23+ $ shared = $ shared ? '=shared ' : '' ;
24+ $ arg = "--with-xlswriter {$ shared } --enable-reader " ;
2525 if ($ installer ->getLibraryPackage ('openssl ' )) {
2626 $ arg .= ' --with-openssl= ' . $ installer ->getLibraryPackage ('openssl ' )->getBuildRootPath ();
2727 }
2828 return $ arg ;
2929 }
3030
31- #[BeforeStage('php ' , [php::class, 'makeForUnix ' ], 'ext-xlswriter ' )]
32- #[PatchDescription('Fix Unix build: add -std=gnu17 to CFLAGS to fix build errors on older GCC versions ' )]
33- public function patchBeforeUnixMake (): void
34- {
35- GlobalEnvManager::putenv ('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS= ' . getenv ('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS ' ) . ' -std=gnu17 ' );
36- }
37-
3831 #[BeforeStage('php ' , [php::class, 'makeForWindows ' ], 'ext-xlswriter ' )]
3932 #[PatchDescription('Fix Windows build: apply win32 patch and add UTF-8 BOM to theme.c ' )]
4033 public function patchBeforeMakeForWindows (): void
@@ -47,11 +40,4 @@ public function patchBeforeMakeForWindows(): void
4740 file_put_contents ($ this ->getSourceDir () . '/library/libxlsxwriter/src/theme.c ' , $ bom . $ content );
4841 }
4942 }
50-
51- public function getSharedExtensionEnv (): array
52- {
53- $ parent = parent ::getSharedExtensionEnv ();
54- $ parent ['CFLAGS ' ] .= ' -std=gnu17 ' ;
55- return $ parent ;
56- }
5743}
0 commit comments