From 9179eae85cd0df11bed2ac1472d4dc9e599ba7a5 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 28 Feb 2015 12:22:12 +0100 Subject: php-pecl-memcache: add gcc 5 patch --- memcache-gcc5.patch | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++ php-pecl-memcache.spec | 8 ++++- 2 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 memcache-gcc5.patch diff --git a/memcache-gcc5.patch b/memcache-gcc5.patch new file mode 100644 index 0000000..31c1b0c --- /dev/null +++ b/memcache-gcc5.patch @@ -0,0 +1,84 @@ +diff -ru memcache-3.0.8.old/memcache_pool.c memcache-3.0.8/memcache_pool.c +--- memcache-3.0.8.old/memcache_pool.c 2013-04-08 04:12:54.000000000 +0200 ++++ memcache-3.0.8/memcache_pool.c 2015-02-09 15:26:43.678369270 +0100 +@@ -40,7 +40,7 @@ + + ZEND_DECLARE_MODULE_GLOBALS(memcache) + +-inline void mmc_buffer_alloc(mmc_buffer_t *buffer, unsigned int size) /* ++MMC_POOL_INLINE void mmc_buffer_alloc(mmc_buffer_t *buffer, unsigned int size) /* + ensures space for an additional size bytes {{{ */ + { + register size_t newlen; +@@ -48,7 +48,7 @@ + } + /* }}} */ + +-inline void mmc_buffer_free(mmc_buffer_t *buffer) /* {{{ */ ++MMC_POOL_INLINE void mmc_buffer_free(mmc_buffer_t *buffer) /* {{{ */ + { + if (buffer->value.c != NULL) { + smart_str_free(&(buffer->value)); +@@ -1676,7 +1676,7 @@ + } + /* }}} */ + +-inline int mmc_prepare_key_ex(const char *key, unsigned int key_len, char *result, unsigned int *result_len) /* {{{ */ ++MMC_POOL_INLINE int mmc_prepare_key_ex(const char *key, unsigned int key_len, char *result, unsigned int *result_len) /* {{{ */ + { + unsigned int i; + if (key_len == 0) { +@@ -1694,7 +1694,7 @@ + } + /* }}} */ + +-inline int mmc_prepare_key(zval *key, char *result, unsigned int *result_len) /* {{{ */ ++MMC_POOL_INLINE int mmc_prepare_key(zval *key, char *result, unsigned int *result_len) /* {{{ */ + { + if (Z_TYPE_P(key) == IS_STRING) { + return mmc_prepare_key_ex(Z_STRVAL_P(key), Z_STRLEN_P(key), result, result_len); +diff -ru memcache-3.0.8.old/memcache_pool.h memcache-3.0.8/memcache_pool.h +--- memcache-3.0.8.old/memcache_pool.h 2013-04-08 04:12:54.000000000 +0200 ++++ memcache-3.0.8/memcache_pool.h 2015-02-09 15:26:05.303142526 +0100 +@@ -135,8 +135,15 @@ + #define mmc_buffer_release(b) memset((b), 0, sizeof(*(b))) + #define mmc_buffer_reset(b) (b)->value.len = (b)->idx = 0 + +-inline void mmc_buffer_alloc(mmc_buffer_t *, unsigned int); +-inline void mmc_buffer_free(mmc_buffer_t *); ++#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L ++/* see https://gcc.gnu.org/gcc-5/porting_to.html */ ++#define MMC_POOL_INLINE extern inline ++#else ++#define MMC_POOL_INLINE inline ++#endif ++ ++MMC_POOL_INLINE void mmc_buffer_alloc(mmc_buffer_t *, unsigned int); ++MMC_POOL_INLINE void mmc_buffer_free(mmc_buffer_t *); + + /* stream handlers */ + typedef struct mmc_stream mmc_stream_t; +@@ -391,8 +398,8 @@ + double timeval_to_double(struct timeval tv); + struct timeval double_to_timeval(double sec); + +-inline int mmc_prepare_key_ex(const char *, unsigned int, char *, unsigned int *); +-inline int mmc_prepare_key(zval *, char *, unsigned int *); ++MMC_POOL_INLINE int mmc_prepare_key_ex(const char *, unsigned int, char *, unsigned int *); ++MMC_POOL_INLINE int mmc_prepare_key(zval *, char *, unsigned int *); + + #define mmc_str_left(h, n, hlen, nlen) ((hlen) >= (nlen) ? memcmp((h), (n), (nlen)) == 0 : 0) + +diff -ru memcache-3.0.8.old/memcache_queue.h memcache-3.0.8/memcache_queue.h +--- memcache-3.0.8.old/memcache_queue.h 2013-04-08 04:12:54.000000000 +0200 ++++ memcache-3.0.8/memcache_queue.h 2015-02-09 15:24:23.309539885 +0100 +@@ -39,6 +39,9 @@ + + #ifdef PHP_WIN32 + #define MMC_QUEUE_INLINE ++#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L ++/* see https://gcc.gnu.org/gcc-5/porting_to.html */ ++#define MMC_QUEUE_INLINE extern inline + #else + #define MMC_QUEUE_INLINE inline + #endif diff --git a/php-pecl-memcache.spec b/php-pecl-memcache.spec index 1d3ca36..1eb31e8 100644 --- a/php-pecl-memcache.spec +++ b/php-pecl-memcache.spec @@ -24,7 +24,7 @@ Summary: Extension to work with the Memcached caching daemon Name: %{?scl_prefix}php-pecl-memcache Version: 3.0.8 -Release: 5%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}.1 +Release: 7%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} License: PHP Group: Development/Languages URL: http://pecl.php.net/package/%{pecl_name} @@ -34,6 +34,8 @@ Source: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz # http://svn.php.net/viewvc/pecl/memcache/branches/NON_BLOCKING_IO/tests/connect.inc?view=co Source3: connect.inc +Patch0: %{pecl_name}-gcc5.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: %{?scl_prefix}php-devel BuildRequires: %{?scl_prefix}php-pear @@ -92,6 +94,7 @@ Memcache can be used as a PHP session handler. mv %{pecl_name}-%{version} NTS pushd NTS +%patch0 -p1 -b .gcc5 # Chech version as upstream often forget to update this extver=$(sed -n '/#define PHP_MEMCACHE_VERSION/{s/.* "//;s/".*$//;p}' php_memcache.h) @@ -257,6 +260,9 @@ fi %changelog +* Tue Feb 10 2015 Remi Collet - 3.0.8-7 +- fix gcc 5 FTBFS + * Wed Dec 24 2014 Remi Collet - 3.0.8-5.1 - Fedora 21 SCL mass rebuild -- cgit