mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-02 14:25:41 +08:00
Forward-port #1086
This commit is contained in:
@@ -11,6 +11,7 @@ use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Attribute\PatchDescription;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Util\GlobalEnvManager;
|
||||
use StaticPHP\Util\SourcePatcher;
|
||||
|
||||
#[Extension('xlswriter')]
|
||||
@@ -27,6 +28,13 @@ class xlswriter extends PhpExtensionPackage
|
||||
return $arg;
|
||||
}
|
||||
|
||||
#[BeforeStage('php', [php::class, 'makeForUnix'], 'ext-xlswriter')]
|
||||
#[PatchDescription('Fix Unix build: add -std=gnu17 to CFLAGS to fix build errors on older GCC versions')]
|
||||
public function patchBeforeUnixMake(): void
|
||||
{
|
||||
GlobalEnvManager::putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS=' . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') . ' -std=gnu17');
|
||||
}
|
||||
|
||||
#[BeforeStage('php', [php::class, 'makeForWindows'], 'ext-xlswriter')]
|
||||
#[PatchDescription('Fix Windows build: apply win32 patch and add UTF-8 BOM to theme.c')]
|
||||
public function patchBeforeMakeForWindows(): void
|
||||
@@ -39,4 +47,11 @@ class xlswriter extends PhpExtensionPackage
|
||||
file_put_contents($this->getSourceDir() . '/library/libxlsxwriter/src/theme.c', $bom . $content);
|
||||
}
|
||||
}
|
||||
|
||||
public function getSharedExtensionEnv(): array
|
||||
{
|
||||
$parent = parent::getSharedExtensionEnv();
|
||||
$parent['CFLAGS'] .= ' -std=gnu17';
|
||||
return $parent;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user