Add xlswriter extension windows support (#712)

* Add xlswriter extension windows support

* cs fix
This commit is contained in:
Jerry Ma 2025-04-24 14:21:37 +08:00 committed by GitHub
parent a014294d58
commit 22a438ed5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 26 additions and 8 deletions

View File

@ -958,7 +958,6 @@
}, },
"xlswriter": { "xlswriter": {
"support": { "support": {
"Windows": "wip",
"BSD": "wip" "BSD": "wip"
}, },
"type": "external", "type": "external",

View File

@ -18,4 +18,23 @@ class xlswriter extends Extension
} }
return $arg; return $arg;
} }
public function getWindowsConfigureArg(): string
{
return '--with-xlswriter';
}
public function patchBeforeMake(): bool
{
if (PHP_OS_FAMILY === 'Windows') {
$content = file_get_contents($this->source_dir . '/library/libxlsxwriter/src/theme.c');
$bom = pack('CCC', 0xEF, 0xBB, 0xBF);
if (substr($content, 0, 3) !== $bom) {
file_put_contents($this->source_dir . '/library/libxlsxwriter/src/theme.c', $content);
return true;
}
return false;
}
return false;
}
} }

View File

@ -13,23 +13,23 @@ declare(strict_types=1);
// test php version (8.1 ~ 8.4 available, multiple for matrix) // test php version (8.1 ~ 8.4 available, multiple for matrix)
$test_php_version = [ $test_php_version = [
// '8.1', '8.1',
// '8.2', '8.2',
// '8.3', '8.3',
'8.4', '8.4',
]; ];
// test os (macos-13, macos-14, macos-15, ubuntu-latest, windows-latest are available) // test os (macos-13, macos-14, macos-15, ubuntu-latest, windows-latest are available)
$test_os = [ $test_os = [
// 'macos-13', // 'macos-13',
'macos-14', // 'macos-14',
'macos-15', // 'macos-15',
// 'ubuntu-latest', // 'ubuntu-latest',
// 'ubuntu-22.04', // 'ubuntu-22.04',
// 'ubuntu-24.04', // 'ubuntu-24.04',
// 'ubuntu-22.04-arm', // 'ubuntu-22.04-arm',
// 'ubuntu-24.04-arm', // 'ubuntu-24.04-arm',
// 'windows-latest', 'windows-latest',
]; ];
// whether enable thread safe // whether enable thread safe
@ -46,7 +46,7 @@ $prefer_pre_built = false;
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
$extensions = match (PHP_OS_FAMILY) { $extensions = match (PHP_OS_FAMILY) {
'Linux', 'Darwin' => 'pgsql', 'Linux', 'Darwin' => 'pgsql',
'Windows' => 'ev', 'Windows' => 'xlswriter',
}; };
// If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`).