File php7-redis.spec of Package php7-redis

# spec file for package php7-redis
# Copyright (c) 2017 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 php_name    php7
%define pkg_name    phpredis
Name:           php7-redis
Version:        3.1.1
Release:        0
Summary:        Interface for communicating with the Redis key-value store
License:        PHP-3.01
Group:          Productivity/Networking/Web/Servers
BuildRequires:  %{php_name}
BuildRequires:  %{php_name}-devel
BuildRequires:  %{php_name}-soap
Provides:       php-%{pkg_name} = %{version}
Obsoletes:      php-%{pkg_name} < %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if %{?php_zend_api}0
Requires:       php(api) = %{php_core_api}
Requires:       php(zend-abi) = %{php_zend_api}
%requires_eq    %{php_name}

The phpredis extension provides an API for communicating with the Redis key-value store.

%setup -q -n %{pkg_name}-%{version}
mkdir %{name}

pushd %{name}
export CFLAGS="%{optflags}"
../configure --enable-phpredis
sed -i -e 's|PHP_EXECUTABLE = %{_bindir}/php-cgi|PHP_EXECUTABLE = %{_bindir}/php|' Makefile
make %{?_smp_mflags}

make DESTDIR=%{buildroot} install %{?_smp_mflags} -C %{name} INSTALL_ROOT=%{buildroot}
mkdir -p %{buildroot}%{_sysconfdir}/%{php_name}/conf.d
echo "" > %{buildroot}%{_sysconfdir}/%{php_name}/conf.d/redis.ini

# only check if the extension can be loaded
%{_bindir}/php \
    --no-php-ini \
    --define extension=%{buildroot}%{_libdir}/%{php_name}/extensions/ \
    --modules | grep redis

if [ -x %{_bindir}/zts-php ] ; then
%{_bindir}/zts-php \
    --no-php-ini \
    --define extension=%{buildroot}%{_libdir}/%{php_name}/extensions/ \
    --modules | grep redis

# other tests qhich require redis can not be run

%config(noreplace) %{_sysconfdir}/%{php_name}/conf.d/redis.ini