You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
219 lines
5.6 KiB
219 lines
5.6 KiB
%undefine _strict_symbol_defs_build |
|
%bcond_without tests |
|
|
|
%global gh_commit b771cd50a7fe519b6aaccbe5dc97594e68e0c88f |
|
%global gh_short %(c=%{gh_commit}; echo ${c:0:7}) |
|
%global gh_owner krakjoe |
|
%global gh_project apcu |
|
%global pecl_name apcu |
|
%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} |
|
%global ini_name 40-%{pecl_name}.ini |
|
%global sources %{pecl_name}-%{version} |
|
%global _configure ../%{sources}/configure |
|
|
|
Name: php-pecl-apcu |
|
Version: 5.1.24 |
|
Release: 1%{dist} |
|
License: PHP-3.01 |
|
URL: https://pecl.php.net/package/APCu |
|
Summary: APC User Cache |
|
Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz |
|
Source1: %{pecl_name}-5.1.19.ini |
|
Source2: %{pecl_name}-panel.conf |
|
Source3: %{pecl_name}.conf.php |
|
|
|
BuildRequires: make |
|
BuildRequires: gcc |
|
BuildRequires: php-devel >= 7.0 |
|
BuildRequires: php-pear |
|
|
|
Requires: php > 8 |
|
|
|
Obsoletes: php-apcu < 4.0.0-1 |
|
Provides: php-apcu = %{version} |
|
Provides: php-apcu%{?_isa} = %{version} |
|
Provides: php-pecl(apcu) = %{version} |
|
Provides: php-pecl(apcu)%{?_isa} = %{version} |
|
|
|
|
|
%description |
|
APCu is userland caching: APC stripped of opcode caching. |
|
|
|
APCu only supports userland caching of variables. |
|
|
|
|
|
%package devel |
|
Summary: APCu developer files (header) |
|
Requires: %{name}%{?_isa} = %{version}-%{release} |
|
Requires: php-devel%{?_isa} |
|
|
|
Obsoletes: php-pecl-apc-devel < 4 |
|
Provides: php-pecl-apc-devel = %{version}-%{release} |
|
Provides: php-pecl-apc-devel%{?_isa} = %{version}-%{release} |
|
|
|
%description devel |
|
These are the files needed to compile programs using APCu. |
|
|
|
|
|
%package -n apcu-panel |
|
Summary: APCu control panel |
|
BuildArch: noarch |
|
Requires: %{name} = %{version}-%{release} |
|
Requires: php(httpd) |
|
Requires: php-gd |
|
Requires: httpd |
|
|
|
Obsoletes: apc-panel < 4 |
|
Provides: apc-panel = %{version}-%{release} |
|
|
|
%description -n apcu-panel |
|
This package provides the APCu control panel, with Apache |
|
configuration, available on http://localhost/apcu-panel/ |
|
|
|
|
|
%prep |
|
%setup -qc |
|
sed -e '/LICENSE/s/role="doc"/role="src"/' -i package.xml |
|
|
|
cd %{sources} |
|
# Sanity check, really often broken |
|
extver=$(sed -n '/#define PHP_APCU_VERSION/{s/.* "//;s/".*$//;p}' php_apc.h) |
|
if test "x${extver}" != "x%{version}%{?prever}"; then |
|
: Error: Upstream extension version is ${extver}, expecting %{version}%{?prever}. |
|
exit 1 |
|
fi |
|
cd .. |
|
|
|
mkdir NTS |
|
%if %{with_zts} |
|
mkdir ZTS |
|
%endif |
|
|
|
# Fix path to configuration file |
|
sed -e s:apc.conf.php:%{_sysconfdir}/apcu-panel/conf.php:g \ |
|
-i %{sources}/apc.php |
|
# Provide the control panel as doc |
|
sed -e '/"apc.php"/s/role="src"/role="doc"/' -i package.xml |
|
|
|
%build |
|
%{?dtsenable} |
|
|
|
cd %{sources} |
|
%{__phpize} |
|
[ -f Makefile.global ] && GLOBAL=Makefile.global || GLOBAL=build/Makefile.global |
|
sed -e 's/INSTALL_ROOT/DESTDIR/' -i $GLOBAL |
|
|
|
cd ../NTS |
|
%configure \ |
|
--enable-apcu \ |
|
--with-php-config=%{__phpconfig} |
|
%make_build |
|
|
|
%if %{with_zts} |
|
cd ../ZTS |
|
%configure \ |
|
--enable-apcu \ |
|
--with-php-config=%{__ztsphpconfig} |
|
%make_build |
|
%endif |
|
|
|
|
|
%install |
|
%{?dtsenable} |
|
|
|
# Install the NTS stuff |
|
%make_install -C NTS |
|
install -D -m 644 %{SOURCE1} %{buildroot}%{php_inidir}/%{ini_name} |
|
|
|
%if %{with_zts} |
|
# Install the ZTS stuff |
|
%make_install -C ZTS |
|
install -D -m 644 %{SOURCE1} %{buildroot}%{php_ztsinidir}/%{ini_name} |
|
%endif |
|
|
|
# Install the package XML file |
|
install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml |
|
|
|
# Install the Control Panel |
|
# Pages |
|
install -D -m 644 -p %{sources}/apc.php \ |
|
%{buildroot}%{_datadir}/apcu-panel/index.php |
|
# Apache config |
|
install -D -m 644 -p %{SOURCE2} \ |
|
%{buildroot}%{_sysconfdir}/httpd/conf.d/apcu-panel.conf |
|
# Panel config |
|
install -D -m 644 -p %{SOURCE3} \ |
|
%{buildroot}%{_sysconfdir}/apcu-panel/conf.php |
|
|
|
|
|
# Test & Documentation |
|
cd %{sources} |
|
for i in $(grep 'role="test"' ../package.xml | sed -e 's/^.*name="//;s/".*$//') |
|
do [ -f $i ] && install -Dpm 644 $i %{buildroot}%{pecl_testdir}/%{pecl_name}/$i |
|
[ -f tests/$i ] && install -Dpm 644 tests/$i %{buildroot}%{pecl_testdir}/%{pecl_name}/tests/$i |
|
done |
|
for i in $(grep 'role="doc"' ../package.xml | sed -e 's/^.*name="//;s/".*$//') |
|
do install -Dpm 644 $i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i |
|
done |
|
|
|
|
|
%check |
|
cd %{sources} |
|
|
|
%{_bindir}/php -n \ |
|
-d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ |
|
-m | grep '^apcu$' |
|
|
|
%if %{with tests} |
|
# Upstream test suite for NTS extension |
|
TEST_PHP_EXECUTABLE=%{__php} \ |
|
TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \ |
|
REPORT_EXIT_STATUS=1 \ |
|
%{__php} -n run-tests.php -q --show-diff |
|
%endif |
|
|
|
%if %{with_zts} |
|
%{__ztsphp} -n \ |
|
-d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ |
|
-m | grep '^apcu$' |
|
|
|
%if %{with tests} |
|
# Upstream test suite for ZTS extension |
|
TEST_PHP_EXECUTABLE=%{__ztsphp} \ |
|
TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so" \ |
|
REPORT_EXIT_STATUS=1 \ |
|
%{__ztsphp} -n run-tests.php -q --show-diff |
|
%endif |
|
%endif |
|
|
|
|
|
%files |
|
%license %{sources}/LICENSE |
|
%{pecl_xmldir}/%{name}.xml |
|
|
|
%config(noreplace) %{php_inidir}/%{ini_name} |
|
%{php_extdir}/%{pecl_name}.so |
|
|
|
%if %{with_zts} |
|
%config(noreplace) %{php_ztsinidir}/%{ini_name} |
|
%{php_ztsextdir}/%{pecl_name}.so |
|
%endif |
|
|
|
|
|
%files devel |
|
%{php_incldir}/ext/%{pecl_name} |
|
|
|
%if %{with_zts} |
|
%{php_ztsincldir}/ext/%{pecl_name} |
|
%endif |
|
|
|
|
|
%files -n apcu-panel |
|
# Need to restrict access, as it contains a clear password |
|
%attr(550,apache,root) %dir %{_sysconfdir}/apcu-panel |
|
%config(noreplace) %{_sysconfdir}/apcu-panel/conf.php |
|
%config(noreplace) %{_sysconfdir}/httpd/conf.d/apcu-panel.conf |
|
%{_datadir}/apcu-panel |
|
|
|
|
|
%changelog
|
|
|