]> git.pld-linux.org Git - packages/php-xhp.git/blob - php-xhp.spec
8d884c889ce3348d86bbe615a7334fab55a262d1
[packages/php-xhp.git] / php-xhp.spec
1 #
2 # Conditional build:
3 %bcond_without  tests           # build without tests
4
5 %if "%{pld_release}" == "ac"
6 # add suffix, but allow ccache, etc in ~/.rpmmacros
7 %{expand:%%define       __cc    %(echo '%__cc' | sed -e 's,-gcc,-gcc4,')}
8 %{expand:%%define       __cxx   %(echo '%__cxx' | sed -e 's,-g++,-g++4,')}
9 %{expand:%%define       __cpp   %(echo '%__cpp' | sed -e 's,-gcc,-gcc4,')}
10 %endif
11
12 %define         php_name        php%{?php_suffix}
13 %define         modname xhp
14 Summary:        Inline XML For PHP
15 Name:           %{php_name}-%{modname}
16 Version:        1.4
17 Release:        2
18 License:        PHP 3.01
19 Group:          Development/Languages/PHP
20 Source0:        https://github.com/facebook/xhp/archive/%{version}/php-%{modname}-%{version}.tar.gz
21 # Source0-md5:  98d56ee6b5bc22f76be4106a224c5875
22 URL:            http://github.com/facebook/xhp/wiki
23 Patch0:         optflags.patch
24 BuildRequires:  %{php_name}-devel >= 4:5.2.0
25 %{?with_tests:BuildRequires:    /usr/bin/php}
26 # if you use git checkout:
27 #BuildRequires: bison >= 2.3
28 #BuildRequires: flex >= 2.5.35
29 BuildRequires:  libstdc++-devel >= 5:4.0
30 %{?with_tests:BuildRequires:    php-pcre}
31 BuildRequires:  re2c >= 0.13.5
32 BuildRequires:  rpm >= 4.4.9-56
33 BuildRequires:  rpmbuild(macros) >= 1.666
34 %{?requires_php_extension}
35 # gcc4 might be installed, but not current __cc
36 %if "%(echo %{cc_version} | cut -d. -f1,2)" < "4.0"
37 BuildRequires:  __cc >= 4.0
38 %endif
39 Requires(post,postun):  /sbin/ldconfig
40 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
41
42 %description
43 XHP is a PHP extension which augments the syntax of the language such
44 that XML document fragments become valid PHP expressions. This allows
45 you to use PHP as a stricter templating engine and offers much more
46 straightforward implementation of reusable components.
47
48 %package devel
49 Summary:        Header files for xhp
50 Summary(pl.UTF-8):      Pliki nagłówkowe biblioteki xhp
51 Group:          Development/Libraries
52 Requires:       %{name} = %{version}-%{release}
53 Requires:       php-devel >= 4:5.2.0
54
55 %description devel
56 Header files for xhp.
57
58 %prep
59 %setup -q -n %{modname}-%{version}
60 %patch0 -p1
61
62 # disable failing tests
63 mv tests/idx-01.phpt{,.fail}
64 mv tests/trait.phpt{,.fail}
65
66 %ifarch alpha sparc ppc
67 %{__sed} -i -e 's/-minline-all-stringops//' xhp/Makefile
68 %endif
69
70 %build
71 %{__make} -C xhp \
72         libdir=%{_libdir} \
73         CXX="%{__cxx}" \
74         OPTFLAGS="%{rpmcxxflags} -fpermissive"
75
76 phpize
77 %configure
78 %{__make} \
79         CC="%{__cc}" \
80         CXX="%{__cxx}" \
81         CXXFLAGS="%{rpmcxxflags} -fpermissive"
82
83 %if %{with tests}
84 cat <<'EOF' > run-tests.sh
85 #!/bin/sh
86 export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
87 unset TZ LANG LC_ALL || :
88 %{__make} test \
89         RUN_TESTS_SETTINGS="-q $*"
90 EOF
91 chmod +x run-tests.sh
92 ./run-tests.sh -w failed.log -s test.log
93 test ! -s failed.log
94 %endif
95
96 %install
97 rm -rf $RPM_BUILD_ROOT
98 %{__make} install \
99         EXTENSION_DIR=%{php_extensiondir} \
100         INSTALL_ROOT=$RPM_BUILD_ROOT
101
102 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
103 cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini
104 ; Enable %{modname} extension module
105 extension=%{modname}.so
106 EOF
107
108 install -d $RPM_BUILD_ROOT%{php_data_dir}/xhp
109 cp -a php-lib/* $RPM_BUILD_ROOT%{php_data_dir}/xhp
110 install -p xhp/libxhp.so $RPM_BUILD_ROOT%{_libdir}
111
112 # files used by hiphop-php
113 install -d $RPM_BUILD_ROOT{%{_libdir},%{_includedir}}
114 cp -p xhp/libxhp.a $RPM_BUILD_ROOT%{_libdir}
115 cp -p xhp/xhp_preprocess.hpp $RPM_BUILD_ROOT%{_includedir}
116
117 %clean
118 rm -rf $RPM_BUILD_ROOT
119
120
121 %post
122 /sbin/ldconfig
123 %php_webserver_restart
124
125 %postun
126 /sbin/ldconfig
127 if [ "$1" = 0 ]; then
128         %php_webserver_restart
129 fi
130
131 %files
132 %defattr(644,root,root,755)
133 %doc README.textile INSTALL
134 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
135 %attr(755,root,root) %{php_extensiondir}/%{modname}.so
136 %{_libdir}/libxhp.so
137 %{php_data_dir}/xhp
138
139 %files devel
140 %defattr(644,root,root,755)
141 %{_includedir}/xhp_preprocess.hpp
142 %{_libdir}/libxhp.a
This page took 0.05637 seconds and 2 git commands to generate.