]> git.pld-linux.org Git - packages/rpm.git/blobdiff - rpm.macros
- minor spelling
[packages/rpm.git] / rpm.macros
index 27b5b8875cff3578349c0f4a5c120b57c3bb1578..a6fe92876782338015b9eee2090b6505b9a02767 100644 (file)
@@ -1,5 +1,5 @@
 # $Revision$, $Date$
-# PLD rpm macros
+# PLD Linux rpm macros
 
 %epoch         0
 %x8664         x86_64 amd64 ia32e
@@ -51,6 +51,46 @@ fi; \
 #      and that both p and q are package names (i.e. no version/release).
 %_dependency_whiteout  %{nil}
 
+
+#-----------------------------------------------------------------
+#
+# (re)definition of %{rpm*flags} with %filterout_* support
+# Requires:            awk
+#
+# Flags specified in %filterout_* are removed from %rpm*flags, exactly:
+# %rpmcflags    = %optflags - %filterout - %filterout_c   - %filterout_ld
+# %rpmcxxflags  = %optflags - %filterout - %filterout_cxx - %filterout_ld
+# %rpmldflags   = %optldflags - %filterout_ld
+#
+# Regular expressions are supported, but to avoid some character be treated
+# as regular expression it must be escaped twice.
+
+%filter_out                                            \
+       for (i in I) {  A=0;                    \
+               for (f in F) {                          \
+                       if (I[i] ~ "^" F[f] "$") A=1;   \
+               };                                                      \
+               if (!A) printf(I[i] FS);        \
+       }
+
+%rpmcflags %(awk 'BEGIN {
+       split("%{?debug:%debugcflags}%{!?debug:%optflags}%{?debuginfocflags}",I);
+       split("%{?filterout} %{?filterout_c} %{?filterout_ld}",F);
+       %{filter_out}
+}')
+
+%rpmcxxflags %(awk 'BEGIN {
+       split("%{?debug:%debugcflags}%{!?debug:%optflags}%{?debuginfocflags}",I);
+       split("%{?filterout} %{?filterout_cxx} %{?filterout_ld}",F);
+       %{filter_out}
+}')
+
+%rpmldflags %(awk 'BEGIN {
+       split("%{?optldflags}",I);
+       split("%{?filterout_ld}",F)
+       %{filter_out}
+}')
+
 #-----------------------------------------------------------------
 %configure2_13 { \
  if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
@@ -211,7 +251,7 @@ unset LINGUAS ||:\
 %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_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  %( VER_H=%{_kernelsrcdir}/include/linux/utsrelease.h; [ -f $VER_H ] || VER_H=%{_kernelsrcdir}/include/linux/version.h; [ -f $VER_H ] && (grep UTS_RELEASE $VER_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 2>/dev/null --qf "%{RELEASE}" | grep -v "is not")
 %__kernel_rpmvr        %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h 2>/dev/null --qf "%{VERSION}-%{RELEASE}" | grep -v "is not")
 %_kernel_ver   %{__kernel_ver}%{?with_dist_kernel:%(echo %{__kernel_ver} | grep -q -e - || echo -%{__kernel_rel})}
@@ -456,7 +496,7 @@ fi \
 
 # Ruby
 %ruby_archdir          %(ruby -r rbconfig -e 'print Config::CONFIG["archdir"]' 2>/dev/null || echo ERROR)
-%ruby_ridir            %(ruby -r rbconfig -e 'include Config; print File.join(CONFIG["datadir"], "ri", CONFIG["ruby_version"], "system")' 2>/dev/null || echo ERROR)
+%ruby_ridir                    %(ruby -r rbconfig -e 'include Config; print File.join(CONFIG["datadir"], "ri", CONFIG["ruby_version"], "system")' 2>/dev/null || echo ERROR)
 %ruby_rubylibdir       %(ruby -r rbconfig -e 'print Config::CONFIG["rubylibdir"]' 2>/dev/null || echo ERROR)
 %ruby_sitearchdir      %(ruby -r rbconfig -e 'print Config::CONFIG["sitearchdir"]' 2>/dev/null || echo ERROR)
 %ruby_sitelibdir       %(ruby -r rbconfig -e 'print Config::CONFIG["sitelibdir"]' 2>/dev/null || echo ERROR)
@@ -464,7 +504,7 @@ fi \
 %ruby_ver_requires_eq  Requires:       ruby(ver) = %ruby_version
 %ruby_mod_ver_requires_eq      Requires:       ruby-modules(ver) = %ruby_version
 
-%php_pear_dir  %{_datadir}/pear
+%php_pear_dir          /usr/share/pear
 
 # directory where php includes are installed on system.
 %__php_includedir              /usr/include/php
@@ -483,6 +523,7 @@ fi \
 # macros for public use
 # for php extensions (php-pecl)
 %requires_php_extension %{__php_api_requires modules_api php_api_version} \
+%{__php_api_requires zend_module_api} \
 %{__php_api_requires -v %php_major_version debug php_debug} \
 %{__php_api_requires -v %php_major_version thread-safety zend_zts}
 
@@ -497,14 +538,14 @@ fi \
 
 # Python specific macro definitions.
 # python main version
-%py_ver                %(python -c "import sys; print sys.version[:3]")
+%py_ver                        %(python -c "import sys; print sys.version[:3]")
 
 # directories
 %py_prefix             %(python -c "import sys; print sys.prefix")
 %py_libdir             %{py_prefix}/%{_lib}/python%{py_ver}
 %py_scriptdir  %{py_prefix}/share/python%{py_ver}
 %py_incdir             /usr/include/python%{py_ver}
-%py_sitedir    %{py_libdir}/site-packages
+%py_sitedir            %{py_libdir}/site-packages
 %py_sitescriptdir %{py_scriptdir}/site-packages
 %py_dyndir             %{py_libdir}/lib-dynload
 
@@ -653,7 +694,7 @@ else \
                %{-M} \\\
                %{-G:-G %{-G*}} \\\
                %{expand:%{%{#}}} 1>&2 || exit $? \
-       [ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i passwd \
+       [ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i passwd || : \
 fi;
 
 # Usage:
@@ -675,7 +716,7 @@ if [ -n "`/usr/bin/getgid %{1}`" ]; then \
 else \
        echo "Adding group %{1} GID=%{-g*}." \
        /usr/sbin/groupadd -g %{-g*} -r %{1} 1>&2 || exit $? \
-       [ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i group \
+       [ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i group || : \
 fi;
 
 # apache_config_{install/uninstall} macros written by glen@pld-linux.org.
@@ -904,7 +945,7 @@ EOF
 # line endings.
 #
 # the pear install process output is recorded to install.log, you should put it
-# to %%doc for latter debug or just information.
+# to %%doc for later debug or just for information.
 #
 # additionally additional-packages.txt is produced if it was detected that the
 # package has optional dependencies. the file format is suitable of displaying
@@ -1003,4 +1044,6 @@ for schema in %*; do \
 done \
 %{nil}
 
+%env_update [ ! -x /sbin/env-update ] || /sbin/env-update -u || :
+
 # vim:ts=4 sw=4 noet
This page took 0.03988 seconds and 4 git commands to generate.