From 67aba1a929b8dbf80febcac6bec1159246a5a595 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 2 Jul 2021 15:05:07 +0200 Subject: update to 3.0.1 add patch for PHP 8.1 from https://github.com/arnaud-lb/php-memory-profiler/pull/54 --- .gitignore | 2 ++ PHPINFO | 2 +- REFLECTION | 2 +- memprof-php81.patch | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ php-pecl-memprof.spec | 16 +++++++++++++- 5 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 memprof-php81.patch diff --git a/.gitignore b/.gitignore index 1ab5c4f..01f0400 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ +clog package-*.xml *.tgz +*.tar.bz2 *.tar.gz *.tar.xz *.tar.xz.asc diff --git a/PHPINFO b/PHPINFO index b7c6b5b..5eb2aac 100644 --- a/PHPINFO +++ b/PHPINFO @@ -2,7 +2,7 @@ memprof memprof support => enabled -memprof version => 3.0.0 +memprof version => 3.0.1 memprof native malloc support => Yes Directive => Local Value => Master Value diff --git a/REFLECTION b/REFLECTION index c05f402..55057a2 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #119 memprof version 3.0.0 ] { +Extension [ extension #121 memprof version 3.0.1 ] { - INI { Entry [ memprof.output_dir ] diff --git a/memprof-php81.patch b/memprof-php81.patch new file mode 100644 index 0000000..46840ec --- /dev/null +++ b/memprof-php81.patch @@ -0,0 +1,59 @@ +From 9fde6cfe03c96d9f448484aa137901eca2d44d0c Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 2 Jul 2021 14:44:34 +0200 +Subject: [PATCH] fix build with 8.1.0alpha2 + +--- + memprof.c | 19 ++++++++++++------- + 1 file changed, 12 insertions(+), 7 deletions(-) + +diff --git a/memprof.c b/memprof.c +index a85b5bd..d754838 100644 +--- a/memprof.c ++++ b/memprof.c +@@ -196,15 +196,18 @@ static void (*old_zend_execute)(zend_execute_data *execute_data); + static void (*old_zend_execute_internal)(zend_execute_data *execute_data_ptr, zval *return_value); + #define zend_execute_fn zend_execute_ex + +-#if ZEND_MODULE_API_NO < 20170718 /* PHP 7.1 - 7.2 */ ++#if PHP_VERSION_ID < 70200 /* PHP 7.1 */ + static void (*old_zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args); + #define MEMPROF_ZEND_ERROR_CB_ARGS_PASSTHRU type, error_filename, error_lineno, format, args +-#elif ZEND_MODULE_API_NO < 20200930 /* PHP 7.3 - 7.4 */ ++#elif PHP_VERSION_ID < 80000 /* PHP 7.2 - 7.4 */ + static void (*old_zend_error_cb)(int type, const char *error_filename, const uint32_t error_lineno, const char *format, va_list args); + #define MEMPROF_ZEND_ERROR_CB_ARGS_PASSTHRU type, error_filename, error_lineno, format, args +-#else /* PHP 8 */ ++#elif PHP_VERSION_ID < 80100 /* PHP 8.0 */ + static void (*old_zend_error_cb)(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message); + #define MEMPROF_ZEND_ERROR_CB_ARGS_PASSTHRU type, error_filename, error_lineno, message ++#else /* PHP 8.1 */ ++static void (*old_zend_error_cb)(int type, zend_string *error_filename, const uint32_t error_lineno, zend_string *message); ++#define MEMPROF_ZEND_ERROR_CB_ARGS_PASSTHRU type, error_filename, error_lineno, message + #endif + + static PHP_INI_MH((*origOnChangeMemoryLimit)) = NULL; +@@ -764,17 +767,19 @@ static char * generate_filename(const char * format) { + return filename; + } + +-#if ZEND_MODULE_API_NO < 20170718 /* PHP 7.1 - 7.2 */ ++#if PHP_VERSION_ID < 70200 /* PHP 7.1 */ + static void memprof_zend_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) +-#elif ZEND_MODULE_API_NO < 20200930 /* PHP 7.3 - 7.4 */ ++#elif PHP_VERSION_ID < 80000 /* PHP 7.2 - 7.4 */ + static void memprof_zend_error_cb(int type, const char *error_filename, const uint32_t error_lineno, const char *format, va_list args) +-#else /* PHP 8 */ ++#elif PHP_VERSION_ID < 80100 /* PHP 8.0 */ + static void memprof_zend_error_cb(int type, const char *error_filename, const uint32_t error_lineno, zend_string *message) ++#else /* PHP 8.1 */ ++static void memprof_zend_error_cb(int type, zend_string *error_filename, const uint32_t error_lineno, zend_string *message) + #endif + { + char * filename; + php_stream * stream; +-#if ZEND_MODULE_API_NO < 20200930 ++#if PHP_VERSION_ID < 80000 + const char * msg = format; + #else + const char * msg = ZSTR_VAL(message); diff --git a/php-pecl-memprof.spec b/php-pecl-memprof.spec index f03cd5d..bc55a50 100644 --- a/php-pecl-memprof.spec +++ b/php-pecl-memprof.spec @@ -33,12 +33,14 @@ Summary: Memory usage profiler Name: %{?sub_prefix}php-pecl-%{pecl_name} -Version: 3.0.0 +Version: 3.0.1 Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: BSD URL: https://pecl.php.net/package/%{pecl_name} Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz +Patch0: %{pecl_name}-php81.patch + BuildRequires: make BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel >= 7.1 @@ -65,6 +67,9 @@ Obsoletes: php74-pecl-%{pecl_name} <= %{version} %if "%{php_version}" > "8.0" Obsoletes: php80-pecl-%{pecl_name} <= %{version} %endif +%if "%{php_version}" > "8.1" +Obsoletes: php81-pecl-%{pecl_name} <= %{version} +%endif %endif @@ -85,6 +90,8 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS +%patch0 -p1 -b .pr54 + # Sanity check, really often broken extver=$(sed -n '/#define PHP_MEMPROF_VERSION/{s/.* "//;s/".*$//;p}' php_memprof.h) if test "x${extver}" != "x%{version}%{?prever:-%{prever}}"; then @@ -182,6 +189,8 @@ fi %if %{with tests} cd NTS +grep "HAVE_MALLOC_HOOKS 1" config.h && export MEMPROF_EXPECT_NATIVE_TRACKING=1 + : Upstream test suite for NTS extension TEST_PHP_EXECUTABLE=%{_bindir}/php \ TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \ @@ -223,6 +232,11 @@ REPORT_EXIT_STATUS=1 \ %changelog +* Fri Jul 2 2021 Remi Collet - 3.0.1-1 +- update to 3.0.1 +- add patch for PHP 8.1 from + https://github.com/arnaud-lb/php-memory-profiler/pull/54 + * Tue Mar 30 2021 Remi Collet - 3.0.0-1 - update to 3.0.0 -- cgit