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
#
607bf34
%{!?php_inidir: %{expand: %%global php_inidir  %{_sysconfdir}/php.d}}
7d0f27e
%global ext_name     xcache
7d0f27e
%global with_zts     0%{?__ztsphp:1}
7d0f27e
7d0f27e
Summary:       Fast, stable PHP opcode cacher
7d0f27e
Name:          php-xcache
3d7213d
Version:       3.1.1
3d7213d
Release:       1%{?dist}
7d0f27e
License:       BSD
7d0f27e
Group:         Development/Languages
7d0f27e
URL:           http://xcache.lighttpd.net/
7d0f27e
7d0f27e
Source0:       http://xcache.lighttpd.net/pub/Releases/%{version}/%{ext_name}-%{version}.tar.gz
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
f6ee022
%if 0%{?fedora} < 20
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
7d0f27e
Requires:      %{name} = %{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
3d7213d
mv %{version} 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)
607bf34
if test "x${extver}" != "x%{version}%{?svnrev:-dev}"; then
607bf34
   : Error: Upstream extension version is ${extver}, expecting %{version}%{?svnrev:-dev}.
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}
607bf34
install -D -m 644 nts/%{ext_name}.ini %{buildroot}%{php_inidir}/%{ext_name}.ini
7d0f27e
7d0f27e
%if %{with_zts}
7d0f27e
# Install the ZTS stuff
7d0f27e
make -C zts install INSTALL_ROOT=%{buildroot}
7d0f27e
install -D -m 644 zts/%{ext_name}.ini %{buildroot}%{php_ztsinidir}/%{ext_name}.ini
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 \
f6ee022
%{__php} 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 \
7d0f27e
%{__ztsphp} run-tests.php -n -c xcache-test.ini tests
7d0f27e
%endif
7d0f27e
7d0f27e
7d0f27e
%files
7d0f27e
%doc nts/{AUTHORS,ChangeLog,COPYING,README,THANKS}
607bf34
%config(noreplace) %{php_inidir}/%{ext_name}.ini
7d0f27e
%{php_extdir}/%{ext_name}.so
7d0f27e
7d0f27e
%if %{with_zts}
7d0f27e
%config(noreplace) %{php_ztsinidir}/%{ext_name}.ini
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
3d7213d
* Tue Sep  9 2014 Remi Collet <remi@fedoraproject.org> - 3.1.1-1
3d7213d
- version 3.1.1
3d7213d
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