|
| 1 | +%{!?__pecl: %{expand: %%global __pecl %{_bindir}/pecl}} |
| 2 | +%{!?php_extdir: %{expand: %%global php_extdir %(php-config --extension-dir)}} |
| 3 | + |
| 4 | +%global extname igbinary |
| 5 | + |
| 6 | +%if 0%{?fedora} >= 14 |
| 7 | +%global withapc 1 |
| 8 | +%else |
| 9 | +# EL-6 only provides 3.1.3pl1 |
| 10 | +%global withapc 0 |
| 11 | +%endif |
| 12 | + |
| 13 | +Summary: Replacement for the standard PHP serializer |
| 14 | +Name: php-pecl-igbinary |
| 15 | +Version: 1.1.1 |
| 16 | +Release: 3%{?dist} |
| 17 | +License: BSD |
| 18 | +Group: System Environment/Libraries |
| 19 | + |
| 20 | +URL: http://pecl.php.net/package/igbinary |
| 21 | +Source0: http://pecl.php.net/get/%{extname}-%{version}.tgz |
| 22 | +# http://pecl.php.net/bugs/22598 |
| 23 | +# https://github.com/igbinary/igbinary/tree/1.1.1/tests |
| 24 | +Source1: %{extname}-tests.tgz |
| 25 | + |
| 26 | +BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n) |
| 27 | +BuildRequires: php-devel >= 5.2.0 |
| 28 | +%if %{withapc} |
| 29 | +BuildRequires: php-pecl-apc-devel >= 3.1.7 |
| 30 | +%else |
| 31 | +BuildRequires: php-pear |
| 32 | +%endif |
| 33 | + |
| 34 | +Requires(post): %{__pecl} |
| 35 | +Requires(postun): %{__pecl} |
| 36 | +Requires: php(zend-abi) = %{php_zend_api} |
| 37 | +Requires: php(api) = %{php_core_api} |
| 38 | +Provides: php-pecl(%{extname}) = %{version} |
| 39 | + |
| 40 | + |
| 41 | +# RPM 4.8 |
| 42 | +%{?filter_provides_in: %filter_provides_in %{php_extdir}/.*\.so$} |
| 43 | +%{?filter_setup} |
| 44 | +# RPM 4.9 |
| 45 | +%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}%{php_extdir}/.*\\.so$ |
| 46 | + |
| 47 | + |
| 48 | +%description |
| 49 | +Igbinary is a drop in replacement for the standard PHP serializer. |
| 50 | + |
| 51 | +Instead of time and space consuming textual representation, |
| 52 | +igbinary stores PHP data structures in a compact binary form. |
| 53 | +Savings are significant when using memcached or similar memory |
| 54 | +based storages for serialized data. |
| 55 | + |
| 56 | + |
| 57 | +%package devel |
| 58 | +Summary: Igbinary developer files (header) |
| 59 | +Group: Development/Libraries |
| 60 | +Requires: php-pecl-%{extname}%{?_isa} = %{version}-%{release} |
| 61 | +Requires: php-devel |
| 62 | + |
| 63 | +%description devel |
| 64 | +These are the files needed to compile programs using Igbinary |
| 65 | + |
| 66 | + |
| 67 | +%prep |
| 68 | +%setup -q -c |
| 69 | + |
| 70 | +cat <<EOF | tee %{extname}.ini |
| 71 | +; Enable %{extname} extension module |
| 72 | +extension=%{extname}.so |
| 73 | + |
| 74 | +; Enable or disable compacting of duplicate strings |
| 75 | +; The default is On. |
| 76 | +;igbinary.compact_strings=On |
| 77 | + |
| 78 | +; Use igbinary as session serializer |
| 79 | +;session.serialize_handler=igbinary |
| 80 | + |
| 81 | +%if %{withapc} |
| 82 | +; Use igbinary as APC serializer |
| 83 | +;apc.serializer=igbinary |
| 84 | +%endif |
| 85 | +EOF |
| 86 | + |
| 87 | +cd %{extname}-%{version} |
| 88 | +tar xzf %{SOURCE1} |
| 89 | + |
| 90 | + |
| 91 | +%build |
| 92 | +cd %{extname}-%{version} |
| 93 | +%{_bindir}/phpize |
| 94 | +%configure --with-php-config=%{_bindir}/php-config |
| 95 | +make %{?_smp_mflags} |
| 96 | + |
| 97 | + |
| 98 | +%install |
| 99 | +rm -rf %{buildroot} |
| 100 | + |
| 101 | +make install -C %{extname}-%{version} \ |
| 102 | + INSTALL_ROOT=%{buildroot} |
| 103 | + |
| 104 | +install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml |
| 105 | + |
| 106 | +install -D -m 644 %{extname}.ini %{buildroot}%{_sysconfdir}/php.d/%{extname}.ini |
| 107 | + |
| 108 | + |
| 109 | +%check |
| 110 | +cd %{extname}-%{version} |
| 111 | + |
| 112 | +# simple module load test |
| 113 | +# without APC to ensure than can run without |
| 114 | +%{_bindir}/php --no-php-ini \ |
| 115 | + --define extension_dir=modules \ |
| 116 | + --define extension=%{extname}.so \ |
| 117 | + --modules | grep %{extname} |
| 118 | + |
| 119 | +%if %{withapc} |
| 120 | +# APC required for test 045 |
| 121 | +ln -s %{php_extdir}/apc.so modules/ |
| 122 | +%endif |
| 123 | + |
| 124 | +NO_INTERACTION=1 make test | tee rpmtests.log |
| 125 | +grep -q "FAILED TEST" rpmtests.log && exit 1 |
| 126 | + |
| 127 | + |
| 128 | +%clean |
| 129 | +rm -rf %{buildroot} |
| 130 | + |
| 131 | + |
| 132 | +%post |
| 133 | +%{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : |
| 134 | + |
| 135 | + |
| 136 | +%postun |
| 137 | +if [ $1 -eq 0 ] ; then |
| 138 | + %{pecl_uninstall} %{extname} >/dev/null || : |
| 139 | +fi |
| 140 | + |
| 141 | + |
| 142 | +%files |
| 143 | +%defattr(-,root,root,-) |
| 144 | +%doc %{extname}-%{version}/COPYING |
| 145 | +%doc %{extname}-%{version}/CREDITS |
| 146 | +%doc %{extname}-%{version}/NEWS |
| 147 | +%doc %{extname}-%{version}/README |
| 148 | +%config(noreplace) %{_sysconfdir}/php.d/%{extname}.ini |
| 149 | +%{php_extdir}/%{extname}.so |
| 150 | +%{pecl_xmldir}/%{name}.xml |
| 151 | + |
| 152 | + |
| 153 | +%files devel |
| 154 | +%defattr(-,root,root,-) |
| 155 | +%{_includedir}/php/ext/%{extname} |
| 156 | + |
| 157 | + |
| 158 | +%changelog |
| 159 | +* Sun Sep 18 2011 Remi Collet <rpms@famillecollet.com> 1.1.1-3 |
| 160 | +- fix EPEL-6 build, no arch version for php-devel |
| 161 | + |
| 162 | +* Sat Sep 17 2011 Remi Collet <rpms@famillecollet.com> 1.1.1-2 |
| 163 | +- clean spec, adapted filters |
| 164 | + |
| 165 | +* Mon Mar 14 2011 Remi Collet <rpms@famillecollet.com> 1.1.1-1 |
| 166 | +- version 1.1.1 published on pecl.php.net |
| 167 | +- rename to php-pecl-igbinary |
| 168 | + |
| 169 | +* Mon Jan 17 2011 Remi Collet <rpms@famillecollet.com> 1.1.1-1 |
| 170 | +- update to 1.1.1 |
| 171 | + |
| 172 | +* Fri Dec 31 2010 Remi Collet <rpms@famillecollet.com> 1.0.2-3 |
| 173 | +- updated tests from Git. |
| 174 | + |
| 175 | +* Sat Oct 23 2010 Remi Collet <rpms@famillecollet.com> 1.0.2-2 |
| 176 | +- filter provides to avoid igbinary.so |
| 177 | +- add missing %%dist |
| 178 | + |
| 179 | +* Wed Sep 29 2010 Remi Collet <rpms@famillecollet.com> 1.0.2-1 |
| 180 | +- initital RPM |
| 181 | + |
0 commit comments