Skip to content

Commit 22a438e

Browse files
authored
Add xlswriter extension windows support (#712)
* Add xlswriter extension windows support * cs fix
1 parent a014294 commit 22a438e

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

config/ext.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,6 @@
958958
},
959959
"xlswriter": {
960960
"support": {
961-
"Windows": "wip",
962961
"BSD": "wip"
963962
},
964963
"type": "external",

src/SPC/builder/extension/xlswriter.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,23 @@ public function getUnixConfigureArg(bool $shared = false): string
1818
}
1919
return $arg;
2020
}
21+
22+
public function getWindowsConfigureArg(): string
23+
{
24+
return '--with-xlswriter';
25+
}
26+
27+
public function patchBeforeMake(): bool
28+
{
29+
if (PHP_OS_FAMILY === 'Windows') {
30+
$content = file_get_contents($this->source_dir . '/library/libxlsxwriter/src/theme.c');
31+
$bom = pack('CCC', 0xEF, 0xBB, 0xBF);
32+
if (substr($content, 0, 3) !== $bom) {
33+
file_put_contents($this->source_dir . '/library/libxlsxwriter/src/theme.c', $content);
34+
return true;
35+
}
36+
return false;
37+
}
38+
return false;
39+
}
2140
}

src/globals/test-extensions.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@
1313

1414
// test php version (8.1 ~ 8.4 available, multiple for matrix)
1515
$test_php_version = [
16-
// '8.1',
17-
// '8.2',
18-
// '8.3',
16+
'8.1',
17+
'8.2',
18+
'8.3',
1919
'8.4',
2020
];
2121

2222
// test os (macos-13, macos-14, macos-15, ubuntu-latest, windows-latest are available)
2323
$test_os = [
2424
// 'macos-13',
25-
'macos-14',
26-
'macos-15',
25+
// 'macos-14',
26+
// 'macos-15',
2727
// 'ubuntu-latest',
2828
// 'ubuntu-22.04',
2929
// 'ubuntu-24.04',
3030
// 'ubuntu-22.04-arm',
3131
// 'ubuntu-24.04-arm',
32-
// 'windows-latest',
32+
'windows-latest',
3333
];
3434

3535
// whether enable thread safe
@@ -46,7 +46,7 @@
4646
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
4747
$extensions = match (PHP_OS_FAMILY) {
4848
'Linux', 'Darwin' => 'pgsql',
49-
'Windows' => 'ev',
49+
'Windows' => 'xlswriter',
5050
};
5151

5252
// If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`).

0 commit comments

Comments
 (0)