File php7-APCu.spec of Package php7-APCu

# spec file for package php7-APCu
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

%define pkg_name apcu
Name:           php7-APCu
Version:        5.1.15
Release:        0
Summary:        APCu - APC User Cache
License:        PHP-3.01
Group:          Productivity/Networking/Web/Servers
Source1:        apcu.ini
BuildRequires:  php7-devel >= 7.0
BuildRequires:  xz
Requires:       php(api) = %{php_core_api}
Requires:       php(zend-abi) = %{php_zend_api}
Provides:       php-APCu = %{version}
Obsoletes:      php-APCu < %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

APCu is userland caching: APC stripped of opcode caching in preparation
for the deployment of Zend Optimizer+ as the primary solution to opcode
caching in future versions of PHP.

%setup -q -n %{pkg_name}-%{version}
if [ -z "$SOURCE_DATE_EPOCH" ]; then
FAKE_BUILDTIME=$(LC_ALL=C date -u -r php_apc.c '+%%H:%%M')
FAKE_BUILDDATE=$(LC_ALL=C date -u -r php_apc.c '+%%b %%e %%Y')
sed -e "s/__TIME__/\"$FAKE_BUILDTIME\"/g" -i php_apc.c
sed -e "s/__DATE__/\"$FAKE_BUILDDATE\"/g" -i php_apc.c

export CFLAGS="%optflags -fvisibility=hidden"
%configure --enable-apcu
make %{?_smp_mflags}

make %{?_smp_mflags} test PHP_EXECUTABLE=%{_bindir}/php NO_INTERACTION=1

make install INSTALL_ROOT=%{buildroot}
install -D -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/php7/conf.d/%{pkg_name}.ini

# remove not used header file(s)
rm -rf %{buildroot}/%{_includedir}/php7/ext/%{pkg_name}/

%config(noreplace) %{_sysconfdir}/php7/conf.d/%{pkg_name}.ini
%doc NOTICE TECHNOTES.txt apc.php
%license LICENSE