Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/Package/Target/php/windows.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,21 @@ public function makeCgiForWindows(TargetPackage $package, PackageBuilder $builde
$this->deployWindowsBinary($builder, $package, 'php-cgi');
}

#[BeforeStage('php', [self::class, 'makeForWindows'])]
#[PatchDescription('Define LEXBOR_STATIC for static builds (PHP 8.5+ uri extension)')]
public function patchLexborStaticDefine(TargetPackage $package): void
{
if ($this->getPHPVersionID() < 80500) {
return;
}
$makefile_path = "{$package->getSourceDir()}\\Makefile";
$content = FileSystem::readFile($makefile_path);
// ext/uri references lexbor headers which default to __declspec(dllimport) on Windows.
// LEXBOR_STATIC makes LXB_API expand to nothing, required for static linking.
$content = preg_replace('/^CFLAGS_URI=(.+)$/m', 'CFLAGS_URI=$1 /D LEXBOR_STATIC', $content, 1);
FileSystem::writeFile($makefile_path, $content);
}

#[Stage]
public function makeForWindows(TargetPackage $package, PackageInstaller $installer): void
{
Expand Down
Loading