]> git.pld-linux.org Git - packages/rpm.git/blob - php-pear-build-macros
- add -z option to unpack tgz before calling pear install for buggy packages like...
[packages/rpm.git] / php-pear-build-macros
1 # vim:syn=spec:ai
2
3 # original macros.php macros
4 %define __php_provides  /usr/lib/rpm/php.prov
5 %define __php_requires  /usr/lib/rpm/php.req
6
7 # pear install macros written by glen@pld-linux.org.
8 # All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
9 #
10 # Usage:
11 #       %%pear_package_setup [-a #] [-n FMT]
12 #
13 # -a #   - unpack SOURCE# instead of SOURCE0
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. use this for buggy packages.
16 #
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.
20 #
21 # additionally BUILDROOT is stripped from files and files are converted to UNIX
22 # line endings.
23 #
24 # the pear install process output is recorded to install.log, you should put it
25 # to %%doc for latter debug or just information.
26 #
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.
31 #
32 %define pear_package_setup(a:n:z) \
33 %setup -q -c -T -n %{-n*}%{!-n:%{_pearname}-%{version}}\
34 D=%{_builddir}/%{-n*}%{!-n:%{_pearname}-%{version}} \
35 %{-z:tar zxf %{S:%{-a*}%{!-a:0}}} \
36 pear \\\
37         -d doc_dir=/docs \\\
38         -d php_dir=%{php_pear_dir} \\\
39         -d bin_dir=%{_bindir} \\\
40         -d data_dir=%{php_pear_dir}/data \\\
41         -d test_dir=%{php_pear_dir}/tests \\\
42         install \\\
43         --installroot=${D} \\\
44         --offline \\\
45         --nodeps \\\
46         %{!-z:%{S:%{-a*}%{!-a:0}}}%{-z:%{_pearname}-%{version}/package.xml} | tee install.log \
47 # make post message of optional packages \
48 grep 'can optionally use' install.log | sed -e 's,package "pear/,package "php-pear-,g;s,^pear/,php-pear-,' > optional-packages.txt \
49 if [ -s optional-packages.txt ]; then \
50         awk -F'"' '/use package/{print $2}' optional-packages.txt | sed -e "s,_,/,g;s,php-pear-, 'pear(,;s,$,.*)'," | tr -d '\\\n' > _noautoreq \
51 else \
52         rm -f optional-packages.txt \
53 fi \
54 rm ./%{php_pear_dir}/.{lock,filemap} \
55 # undos sources \
56 find . -type f -print0 | xargs -0 sed -i -e 's,\\r$,,' \
57 # bug in PEAR --installroot. \
58 # http://pear.php.net/bugs/bug.php?id=5448 \
59 grep -rl "${D}" ./{%{_bindir},%{php_pear_dir}}/* | xargs -r sed -i -e "s,${D},," \
60 %{nil}
61
62
63 # copies exctracted PEAR package structure to buildroot. also copies PEAR
64 # registry file.
65 # please use this macro, for future expansions being possible.
66 %define pear_package_install() \
67 cp -a ./%{php_pear_dir}/{.registry,*} $RPM_BUILD_ROOT%{php_pear_dir} \
68 # help the developer out a little: \
69 if [ -f _noautoreq ]; then \
70         echo "AutoReqdep detected:" \
71         echo "_noautoreq $(cat _noautoreq)" \
72 fi \
73 %{nil}
74
75 # default excludes for PEAR packages.
76 # if you need add something to the list use
77 # %%{expand:%%%%define _noautocompressdoc %%{_noautocompressdoc} otherexcludes} in your specfile.
78
79 # this file displayed in %post
80 %define _noautocompressdoc optional-packages.txt
81
82 # don't provide tests
83 %define _noautoprov 'pear(tests/.*)'
This page took 0.10862 seconds and 4 git commands to generate.