+#
+# Conditional build:
+%bcond_without tests # build without tests
+
%define php_name php%{?php_suffix}
%define modname imagick
%define status stable
BuildRequires: %{php_name}-devel >= 4:5.3
BuildRequires: ImageMagick-devel >= 1:6.2.4.0
BuildRequires: rpmbuild(macros) >= 1.650
+%if %{with tests}
+BuildRequires: %{php_name}-cli
+BuildRequires: %{php_name}-spl
+%endif
%{?requires_php_extension}
Requires(triggerpostun): sed >= 4.0
Requires: %{php_name}-spl
%{__make} \
CFLAGS_CLEAN="%{rpmcflags}"
+%if %{with tests}
+%{__php} -n -q \
+ -d extension_dir=modules \
+ -d extension=%{php_extensiondir}/spl.so \
+ -d extension=%{modname}.so \
+ -m > modules.log
+grep %{modname} modules.log
+
+export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
+%{__make} test \
+ PHP_EXECUTABLE=%{__php} \
+ PHP_TEST_SHARED_SYSTEM_EXTENSIONS="spl" \
+%endif
+
%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT{%{php_sysconfdir}/conf.d,%{php_extensiondir},%{_examplesdir}/%{name}-%{version}}