]> git.pld-linux.org Git - packages/rpm.git/blob - php-pear-build-macros
- adjust for including from rpm.spec
[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 #
16 # unpack PEAR package to %%{_builddir}/FMT. package is extracted with already
17 # destination hierarchy. you should copy the tree to buildroot after
18 # patching/reorganizing with %%pear_package_install.
19 #
20 # additionally BUILDROOT is stripped from files and files are converted to UNIX
21 # line endings.
22 #
23 # the pear install process output is recorded to install.log, you should put it
24 # to %%doc for latter debug or just information.
25 #
26 # additionally additional-packages.txt is produced if it was detected that the
27 # package has optional dependencies. the file format is suitable of displaying
28 # in %%post of a package. you should put this file to %%doc. noautocompressdoc is
29 # automatically added for this file.
30 #
31 %define pear_package_setup(a:n:) \
32 %setup -q -c -T -n %{-n*}%{!-n:%{_pearname}-%{version}}\
33 D=%{_builddir}/%{-n*}%{!-n:%{_pearname}-%{version}} \
34 pear \\\
35         -d doc_dir=/docs \\\
36         -d php_dir=%{php_pear_dir} \\\
37         -d bin_dir=%{_bindir} \\\
38         -d data_dir=%{php_pear_dir}/data \\\
39         -d test_dir=%{php_pear_dir}/tests \\\
40         install \\\
41         --installroot=${D} \\\
42         --offline \\\
43         --nodeps \\\
44         %{S:%{-a*}%{!-a:0}} | tee install.log \
45 # make post message of optional packages \
46 grep 'can optionally use package' install.log | sed -e 's,pear/,php-pear-,g' > optional-packages.txt \
47 if [ -s optional-packages.txt ]; then \
48         awk -F'"' '{print $2}' optional-packages.txt | sed -e "s,_,/,g;s,php-pear-, 'pear(,;s,$,.*)'," | tr -d '\\\n' > _noautoreq \
49 else \
50         rm -f optional-packages.txt \
51 fi \
52 rm ./%{php_pear_dir}/.{lock,filemap} \
53 # undos sources \
54 find . -type f -print0 | xargs -0 sed -i -e 's,\\r$,,' \
55 # bug in PEAR --installroot. \
56 # http://pear.php.net/bugs/bug.php?id=5448 \
57 grep -rl "${D}" ./{%{_bindir},%{php_pear_dir}}/* | xargs -r sed -i -e "s,${D},," \
58 %{nil}
59
60
61 # copies exctracted PEAR package structure to buildroot. also copies PEAR
62 # registry file.
63 # please use this macro, for future expansions being possible.
64 %define pear_package_install() \
65 cp -a ./%{php_pear_dir}/{.registry,*} $RPM_BUILD_ROOT%{php_pear_dir} \
66 # help the developer out a little: \
67 if [ -f _noautoreq ]; then \
68         echo "AutoReqdep detected:" \
69         echo "_noautoreq $(cat _noautoreq)" \
70 fi \
71 %{nil}
72
73 # default excludes for PEAR packages.
74 # if you need add something to the list use
75 # %%{expand:%%%%define _noautocompressdoc %%{_noautocompressdoc} otherexcludes} in your specfile.
76
77 # this file displayed in %post
78 %define _noautocompressdoc optional-packages.txt
79
80 # don't provide tests
81 %define _noautoprov 'pear(tests/.*)'
This page took 0.055767 seconds and 4 git commands to generate.