22#
33# Copyright (c) 2009-2016 Remi Collet
44# License: CC-BY-SA
5- # http://creativecommons.org/licenses/by-sa/3 .0/
5+ # http://creativecommons.org/licenses/by-sa/4 .0/
66#
77# Please, preserve the changelog entries
88#
1111%global with_tests 0%{?_with_tests:1 }
1212%global pecl_name memcached
1313# After 40-igbinary, 40-json, 40-msgpack
14- %global ini_name 50-%{pecl_name }.ini
14+ %global ini_name 50-%{pecl_name }.ini
15+ # https://github.com/php-memcached-dev/php-memcached/commits/php7
16+ %global gh_commit 6ace07da69a5ebc021e56a9d2f52cdc8897b4f23
17+ %global gh_short %(c= %{gh_commit }; echo ${c:0:7})
18+ %global gh_date 20160217
19+ %global gh_owner php-memcached-dev
20+ %global gh_project php-memcached
1521
1622Summary: Extension to work with the Memcached caching daemon
1723Name: php-pecl-memcached
18- Version: 2.2.0
19- Release: 8%{?dist }
20- # memcached is PHP, FastLZ is MIT
21- License: PHP and MIT
24+ Version: 3.0.0
25+ %if 0%{?gh_date:1 }
26+ Release: 0.1.%{gh_date }git%{gh_short }%{?dist }
27+ Source0: https://github.com/%{gh_owner }/%{gh_project }/archive/%{gh_commit }/%{gh_project }-%{version }%{?prever }-%{gh_short }.tar.gz
28+ %else
29+ Release: 1%{?dist }
30+ Source0: http://pecl.php.net/get/%{pecl_name }-%{version }.tgz
31+ %endif
32+ License: PHP
2233Group: Development/Languages
2334URL: http://pecl.php.net/package/%{pecl_name }
2435
25- Source0: http://pecl.php.net/get/%{pecl_name }-%{version }.tgz
2636
27- # 5.2.10 required to HAVE_JSON enabled
28- BuildRequires: php-devel >= 5.2.10
37+ BuildRequires: php-devel >= 7
2938BuildRequires: php-pear
3039BuildRequires: php-json
3140BuildRequires: php-pecl-igbinary-devel
@@ -36,16 +45,17 @@ BuildRequires: libevent-devel > 2
3645BuildRequires: libmemcached-devel > 1
3746BuildRequires: zlib-devel
3847BuildRequires: cyrus-sasl-devel
48+ BuildRequires: fastlz-devel
3949%if %{with_tests }
4050BuildRequires: memcached
4151%endif
4252
4353Requires: php-json%{?_isa }
44- Requires: php-pecl- igbinary%{?_isa }
54+ Requires: php-igbinary%{?_isa }
4555Requires: php(zend-abi) = %{php_zend_api }
4656Requires: php(api) = %{php_core_api }
4757%ifnarch ppc64
48- Requires: php-pecl- msgpack%{?_isa }
58+ Requires: php-msgpack%{?_isa }
4959%endif
5060
5161Provides: php-%{pecl_name } = %{version }
@@ -68,11 +78,31 @@ It also provides a session handler (memcached).
6878%prep
6979%setup -c -q
7080
81+ %if 0%{?gh_date:1 }
82+ mv %{gh_project }-%{gh_commit } NTS
83+ sed -e '/PHP_MEMCACHED_VERSION/s/3.0.0b1/%{version }-dev/' -i NTS/php_memcached.h
84+ %{__php} -r '
85+ $pkg = simplexml_load_file("NTS/package.xml");
86+ $pkg-> date = substr("%{gh_date }",0,4)."-".substr("%{gh_date }",4,2)."-".substr("%{gh_date }",6,2);
87+ $pkg-> version-> release = "%{version }dev";
88+ $pkg-> stability-> release = "devel";
89+ $pkg-> asXML("package.xml");
90+ '
91+ %else
7192mv %{pecl_name }-%{version }%{?prever } NTS
93+ %endif
94+
95+ # Don't install/register tests
96+ sed -e 's/role= "test"/role= "src"/' \
97+ -e '/LICENSE/s/role= "doc"/role= "src"/' \
98+ -e '/name= .fastlz/d' \
99+ -i package.xml
100+
101+ rm -r NTS/fastlz
72102
73103# Chech version as upstream often forget to update this
74104extver= $(sed -n '/#define PHP_MEMCACHED_VERSION/{s/.* "//;s/".*$//;p}' NTS/php_memcached.h)
75- if test "x${extver}" != "x%{version }"; then
105+ if test "x${extver}" != "x%{version }%{?gh_date:-dev}%{? intver } "; then
76106 : Error: Upstream HTTP version is now ${extver}, expecting %{version }.
77107 : Update the pdover macro and rebuild.
78108 exit 1
@@ -114,7 +144,12 @@ peclconf() {
114144%ifnarch ppc64
115145 --enable-memcached-msgpack \
116146%endif
147+ %if 1
148+ --disable-memcached-protocol \
149+ %else
117150 --enable-memcached-protocol \
151+ %endif
152+ --with-system-fastlz \
118153 --with-php-config=$1
119154}
120155cd NTS
@@ -149,9 +184,6 @@ install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}
149184
150185# Test & Documentation
151186cd NTS
152- for i in $(grep 'role= "test"' ../package.xml | sed -e 's/^.*name= "//;s/".*$//')
153- do install -Dpm 644 $i %{buildroot }%{pecl_testdir }/%{pecl_name }/$i
154- done
155187for i in $(grep 'role= "doc"' ../package.xml | sed -e 's/^.*name= "//;s/".*$//')
156188do install -Dpm 644 $i %{buildroot }%{pecl_docdir }/%{pecl_name }/$i
157189done
@@ -213,8 +245,8 @@ exit $ret
213245
214246
215247%files
248+ %license NTS/LICENSE
216249%doc %{pecl_docdir }/%{pecl_name }
217- %doc %{pecl_testdir }/%{pecl_name }
218250%{pecl_xmldir }/%{name }.xml
219251
220252%config(noreplace) %{php_inidir }/%{ini_name }
@@ -227,6 +259,11 @@ exit $ret
227259
228260
229261%changelog
262+ * Mon Jun 27 2016 Remi Collet <rcollet@redhat.com> - 3.0.0-0.1.20160217git6ace07d
263+ - git snapshopt for PHP 7
264+ - don't install/register tests
265+ - fix license installation
266+
230267* Wed Feb 10 2016 Remi Collet <remi@fedoraproject.org> - 2.2.0-8
231268- drop scriptlets (replaced by file triggers in php-pear)
232269- cleanup
0 commit comments