diff --git a/README.md b/README.md index 38544e84..1a4b3d00 100755 --- a/README.md +++ b/README.md @@ -335,3 +335,10 @@ and they all have their own open source licenses. Please use the `bin/spc dump-license` command to export the open source licenses used in the project after compilation, and comply with the corresponding project's LICENSE. + +## Troubleshooting + +When downloading extensions, you may eventually see errors like `curl: (56) The requested URL returned error: 403` which are often caused by github rate limiting. +You can verify this by adding `--debug` to the command and will see something like `[DEBU] Running command (no output) : curl -sfSL "https://api.github.com/repos/openssl/openssl/releases"`. + +To fix this, [create](https://github.com/settings/tokens) a personal access token on GitHub and set it as an environment variable `GITHUB_TOKEN=`. \ No newline at end of file diff --git a/config/ext.json b/config/ext.json index 08ed6777..c6054abf 100644 --- a/config/ext.json +++ b/config/ext.json @@ -432,6 +432,21 @@ "type": "builtin", "arg-type-unix": "custom" }, + "opentelemetry": { + "notes": true, + "support": { + "Windows": "wip" + }, + "arg-type": "enable", + "source": "opentelemetry", + "unix-only": true, + "ext-suggests": [ + "grpc", + "protobuf", + "ffi" + ], + "type": "external" + }, "openssl": { "notes": true, "type": "builtin", diff --git a/config/source.json b/config/source.json index a3ecd8df..ac1570f0 100644 --- a/config/source.json +++ b/config/source.json @@ -667,6 +667,16 @@ "path": "COPYING" } }, + "opentelemetry": { + "type": "url", + "url": "https://pecl.php.net/get/opentelemetry", + "path": "php-src/ext/opentelemetry", + "filename": "opentelemetry.tgz", + "license": { + "type": "file", + "path": "LICENSE" + } + }, "openssl": { "type": "ghrel", "repo": "openssl/openssl", diff --git a/src/SPC/builder/extension/opentelemetry.php b/src/SPC/builder/extension/opentelemetry.php new file mode 100644 index 00000000..d86037af --- /dev/null +++ b/src/SPC/builder/extension/opentelemetry.php @@ -0,0 +1,43 @@ +builder->getPHPVersionID() < 80000 && getenv('SPC_SKIP_PHP_VERSION_CHECK') !== 'yes') { + throw new \RuntimeException('The opentelemetry extension requires PHP 8.0 or later'); + } + } + + public function patchBeforeBuildconf(): bool + { + // soft link to the grpc source code + if ($this->builder instanceof WindowsBuilder) { + // not support windows yet + throw new \RuntimeException('opentelemetry extension does not support windows yet'); + } + return false; + } + + public function patchBeforeMake(): bool + { + // add -Wno-strict-prototypes + GlobalEnvManager::putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS=' . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') . ' -Wno-strict-prototypes'); + return true; + } + + public function getUnixConfigureArg(): string + { + return '--enable-opentelemetry=' . BUILD_ROOT_PATH . '/opentelemetry GRPC_LIB_SUBDIR=' . BUILD_LIB_PATH; + } +} diff --git a/src/globals/ext-tests/opentelemetry.php b/src/globals/ext-tests/opentelemetry.php new file mode 100644 index 00000000..746068b3 --- /dev/null +++ b/src/globals/ext-tests/opentelemetry.php @@ -0,0 +1,5 @@ +