diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bb160f5c..17355887 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -199,6 +199,6 @@ jobs: if: ${{ !startsWith(matrix.os, 'windows-') }} run: php src/globals/test-extensions.php build_embed_cmd ${{ matrix.os }} ${{ matrix.php }} - - name: Setup tmate session - if: ${{ failure() }} - uses: mxschmitt/action-tmate@v3 +# - name: Setup tmate session +# if: ${{ failure() }} +# uses: mxschmitt/action-tmate@v3 diff --git a/config/ext.json b/config/ext.json index a5eca9f4..5a3ebbd4 100644 --- a/config/ext.json +++ b/config/ext.json @@ -233,7 +233,7 @@ }, "type": "external", "source": "grpc", - "arg-type-unix": "custom", + "arg-type-unix": "with-prefix", "cpp-extension": true, "lib-depends": [ "grpc" diff --git a/src/SPC/builder/extension/grpc.php b/src/SPC/builder/extension/grpc.php index 7a3ed091..d718d7de 100644 --- a/src/SPC/builder/extension/grpc.php +++ b/src/SPC/builder/extension/grpc.php @@ -16,23 +16,20 @@ class grpc extends Extension { public function patchBeforeBuildconf(): bool { - // soft link to the grpc source code if ($this->builder instanceof WindowsBuilder) { - // not support windows yet throw new \RuntimeException('grpc extension does not support windows yet'); } - if (!is_link(SOURCE_PATH . '/php-src/ext/grpc')) { - if (is_dir($this->builder->getLib('grpc')->getSourceDir() . '/src/php/ext/grpc')) { - shell()->exec('ln -s ' . $this->builder->getLib('grpc')->getSourceDir() . '/src/php/ext/grpc ' . SOURCE_PATH . '/php-src/ext/grpc'); - } else { - throw new \RuntimeException('Cannot find grpc source code'); - } - $macos = $this->builder instanceof MacOSBuilder ? "\n" . ' LDFLAGS="$LDFLAGS -framework CoreFoundation"' : ''; - FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/ext/grpc/config.m4', '/GRPC_LIBDIR=.*$/m', 'GRPC_LIBDIR=' . BUILD_LIB_PATH . $macos); - FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/ext/grpc/config.m4', '/SEARCH_PATH=.*$/m', 'SEARCH_PATH="' . BUILD_ROOT_PATH . '"'); - return true; + if (file_exists(SOURCE_PATH . '/php-src/ext/grpc')) { + return false; } - return false; + // soft link to the grpc source code + if (is_dir($this->builder->getLib('grpc')->getSourceDir() . '/src/php/ext/grpc')) { + shell()->exec('ln -s ' . $this->builder->getLib('grpc')->getSourceDir() . '/src/php/ext/grpc ' . SOURCE_PATH . '/php-src/ext/grpc'); + } else { + throw new \RuntimeException('Cannot find grpc source code'); + } + FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/grpc/config.m4', 'PHP_ARG_ENABLE(grpc,', 'PHP_ARG_WITH(grpc,'); + return true; } public function patchBeforeConfigure(): bool @@ -62,11 +59,6 @@ class grpc extends Extension return true; } - public function getUnixConfigureArg(bool $shared = false): string - { - return '--enable-grpc=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . '/grpc GRPC_LIB_SUBDIR=' . BUILD_LIB_PATH; - } - private function getLibraries(): array { $libs = shell()->execWithResult('$PKG_CONFIG --libs --static grpc')[1][0]; diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 1d0df8de..5f44332e 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -21,19 +21,19 @@ $test_php_version = [ // test os (macos-13, macos-14, macos-15, ubuntu-latest, windows-latest are available) $test_os = [ - // 'macos-13', // bin/spc for x86_64 + 'macos-13', // bin/spc for x86_64 // 'macos-14', // bin/spc for arm64 - // 'macos-15', // bin/spc for arm64 + 'macos-15', // bin/spc for arm64 'ubuntu-latest', // bin/spc-alpine-docker for x86_64 - // 'ubuntu-22.04', // bin/spc-gnu-docker for x86_64 - // 'ubuntu-24.04', // bin/spc for x86_64 - // 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64 - // 'ubuntu-24.04-arm', // bin/spc for arm64 + 'ubuntu-22.04', // bin/spc-gnu-docker for x86_64 + 'ubuntu-24.04', // bin/spc for x86_64 + 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64 + 'ubuntu-24.04-arm', // bin/spc for arm64 // 'windows-latest', // .\bin\spc.ps1 ]; // whether enable thread safe -$zts = false; +$zts = true; $no_strip = false;