]> git.pld-linux.org Git - packages/rpm.git/blob - php-pear-build-macros
- partial merge from HEAD
[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 #   - also unpack SOURCE#. for PEAR bootstrapping
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. for PEAR bootstrapping
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.
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) \
54 %setup -q -c -T -n %{-n*}%{!-n:%{_pearname}-%{version}}\
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 \\\
60         -d doc_dir=/docs \\\
61         -d php_dir=%{php_pear_dir} \\\
62         -d bin_dir=%{_bindir} \\\
63         -d data_dir=%{php_pear_dir}/data \\\
64         -d test_dir=%{php_pear_dir}/tests \\\
65         install \\\
66         --packagingroot=${_D} \\\
67         --offline \\\
68         --nodeps \\\
69         %{-f:--force} \\\
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 \
73 %{!?_noautocompressdoc:%global _noautocompressdoc %{nil}}%{expand:%%global _noautocompressdoc %{_noautocompressdoc} optional-packages.txt} \
74 %{!?_noautoprov:%global _noautoprov %{nil}}%{expand:%%global _noautoprov %{_noautoprov} 'pear(tests/.*)'} \
75 %{nil}
76
77 # copies exctracted PEAR package structure to buildroot.
78 # also copies PEAR registry file.
79 # please use this macro, for future extensions being possible.
80 %define pear_package_install() \
81 cp -a ./%{php_pear_dir}/{.registry,*} $RPM_BUILD_ROOT%{php_pear_dir} \
82 find $RPM_BUILD_ROOT%{php_pear_dir} '(' -name '*~' -o -name '*.orig' ')' | xargs -r rm -v \
83 # help the developer out a little: \
84 if [ -f _noautoreq ]; then \
85         echo "AutoReqdep detected:" \
86         echo "_noautoreq $(cat _noautoreq)" \
87 fi \
88 %{nil}
This page took 0.031004 seconds and 3 git commands to generate.