]>
Commit | Line | Data |
---|---|---|
41f876e5 ER |
1 | # vim:syn=spec:ai |
2 | ||
a3043860 ER |
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 | |
58da3b17 | 10 | # -n FMT - create builddir with FMT, instead of default %%{_pearname}-%%{version} |
a3043860 ER |
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 | # | |
5f67de6c | 27 | %pear_package_setup(a:n:) \ |
58da3b17 ER |
28 | %setup -q -c -T -n %{-n*}%{!-n:%{_pearname}-%{version}}\ |
29 | D=%{_builddir}/%{-n*}%{!-n:%{_pearname}-%{version}} \ | |
87e862a2 | 30 | pear \\\ |
41f876e5 | 31 | -d doc_dir=/docs \\\ |
87e862a2 ER |
32 | -d php_dir=%{php_pear_dir} \\\ |
33 | -d bin_dir=%{_bindir} \\\ | |
41f876e5 | 34 | -d data_dir=%{php_pear_dir}/data \\\ |
87e862a2 | 35 | -d test_dir=%{php_pear_dir}/tests \\\ |
41f876e5 ER |
36 | install \\\ |
37 | --installroot=${D} \\\ | |
38 | --offline \\\ | |
39 | --nodeps \\\ | |
203e6ddd ER |
40 | %{S:%{-a*}%{!-a:0}} | tee install.log \ |
41 | # make post message of optional packages \ | |
ea5a95d2 | 42 | grep 'can optionally use package' install.log | sed -e 's,pear/,php-pear-,g' > optional-packages.txt \ |
bd91fbc8 | 43 | if [ -s optional-packages.txt ]; then \ |
73d67802 | 44 | awk -F'"' '{print $2}' optional-packages.txt | sed -e "s,_,/,g;s,php-pear-, 'pear(,;s,$,.*)'," | tr -d '\\\n' > _noautoreq \ |
bd91fbc8 ER |
45 | else \ |
46 | rm -f optional-packages.txt \ | |
47 | fi \ | |
41f876e5 ER |
48 | rm ./%{php_pear_dir}/.{lock,filemap} \ |
49 | # undos sources \ | |
50 | find . -type f -print0 | xargs -0 sed -i -e 's,\\r$,,' \ | |
87e862a2 | 51 | # bug in PEAR --installroot. \ |
dca16be0 | 52 | # http://pear.php.net/bugs/bug.php?id=5448 \ |
41f876e5 ER |
53 | grep -rl "${D}" ./{%{_bindir},%{php_pear_dir}}/* | xargs -r sed -i -e "s,${D},," \ |
54 | %{nil} | |
55 | ||
a3043860 ER |
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. | |
5f67de6c | 60 | %pear_package_install() \ |
41f876e5 | 61 | cp -a ./%{php_pear_dir}/{.registry,*} $RPM_BUILD_ROOT%{php_pear_dir} \ |
bd91fbc8 ER |
62 | # help the developer out a little: \ |
63 | if [ -f _noautoreq ]; then \ | |
64 | echo "AutoReqdep detected:" \ | |
65 | echo "_noautoreq $(cat _noautoreq)" \ | |
66 | fi \ | |
41f876e5 | 67 | %{nil} |
ea5a95d2 | 68 | |
a3043860 ER |
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 | |
5f67de6c | 74 | %_noautocompressdoc optional-packages.txt |
087edc3b ER |
75 | |
76 | # don't provide tests | |
5f67de6c | 77 | %_noautoprov 'pear(tests/.*)' |