From b69a739ec1a9cfba33ce0a71a7f326da64b7f17d Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 7 Oct 2013 08:47:47 +0200 Subject: php-pecl-event: fix build with libevent2 < 2.0.17 --- event-ver.patch | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ php-pecl-event-dev.spec | 8 ++++++-- php-pecl-event.spec | 8 ++++++-- 3 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 event-ver.patch diff --git a/event-ver.patch b/event-ver.patch new file mode 100644 index 0000000..9c821f1 --- /dev/null +++ b/event-ver.patch @@ -0,0 +1,48 @@ +diff --git a/classes/http_request.c b/classes/http_request.c +index 4cf536e..bf5ffe4 100644 +--- a/classes/http_request.c ++++ b/classes/http_request.c +@@ -355,6 +355,7 @@ PHP_METHOD(EventHttpRequest, getOutputBuffer) + } + /* }}} */ + ++#if LIBEVENT_VERSION_NUMBER >= 0x02001100 + /* {{{ proto EventBufferEvent EventHttpRequest::getBufferEvent(void); + * Returns EventBufferEvent object on success, otherwise &null. */ + PHP_METHOD(EventHttpRequest, getBufferEvent) +@@ -387,6 +388,7 @@ PHP_METHOD(EventHttpRequest, getBufferEvent) + bev->_internal = 1; + } + /* }}} */ ++#endif + + /* {{{ proto EventHttpConnection EventHttpRequest::getConnection(void); + * Returns EventHttpConnection object. +diff --git a/src/fe.c b/src/fe.c +index ccfef57..2a4d1e6 100644 +--- a/src/fe.c ++++ b/src/fe.c +@@ -697,7 +697,9 @@ const zend_function_entry php_event_http_req_ce_functions[] = { + PHP_ME(EventHttpRequest, clearHeaders, arginfo_event__void, ZEND_ACC_PUBLIC) + PHP_ME(EventHttpRequest, removeHeader, arginfo_event_http_req_remove_header, ZEND_ACC_PUBLIC) + PHP_ME(EventHttpRequest, findHeader, arginfo_event_http_req_remove_header, ZEND_ACC_PUBLIC) ++#if LIBEVENT_VERSION_NUMBER >= 0x02001100 + PHP_ME(EventHttpRequest, getBufferEvent, arginfo_event__void, ZEND_ACC_PUBLIC) ++#endif + PHP_ME(EventHttpRequest, getConnection, arginfo_event__void, ZEND_ACC_PUBLIC) + PHP_ME(EventHttpRequest, closeConnection, arginfo_event__void, ZEND_ACC_PUBLIC) + +diff --git a/src/fe.h b/src/fe.h +index f57b947..e1d3997 100644 +--- a/src/fe.h ++++ b/src/fe.h +@@ -192,7 +192,9 @@ PHP_METHOD(EventHttpRequest, addHeader); + PHP_METHOD(EventHttpRequest, clearHeaders); + PHP_METHOD(EventHttpRequest, removeHeader); + PHP_METHOD(EventHttpRequest, findHeader); ++#if LIBEVENT_VERSION_NUMBER >= 0x02001100 + PHP_METHOD(EventHttpRequest, getBufferEvent); ++#endif + PHP_METHOD(EventHttpRequest, getConnection); + PHP_METHOD(EventHttpRequest, closeConnection); + diff --git a/php-pecl-event-dev.spec b/php-pecl-event-dev.spec index 53e2cc0..c24b657 100644 --- a/php-pecl-event-dev.spec +++ b/php-pecl-event-dev.spec @@ -19,11 +19,14 @@ Group: Development/Languages URL: http://pecl.php.net/package/event Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz +# https://bugs.php.net/65847 evhttp_connection_get_bufferevent +# https://bitbucket.org/osmanov/pecl-event/pull-request/3 +Patch0: %{pecl_name}-ver.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: php-devel > 5.4 BuildRequires: php-pear -# https://bugs.php.net/65847 evhttp_connection_get_bufferevent -BuildRequires: libevent-devel >= 2.0.17 +BuildRequires: libevent-devel >= 2.0.2 BuildRequires: openssl-devel BuildRequires: pkgconfig @@ -66,6 +69,7 @@ Version 1.0.0 introduces: %setup -q -c cd %{pecl_name}-%{version} +%patch0 -p1 # Sanity check, really often broken extver=$(sed -n '/#define PHP_EVENT_VERSION/{s/.* "//;s/".*$//;p}' php_event.h) diff --git a/php-pecl-event.spec b/php-pecl-event.spec index 7232b53..56ff5fb 100644 --- a/php-pecl-event.spec +++ b/php-pecl-event.spec @@ -20,10 +20,13 @@ Group: Development/Languages URL: http://pecl.php.net/package/event Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz +# https://bugs.php.net/65847 evhttp_connection_get_bufferevent +# https://bitbucket.org/osmanov/pecl-event/pull-request/3 +Patch0: %{pecl_name}-ver.patch + BuildRequires: php-devel > 5.4 BuildRequires: php-pear -# https://bugs.php.net/65847 evhttp_connection_get_bufferevent -BuildRequires: libevent-devel >= 2.0.17 +BuildRequires: libevent-devel >= 2.0.2 BuildRequires: openssl-devel BuildRequires: pkgconfig @@ -57,6 +60,7 @@ Version 1.0.0 introduces: %setup -q -c cd %{pecl_name}-%{version} +%patch0 -p1 # Sanity check, really often broken extver=$(sed -n '/#define PHP_EVENT_VERSION/{s/.* "//;s/".*$//;p}' php_event.h) -- cgit