]> git.pld-linux.org Git - packages/rpm.git/blobdiff - php-pear-build-macros
- fix prep failures
[packages/rpm.git] / php-pear-build-macros
index 318bf5c84de2ae0964abeb25d17d741569683cc0..7e508a5034b9b74077bb4328fb5b2eac52d27858 100644 (file)
@@ -1,8 +1,39 @@
 # vim:syn=spec:ai
 
-%define        pear_package_setup(a:) \
-%setup -q -c -T\
-D=%{_builddir}/%{name}-%{version} \
+# original macros.php macros
+%define        __php_provides  /usr/lib/rpm/php.prov
+%define        __php_requires  /usr/lib/rpm/php.req
+
+# pear install macros written by glen@pld-linux.org.
+# All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
+#
+# Usage:
+#      %%pear_package_setup [-a #] [-n FMT]
+#
+# -a #   - unpack SOURCE# instead of SOURCE0
+# -n FMT - create builddir with FMT, instead of default %%{_pearname}-%%{version}
+# -z     - unpack pear package and let pear use package.xml (not tarball) for install. use this for buggy packages.
+# -f     - force pear install. use with care.
+#
+# unpack PEAR package to %%{_builddir}/FMT. package is extracted with already
+# destination hierarchy. you should copy the tree to buildroot after
+# patching/reorganizing with %%pear_package_install.
+#
+# additionally BUILDROOT is stripped from files and files are converted to UNIX
+# line endings.
+#
+# the pear install process output is recorded to install.log, you should put it
+# to %%doc for latter debug or just information.
+#
+# additionally additional-packages.txt is produced if it was detected that the
+# package has optional dependencies. the file format is suitable of displaying
+# in %%post of a package. you should put this file to %%doc. noautocompressdoc is
+# automatically added for this file.
+#
+%define pear_package_setup(a:n:zf) \
+%setup -q -c -T -n %{-n*}%{!-n:%{_pearname}-%{version}}\
+D=%{_builddir}/%{-n*}%{!-n:%{_pearname}-%{version}} \
+%{-z:tar zxf %{S:%{-a*}%{!-a:0}}; P=%{_pearname}-%{version}/package.xml; [ -f $P ] || P=package.xml} \
 pear \\\
        -d doc_dir=/docs \\\
        -d php_dir=%{php_pear_dir} \\\
@@ -13,11 +44,12 @@ pear \\\
        --installroot=${D} \\\
        --offline \\\
        --nodeps \\\
-       %{S:%{-a*}%{!-a:0}} | tee install.log \
+       %{-f:--force} \\\
+       %{!-z:%{S:%{-a*}%{!-a:0}}}%{-z:$P} | tee install.log \
 # make post message of optional packages \
-grep 'can optionally use package' install.log | sed -e 's,pear/,php-pear-,g' > optional-packages.txt \
+grep 'can optionally use' install.log | sed -e 's,package "pear/,package "php-pear-,g;s,^pear/,php-pear-,' > optional-packages.txt \
 if [ -s optional-packages.txt ]; then \
-       awk -F'"' '{print $2}' optional-packages.txt | sed -e "s,_,/,g;s,php-pear-, 'pear(,;s,$,.*)'," | tr -d '\\\n' > _noautoreq \
+       awk -F'"' '/use package/{print $2}' optional-packages.txt | sed -e "s,_,/,g;s,php-pear-, 'pear(,;s,$,.*)'," | tr -d '\\\n' > _noautoreq \
 else \
        rm -f optional-packages.txt \
 fi \
@@ -29,9 +61,13 @@ find . -type f -print0 | xargs -0 sed -i -e 's,\\r$,,' \
 grep -rl "${D}" ./{%{_bindir},%{php_pear_dir}}/* | xargs -r sed -i -e "s,${D},," \
 %{nil}
 
-%define        pear_package_install() \
+
+# copies exctracted PEAR package structure to buildroot. also copies PEAR
+# registry file.
+# please use this macro, for future expansions being possible.
+%define pear_package_install() \
 cp -a ./%{php_pear_dir}/{.registry,*} $RPM_BUILD_ROOT%{php_pear_dir} \
+find $RPM_BUILD_ROOT%{php_pear_dir} '(' -name '*~' -o -name '*.orig' ')' | xargs -r rm -v \
 # help the developer out a little: \
 if [ -f _noautoreq ]; then \
        echo "AutoReqdep detected:" \
@@ -39,8 +75,12 @@ if [ -f _noautoreq ]; then \
 fi \
 %{nil}
 
-# displayed in post
+# default excludes for PEAR packages.
+# if you need add something to the list use
+# %%{expand:%%%%define _noautocompressdoc %%{_noautocompressdoc} otherexcludes} in your specfile.
+
+# this file displayed in %post
 %define _noautocompressdoc optional-packages.txt
 
 # don't provide tests
-%define        _noautoprov 'pear(tests/.*)'
+%define _noautoprov 'pear(tests/.*)'
This page took 0.050062 seconds and 4 git commands to generate.