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
3 changed files with 26 additions and 8 deletions

View File

@@ -18,4 +18,23 @@ class xlswriter extends Extension
}
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;
}
}