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