]> git.pld-linux.org Git - packages/rpm-build-macros.git/blobdiff - rpm.macros
- it's time, for /etc/httpd/conf.d
[packages/rpm-build-macros.git] / rpm.macros
index 197b23e09501170d12386f5e48eb6c81d643b0f4..94847f7b2537c879ec0e00ea5ff7a91fe9503d60 100644 (file)
@@ -91,6 +91,20 @@ fi; \
        %{filter_out}
 }')
 
+# rpmldflags with stripped -Wl, -- in the form flags have to be passed to 'ld'
+# but, don't use it, better use gcc as linker
+%ld_rpmldflags %(awk 'BEGIN {
+        split("%{rpmldflags}",F);
+        for (f in F) {
+                s = F[f];
+                if (s ~ /^-Wl,/) {
+                        s = substr(s,5);
+                        gsub(/,/," ",s);
+                };
+                printf(s FS);
+        };
+}')
+
 #-----------------------------------------------------------------
 %configure2_13 { \
  if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
@@ -120,12 +134,32 @@ fi; \
        %{dependencytracking} \
 }
 
+# override __cmake to add -j4 in your ~/.rpmmacros for parallel make
+%__cmake       /usr/bin/cmake
 %cmake { \
 CC="%{__cc}" \
 CXX="%{__cxx}" \
 CFLAGS="%{rpmcflags}" \
 CXXFLAGS="%{rpmcxxflags}" \
-cmake \
+%{__cmake} \
+}
+
+# override __scons to add -j4 in your ~/.rpmmacros for parallel make
+%__scons       /usr/bin/scons
+%scons { \
+%{__scons} \
+}
+
+# waf. see waf.spec
+# override __waf to add -j4 in your ~/.rpmmacros for parallel make
+%__waf /usr/bin/waf
+%waf { \
+CC="%{__cc}" \
+CXX="%{__cxx}" \
+CPP="%{__cpp}" \
+CFLAGS="%{rpmcflags}" \
+CXXFLAGS="%{rpmcxxflags}" \
+%{__waf} \
 }
 
 #----------------------------------------------------------------
@@ -164,17 +198,21 @@ cmake \
 # Overloading of some basic macros
 %prep \
 %%prep\
-LANG=C\
-export LANG\
-unset DISPLAY ||:\
+export LC_ALL=C\
+export LANG=C\
 unset LINGUAS ||:\
+unset LANGUAGE ||:\
+unset LC_MESSAGES ||:\
+unset DISPLAY ||:\
 %{nil}
 
 %build %%build\
-LANG=C\
-export LANG\
-unset DISPLAY ||:\
+export LC_ALL=C\
+export LANG=C\
 unset LINGUAS ||:\
+unset LANGUAGE ||:\
+unset LC_MESSAGES ||:\
+unset DISPLAY ||:\
 %{nil}
 
 %install \
@@ -182,10 +220,12 @@ unset LINGUAS ||:\
 %{?buildsubdir:%{debug_package}}\
 %endif\
 %%install\
-LANG=C\
-export LANG\
-unset DISPLAY ||:\
+export LC_ALL=C\
+export LANG=C\
 unset LINGUAS ||:\
+unset LANGUAGE ||:\
+unset LC_MESSAGES ||:\
+unset DISPLAY ||:\
 %{nil}
 
 # Location of autoconf macros
@@ -372,14 +412,13 @@ fi; }; __spec_install_post_chrpath } } }
 #%no_install_post_compress_modules     1
 %__spec_install_post_compress_modules { \
 %{!?no_install_post_compress_modules: __spec_install_post_compress_modules() { \
-       if [ -d "$RPM_BUILD_ROOT" ]; then \
-               echo "Compress kernel modules if any."; \
-               if test -d $RPM_BUILD_ROOT/lib/modules ; then \
-                       find $RPM_BUILD_ROOT/lib/modules -name \*o -type f -print | \
-                       xargs -r %{__gzip} -9nf; \
-                       find $RPM_BUILD_ROOT/lib/modules -name \*o -type l -printf "%p %l\n" | \
-                       while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \
-               fi; \
+       if [ -d $RPM_BUILD_ROOT/lib/modules ]; then \
+               echo "Compress kernel modules"; \
+               q=$(find $RPM_BUILD_ROOT/lib/modules -name '*o' -type f -print); \
+               echo "$q" | xargs -r %{__gzip} -9nf; \
+               printf "%d modules compressed\n" $(echo "$q" | wc -l); \
+               find $RPM_BUILD_ROOT/lib/modules -name '*o' -type l -printf "%p %l\n" | \
+               while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \
        fi; \
 }; __spec_install_post_compress_modules } }
 
@@ -505,6 +544,8 @@ fi \
 %ruby_mod_ver_requires_eq      Requires:       ruby-modules(ver) = %ruby_version
 
 %php_pear_dir          /usr/share/pear
+%php_extensiondir      %(php-config --extension-dir 2>/dev/null || echo ERROR)
+%php_sysconfdir                %(php-config --sysconfdir 2>/dev/null || echo ERROR)
 
 # directory where php includes are installed on system.
 %__php_includedir              /usr/include/php
@@ -536,6 +577,30 @@ fi \
 # for php pdo modules (php-pecl-PDO_*)
 %requires_php_pdo_module %{__php_api_requires PDO_API php_pdo_api_version}
 
+# for using PHP post scripts. for PHP >= 5.0
+%php_webserver_restart \
+[ ! -f /etc/apache/conf.d/??_mod_php.conf ] || %service -q apache restart \
+[ ! -f /etc/httpd/conf.d/??_mod_php.conf ] || %service -q httpd restart \
+if [ -f /etc/rc.d/init.d/php-fcgi ]; then \
+       PHP_FCGI_BINARY=; . /etc/sysconfig/php-fcgi 2>/dev/null \
+       if [[ ${PHP_FCGI_BINARY:-php.fcgi} = *php.fcgi* ]]; then \
+               %service -q php-fcgi restart \
+       fi \
+fi \
+%{nil}
+
+# for using php post scripts. for PHP >= 4.0 && PHP < 5.0
+%php4_webserver_restart \
+[ ! -f /etc/apache/conf.d/??_mod_php4.conf ] || %service -q apache restart \
+[ ! -f /etc/httpd/conf.d/??_mod_php4.conf ] || %service -q httpd restart \
+if [ -f /etc/rc.d/init.d/php-fcgi ]; then \
+       PHP_FCGI_BINARY=; . /etc/sysconfig/php-fcgi 2>/dev/null \
+       if [[ ${PHP_FCGI_BINARY:-php.fcgi} = *php4.fcgi* ]]; then \
+               %service -q php-fcgi restart \
+       fi \
+fi \
+%{nil}
+
 # Python specific macro definitions.
 # python main version
 %py_ver                        %(python -c "import sys; print sys.version[:3]")
@@ -655,8 +720,8 @@ fi \
 eval $CMD %2%{?3: %3} \
 %nil
 
-# useradd/groupadd macros written by glen@pld-linux.org.
-# All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
+# useradd/groupadd macros
+# Author: Elan Ruusamäe <glen@pld-linux.org>
 #
 # Usage:
 #   %useradd [-P package] [-u uid] [-d home_dir] [-s shell] [-c comment]
@@ -719,10 +784,11 @@ else \
        [ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i group || : \
 fi;
 
-# apache_config_{install/uninstall} macros written by glen@pld-linux.org.
-# All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
+# apache_config_{install/uninstall} macros *DEPRECATED*
+# Author: Elan Ruusamäe <glen@pld-linux.org>
 #
-# You should use webapp macros instead. these are here until single piece of them is gone from specs ;)
+# You should use webapp macros instead. these are here until single piece of
+# them is gone from specs ;)
 #
 # The config is installed/removed inside trigger, this means that you can any
 # time install apache1 or apache package and the configuration file is updated.
@@ -788,6 +854,7 @@ fi \
 %{nil}
 
 # webapp macros
+# Author: Elan Ruusamäe <glen@pld-linux.org>
 #
 # The config is installed/removed inside trigger, this means that you can any
 # time install apache1/apache/lighttpd package and the configuration file is
@@ -825,7 +892,7 @@ fi \
 %{nil}
 
 # see browser-plugins.spec / template-browser-plugin.spec
-# written by glen@pld-linux.org.
+# Author: Elan Ruusamäe <glen@pld-linux.org>
 %nsplugin_install(d:f) { \
 # create link if it's first install of either of the packages \
 if [ -n "%{-f:1}" ] || ([ "$1" = "1" ] && [ "$2" = "1" ] && [ -d %{-d*} ]); then \
@@ -851,14 +918,12 @@ if [ "$1" = "0" ] || [ "$2" = "0" ]; then \
 }
 
 # service macro.
+# Author: Elan Ruusamäe <glen@pld-linux.org>
 #
 # calls usual service restart on package %post, but skips the restart if
 # administrator has disabled automatic service restarts in either global
 # /etc/sysconfig/rpm or per service /etc/sysconfig/SERVICE file.
 #
-# written by glen@pld-linux.org.
-# All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
-#
 # Usage:
 #   %service [-q] SERVICE ACTION ["SERVICE NICE DESCRIPTION"]
 #
@@ -927,7 +992,7 @@ run "$@"\
 EOF
 
 # PEAR install macros
-# Author: glen@pld-linux.org.
+# Author: Elan Ruusamäe <glen@pld-linux.org>
 #
 # Usage:
 #      %%pear_package_setup [-a #] [-n FMT]
@@ -1065,13 +1130,15 @@ done \
 # Author: Przemyslaw Iskra <sparky@pld-linux.org>
 #
 # Usage:
-#      %build_kernel_modules -m <modules>
+#      %build_kernel_modules -m <modules> -C <directory>
 #
 #  remember that proper Makefile is still required
 # Options:
-#  -m <modules> (required) -- coma-separated list of modules to save,
+#  -m <modules> (required) -- comma-separated list of modules to save,
 #              without .ko extension, may be placed in subdirectory
+#  -C <directory> -- change to <directory> before doing anything
 #  -p <arg>, -P <arg> -- arguments passeed to make scripts
+#  -c -- do not execute make clean
 #  <additional arguments> -- all additional arguments will be passed to
 #              make modules
 #
@@ -1089,7 +1156,7 @@ done \
 # - in last line \ has to touch arguments so arguments passing
 #   in new lines (using \) will be supported
 
-%build_kernel_modules(p:P:m:)                                                                          \
+%build_kernel_modules(p:P:m:C:c)                                                                       \
 %{!?-m:%{error:%{0}: Required module name/list missing} exit 1}                \
                                                                                                                                        \
 %define Opts                                                                                                           \\\\\\\
@@ -1105,6 +1172,7 @@ done \
 %define        MakeOpts HOSTCC="%{__cc}" SYSSRC=%{_kernelsrcdir} SYSOUT=$PWD/o \\\\\\\
                O=$PWD/o %{?with_verbose:V=1} %{Opts}                                           \
                                                                                                                                        \
+%{?-C:cd %{-C*}}                                                                                                       \
 compile() {                                                                                                                    \
        L="<"; [[ '%{*}' != *$L$L* ]] || PATCH_SH="set -x -e;$(cat)"    \
        set -e -x                                                                                                               \
@@ -1112,6 +1180,7 @@ compile() {                                                                                                                       \
 for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do \
        [ -r "%{_kernelsrcdir}/config-$cfg" ] || exit 1                                 \
                                                                                                                                        \
+       rm -rf o                                                                                                                \
        install -d o/include/linux                                                                              \
        ln -sf %{_kernelsrcdir}/config-$cfg o/.config                                   \
        ln -sf %{_kernelsrcdir}/Module.symvers-$cfg o/Module.symvers    \
@@ -1131,9 +1200,9 @@ for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}
                ln -sf %{_kernelsrcdir}/scripts o/scripts                                       \
        %endif                                                                                                                  \
                                                                                                                                        \
-       %{__make} -C %{_kernelsrcdir} clean                                                             \\\
+       %{!?-c:%{__make} -C %{_kernelsrcdir} clean                                              \\\
                RCS_FIND_IGNORE="-name '*.ko' -o"                                                       \\\
-               M=$PWD %{MakeOpts}                                                                                      \
+               M=$PWD %{MakeOpts}}                                                                                     \
        %{__make} -C %{_kernelsrcdir} modules                                                   \\\
                ${1+"$@"}                                                                                                       \\\
                M=$PWD %{MakeOpts}                                                                                      \
@@ -1142,6 +1211,7 @@ for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}
                [ -z "${MODULE}" ] || mv ${MODULE}{,-$cfg}.ko                           \
        done                                                                                                                    \
 done                                                                                                                           \
+%{?-C:cd -}                                                                                                                    \
 }                                                                                                                                      \
 compile %{*}\
 %{nil}
@@ -1154,7 +1224,7 @@ compile %{*}\
 #      %install_kernel_modules -m <modules> -d <directory>
 #
 # Options:
-#  -m <modules> (required) -- coma-separated list of modules to install,
+#  -m <modules> (required) -- comma-separated list of modules to install,
 #              without .ko extension, may be placed in subdirectory
 #  -d <directory> (required) -- in what subdirectory modules should be
 #              installed (eg. misc, kernel/drivers/net)
This page took 0.055445 seconds and 4 git commands to generate.