e1f317b
# spec file for php-xcache
e1f317b
#
f6ee022
# Copyright (c) 2012-2014 Remi Collet
e1f317b
# License: CC-BY-SA
e1f317b
# http://creativecommons.org/licenses/by-sa/3.0/
e1f317b
#
e1f317b
# Please, preserve the changelog entries
e1f317b
#
8967124
%{!?php_inidir:  %global php_inidir       %{_sysconfdir}/php.d}
7d0f27e
%global ext_name     xcache
7d0f27e
%global with_zts     0%{?__ztsphp:1}
7d0f27e
8967124
%if "%{php_version}" < "5.6"
8967124
%global ini_name  %{ext_name}.ini
8967124
%else
8967124
%global ini_name  40-%{ext_name}.ini
8967124
%endif
8967124
7d0f27e
Summary:       Fast, stable PHP opcode cacher
7d0f27e
Name:          php-xcache
9530729
Epoch:         1
9530729
Version:       3.2.0
11e5b66
Release:       3%{?dist}
7d0f27e
License:       BSD
7d0f27e
Group:         Development/Languages
7d0f27e
URL:           http://xcache.lighttpd.net/
7d0f27e
8967124
%if 0%{?svnrev}
9530729
# svn export -r 1496 svn://svn.lighttpd.net/xcache/trunk xcache-4.0.0
8967124
# tar czf xcache-svn1496.tgz xcache-4.0.0
8967124
Source0:       xcache-svn%{svnrev}.tgz
8967124
%else
9530729
Source0:       http://xcache.lighttpd.net/pub/Releases/%{version}%{?prever:-%{prever}}/%{ext_name}-%{version}%{?prever:-%{prever}}.tar.gz
8967124
%endif
7d0f27e
Source1:       xcache-httpd.conf
7d0f27e
7d0f27e
# Relocation of configuration files to /etc/xcache
7d0f27e
Patch0:        xcache-config.patch
f6ee022
# Disable cache to allow work with php-opcache
f6ee022
Patch1:        xcache-cacher.patch
7d0f27e
7d0f27e
BuildRequires: php-devel
7d0f27e
7d0f27e
Requires:      php(zend-abi) = %{php_zend_api}
7d0f27e
Requires:      php(api) = %{php_core_api}
7d0f27e
9530729
%if 0%{?fedora} < 20 && 0%{?rhel} < 7
7d0f27e
# Filter private shared object
7d0f27e
%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
7d0f27e
%{?filter_setup}
f6ee022
%endif
7d0f27e
7d0f27e
7d0f27e
%description
f6ee022
XCache is a fast, stable  PHP opcode and data cacher that has been tested
f6ee022
and is now running on production servers under high load.
7d0f27e
7d0f27e
It is tested (on linux) and supported on all of the latest PHP release. 
7d0f27e
ThreadSafe is also perfectly supported. 
7d0f27e
f6ee022
NOTICE: opcode cacher is disable to allow use with php-opcache only for user
f6ee022
data cache. You need to edit configuration file (xcache.ini) to enable it.
7d0f27e
7d0f27e
7d0f27e
%package -n xcache-admin
7d0f27e
Summary:       XCache Administration
7d0f27e
Group:         Development/Languages
7d0f27e
Requires:      mod_php, httpd
9530729
Requires:      %{name} = %{epoch}:%{version}-%{release}
7d0f27e
BuildArch:     noarch
7d0f27e
7d0f27e
%description -n xcache-admin
7d0f27e
This package provides the XCache Administration web application,
7d0f27e
with Apache configuration, on http://localhost/xcache
7d0f27e
7d0f27e
This requires to configure, in XCache configuration file (xcache.ini):
7d0f27e
- xcache.admin.user
7d0f27e
- xcache.admin.pass
7d0f27e
- xcache.coveragedump_directory
7d0f27e
7d0f27e
7d0f27e
%prep
7d0f27e
%setup -q -c 
7d0f27e
7d0f27e
# rename source folder
34f4f8b
mv xcache-%{version}%{?prever:-%{prever}} nts
7d0f27e
f6ee022
cp %{SOURCE1} xcache-httpd.conf
7d0f27e
cd nts
7d0f27e
%patch0 -p1
f6ee022
%patch1 -p1
7d0f27e
7d0f27e
# Sanity check, really often broken
7d0f27e
extver=$(sed -n '/define XCACHE_VERSION/{s/.* "//;s/".*$//;p}' xcache.h)
9530729
if test "x${extver}" != "x%{version}%{?svnrev:-dev}%{?prever:-%{prever}}"; then
9530729
   : Error: Upstream extension version is ${extver}, expecting %{version}%{?svnrev:-dev}%{?prever:-%{prever}}.
7d0f27e
   exit 1
7d0f27e
fi
7d0f27e
cd ..
7d0f27e
7d0f27e
%if %{with_zts}
7d0f27e
# duplicate for ZTS build
7d0f27e
cp -pr nts zts
7d0f27e
%endif
7d0f27e
7d0f27e
7d0f27e
%build
7d0f27e
# Without --enable-xcache-assembler, --enable-xcache-encoder, --enable-xcache-decoder
7d0f27e
# This seems not yet implemented
7d0f27e
7d0f27e
cd nts
7d0f27e
%{_bindir}/phpize
7d0f27e
%configure \
7d0f27e
    --enable-xcache \
7d0f27e
    --enable-xcache-constant \
7d0f27e
    --enable-xcache-optimizer \
7d0f27e
    --enable-xcache-coverager \
7d0f27e
    --with-php-config=%{_bindir}/php-config
7d0f27e
make %{?_smp_mflags}
7d0f27e
7d0f27e
%if %{with_zts}
7d0f27e
cd ../zts
7d0f27e
%{_bindir}/zts-phpize
7d0f27e
%configure \
7d0f27e
    --enable-xcache \
7d0f27e
    --enable-xcache-constant \
7d0f27e
    --enable-xcache-optimizer \
7d0f27e
    --enable-xcache-coverager \
7d0f27e
    --with-php-config=%{_bindir}/zts-php-config
7d0f27e
make %{?_smp_mflags}
7d0f27e
%endif
7d0f27e
7d0f27e
7d0f27e
%install
7d0f27e
# Install the NTS stuff
7d0f27e
make -C nts install INSTALL_ROOT=%{buildroot}
8967124
install -D -m 644 nts/%{ext_name}.ini %{buildroot}%{php_inidir}/%{ini_name}
7d0f27e
7d0f27e
%if %{with_zts}
7d0f27e
# Install the ZTS stuff
7d0f27e
make -C zts install INSTALL_ROOT=%{buildroot}
8967124
install -D -m 644 zts/%{ext_name}.ini %{buildroot}%{php_ztsinidir}/%{ini_name}
7d0f27e
%endif
7d0f27e
7d0f27e
# Install the admin stuff
7d0f27e
install -d -m 755 %{buildroot}%{_datadir}
7d0f27e
cp -pr nts/htdocs %{buildroot}%{_datadir}/xcache
7d0f27e
install -d -m 755 %{buildroot}%{_sysconfdir}/xcache/cacher
7d0f27e
install -d -m 755 %{buildroot}%{_sysconfdir}/xcache/coverager
7d0f27e
mv %{buildroot}%{_datadir}/xcache/config.example.php \
7d0f27e
   %{buildroot}%{_sysconfdir}/xcache
7d0f27e
mv %{buildroot}%{_datadir}/xcache/cacher/config.example.php \
7d0f27e
   %{buildroot}%{_sysconfdir}/xcache/cacher
7d0f27e
mv %{buildroot}%{_datadir}/xcache/coverager/config.example.php \
7d0f27e
   %{buildroot}%{_sysconfdir}/xcache/coverager
7d0f27e
f6ee022
install -D -m 644 -p xcache-httpd.conf \
7d0f27e
        %{buildroot}%{_sysconfdir}/httpd/conf.d/xcache.conf
7d0f27e
7d0f27e
7d0f27e
%check
7d0f27e
cd nts
7d0f27e
7d0f27e
# simple module load test
f6ee022
%{__php} --no-php-ini \
7d0f27e
    --define extension_dir=%{buildroot}%{php_extdir}/\
7d0f27e
    --define extension=%{ext_name}.so \
7d0f27e
    --modules | grep XCache
7d0f27e
7d0f27e
# upstream unit tests
f6ee022
TEST_PHP_EXECUTABLE=%{__php} \
7d0f27e
NO_INTERACTION=1 \
7d0f27e
REPORT_EXIT_STATUS=1 \
9530729
%{__php} -n run-tests.php -n -c xcache-test.ini tests
7d0f27e
7d0f27e
%if %{with_zts}
7d0f27e
cd ../zts
7d0f27e
%{__ztsphp} --no-php-ini \
7d0f27e
    --define extension_dir=%{buildroot}%{php_ztsextdir}/\
7d0f27e
    --define extension=%{ext_name}.so \
7d0f27e
    --modules | grep XCache
7d0f27e
7d0f27e
TEST_PHP_EXECUTABLE=%{__ztsphp} \
7d0f27e
NO_INTERACTION=1 \
7d0f27e
REPORT_EXIT_STATUS=1 \
9530729
%{__ztsphp} -n run-tests.php -n -c xcache-test.ini tests
7d0f27e
%endif
7d0f27e
7d0f27e
7d0f27e
%files
7d0f27e
%doc nts/{AUTHORS,ChangeLog,COPYING,README,THANKS}
8967124
%config(noreplace) %{php_inidir}/%{ini_name}
7d0f27e
%{php_extdir}/%{ext_name}.so
7d0f27e
7d0f27e
%if %{with_zts}
8967124
%config(noreplace) %{php_ztsinidir}/%{ini_name}
7d0f27e
%{php_ztsextdir}/%{ext_name}.so
7d0f27e
%endif
7d0f27e
7d0f27e
%files -n xcache-admin
7d0f27e
%config(noreplace) %{_sysconfdir}/httpd/conf.d/xcache.conf
7d0f27e
%{_datadir}/xcache
7d0f27e
# No real configuration files, only sample files
7d0f27e
%{_sysconfdir}/xcache
7d0f27e
7d0f27e
7d0f27e
%changelog
11e5b66
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1:3.2.0-3
11e5b66
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
11e5b66
5c09f1f
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1:3.2.0-2
5c09f1f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
5c09f1f
34f4f8b
* Thu Sep 18 2014 Remi Collet <remi@fedoraproject.org> - 1:3.2.0-1
34f4f8b
- Update to 3.2.0
34f4f8b
9530729
* Tue Sep  9 2014 Remi Collet <remi@fedoraproject.org> - 1:3.2.0-0.1.rc1
9530729
- Update to 3.2.0-rc1
9530729
- bump epoch to 1
9530729
b59f446
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.0.0-0.2.svn1496
b59f446
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
b59f446
8967124
* Sat Jun  7 2014 Remi Collet <remi@fedoraproject.org> - 4.0.0-0.1.svn1496
8967124
- Update to 4.0.0-dev for PHP 5.6
8967124
- add numerical prefix to configuration file
8967124
0d59ef2
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.0-3
0d59ef2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
0d59ef2
f6ee022
* Thu Jan  9 2014 Remi Collet <remi@fedoraproject.org> - 3.1.0-2
f6ee022
- drop conflicts with other opcode cache
f6ee022
- disable opcode cache in provided configuration
f6ee022
e57a09b
* Sat Oct 12 2013 Remi Collet <remi@fedoraproject.org> - 3.1.0-1
e57a09b
- version 3.1.0
e57a09b
96911c7
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.0-0.3.svn1264
96911c7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
96911c7
e1f317b
* Fri Jun 14 2013 Remi Collet <remi@fedoraproject.org> - 3.1.0-0.2.svn1268
e1f317b
- latest changes from upstream
e1f317b
607bf34
* Tue Apr 16 2013 Remi Collet <remi@fedoraproject.org> - 3.1.0-0.1.svn1234
607bf34
- update to SVN snapshot for php 5.5 compatibility
607bf34
e215c97
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.1-2
e215c97
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
e215c97
65227a0
* Thu Jan 17 2013 Remi Collet <remi@fedoraproject.org> - 3.0.1-1
65227a0
- bugfixes version
65227a0
e57a09b
* Thu Nov 22 2012 Remi Collet <remi@fedoraproject.org> - 3.0.0-1.1
7d0f27e
- upstream have fixed the sources (review #859504)
7d0f27e
7d0f27e
* Wed Oct 31 2012 Remi Collet <remi@fedoraproject.org> - 3.0.0-1
7d0f27e
- new major version
7d0f27e
- drop xcache-coverager subpackage
7d0f27e
- xcache-admin now provides cacher, coverager and diagnosis
7d0f27e
- run unit tests provided by upstream
7d0f27e
7d0f27e
* Sat Oct 27 2012 Remi Collet <remi@fedoraproject.org> - 2.0.1-4
7d0f27e
- drop php prefix from sub packages
7d0f27e
- clean EL-5 stuff
7d0f27e
7d0f27e
* Fri Sep 21 2012 Remi Collet <remi@fedoraproject.org> - 2.0.1-3
7d0f27e
- prepare for review with EL-5 stuff
7d0f27e
7d0f27e
* Fri Sep 21 2012 Remi Collet <remi@fedoraproject.org> - 2.0.1-2
7d0f27e
- add admin and coverager sub-package
7d0f27e
7d0f27e
* Sun Sep  9 2012 Remi Collet <remi@fedoraproject.org> - 2.0.1-1
7d0f27e
- initial package
7d0f27e