3 # original macros.php macros
4 %define __php_provides /usr/lib/rpm/php.prov
5 %define __php_requires /usr/lib/rpm/php.req
7 # pear install macros written by glen@pld-linux.org.
8 # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
11 # %%pear_package_setup [-a #] [-n FMT]
13 # -a # - also unpack SOURCE#. for PEAR bootstrapping
14 # -n FMT - create builddir with FMT, instead of default %%{_pearname}-%%{version}
15 # -z - unpack pear package and let pear use package.xml (not tarball) for install. for PEAR bootstrapping
17 # unpack PEAR package to %%{_builddir}/FMT. package is extracted with already
18 # destination hierarchy. you should copy the tree to buildroot after
19 # patching/reorganizing with %%pear_package_install.
21 # additionally BUILDROOT is stripped from files and files are converted to UNIX
24 # the pear install process output is recorded to install.log, you should put it
25 # to %%doc for latter debug or just information.
27 # additionally additional-packages.txt is produced if it was detected that the
28 # package has optional dependencies. the file format is suitable of displaying
29 # in %%post of a package. you should put this file to %%doc. noautocompressdoc is
30 # automatically added for this file.
33 # records install.log and transforms PEAR names to PLD Linux rpm package names.
34 %define __pear_install_log \
36 # make post message of optional packages \
37 grep 'can optionally use' install.log | sed -e 's,package "pear/,package "php-pear-,g;s,^pear/,php-pear-,' > optional-packages.txt \
38 if [ -s optional-packages.txt ]; then \
39 awk -F'"' '/use package/{print $2}' optional-packages.txt | sed -e "s,_,/,g;s,php-pear-, 'pear(,;s,$,.*)'," | tr -d '\\\n' > _noautoreq \
41 rm -f optional-packages.txt \
44 find . -type f -print0 | xargs -0 sed -i -e 's,\\r$,,' \
46 # command invoking pear cli
47 %define __pear /usr/bin/pear
50 # using this macro will append optional-packages.txt to the nocompressdoc list
51 # as it's displayed to user after package install. and adding additional gzip
52 # dep is just waste ;)
53 %define pear_package_setup(a:n:z) \
54 %setup -q -c -T -n %{-n*}%{!-n:%{_pearname}-%{version}}\
55 _D=%{_builddir}/%{-n*}%{!-n:%{_pearname}-%{version}} \
56 %{-z:tar zxf %{S:0}; %{-a:tar zxf %{S:%{-a*}};} _P=package2.xml; [ -f $_P ] || _P=package.xml; _N=%{!-n:%{_pearname}-%{version}}; mv $_P $_N; cd $_N} \
57 install -d ./%{php_pear_dir} \
61 -d php_dir=%{php_pear_dir} \\\
62 -d bin_dir=%{_bindir} \\\
63 -d data_dir=%{php_pear_dir}/data \\\
64 -d test_dir=%{php_pear_dir}/tests \\\
66 --packagingroot=${_D} \\\
70 %{!-z:%{S:%{-a*}%{!-a:0}}}%{-z:$_P} > .install.log || { c=$?; cat .install.log; exit $c; } \
72 cat %{-z:$_N/}.install.log | %__pear_install_log \
73 %{!?_noautocompressdoc:%global _noautocompressdoc %{nil}}%{expand:%%global _noautocompressdoc %{_noautocompressdoc} optional-packages.txt} \
74 %{!?_noautoprov:%global _noautoprov %{nil}}%{expand:%%global _noautoprov %{_noautoprov} 'pear(tests/.*)'} \
77 # copies exctracted PEAR package structure to buildroot.
78 # also copies PEAR registry file.
79 # please use this macro, for future extensions being possible.
80 %define pear_package_install() \
81 cp -a ./%{php_pear_dir}/{.registry,*} $RPM_BUILD_ROOT%{php_pear_dir} \
82 find $RPM_BUILD_ROOT%{php_pear_dir} '(' -name '*~' -o -name '*.orig' ')' | xargs -r rm -v \
83 # help the developer out a little: \
84 if [ -f _noautoreq ]; then \
85 echo "AutoReqdep detected:" \
86 echo "_noautoreq $(cat _noautoreq)" \