]>
Commit | Line | Data |
---|---|---|
41f876e5 ER |
1 | # vim:syn=spec:ai |
2 | ||
b32dfcf9 ER |
3 | # original macros.php macros |
4 | %define __php_provides /usr/lib/rpm/php.prov | |
5 | %define __php_requires /usr/lib/rpm/php.req | |
6 | ||
a3043860 ER |
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 | # | |
03c3bc0b | 13 | # -a # - also unpack SOURCE#. for PEAR bootstrapping |
58da3b17 | 14 | # -n FMT - create builddir with FMT, instead of default %%{_pearname}-%%{version} |
03c3bc0b | 15 | # -z - unpack pear package and let pear use package.xml (not tarball) for install. for PEAR bootstrapping |
a3043860 ER |
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. | |
03c3bc0b ER |
31 | |
32 | ||
33 | # records install.log and transforms PEAR names to PLD Linux rpm package names. | |
34 | %define __pear_install_log \ | |
35 | tee install.log \ | |
36 | # make post message of optional packages \ | |
37 | grep 'can optionally use' install.log | sed -e 's,package "pear/,package "php-pear-,g;s,^pear/,php-pear-,' > optional-packages.txt \ | |
38 | if [ -s optional-packages.txt ]; then \ | |
39 | awk -F'"' '/use package/{print $2}' optional-packages.txt | sed -e "s,_,/,g;s,php-pear-, 'pear(,;s,$,.*)'," | tr -d '\\\n' > _noautoreq \ | |
40 | else \ | |
41 | rm -f optional-packages.txt \ | |
42 | fi \ | |
43 | # undos sources \ | |
44 | find . -type f -print0 | xargs -0 sed -i -e 's,\\r$,,' \ | |
45 | ||
46 | # command invoking pear cli | |
47 | %define __pear /usr/bin/pear | |
48 | ||
49 | # the main macro. | |
50 | # using this macro will append optional-packages.txt to the nocompressdoc list | |
51 | # as it's displayed to user after package install. and adding additional gzip | |
52 | # dep is just waste ;) | |
53 | %define pear_package_setup(a:n:z) \ | |
58da3b17 | 54 | %setup -q -c -T -n %{-n*}%{!-n:%{_pearname}-%{version}}\ |
03c3bc0b ER |
55 | _D=%{_builddir}/%{-n*}%{!-n:%{_pearname}-%{version}} \ |
56 | %{-z:tar zxf %{S:0}; %{-a:tar zxf %{S:%{-a*}};} _P=package2.xml; [ -f $_P ] || _P=package.xml; _N=%{!-n:%{_pearname}-%{version}}; mv $_P $_N; cd $_N} \ | |
57 | install -d ./%{php_pear_dir} \ | |
58 | %__pear \\\ | |
59 | -c pearrc \\\ | |
41f876e5 | 60 | -d doc_dir=/docs \\\ |
87e862a2 ER |
61 | -d php_dir=%{php_pear_dir} \\\ |
62 | -d bin_dir=%{_bindir} \\\ | |
41f876e5 | 63 | -d data_dir=%{php_pear_dir}/data \\\ |
87e862a2 | 64 | -d test_dir=%{php_pear_dir}/tests \\\ |
41f876e5 | 65 | install \\\ |
03c3bc0b | 66 | --packagingroot=${_D} \\\ |
41f876e5 ER |
67 | --offline \\\ |
68 | --nodeps \\\ | |
81e7bee9 | 69 | %{-f:--force} \\\ |
03c3bc0b ER |
70 | %{!-z:%{S:%{-a*}%{!-a:0}}}%{-z:$_P} > .install.log || { c=$?; cat .install.log; exit $c; } \ |
71 | %{-z:cd ..} \ | |
72 | cat %{-z:$_N/}.install.log | %__pear_install_log \ | |
03c3bc0b ER |
73 | %{!?_noautocompressdoc:%global _noautocompressdoc %{nil}}%{expand:%%global _noautocompressdoc %{_noautocompressdoc} optional-packages.txt} \ |
74 | %{!?_noautoprov:%global _noautoprov %{nil}}%{expand:%%global _noautoprov %{_noautoprov} 'pear(tests/.*)'} \ | |
41f876e5 ER |
75 | %{nil} |
76 | ||
03c3bc0b ER |
77 | # copies exctracted PEAR package structure to buildroot. |
78 | # also copies PEAR registry file. | |
79 | # please use this macro, for future extensions being possible. | |
b32dfcf9 | 80 | %define pear_package_install() \ |
41f876e5 | 81 | cp -a ./%{php_pear_dir}/{.registry,*} $RPM_BUILD_ROOT%{php_pear_dir} \ |
4c0d9db9 | 82 | find $RPM_BUILD_ROOT%{php_pear_dir} '(' -name '*~' -o -name '*.orig' ')' | xargs -r rm -v \ |
bd91fbc8 ER |
83 | # help the developer out a little: \ |
84 | if [ -f _noautoreq ]; then \ | |
85 | echo "AutoReqdep detected:" \ | |
86 | echo "_noautoreq $(cat _noautoreq)" \ | |
87 | fi \ | |
41f876e5 | 88 | %{nil} |