c0be329
# Fedora spec file for php-pecl-yac (previously php-yac)
8191f61
#
3aac9f4
# Copyright (c) 2013-2018 Remi Collet
8191f61
# License: CC-BY-SA
c0be329
# http://creativecommons.org/licenses/by-sa/4.0/
8191f61
#
8191f61
# Please, preserve the changelog entries
8191f61
#
3aac9f4
3aac9f4
# we don't want -z defs linker flag
3aac9f4
%undefine _strict_symbol_defs_build
3aac9f4
8191f61
%global with_zts    0%{?__ztsphp:1}
8191f61
%global pecl_name   yac
8191f61
%global with_tests  %{!?_without_tests:1}%{?_without_tests:0}
8191f61
%global ini_name    40-%{pecl_name}.ini
8191f61
8191f61
Summary:        Lockless user data cache
8191f61
Name:           php-pecl-%{pecl_name}
3af42bc
Version:        2.0.2
0c97357
Release:        8%{?dist}
8191f61
8191f61
License:        PHP
8191f61
URL:            http://pecl.php.net/package/%{pecl_name}
8191f61
Source0:        http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
8191f61
ae1205b
Patch0:         https://patch-diff.githubusercontent.com/raw/laruence/yac/pull/89.patch
ae1205b
d97edde
BuildRequires:  php-devel > 7
8191f61
BuildRequires:  php-pear
8191f61
BuildRequires:  fastlz-devel
8191f61
8191f61
Requires:       php(zend-abi) = %{php_zend_api}
8191f61
Requires:       php(api) = %{php_core_api}
8191f61
8191f61
# Package have be renamed
8191f61
Obsoletes:      php-%{pecl_name} < %{version}
8191f61
Provides:       php-%{pecl_name} = %{version}
8191f61
Provides:       php-%{pecl_name}%{?_isa} = %{version}
8191f61
Provides:       php-pecl(%{pecl_name}) = %{version}
8191f61
Provides:       php-pecl(%{pecl_name})%{?_isa} = %{version}
8191f61
8191f61
8191f61
%description
8191f61
Yac (Yet Another Cache) is a shared memory user data cache for PHP.
8191f61
8191f61
It can be used to replace APC or local memcached.
8191f61
8191f61
Yac is lockless, that means, it is very fast, but there could be a
8191f61
chance you will get a wrong data(depends on how many key slots are
8191f61
allocated and how many keys are stored), so you'd better make sure
8191f61
that your product is not very sensitive to that.
8191f61
8191f61
8191f61
%prep
8191f61
%setup -qc
8191f61
mv %{pecl_name}-%{version} NTS
8191f61
8191f61
# Don't install (register) the tests
c0be329
sed -e 's/role="test"/role="src"/' \
c0be329
    -e '/LICENSE/s/role="doc"/role="src"/' \
c0be329
    -i package.xml
8191f61
8191f61
cd NTS
ae1205b
%patch0 -p1 -b .pr89
ae1205b
8191f61
# drop bundled fastlz to ensure it is not used
8191f61
sed -e '\:name="compressor/fastlz:d' -i ../package.xml
8191f61
rm -r compressor/fastlz
8191f61
8191f61
# Check version as upstream often forget to update this
8191f61
extver=$(sed -n '/#define PHP_YAC_VERSION/{s/.* "//;s/".*$//;p}' php_yac.h)
8191f61
if test "x${extver}" != "x%{version}%{?prever}"; then
8191f61
   : Error: Upstream YAC version is ${extver}, expecting %{version}%{?prever}.
8191f61
   exit 1
8191f61
fi
8191f61
cd ..
8191f61
8191f61
# Drop in the bit of configuration
8191f61
cat > %{ini_name} << 'EOF'
8191f61
; Enable Yet Another Cache extension module
8191f61
extension = %{pecl_name}.so
8191f61
8191f61
;yac.enable=1
8191f61
;yac.enable_cli=0
8191f61
;yac.debug=0
8191f61
;yac.keys_memory_size=4M
8191f61
;yac.values_memory_size=64M
8191f61
;yac.compress_threshold=-1
8191f61
EOF
8191f61
8191f61
8191f61
%if %{with_zts}
8191f61
# duplicate for ZTS build
8191f61
cp -pr NTS ZTS
8191f61
%endif
8191f61
8191f61
8191f61
%build
8191f61
peclconf() {
8191f61
%configure \
8191f61
    --with-system-fastlz \
8191f61
    --with-php-config=$1
8191f61
}
8191f61
8191f61
cd NTS
8191f61
%{_bindir}/phpize
8191f61
peclconf %{_bindir}/php-config
8191f61
make %{?_smp_mflags}
8191f61
8191f61
%if %{with_zts}
8191f61
cd ../ZTS
8191f61
%{_bindir}/zts-phpize
8191f61
peclconf %{_bindir}/zts-php-config
8191f61
make %{?_smp_mflags}
8191f61
%endif
8191f61
8191f61
8191f61
%install
8191f61
# Install the NTS stuff
8191f61
make -C NTS install INSTALL_ROOT=%{buildroot}
8191f61
install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name}
8191f61
8191f61
# Install XML package description
8191f61
install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml
8191f61
8191f61
# Install the ZTS stuff
8191f61
%if %{with_zts}
8191f61
make -C ZTS install INSTALL_ROOT=%{buildroot}
8191f61
install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}
8191f61
%endif
8191f61
8191f61
# Test & Documentation
8191f61
for i in $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//')
8191f61
do install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i
8191f61
done
8191f61
8191f61
8191f61
%check
8191f61
cd NTS
8191f61
8191f61
: Minimal load test for NTS extension
8191f61
%{_bindir}/php --no-php-ini \
8191f61
    --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \
8191f61
    --modules | grep %{pecl_name}
8191f61
8191f61
%if %{with_tests}
8191f61
: Upstream test suite for NTS extension
8191f61
TEST_PHP_EXECUTABLE=%{__php} \
8191f61
TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=%{pecl_name}.so" \
8191f61
NO_INTERACTION=1 \
8191f61
REPORT_EXIT_STATUS=1 \
8191f61
%{__php} -n run-tests.php --show-diff
8191f61
%else
8191f61
: Upstream test suite disabled
8191f61
%endif
8191f61
8191f61
%if %{with_zts}
8191f61
cd ../ZTS
8191f61
8191f61
: Minimal load test for ZTS extension
8191f61
%{__ztsphp} --no-php-ini \
8191f61
    --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \
8191f61
    --modules | grep %{pecl_name}
8191f61
8191f61
%if %{with_tests}
8191f61
: Upstream test suite for ZTS extension
8191f61
TEST_PHP_EXECUTABLE=%{__ztsphp} \
8191f61
TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=%{pecl_name}.so" \
8191f61
NO_INTERACTION=1 \
8191f61
REPORT_EXIT_STATUS=1 \
8191f61
%{__ztsphp} -n run-tests.php --show-diff
8191f61
%else
8191f61
: Upstream test suite disabled
8191f61
%endif
8191f61
%endif
8191f61
8191f61
8191f61
%files
c0be329
%license NTS/LICENSE
8191f61
%doc %{pecl_docdir}/%{pecl_name}
8191f61
%{pecl_xmldir}/%{name}.xml
8191f61
8191f61
%config(noreplace) %{php_inidir}/%{ini_name}
8191f61
%{php_extdir}/%{pecl_name}.so
8191f61
8191f61
%if %{with_zts}
8191f61
%{php_ztsextdir}/%{pecl_name}.so
8191f61
%config(noreplace) %{php_ztsinidir}/%{ini_name}
8191f61
%endif
8191f61
8191f61
8191f61
%changelog
0c97357
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-8
0c97357
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
0c97357
441d303
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-7
441d303
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
441d303
ae1205b
* Thu Oct 11 2018 Remi Collet <remi@remirepo.net> - 2.0.2-6
ae1205b
- Rebuild for https://fedoraproject.org/wiki/Changes/php73
ae1205b
- add patch for PHP 7.3 from
ae1205b
  https://github.com/laruence/yac/pull/89
ae1205b
c65f044
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-5
c65f044
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
c65f044
f07125f
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-4
f07125f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
f07125f
3aac9f4
* Mon Jan 29 2018 Remi Collet <remi@remirepo.net> - 2.0.2-3
3aac9f4
- undefine _strict_symbol_defs_build
3aac9f4
ce381b3
* Tue Oct 03 2017 Remi Collet <remi@fedoraproject.org> - 2.0.2-2
ce381b3
- rebuild for https://fedoraproject.org/wiki/Changes/php72
ce381b3
3af42bc
* Tue Aug  1 2017 Remi Collet <remi@remirepo.net> - 2.0.2-1
3af42bc
- Update to 2.0.2
3af42bc
711c087
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.1-4
711c087
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
711c087
7e40237
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.1-3
7e40237
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
7e40237
49231e3
* Mon Nov 14 2016 Remi Collet <remi@fedoraproject.org> - 2.0.1-2
49231e3
- rebuild for https://fedoraproject.org/wiki/Changes/php71
49231e3
c4cf89f
* Sat Jul  2 2016 Remi Collet <remi@fedoraproject.org> - 2.0.1-1
c4cf89f
- update to 2.0.1 (php 7)
c4cf89f
d97edde
* Mon Jun 27 2016 Remi Collet <remi@fedoraproject.org> - 2.0.0-1
d97edde
- update to 2.0.0 (php 7)
d97edde
c0be329
* Sat Feb 13 2016 Remi Collet <remi@fedoraproject.org> - 0.9.2-4
c0be329
- drop scriptlets (replaced by file triggers in php-pear)
c0be329
- cleanup
c0be329
7b77082
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.2-3
7b77082
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
7b77082
c062a3d
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.2-2
c062a3d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
c062a3d
8191f61
* Sat Oct 25 2014 Remi Collet <remi@fedoraproject.org> - 0.9.2-1
8191f61
- Update to 0.9.2
8191f61
8191f61
* Sat Sep  6 2014 Remi Collet <remi@fedoraproject.org> - 0.9.1-3
8191f61
- cleanup for review
8191f61
- build with system fastlz
8191f61
- don't install the tests
8191f61
8191f61
* Tue Aug 26 2014 Remi Collet <rcollet@redhat.com> - 0.9.1-2
8191f61
- improve SCL build
8191f61
8191f61
* Fri Jul 25 2014 Remi Collet <remi@fedoraproject.org> - 0.9.1-1
8191f61
- Update to 0.9.1 (beta)
8191f61
8191f61
* Thu Jul 24 2014 Remi Collet <remi@fedoraproject.org> - 0.9.0-1
8191f61
- upstream move to pecl
8191f61
- rename from php-yac to php-pecl-yac
8191f61
- update to 0.9.0 (beta)
8191f61
8191f61
* Thu Apr 17 2014 Remi Collet <remi@fedoraproject.org> - 0.1.1-3
8191f61
- add numerical prefix to extension configuration file (php 5.6)
8191f61
8191f61
* Tue Mar 25 2014 Remi Collet <remi@fedoraproject.org> - 0.1.1-2
8191f61
- allow SCL build
8191f61
8191f61
* Sun Mar 16 2014 Remi Collet <remi@fedoraproject.org> - 0.1.1-1
8191f61
- version 0.1.1
8191f61
8191f61
* Sat Mar 23 2013 Remi Collet <remi@fedoraproject.org> - 0.1.0-0.1.git57fe00d
d97edde
- initial package, version 0.1.0 (experimental)