From fbe66f16df4aff21fa4a5262752db288d097c34b Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 4 Jan 2013 13:40:10 +0100 Subject: php-pecl-xhprof: git snapshot + php 5.5 fix --- Makefile | 2 +- php-pecl-xhprof.spec | 42 +++++++++---- xhprof-arginfo.patch | 54 ---------------- xhprof-php54.patch | 85 -------------------------- xhprof-php55.patch | 170 +++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 202 insertions(+), 151 deletions(-) delete mode 100644 xhprof-arginfo.patch delete mode 100644 xhprof-php54.patch create mode 100644 xhprof-php55.patch diff --git a/Makefile b/Makefile index 1e65467..13af741 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ SRCDIR := $(shell pwd) NAME := $(shell basename $(SRCDIR)) -include ../common/Makefile +include ../../../common/Makefile diff --git a/php-pecl-xhprof.spec b/php-pecl-xhprof.spec index 02edd69..f339986 100644 --- a/php-pecl-xhprof.spec +++ b/php-pecl-xhprof.spec @@ -1,38 +1,46 @@ %{!?__pecl: %{expand: %%global __pecl %{_bindir}/pecl}} %global pecl_name xhprof +%global gitver b8c76ac5ab Name: php-pecl-xhprof Version: 0.9.2 -Release: 5%{?dist}.1 +Release: 8%{?gitver:.git%{gitver}}%{?dist} + Summary: PHP extension for XHProf, a Hierarchical Profiler Group: Development/Languages License: ASL 2.0 URL: http://pecl.php.net/package/%{pecl_name} +%if 0%{?gitver:1} +# https://github.com/facebook/xhprof/archive/master.tar.gz +Source0: %{pecl_name}-%{gitver}.tgz +%else Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz +%endif -# From github -Patch0: %{pecl_name}-arginfo.patch -Patch1: %{pecl_name}-php54.patch +# https://github.com/facebook/xhprof/pull/15 +Patch2: %{pecl_name}-php55.patch # https://bugs.php.net/61262 -ExcludeArch: ppc64 +ExclusiveArch: %{ix86} x86_64 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: php-devel >= 5.2.0 -BuildRequires: php-pear >= 1:1.4.0 +BuildRequires: php-pear Requires: php(zend-abi) = %{php_zend_api} Requires: php(api) = %{php_core_api} Requires(post): %{__pecl} Requires(postun): %{__pecl} + +Provides: php-%{pecl_name} = %{version} +Provides: php-%{pecl_name}%{?_isa} = %{version} Provides: php-pecl(%{pecl_name}) = %{version} +Provides: php-pecl(%{pecl_name})%{?_isa} = %{version} -# RPM 4.8 +# Filter private provides %{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} %{?filter_setup} -# RPM 4.9 -%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}%{_libdir}/.*\\.so$ %description @@ -74,6 +82,10 @@ Documentation : %{_datadir}/doc/%{name}-%{version}/docs/index.html %prep %setup -c -q +%if 0%{?gitver:1} +mv %{pecl_name}-master/package.xml . +mv %{pecl_name}-master %{pecl_name}-%{version} +%endif # Extension configuration file cat >%{pecl_name}.ini < - 0.9.2-8.gitb8c76ac5ab +- git snapshot + php 5.5 fix + https://github.com/facebook/xhprof/pull/15 +- also provides php-xhprof + +* Tue May 22 2012 Remi Collet - 0.9.2-6 +- move from ExcludeArch: ppc64 + to ExclusiveArch: %%{ix86} x86_64 because of cycle_timer() + * Sun May 06 2012 Remi Collet - 0.9.2-5 - make configuration file compatible with apache 2.2 / 2.4 diff --git a/xhprof-arginfo.patch b/xhprof-arginfo.patch deleted file mode 100644 index 60fefbe..0000000 --- a/xhprof-arginfo.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0b3d4054d86b5a52d258623be1497c0c1c3f9a54 Mon Sep 17 00:00:00 2001 -From: philip -Date: Wed, 7 Apr 2010 18:17:09 +0000 -Subject: [PATCH] Added arginfo for reflection - -git-svn-id: https://svn.php.net/repository/pecl/xhprof/trunk@297630 c90b9560-bf6c-de11-be94-00142212c4b1 ---- - extension/xhprof.c | 23 +++++++++++++++++++---- - 1 files changed, 19 insertions(+), 4 deletions(-) - -diff --git a/extension/xhprof.c b/extension/xhprof.c -index eabb165..7001d12 100644 ---- a/extension/xhprof.c -+++ b/extension/xhprof.c -@@ -280,6 +280,21 @@ static ZEND_DLEXPORT void (*_zend_execute_internal) (zend_execute_data *data, - static inline char **hp_strings_in_zval(zval *values); - static inline void hp_array_del(char **name_array); - -+/* {{{ arginfo */ -+ZEND_BEGIN_ARG_INFO_EX(arginfo_xhprof_enable, 0, 0, 0) -+ ZEND_ARG_INFO(0, flags) -+ ZEND_ARG_INFO(0, options) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_INFO(arginfo_xhprof_disable, 0) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_INFO(arginfo_xhprof_sample_enable, 0) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_INFO(arginfo_xhprof_sample_disable, 0) -+ZEND_END_ARG_INFO() -+ - /** - * ********************* - * PHP EXTENSION GLOBALS -@@ -287,10 +302,10 @@ static ZEND_DLEXPORT void (*_zend_execute_internal) (zend_execute_data *data, - */ - /* List of functions implemented/exposed by xhprof */ - zend_function_entry xhprof_functions[] = { -- PHP_FE(xhprof_enable, NULL) -- PHP_FE(xhprof_disable, NULL) -- PHP_FE(xhprof_sample_enable, NULL) -- PHP_FE(xhprof_sample_disable, NULL) -+ PHP_FE(xhprof_enable, arginfo_xhprof_enable) -+ PHP_FE(xhprof_disable, arginfo_xhprof_disable) -+ PHP_FE(xhprof_sample_enable, arginfo_xhprof_sample_enable) -+ PHP_FE(xhprof_sample_disable, arginfo_xhprof_sample_disable) - {NULL, NULL, NULL} - }; - --- -1.7.5.4 - diff --git a/xhprof-php54.patch b/xhprof-php54.patch deleted file mode 100644 index 92cd231..0000000 --- a/xhprof-php54.patch +++ /dev/null @@ -1,85 +0,0 @@ -From a6bae51236677d95cb329d5b20806465c0260394 Mon Sep 17 00:00:00 2001 -From: Scott MacVicar -Date: Sat, 16 Jul 2011 14:43:01 -0700 -Subject: [PATCH] Fixed PHP 5.4 building - -Summary: -Fixed PHP 5.4 building -* class names became constants -* return_reference is stored in zend_function.fn_flags -* deal with znode reorganisation - -Test Plan: -Build against php 5.4 -Build against php 5.3 - -Reviewers: scoates - -CC: - -Differential Revision: 682 ---- - extension/xhprof.c | 19 +++++++++++++++++-- - 1 files changed, 17 insertions(+), 2 deletions(-) - -diff --git a/extension/xhprof.c b/extension/xhprof.c -index 7001d12..33311b3 100644 ---- a/extension/xhprof.c -+++ b/extension/xhprof.c -@@ -28,6 +28,7 @@ - #include "php_ini.h" - #include "ext/standard/info.h" - #include "php_xhprof.h" -+#include "Zend/zend_extensions.h" - #include - #include - #include -@@ -898,7 +899,7 @@ size_t hp_get_function_stack(hp_entry_t *entry, - static char *hp_get_function_name(zend_op_array *ops TSRMLS_DC) { - zend_execute_data *data; - char *func = NULL; -- char *cls = NULL; -+ const char *cls = NULL; - char *ret = NULL; - int len; - zend_function *curr_func; -@@ -942,7 +943,12 @@ size_t hp_get_function_stack(hp_entry_t *entry, - /* we are dealing with a special directive/function like - * include, eval, etc. - */ -+#if ZEND_EXTENSION_API_NO >= 220100525 -+ curr_op = data->opline->extended_value; -+#else - curr_op = data->opline->op2.u.constant.value.lval; -+#endif -+ - switch (curr_op) { - case ZEND_EVAL: - func = "eval"; -@@ -1660,13 +1666,22 @@ ZEND_DLEXPORT void hp_execute_internal(zend_execute_data *execute_data, - if (!_zend_execute_internal) { - /* no old override to begin with. so invoke the builtin's implementation */ - zend_op *opline = EX(opline); -+#if ZEND_EXTENSION_API_NO >= 220100525 -+ temp_variable *retvar = &EX_T(opline->result.var); -+ ((zend_internal_function *) EX(function_state).function)->handler( -+ opline->extended_value, -+ retvar->var.ptr, -+ (EX(function_state).function->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) ? -+ &retvar->var.ptr:NULL, -+ EX(object), ret TSRMLS_CC); -+#else - ((zend_internal_function *) EX(function_state).function)->handler( - opline->extended_value, - EX_T(opline->result.u.var).var.ptr, - EX(function_state).function->common.return_reference ? - &EX_T(opline->result.u.var).var.ptr:NULL, - EX(object), ret TSRMLS_CC); -- -+#endif - } else { - /* call the old override */ - _zend_execute_internal(execute_data, ret TSRMLS_CC); --- -1.7.5.4 - diff --git a/xhprof-php55.patch b/xhprof-php55.patch new file mode 100644 index 0000000..e341443 --- /dev/null +++ b/xhprof-php55.patch @@ -0,0 +1,170 @@ +diff --git a/extension/xhprof.c b/extension/xhprof.c +index f7e2360..a053ede 100644 +--- a/extension/xhprof.c ++++ b/extension/xhprof.c +@@ -28,7 +28,7 @@ + #include "php_ini.h" + #include "ext/standard/info.h" + #include "php_xhprof.h" +-#include "Zend/zend_extensions.h" ++#include "zend_extensions.h" + #include + #include + #include +@@ -233,12 +233,21 @@ typedef struct hp_global_t { + /* XHProf global state */ + static hp_global_t hp_globals; + ++#if PHP_VERSION_ID < 50500 + /* Pointer to the original execute function */ + static ZEND_DLEXPORT void (*_zend_execute) (zend_op_array *ops TSRMLS_DC); + + /* Pointer to the origianl execute_internal function */ + static ZEND_DLEXPORT void (*_zend_execute_internal) (zend_execute_data *data, + int ret TSRMLS_DC); ++#else ++/* Pointer to the original execute function */ ++static void (*_zend_execute_ex) (zend_execute_data *execute_data TSRMLS_DC); ++ ++/* Pointer to the origianl execute_internal function */ ++static void (*_zend_execute_internal) (zend_execute_data *data, ++ struct _zend_fcall_info *fci, int ret TSRMLS_DC); ++#endif + + /* Pointer to the original compile function */ + static zend_op_array * (*_zend_compile_file) (zend_file_handle *file_handle, +@@ -880,8 +889,8 @@ size_t hp_get_function_stack(hp_entry_t *entry, + * a pointer to one-level directory and basefile name + * (d/foo.php) in the same string. + */ +-static char *hp_get_base_filename(char *filename) { +- char *ptr; ++static const char *hp_get_base_filename(const char *filename) { ++ const char *ptr; + int found = 0; + + if (!filename) +@@ -909,7 +918,7 @@ static char *hp_get_base_filename(char *filename) { + */ + static char *hp_get_function_name(zend_op_array *ops TSRMLS_DC) { + zend_execute_data *data; +- char *func = NULL; ++ const char *func = NULL; + const char *cls = NULL; + char *ret = NULL; + int len; +@@ -988,7 +997,7 @@ static char *hp_get_function_name(zend_op_array *ops TSRMLS_DC) { + * you'll see something like "run_init::foo.php" in your reports. + */ + if (add_filename){ +- char *filename; ++ const char *filename; + int len; + filename = hp_get_base_filename((curr_func->op_array).filename); + len = strlen("run_init") + strlen(filename) + 3; +@@ -1629,18 +1638,31 @@ void hp_mode_sampled_endfn_cb(hp_entry_t **entries TSRMLS_DC) { + * + * @author hzhao, kannan + */ ++#if PHP_VERSION_ID < 50500 + ZEND_DLEXPORT void hp_execute (zend_op_array *ops TSRMLS_DC) { ++#else ++ZEND_DLEXPORT void hp_execute_ex (zend_execute_data *execute_data TSRMLS_DC) { ++ zend_op_array *ops = execute_data->op_array; ++#endif + char *func = NULL; + int hp_profile_flag = 1; + + func = hp_get_function_name(ops TSRMLS_CC); + if (!func) { ++#if PHP_VERSION_ID < 50500 + _zend_execute(ops TSRMLS_CC); ++#else ++ _zend_execute_ex(execute_data TSRMLS_CC); ++#endif + return; + } + + BEGIN_PROFILING(&hp_globals.entries, func, hp_profile_flag); ++#if PHP_VERSION_ID < 50500 + _zend_execute(ops TSRMLS_CC); ++#else ++ _zend_execute_ex(execute_data TSRMLS_CC); ++#endif + if (hp_globals.entries) { + END_PROFILING(&hp_globals.entries, hp_profile_flag); + } +@@ -1649,7 +1671,6 @@ ZEND_DLEXPORT void hp_execute (zend_op_array *ops TSRMLS_DC) { + + #undef EX + #define EX(element) ((execute_data)->element) +-#define EX_T(offset) (*(temp_variable *)((char *) EX(Ts) + offset)) + + /** + * Very similar to hp_execute. Proxy for zend_execute_internal(). +@@ -1657,8 +1678,18 @@ ZEND_DLEXPORT void hp_execute (zend_op_array *ops TSRMLS_DC) { + * + * @author hzhao, kannan + */ ++ ++#if PHP_VERSION_ID < 50500 ++#define EX_T(offset) (*(temp_variable *)((char *) EX(Ts) + offset)) ++ + ZEND_DLEXPORT void hp_execute_internal(zend_execute_data *execute_data, + int ret TSRMLS_DC) { ++#else ++#define EX_T(offset) (*EX_TMP_VAR(execute_data, offset)) ++ ++ZEND_DLEXPORT void hp_execute_internal(zend_execute_data *execute_data, ++ struct _zend_fcall_info *fci, int ret TSRMLS_DC) { ++#endif + zend_execute_data *current_data; + char *func = NULL; + int hp_profile_flag = 1; +@@ -1691,7 +1722,11 @@ ZEND_DLEXPORT void hp_execute_internal(zend_execute_data *execute_data, + #endif + } else { + /* call the old override */ ++#if PHP_VERSION_ID < 50500 + _zend_execute_internal(execute_data, ret TSRMLS_CC); ++#else ++ _zend_execute_internal(execute_data, fci, ret TSRMLS_CC); ++#endif + } + + if (func) { +@@ -1711,7 +1746,7 @@ ZEND_DLEXPORT void hp_execute_internal(zend_execute_data *execute_data, + ZEND_DLEXPORT zend_op_array* hp_compile_file(zend_file_handle *file_handle, + int type TSRMLS_DC) { + +- char *filename; ++ const char *filename; + char *func; + int len; + zend_op_array *ret; +@@ -1783,8 +1818,13 @@ static void hp_begin(long level, long xhprof_flags TSRMLS_DC) { + zend_compile_string = hp_compile_string; + + /* Replace zend_execute with our proxy */ ++#if PHP_VERSION_ID < 50500 + _zend_execute = zend_execute; + zend_execute = hp_execute; ++#else ++ _zend_execute_ex = zend_execute_ex; ++ zend_execute_ex = hp_execute_ex; ++#endif + + /* Replace zend_execute_internal with our proxy */ + _zend_execute_internal = zend_execute_internal; +@@ -1855,7 +1895,11 @@ static void hp_stop(TSRMLS_D) { + } + + /* Remove proxies, restore the originals */ ++#if PHP_VERSION_ID < 50500 + zend_execute = _zend_execute; ++#else ++ zend_execute_ex = _zend_execute_ex; ++#endif + zend_execute_internal = _zend_execute_internal; + zend_compile_file = _zend_compile_file; + zend_compile_string = _zend_compile_string; -- cgit