LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File php7-redis.spec of Package php7-redis (Project home:taaem)

#
# 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 http://bugs.opensuse.org/
#


%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
Url:            https://github.com/phpredis/phpredis
Source0:        https://github.com/phpredis/%{pkg_name}/archive/%{version}.tar.gz#/%{pkg_name}-%{version}.tar.gz
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}
%else
%requires_eq    %{php_name}
%endif

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

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

%build
%{_bindir}/phpize
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}
popd

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

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

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

# other tests qhich require redis can not be run

%files
%defattr(-,root,root,-)
%{_libdir}/%{php_name}/extensions/redis.so
%config(noreplace) %{_sysconfdir}/%{php_name}/conf.d/redis.ini
%doc COPYING CREDITS

%changelog