]> git.pld-linux.org Git - packages/rpm-build-macros.git/blobdiff - rpm.macros
- no umask for scrollkeeper-update
[packages/rpm-build-macros.git] / rpm.macros
index 78fefa3c478547f287bc0dc819bc16733487d24b..ddef34f0436ed4af8cf6b31f3fd36d57c82ffa7f 100644 (file)
 
 # Build system path macros.
 #
-%__libtoolize           libtoolize --copy --force
+%__autoconf                    autoconf %{?debug:-Wall}
+%__automake                    automake -a -c -f --foreign
+%__autopoint           autopoint --force
+
 %__gettextize { \
     if ! gettextize --version | grep -q '0\.10\.' ; then \
        if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \
        gettextize --copy --force; \
     fi; \
 }
-%__autopoint            autopoint --force
-%__automake             automake -a -c -f --foreign
-%__autoconf             autoconf %{?debug:-Wall}
+
+%__glib_gettextize     glib-gettextize --copy --force
+%__gnome_doc_common    gnome-doc-common --copy
+%__gtkdocize           gtkdocize --copy
+%__intltoolize         intltoolize --copy --force
+%__libtoolize          libtoolize --copy --force
 
 %dependencytracking    %{nil}
 #-----------------------------------------------------------------
 LANG=C\
 export LANG\
 unset DISPLAY ||:\
+unset LINGUAS ||:\
 %{nil}
 
 %build %%build\
 LANG=C\
 export LANG\
 unset DISPLAY ||:\
+unset LINGUAS ||:\
 %{nil}
 
 %install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\
@@ -125,6 +133,7 @@ unset DISPLAY ||:\
 LANG=C\
 export LANG\
 unset DISPLAY ||:\
+unset LINGUAS ||:\
 %{nil}
 
 # ------------------------------------------------------------------------
@@ -229,8 +238,7 @@ unset DISPLAY ||:\
 %apache_modules_api %(awk '/#define MODULE_MAGIC_NUMBER_MAJOR/ {print $3}' /usr/include/apache/ap_mmn.h 2>/dev/null || echo ERROR)
 
 # kernel version-release handling
-%__kernel_rel    %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h --queryformat "%{VERSION}" | grep -v "is not")
-#__kernel_ver    %([ -f %{_kernelsrcdir}/include/linux/version.h ] && (grep UTS_RELEASE %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | head -n 1 | cut -d'"' -f2) || (awk '/^VERSION/ { ver = $0; gsub(/VERSION.*=/, NIL, ver); } /^PATCHLEVEL/ { plev = $0; gsub(/PATCHLEVEL.*=/, NIL, plev); } /^SUBLEVEL/ { slev = $0; gsub(/SUBLEVEL.*=/, NIL, slev); } /^EXTRAVERSION/ { ever = $0; gsub(/EXTRAVERSION.*=/, NIL, ever); gsub(/ /, NIL, ever); } END { printf("%d.%d.%d%s", ver, plev, slev, ever); }' %{_kernelsrcdir}/Makefile 2> /dev/null))
+%__kernel_ver    %([ -f %{_kernelsrcdir}/include/linux/version.h ] && (grep UTS_RELEASE %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | head -n 1 | cut -d'"' -f2) || (awk '/^VERSION/ { ver = $0; gsub(/VERSION.*=/, NIL, ver); } /^PATCHLEVEL/ { plev = $0; gsub(/PATCHLEVEL.*=/, NIL, plev); } /^SUBLEVEL/ { slev = $0; gsub(/SUBLEVEL.*=/, NIL, slev); } /^EXTRAVERSION/ { ever = $0; gsub(/EXTRAVERSION.*=/, NIL, ever); gsub(/ /, NIL, ever); } END { printf("%d.%d.%d%s", ver, plev, slev, ever); }' %{_kernelsrcdir}/Makefile 2> /dev/null))
 %__kernel_rel    %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h --queryformat "%{RELEASE}" | grep -v "is not")
 %__kernel_rpmvr  %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h --queryformat "%{VERSION}-%{RELEASE}" | grep -v "is not")
 %_kernel_ver     %{__kernel_ver}%{?with_dist_kernel:%(echo %{__kernel_ver} | grep -q -e - || echo -%{__kernel_rel})}
@@ -313,7 +321,7 @@ unset DISPLAY ||:\
        %{?verbose:set -x;} \
 if [ -d "$RPM_BUILD_ROOT" ]; then \
 echo "Remove RPATH from executable binaries and shared object files."; \
-find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" %{?_noautochrpath:! -regex "%{_noautochrpath}"} | xargs -r file | \
+find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*" %{?_noautochrpath:! -regex "%{_noautochrpath}"} | xargs -r file | \
        awk '/ELF.*(executable.*dynamically linked|shared object)/ {print $1}' | cut -d: -f1 | \
 while read file ; do \
        rpath= ; \
@@ -359,15 +367,64 @@ echo "Compress kernel modules if any."; \
 %_binary_payload        w9.bzdio
 
 #-----------------------------------------------------------------
-# Update all GConf2 schemas
+# Update GConf2 schemas
 #
 # Requires: GConf2
 #
-%gconf_schema_install { umask 022; \
-    GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" \
-    /usr/bin/gconftool-2 --makefile-install-rule \
-    /etc/gconf/schemas/*.schemas > /dev/null \
-}
+%gconf_schema_install() \
+    umask 022; \
+    GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" /usr/bin/gconftool-2 --makefile-install-rule /etc/gconf/schemas/%{?1}%{!?1:*.schemas} > /dev/null \
+    %{nil}
+
+%gconf_schema_uninstall() \
+if [ $1 = 0 ]; then \
+    umask 022; \
+    GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" /usr/bin/gconftool-2 --makefile-uninstall-rule /etc/gconf/schemas/%{?1} > /dev/null \
+fi \
+%{nil}
+
+#-----------------------------------------------------------------
+# Update desktop MIME database
+# requries: desktop-file-utils
+#
+%update_desktop_database_post() \
+       umask 022; \
+       /usr/bin/update-desktop-database; \
+       %{nil}
+
+%update_desktop_database_postun() \
+if [ $1 = 0 ]; then \
+       umask 022; \
+       /usr/bin/update-desktop-database; \
+fi \
+%{nil}
+
+#-----------------------------------------------------------------
+# Update scrollkeeper database
+# requires: scrollkeeper
+#
+%scrollkeeper_update_post() \
+       /usr/bin/scrollkeeper-update -q; \
+       %{nil}
+
+%scrollkeeper_update_postun() \
+if [ $1 = 0 ]; then \
+       /usr/bin/scrollkeeper-update -q; \
+fi \
+%{nil}
+
+#-----------------------------------------------------------------
+# Run ldconfig after installing/deinstalling libraries
+#
+%ldconfig_post() \
+       /sbin/ldconfig; \
+       %{nil}
+
+%ldconfig_postun() \
+if [ $1 = 0 ]; then \
+       /sbin/ldconfig; \
+fi \
+%{nil}
 
 #-----------------------------------------------------------------
 # post %install sequence:
@@ -428,7 +485,28 @@ echo "Compress kernel modules if any."; \
 %py_ocomp       python -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
 
 # Software written in Python language require Python with main version
-%pyrequires_eq() Requires:     python(bytecode) = %py_ver %1
+%pyrequires_eq() Requires:     %1
+
+
+# Hardlink binary identical .pyc and .pyo files
+# (idea by glen <at> pld-linux <dot> org)
+%__spec_install_post_py_hardlink {\
+%{!?no_install_post_py_hardlink: \
+[ ! -d "$RPM_BUILD_ROOT" ] || find "$RPM_BUILD_ROOT" -name '*.pyc' | while read a; do \
+       b="$(echo $a|sed -e 's/.pyc$/.pyo/')"; \
+       if cmp -s "$a" "$b"; then \
+               ln -f "$a" "$b"; \
+       fi; \
+done \
+} }
+
+# remove python sources, so that check-files won't complain                                                                
+# (idea by glen <at> pld-linux <dot> org)
+%py_postclean() \
+for d in %{py_sitescriptdir} %{py_sitedir}; do \
+ [ ! -d "$RPM_BUILD_ROOT$d" ] || find "$RPM_BUILD_ROOT$d" -name '*.py' -exec rm {} \; ;\
+done \
+%{nil}
 
 # depmod macro
 %depmod() { \
@@ -486,22 +564,25 @@ fi; \
 # banner support (useful in {pre,post}{,un} and triggers)
 #
 # Usage:
-#      %banner name [-a] [-e] [-n] [-tn]
+#      %banner name [-a] [-e] [-n] [-tn] <<EOF
 # the banner text, the banner text
-# the banner text, and following line HAVE TO BE:
-# EOF
+# the banner text, and following line
+#EOF
+# You can use any form of here-document, <<'EOF' <<-EOT will do.
+# NOTE: if your use "<<-EOF", then You can actually indent inside here-document.
+#
 # -a   - append to the banner
 # -e   - send to stderr instead of stdout
 # -n   - no show banner (overrides -t)
 # -t   - show only, if RPM_SCRIPTVERBOSITY >= n; default n=5
-%banner(a:e:n:t:)      \
+%banner(aent:) \
 RPM_SCRIPTVERBOSITY=5 \
 [ -r /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm \
 if [ -x /usr/bin/banner.sh ]; then \
-       CMD="/usr/bin/banner.sh %{-e:--stderr} %{!-n:\`[ $RPM_SCRIPTVERBOSITY -ge %{-t:%{-t*}}%{!-t:5} ] && echo '-s'\`} %{!-a:-m}%{-a:-M} %1" \
+       CMD="/usr/bin/banner.sh %{-e:--stderr} %{!-n:$([ $RPM_SCRIPTVERBOSITY -ge %{-t:%{-t*}}%{!-t:5} ] && echo -s)} %{!-a:-m}%{-a:-M} %1" \
 else \
        CMD="cat%{-e: >&2}" \
 fi \
-$CMD << EOF \
+$CMD %2%{?3: %3} \
 %nil
 
This page took 0.137891 seconds and 4 git commands to generate.