]> git.pld-linux.org Git - packages/php-redis.git/blobdiff - php-redis.spec
Up to 4.3.0, last version with php5 support
[packages/php-redis.git] / php-redis.spec
index 9e221768bf21077501901a2222389f86da05c58a..d8bb5a6ee91a0ff28c32196524763b4c45382c3f 100644 (file)
@@ -1,16 +1,42 @@
+# TODO
+# - use external igbinary and make it's dependency optional
+#
+# Conditional build:
+%bcond_without phpdoc          # build phpdoc package
+%bcond_with    tests           # build without tests
+
+# build "phpdoc" only for 7.3 version on pld builders
+%if 0%{?_pld_builder:1} && "%{?php_suffix}" != "73"
+%undefine      with_phpdoc
+%endif
+
+%define                php_name        php%{?php_suffix}
 %define                modname redis
 Summary:       %{modname} A PHP extension for Redis
-Name:          php-%{modname}
-Version:       2.1.3
+Name:          %{php_name}-%{modname}
+Version:       4.3.0
 Release:       1
 License:       PHP 3.01
 Group:         Development/Languages/PHP
-Source0:       https://github.com/nicolasff/phpredis/tarball/%{version}#/%{name}-%{version}.tgz
-# Source0-md5: eb2bee7e42f7a32a38c2a45377f21086
-URL:           https://github.com/nicolasff/phpredis
-BuildRequires: php-devel >= 4:5.0.4
+Source0:       https://github.com/phpredis/phpredis/tarball/%{version}/%{modname}-%{version}.tar.gz
+# Source0-md5: a038194807474611cf76dd727098b986
+Source1:       https://github.com/ukko/phpredis-phpdoc/archive/9ec1795bcd45ec83a19b46cf9a8b78b4e4d7ac80/%{modname}-phpdoc.tar.gz
+# Source1-md5: eaba2e5fad040e2f4526374c073ae5f7
+URL:           https://github.com/phpredis/phpredis
+BuildRequires: %{php_name}-cli
+BuildRequires: %{php_name}-devel >= 4:5.0.4
+BuildRequires: %{php_name}-pcre
+BuildRequires: %{php_name}-session
+BuildRequires: %{php_name}-simplexml
+%if %{with tests}
+BuildRequires: %{php_name}-pecl-igbinary
+BuildRequires: %{php_name}-zlib
+%endif
 BuildRequires: rpmbuild(macros) >= 1.519
 %{?requires_php_extension}
+Requires:      %{php_name}-session
+Provides:      php(%{modname}) = %{version}
+Obsoletes:     php-redis < 2.2.5-1
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -19,18 +45,62 @@ Redis key-value store.
 
 This extension also provides session support.
 
+%package -n php-redis-phpdoc
+Summary:       @phpdoc extension PHP for IDE autocomplete
+Group:         Documentation
+URL:           https://github.com/ukko/phpredis-phpdoc
+Requires:      php-dirs
+BuildArch:     noarch
+
+%description -n php-redis-phpdoc
+@phpdoc extension PHP for IDE autocomplete.
+
 %prep
-%setup -qc
-mv *-php%{modname}-*/* .
+%setup -qc -a1
+mv phpredis-phpredis-*/* .
+mv phpredis-phpdoc-* phpdoc
 
 %build
 phpize
 %configure
 %{__make}
 
+export TEST_PHP_EXECUTABLE="%{__php}"
+export TEST_PHP_ARGS=" -n \
+       -dextension_dir=modules \
+       -dextension=%{php_extensiondir}/pcre.so \
+       -dextension=%{php_extensiondir}/spl.so \
+       -dextension=%{php_extensiondir}/simplexml.so \
+       -dextension=%{php_extensiondir}/session.so \
+       -dextension=%{modname}.so \
+"
+
+# simple module load test
+$TEST_PHP_EXECUTABLE $TEST_PHP_ARGS -m > modules.log
+grep %{modname} modules.log
+
+%if %{with tests}
+TEST_PHP_ARGS="
+       $TEST_PHP_ARGS
+       -dextension=%{php_extensiondir}/zlib.so \
+"
+
+# Run tests for Redis class (note this is the default)
+$TEST_PHP_EXECUTABLE $TEST_PHP_ARGS tests/TestRedis.php --class Redis
+
+# Run tests for RedisArray class
+tests/mkring.sh start
+$TEST_PHP_EXECUTABLE $TEST_PHP_ARGS tests/TestRedis.php --class RedisArray
+tests/mkring.sh stop
+
+# Run tests for the RedisCluster class
+tests/make-cluster.sh start
+$TEST_PHP_EXECUTABLE $TEST_PHP_ARGS tests/TestRedis.php --class RedisCluster
+tests/make-cluster.sh stop
+%endif
+
 %install
 rm -rf $RPM_BUILD_ROOT
-
 %{__make} install \
        EXTENSION_DIR=%{php_extensiondir} \
        INSTALL_ROOT=$RPM_BUILD_ROOT
@@ -41,6 +111,9 @@ cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini
 extension=%{modname}.so
 EOF
 
+install -d $RPM_BUILD_ROOT%{_examplesdir}/php-%{modname}-%{version}
+cp -a phpdoc/src/*.php $RPM_BUILD_ROOT%{_examplesdir}/php-%{modname}-%{version}
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -57,3 +130,9 @@ fi
 %doc CREDITS README.markdown
 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
 %attr(755,root,root) %{php_extensiondir}/%{modname}.so
+
+%if %{with phpdoc}
+%files -n php-redis-phpdoc
+%defattr(644,root,root,755)
+%{_examplesdir}/php-%{modname}-%{version}
+%endif
This page took 0.057601 seconds and 5 git commands to generate.