]> git.pld-linux.org Git - packages/php-ast.git/blob - php-ast.spec
i686 requires pcre
[packages/php-ast.git] / php-ast.spec
1 #
2 # Conditional build:
3 %bcond_without  tests           # build without tests
4
5 %define         php_name        php%{?php_suffix}
6 %define         modname ast
7 Summary:        Extension exposing PHP 7 abstract syntax tree
8 Name:           %{php_name}-%{modname}
9 Version:        0.1.1
10 Release:        1
11 License:        BSD
12 Group:          Development/Languages/PHP
13 Source0:        https://github.com/nikic/php-ast/archive/v%{version}/php-%{modname}-%{version}.tar.gz
14 # Source0-md5:  8ea356bd81ed52e838ac1105433c7ab6
15 URL:            https://github.com/nikic/php-ast
16 %{?with_tests:BuildRequires:    %{php_name}-cli}
17 BuildRequires:  %{php_name}-devel >= 4:7.0
18 BuildRequires:  rpmbuild(macros) >= 1.666
19 %if %{with tests}
20 BuildRequires:  %{php_name}-cli
21 BuildRequires:  %{php_name}-pcre
22 BuildRequires:  %{php_name}-spl
23 %endif
24 %{?requires_php_extension}
25 Requires:       %{php_name}-pcre
26 Requires:       %{php_name}-spl
27 Provides:       php(ast) = %{version}
28 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
29
30 %description
31 This extension exposes the abstract syntax tree generated by PHP 7.
32
33 %prep
34 %setup -q -n php-%{modname}-%{version}
35
36 %build
37 phpize
38 %configure
39 %{__make}
40
41 %if %{with tests}
42 # simple module load test
43 %{__php} -n -q \
44         -d extension_dir=modules \
45         -d extension=%{php_extensiondir}/pcre.so \
46         -d extension=%{php_extensiondir}/spl.so \
47         -d extension=%{modname}.so \
48         -m > modules.log
49 grep %{modname} modules.log
50
51 export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
52 %{__make} test \
53         PHP_EXECUTABLE=%{__php} \
54         PHP_TEST_SHARED_SYSTEM_EXTENSIONS="pcre spl" \
55 %endif
56
57 %install
58 rm -rf $RPM_BUILD_ROOT
59 %{__make} install \
60         EXTENSION_DIR=%{php_extensiondir} \
61         INSTALL_ROOT=$RPM_BUILD_ROOT
62
63 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
64 cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini
65 ; Enable %{modname} extension module
66 extension=%{modname}.so
67 EOF
68
69 %clean
70 rm -rf $RPM_BUILD_ROOT
71
72 %post
73 %php_webserver_restart
74
75 %postun
76 if [ "$1" = 0 ]; then
77         %php_webserver_restart
78 fi
79
80 %files
81 %defattr(644,root,root,755)
82 %doc README.md LICENSE
83 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
84 %attr(755,root,root) %{php_extensiondir}/%{modname}.so
This page took 0.15449 seconds and 4 git commands to generate.