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