diff options
author | Remi Collet <remi@remirepo.net> | 2020-10-15 12:12:59 +0200 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2020-10-15 12:12:59 +0200 |
commit | d069dc3d5fb14c394bc0323338b34ae42a497491 (patch) | |
tree | cc2efce045150457214110449c49a5aa84d3fdc0 | |
parent | bb02015caf32f1fafddc750b4e5090d1de1a7533 (diff) |
add patch to properly check available command from
https://github.com/SkyAPM/SkyAPM-php-sdk/pull/275
add patch to fix build with PHP 8 from
https://github.com/SkyAPM/SkyAPM-php-sdk/pull/276
-rw-r--r-- | 275.patch | 38 | ||||
-rw-r--r-- | 276.patch | 61 | ||||
-rw-r--r-- | php-pecl-skywalking.spec | 14 |
3 files changed, 111 insertions, 2 deletions
diff --git a/275.patch b/275.patch new file mode 100644 index 0000000..37958a8 --- /dev/null +++ b/275.patch @@ -0,0 +1,38 @@ +From 31c23f5f4109e795aa502c3a133a2dba7e1740c1 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Thu, 15 Oct 2020 11:32:14 +0200 +Subject: [PATCH] ensure used commands are available at configure time + +--- + config.m4 | 17 +++++++++++++---- + 1 file changed, 13 insertions(+), 4 deletions(-) + +diff --git a/config.m4 b/config.m4 +index f110c4d..559c160 100644 +--- a/config.m4 ++++ b/config.m4 +@@ -110,11 +110,20 @@ if test "$PHP_SKYWALKING" != "no"; then + -L$GRPC_LIBDIR + ]) + ++ AC_PATH_PROG(PROTOC, protoc, no) ++ if ! test -x "$PROTOC"; then ++ AC_MSG_ERROR([protoc command missing, please reinstall the protobuf distribution]) ++ fi ++ AC_PATH_PROG(GRPC_CPP_PLUGIN, grpc_cpp_plugin, no) ++ if ! test -x "$GRPC_CPP_PLUGIN"; then ++ AC_MSG_ERROR([grpc_cpp_plugin command missing, please reinstall the grpc distribution]) ++ fi ++ + mkdir -p src/network/v3 +- protoc -I src/protocol/v3 --grpc_out=src/network/v3 --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` --cpp_out=src/network/v3 src/protocol/v3/common/Common.proto +- protoc -I src/protocol/v3 --grpc_out=src/network/v3 --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` --cpp_out=src/network/v3 src/protocol/v3/language-agent/*.proto +- protoc -I src/protocol/v3 --grpc_out=src/network/v3 --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` --cpp_out=src/network/v3 src/protocol/v3/profile/*.proto +- protoc -I src/protocol/v3 --grpc_out=src/network/v3 --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` --cpp_out=src/network/v3 src/protocol/v3/management/*.proto ++ $PROTOC -I src/protocol/v3 --grpc_out=src/network/v3 --plugin=protoc-gen-grpc=$GRPC_CPP_PLUGIN --cpp_out=src/network/v3 src/protocol/v3/common/Common.proto ++ $PROTOC -I src/protocol/v3 --grpc_out=src/network/v3 --plugin=protoc-gen-grpc=$GRPC_CPP_PLUGIN --cpp_out=src/network/v3 src/protocol/v3/language-agent/*.proto ++ $PROTOC -I src/protocol/v3 --grpc_out=src/network/v3 --plugin=protoc-gen-grpc=$GRPC_CPP_PLUGIN --cpp_out=src/network/v3 src/protocol/v3/profile/*.proto ++ $PROTOC -I src/protocol/v3 --grpc_out=src/network/v3 --plugin=protoc-gen-grpc=$GRPC_CPP_PLUGIN --cpp_out=src/network/v3 src/protocol/v3/management/*.proto + find src -name "*.grpc.pb.cc" | while read id; do mv $id ${id/.grpc/_grpc}; done + + PROTOBUF_LIBDIR=$PROTOBUF_DIR/${PROTOBUF_LIB_SUBDIR-lib} diff --git a/276.patch b/276.patch new file mode 100644 index 0000000..4eb0c88 --- /dev/null +++ b/276.patch @@ -0,0 +1,61 @@ +From ac1b5c26136dac3f0ce81d3e4ee229340b32fe95 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Thu, 15 Oct 2020 12:01:37 +0200 +Subject: [PATCH] fix build with PHP 8.0.0RC2 + +--- + src/sky_predis.cc | 9 ++++++++- + src/sky_utils.cc | 6 +++++- + 2 files changed, 13 insertions(+), 2 deletions(-) + +diff --git a/src/sky_predis.cc b/src/sky_predis.cc +index 0e93241..eb3ddd2 100644 +--- a/src/sky_predis.cc ++++ b/src/sky_predis.cc +@@ -32,9 +32,16 @@ Span *sky_predis(zend_execute_data *execute_data, char *class_name, char *functi + + zval *id = (zval *) emalloc(sizeof(zval)); + zval *arguments = (zval *) emalloc(sizeof(zval)); ++#if PHP_VERSION_ID < 80000 + zend_call_method(command, Z_OBJCE_P(command), nullptr, ZEND_STRL("getid"), id, 0, nullptr, nullptr); + zend_call_method(command, Z_OBJCE_P(command), nullptr, ZEND_STRL("getarguments"), arguments, 0, nullptr, + nullptr); ++#else ++ zend_call_method(Z_OBJ_P(command), Z_OBJCE_P(command), nullptr, ZEND_STRL("getid"), id, 0, nullptr, ++ nullptr); ++ zend_call_method(Z_OBJ_P(command), Z_OBJCE_P(command), nullptr, ZEND_STRL("getarguments"), arguments, ++ 0, nullptr, nullptr); ++#endif + + if (id != nullptr && Z_TYPE_P(id) == IS_STRING) { + span->setOperationName(_class_name + "->" + std::string(Z_STRVAL_P(id))); +@@ -118,4 +125,4 @@ static std::string sky_predis_command(zval *id, zval *arguments) { + } + + return nullptr; +-} +\ No newline at end of file ++} +diff --git a/src/sky_utils.cc b/src/sky_utils.cc +index 61c5089..d9053e4 100644 +--- a/src/sky_utils.cc ++++ b/src/sky_utils.cc +@@ -86,7 +86,11 @@ zval *sky_read_property(zval *obj, const char *property, int parent) { + ce = object->ce->parent; + } + ++#if PHP_VERSION_ID < 80000 + return zend_read_property(ce, obj, property, strlen(property), 0, nullptr); ++#else ++ return zend_read_property(ce, object, property, strlen(property), 0, nullptr); ++#endif + } + return nullptr; + } +@@ -97,4 +101,4 @@ std::string sky_get_class_name(zval *obj) { + return ZSTR_VAL(object->ce->name); + } + return ""; +-} +\ No newline at end of file ++} diff --git a/php-pecl-skywalking.spec b/php-pecl-skywalking.spec index adc39f8..7d263da 100644 --- a/php-pecl-skywalking.spec +++ b/php-pecl-skywalking.spec @@ -21,12 +21,14 @@ Summary: The PHP instrument agent for Apache SkyWalking Name: %{?sub_prefix}php-pecl-%{pecl_name} Version: 4.0.0 -Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +Release: 2%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz License: ASL 2.0 URL: https://pecl.php.net/package/%{pecl_name} Patch0: https://patch-diff.githubusercontent.com/raw/SkyAPM/SkyAPM-php-sdk/pull/274.patch +Patch1: https://patch-diff.githubusercontent.com/raw/SkyAPM/SkyAPM-php-sdk/pull/275.patch +Patch2: https://patch-diff.githubusercontent.com/raw/SkyAPM/SkyAPM-php-sdk/pull/276.patch BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel > 7.0 @@ -94,7 +96,9 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml pushd NTS -%patch0 -p1 -b .pr +%patch0 -p1 -b .pr274 +%patch1 -p1 -b .pr275 +%patch2 -p1 -b .pr276 : Check version extver=$(sed -n '/#define PHP_SKYWALKING_VERSION /{s/.* "//;s/".*$//;p}' php_skywalking.h) @@ -243,6 +247,12 @@ TEST_PHP_EXECUTABLE=%{__ztsphp} \ %changelog +* Thu Oct 15 2020 Remi Collet <remi@remirepo.net> - 4.0.0-2 +- add patch to properly check available command from + https://github.com/SkyAPM/SkyAPM-php-sdk/pull/275 +- add patch to fix build with PHP 8 from + https://github.com/SkyAPM/SkyAPM-php-sdk/pull/276 + * Thu Oct 15 2020 Remi Collet <remi@remirepo.net> - 4.0.0-1 - update to 4.0.0 - add patch to properly use cxx for link from |