Blob Blame History Raw
%global ext_name     xcache
%global with_zts     0%{?__ztsphp:1}

Summary:       Fast, stable PHP opcode cacher
Name:          php-xcache
Version:       3.0.1
Release:       2%{?dist}
License:       BSD
Group:         Development/Languages

Source1:       xcache-httpd.conf

# Relocation of configuration files to /etc/xcache
Patch0:        xcache-config.patch

BuildRequires: php-devel

Requires:      php(zend-abi) = %{php_zend_api}
Requires:      php(api) = %{php_core_api}

# Only one opcode cache can be installed
Conflicts:     php-pecl-apc
Conflicts:     php-eaccelerator

# Filter private shared object
%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}

XCache is a fast, stable  PHP opcode cacher that has been tested and is now
running on production servers under high load. 

It is tested (on linux) and supported on all of the latest PHP release. 
ThreadSafe is also perfectly supported. 

It overcomes a lot of problems that has been with other competing opcachers
such as being able to be used with new  PHP versions. 

%package -n xcache-admin
Summary:       XCache Administration
Group:         Development/Languages
Requires:      mod_php, httpd
Requires:      %{name} = %{version}-%{release}
BuildArch:     noarch

%description -n xcache-admin
This package provides the XCache Administration web application,
with Apache configuration, on http://localhost/xcache

This requires to configure, in XCache configuration file (xcache.ini):
- xcache.admin.user
- xcache.admin.pass
- xcache.coveragedump_directory

%setup -q -c 

# rename source folder
mv %{ext_name}-%{version} nts

cd nts
%patch0 -p1

# Sanity check, really often broken
extver=$(sed -n '/define XCACHE_VERSION/{s/.* "//;s/".*$//;p}' xcache.h)
if test "x${extver}" != "x%{version}"; then
   : Error: Upstream extension version is ${extver}, expecting %{version}.
   exit 1
cd ..

%if %{with_zts}
# duplicate for ZTS build
cp -pr nts zts

# Without --enable-xcache-assembler, --enable-xcache-encoder, --enable-xcache-decoder
# This seems not yet implemented

cd nts
%configure \
    --enable-xcache \
    --enable-xcache-constant \
    --enable-xcache-optimizer \
    --enable-xcache-coverager \
make %{?_smp_mflags}

%if %{with_zts}
cd ../zts
%configure \
    --enable-xcache \
    --enable-xcache-constant \
    --enable-xcache-optimizer \
    --enable-xcache-coverager \
make %{?_smp_mflags}

# Install the NTS stuff
make -C nts install INSTALL_ROOT=%{buildroot}
install -D -m 644 nts/%{ext_name}.ini %{buildroot}%{_sysconfdir}/php.d/%{ext_name}.ini

%if %{with_zts}
# Install the ZTS stuff
make -C zts install INSTALL_ROOT=%{buildroot}
install -D -m 644 zts/%{ext_name}.ini %{buildroot}%{php_ztsinidir}/%{ext_name}.ini

# Install the admin stuff
install -d -m 755 %{buildroot}%{_datadir}
cp -pr nts/htdocs %{buildroot}%{_datadir}/xcache
install -d -m 755 %{buildroot}%{_sysconfdir}/xcache/cacher
install -d -m 755 %{buildroot}%{_sysconfdir}/xcache/coverager
mv %{buildroot}%{_datadir}/xcache/config.example.php \
mv %{buildroot}%{_datadir}/xcache/cacher/config.example.php \
mv %{buildroot}%{_datadir}/xcache/coverager/config.example.php \

install -D -m 644 -p %{SOURCE1} \

cd nts

# simple module load test
php --no-php-ini \
    --define extension_dir=%{buildroot}%{php_extdir}/\
    --define extension=%{ext_name}.so \
    --modules | grep XCache

# upstream unit tests
TEST_PHP_EXECUTABLE=%{_bindir}/php \
php run-tests.php -n -c xcache-test.ini tests

%if %{with_zts}
cd ../zts
%{__ztsphp} --no-php-ini \
    --define extension_dir=%{buildroot}%{php_ztsextdir}/\
    --define extension=%{ext_name}.so \
    --modules | grep XCache

%{__ztsphp} run-tests.php -n -c xcache-test.ini tests

%config(noreplace) %{_sysconfdir}/php.d/%{ext_name}.ini

%if %{with_zts}
%config(noreplace) %{php_ztsinidir}/%{ext_name}.ini

%files -n xcache-admin
%config(noreplace) %{_sysconfdir}/httpd/conf.d/xcache.conf
# No real configuration files, only sample files

* Thu Feb 14 2013 Fedora Release Engineering <> - 3.0.1-2
- Rebuilt for

* Thu Jan 17 2013 Remi Collet <> - 3.0.1-1
- bugfixes version

* Sat Nov 22 2012 Remi Collet <> - 3.0.0-1.1
- upstream have fixed the sources (review #859504)

* Wed Oct 31 2012 Remi Collet <> - 3.0.0-1
- new major version
- drop xcache-coverager subpackage
- xcache-admin now provides cacher, coverager and diagnosis
- run unit tests provided by upstream

* Sat Oct 27 2012 Remi Collet <> - 2.0.1-4
- drop php prefix from sub packages
- clean EL-5 stuff

* Fri Sep 21 2012 Remi Collet <> - 2.0.1-3
- prepare for review with EL-5 stuff

* Fri Sep 21 2012 Remi Collet <> - 2.0.1-2
- add admin and coverager sub-package

* Sun Sep  9 2012 Remi Collet <> - 2.0.1-1
- initial package