3 %bcond_without tests # build without tests
5 %define php_name php%{?php_suffix}
7 Summary: User Operations for Zend
8 Name: %{php_name}-pecl-%{modname}
12 Group: Development/Languages/PHP
13 Source0: https://pecl.php.net/get/%{modname}-%{version}.tgz
14 # Source0-md5: 017d5b778e404fd5c324552c83b84b60
15 URL: https://pecl.php.net/package/uopz
16 %{?with_tests:BuildRequires: %{php_name}-cli}
17 BuildRequires: %{php_name}-devel >= 4:7.0.0
18 BuildRequires: rpmbuild(macros) >= 1.666
20 BuildRequires: %{php_name}-cli
21 BuildRequires: %{php_name}-pcre
22 BuildRequires: %{php_name}-session
23 BuildRequires: %{php_name}-spl
25 %{?requires_php_extension}
26 Provides: php(uopz) = %{version}
27 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
30 The uopz extension exposes Zend engine functionality normally used at
31 compilation and execution time in order to allow modification of the
32 internal structures that represent PHP code.
34 It supports the following activities:
35 - Overloading some Zend opcodes including exit/new and composure
37 - Renaming functions and methods
38 - Deletion of functions and methods
39 - Copying of functions and methods
40 - Redefinition of constants
41 - Deletion of constants
42 - Runtime composition and modification of classes
44 Note: All of the above activities are compatible with opcache,
45 including overloading ZEND_EXIT
49 mv %{modname}-%{version}/* .
57 # simple module load test
59 -d extension_dir=modules \
60 -d extension=%{modname}.so \
62 grep %{modname} modules.log
64 cat <<'EOF' > run-tests.sh
66 export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
68 PHP_EXECUTABLE=%{__php} \
69 PHP_TEST_SHARED_SYSTEM_EXTENSIONS="pcre spl session" \
70 RUN_TESTS_SETTINGS="-q $*"
74 ./run-tests.sh -w failed.log
75 test -f failed.log -a ! -s failed.log
79 rm -rf $RPM_BUILD_ROOT
81 EXTENSION_DIR=%{php_extensiondir} \
82 INSTALL_ROOT=$RPM_BUILD_ROOT
84 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
85 cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini
86 ; Enable %{modname} extension module
87 extension=%{modname}.so
91 rm -rf $RPM_BUILD_ROOT
94 %php_webserver_restart
98 %php_webserver_restart
102 %defattr(644,root,root,755)
103 %doc README.md LICENSE
104 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
105 %attr(755,root,root) %{php_extensiondir}/%{modname}.so