]>
Commit | Line | Data |
---|---|---|
fbe30978 ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without tests # build without tests | |
4 | ||
bf17b0aa | 5 | %define php_name php%{?php_suffix} |
fbe30978 ER |
6 | %define modname xhp |
7 | Summary: Inline XML For PHP | |
bf17b0aa | 8 | Name: %{php_name}-%{modname} |
2ca64c80 ER |
9 | Version: 1.5 |
10 | Release: 1 | |
fbe30978 ER |
11 | License: PHP 3.01 |
12 | Group: Development/Languages/PHP | |
bf17b0aa | 13 | Source0: https://github.com/facebook/xhp/archive/%{version}/php-%{modname}-%{version}.tar.gz |
2ca64c80 | 14 | # Source0-md5: b9a552d6cd823a82f2e57037aed42a69 |
1f1f835a | 15 | URL: http://github.com/facebook/xhp/wiki |
6e3d2a79 | 16 | Patch0: optflags.patch |
bf17b0aa | 17 | BuildRequires: %{php_name}-devel >= 4:5.2.0 |
7302cb23 | 18 | %{?with_tests:BuildRequires: /usr/bin/php} |
f04da752 | 19 | # if you use git checkout: |
42231c7a | 20 | #BuildRequires: bison >= 2.3 |
21 | #BuildRequires: flex >= 2.5.35 | |
d6e96913 | 22 | BuildRequires: libstdc++-devel >= 5:4.0 |
7302cb23 | 23 | %{?with_tests:BuildRequires: php-pcre} |
fbe30978 | 24 | BuildRequires: re2c >= 0.13.5 |
586950e0 | 25 | BuildRequires: rpm >= 4.4.9-56 |
bf17b0aa | 26 | BuildRequires: rpmbuild(macros) >= 1.666 |
fbe30978 | 27 | %{?requires_php_extension} |
40ffe404 | 28 | Requires(post,postun): /sbin/ldconfig |
fbe30978 ER |
29 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
30 | ||
31 | %description | |
32 | XHP is a PHP extension which augments the syntax of the language such | |
33 | that XML document fragments become valid PHP expressions. This allows | |
34 | you to use PHP as a stricter templating engine and offers much more | |
35 | straightforward implementation of reusable components. | |
36 | ||
7a55dfb0 ER |
37 | %package devel |
38 | Summary: Header files for xhp | |
39 | Summary(pl.UTF-8): Pliki nagłówkowe biblioteki xhp | |
40 | Group: Development/Libraries | |
41 | Requires: %{name} = %{version}-%{release} | |
42 | Requires: php-devel >= 4:5.2.0 | |
43 | ||
44 | %description devel | |
45 | Header files for xhp. | |
46 | ||
fbe30978 | 47 | %prep |
63bc4ce6 | 48 | %setup -q -n %{modname}-%{version} |
6e3d2a79 | 49 | %patch0 -p1 |
fbe30978 | 50 | |
0ae8397a ER |
51 | # disable failing tests |
52 | mv tests/idx-01.phpt{,.fail} | |
53 | mv tests/trait.phpt{,.fail} | |
54 | ||
fbe30978 | 55 | %build |
1f1f835a ER |
56 | %{__make} -C xhp \ |
57 | libdir=%{_libdir} \ | |
58 | CXX="%{__cxx}" \ | |
c33315ec | 59 | OPTFLAGS="%{rpmcxxflags} -fpermissive" |
1f1f835a | 60 | |
fbe30978 ER |
61 | phpize |
62 | %configure | |
63 | %{__make} \ | |
1f1f835a | 64 | CC="%{__cc}" \ |
fbe30978 | 65 | CXX="%{__cxx}" \ |
c33315ec | 66 | CXXFLAGS="%{rpmcxxflags} -fpermissive" |
fbe30978 | 67 | |
1f1f835a ER |
68 | %if %{with tests} |
69 | cat <<'EOF' > run-tests.sh | |
70 | #!/bin/sh | |
71 | export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2 | |
72 | unset TZ LANG LC_ALL || : | |
73 | %{__make} test \ | |
74 | RUN_TESTS_SETTINGS="-q $*" | |
75 | EOF | |
76 | chmod +x run-tests.sh | |
77 | ./run-tests.sh -w failed.log -s test.log | |
0ae8397a | 78 | test ! -s failed.log |
1f1f835a | 79 | %endif |
fbe30978 ER |
80 | |
81 | %install | |
82 | rm -rf $RPM_BUILD_ROOT | |
fbe30978 | 83 | %{__make} install \ |
1f1f835a ER |
84 | EXTENSION_DIR=%{php_extensiondir} \ |
85 | INSTALL_ROOT=$RPM_BUILD_ROOT | |
86 | ||
87 | install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d | |
fbe30978 ER |
88 | cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini |
89 | ; Enable %{modname} extension module | |
90 | extension=%{modname}.so | |
91 | EOF | |
92 | ||
4c4f9a10 ER |
93 | install -d $RPM_BUILD_ROOT%{php_data_dir}/xhp |
94 | cp -a php-lib/* $RPM_BUILD_ROOT%{php_data_dir}/xhp | |
40ffe404 | 95 | install -p xhp/libxhp.so $RPM_BUILD_ROOT%{_libdir} |
4c4f9a10 | 96 | |
3dd4785f ER |
97 | # files used by hiphop-php |
98 | install -d $RPM_BUILD_ROOT{%{_libdir},%{_includedir}} | |
44edbd7e | 99 | cp -p xhp/libxhp.a $RPM_BUILD_ROOT%{_libdir} |
3dd4785f | 100 | cp -p xhp/xhp_preprocess.hpp $RPM_BUILD_ROOT%{_includedir} |
35491a30 | 101 | |
fbe30978 ER |
102 | %clean |
103 | rm -rf $RPM_BUILD_ROOT | |
104 | ||
40ffe404 | 105 | |
fbe30978 | 106 | %post |
40ffe404 | 107 | /sbin/ldconfig |
fbe30978 ER |
108 | %php_webserver_restart |
109 | ||
110 | %postun | |
40ffe404 | 111 | /sbin/ldconfig |
fbe30978 ER |
112 | if [ "$1" = 0 ]; then |
113 | %php_webserver_restart | |
114 | fi | |
115 | ||
116 | %files | |
117 | %defattr(644,root,root,755) | |
bf17b0aa | 118 | %doc README.textile INSTALL |
fbe30978 ER |
119 | %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini |
120 | %attr(755,root,root) %{php_extensiondir}/%{modname}.so | |
40ffe404 | 121 | %{_libdir}/libxhp.so |
4c4f9a10 | 122 | %{php_data_dir}/xhp |
7a55dfb0 ER |
123 | |
124 | %files devel | |
125 | %defattr(644,root,root,755) | |
3dd4785f | 126 | %{_includedir}/xhp_preprocess.hpp |
44edbd7e | 127 | %{_libdir}/libxhp.a |