Skip to content

Commit b193105

Browse files
authored
Add missing ext source when downloading pre-built grpc (#652)
* Add missing ext source when downloading pre-built grpc * Add tests
1 parent a247669 commit b193105

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

src/SPC/builder/extension/grpc.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ public function patchBeforeBuildconf(): bool
2222
throw new \RuntimeException('grpc extension does not support windows yet');
2323
}
2424
if (!is_link(SOURCE_PATH . '/php-src/ext/grpc')) {
25-
shell()->exec('ln -s ' . $this->builder->getLib('grpc')->getSourceDir() . '/src/php/ext/grpc ' . SOURCE_PATH . '/php-src/ext/grpc');
25+
if (is_dir($this->builder->getLib('grpc')->getSourceDir() . '/src/php/ext/grpc')) {
26+
shell()->exec('ln -s ' . $this->builder->getLib('grpc')->getSourceDir() . '/src/php/ext/grpc ' . SOURCE_PATH . '/php-src/ext/grpc');
27+
} elseif (is_dir(BUILD_ROOT_PATH . '/grpc_php_ext_src')) {
28+
shell()->exec('ln -s ' . BUILD_ROOT_PATH . '/grpc_php_ext_src ' . SOURCE_PATH . '/php-src/ext/grpc');
29+
} else {
30+
throw new \RuntimeException('Cannot find grpc source code');
31+
}
2632
$macos = $this->builder instanceof MacOSBuilder ? "\n" . ' LDFLAGS="$LDFLAGS -framework CoreFoundation"' : '';
2733
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/ext/grpc/config.m4', '/GRPC_LIBDIR=.*$/m', 'GRPC_LIBDIR=' . BUILD_LIB_PATH . $macos);
2834
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/ext/grpc/config.m4', '/SEARCH_PATH=.*$/m', 'SEARCH_PATH="' . BUILD_ROOT_PATH . '"');

src/SPC/builder/unix/library/grpc.php

+1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ protected function build(): void
2020
FileSystem::copyDir($this->source_dir . '/include/grpc', BUILD_INCLUDE_PATH . '/grpc');
2121
FileSystem::copyDir($this->source_dir . '/include/grpc++', BUILD_INCLUDE_PATH . '/grpc++');
2222
FileSystem::copyDir($this->source_dir . '/include/grpcpp', BUILD_INCLUDE_PATH . '/grpcpp');
23+
FileSystem::copyDir($this->source_dir . '/src/php/ext/grpc', BUILD_ROOT_PATH . '/grpc_php_ext_src');
2324
}
2425
}

src/globals/test-extensions.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
// test php version
1515
$test_php_version = [
16-
'8.1',
17-
'8.2',
16+
// '8.1',
17+
// '8.2',
1818
'8.3',
1919
'8.4',
2020
];
@@ -36,11 +36,11 @@
3636
$upx = false;
3737

3838
// prefer downloading pre-built packages to speed up the build process
39-
$prefer_pre_built = false;
39+
$prefer_pre_built = true;
4040

4141
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
4242
$extensions = match (PHP_OS_FAMILY) {
43-
'Linux', 'Darwin' => 'gettext',
43+
'Linux', 'Darwin' => 'grpc',
4444
'Windows' => 'bcmath',
4545
};
4646

0 commit comments

Comments
 (0)