Skip to content

Commit 92ba60b

Browse files
domr@qq.comdomr@qq.com
authored andcommitted
Apply PHP 8.6 extension compatibility before static compilation
1 parent 0ea0c55 commit 92ba60b

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

‎.github/jit/apply_spc_profile.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,22 @@
1212
if text.count(before) != 1:
1313
raise RuntimeError('Unexpected static-php-cli stdext configure layout')
1414
path.write_text(text.replace(before, "$arg .= ' --disable-swoole-stdext';", 1))
15+
16+
# SPC provides the removed PHP 8.6 macros to phpize builds after installation.
17+
# Apply the same header before make so bundled PECL sources can use it too.
18+
path = Path('src/Package/Target/php/unix.php')
19+
text = path.read_text()
20+
patches = {
21+
''' logger()->info('cleaning up php-src build files');''':
22+
''' $this->installRemovedMacroCompatHeader($package->getSourceDir() . '/main/php.h');
23+
logger()->info('cleaning up php-src build files');''',
24+
'private function installRemovedMacroCompatHeader(): void':
25+
'private function installRemovedMacroCompatHeader(?string $header = null): void',
26+
"$header = BUILD_ROOT_PATH . '/include/php/main/php.h';":
27+
"$header ??= BUILD_ROOT_PATH . '/include/php/main/php.h';",
28+
}
29+
for before, after in patches.items():
30+
if text.count(before) != 1:
31+
raise RuntimeError('Unexpected static-php-cli PHP 8.6 compatibility layout')
32+
text = text.replace(before, after, 1)
33+
path.write_text(text)

‎.github/workflows/build-php-unix.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
path: .release-tools
7676
persist-credentials: false
7777

78-
- name: Disable experimental Swoole stdext for JIT compatibility
78+
- name: Apply Swoole JIT and PHP 8.6 static extension compatibility
7979
run: python3 .release-tools/.github/jit/apply_spc_profile.py --profile stdext-off
8080

8181
- name: Setup build runtime

0 commit comments

Comments
 (0)