]> git.pld-linux.org Git - packages/rpm.git/blobdiff - rpm.macros
- no backslashing needed inside %()
[packages/rpm.git] / rpm.macros
index fc5d27b9d469f0aa1ff8a857dce41edc45bbe2d4..96ad4d9d9b0d97264e3ad400cc0f90d9278aa5c6 100644 (file)
@@ -198,17 +198,21 @@ CXXFLAGS="%{rpmcxxflags}" \
 # 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 \
@@ -216,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
@@ -346,23 +352,28 @@ unset LINGUAS ||:\
        if [ -d "$RPM_BUILD_ROOT" ]; then \
        echo "Strip executable binaries, archives and shared object files."; \
        filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*\.debug" %{?_noautostrip:! -regex "%{_noautostrip}"}`; \
-       elfexelist=`echo $filelist | xargs -r file | \
-               awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \
-       elfsharedlist=`echo $filelist | xargs -r file | \
-               awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \
-       elfarchiveslist=`echo $filelist | xargs -r file | \
-               awk '/current ar archive/ {print $1}' | cut -d: -f1`; \
+       printf "Considering %d files\n" $(echo "$filelist" | wc -l); \
+       filetypes=`echo $filelist | xargs -r file` \
+       elfexelist=`echo "$filetypes" | awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \
+       elfsharedlist=`echo "$filetypes" | awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \
+       archiveslist=`echo "$filetypes" | awk '/current ar archive/ {print $1}' | cut -d: -f1`; \
        if [ -n "$elfexelist" ]; then \
+               printf "Stripping %d ELF executables..." $(echo "$elfexelist" | wc -l); \
                chmod u+w $elfexelist; \
                %{__strip} --remove-section=.note --remove-section=.comment $elfexelist; \
+               echo "DONE"; \
        fi; \
        if [ -n "$elfsharedlist" ]; then \
+               printf "Stripping %d ELF shared libraries..." $(echo "$elfsharedlist" | wc -l); \
                chmod u+w $elfsharedlist; \
                %{__strip} --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \
+               echo "DONE"; \
        fi; \
-       if [ -n "$elfarchiveslist" ]; then \
-               chmod u+w $elfarchiveslist; \
-               %{__strip} --strip-debug --remove-section=.note --remove-section=.comment $elfarchiveslist; \
+       if [ -n "$archiveslist" ]; then \
+               printf "Stripping %d ar archives..." $(echo "$elfsharedlist" | wc -l); \
+               chmod u+w $archiveslist; \
+               %{__strip} --strip-debug --remove-section=.note --remove-section=.comment $archiveslist; \
+               echo "DONE"; \
        fi; \
 fi; }; __spec_install_post_strip } } }
 
@@ -538,6 +549,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
@@ -569,6 +582,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]")
@@ -1153,6 +1190,13 @@ for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}
        ln -sf %{_kernelsrcdir}/config-$cfg o/.config                                   \
        ln -sf %{_kernelsrcdir}/Module.symvers-$cfg o/Module.symvers    \
        ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h o/include/linux/autoconf.h \
+%ifarch ppc ppc64                                                                                                      \
+       install -d o/include/asm                                                                                \
+       [ ! -d %{_kernelsrcdir}/include/asm-powerpc ] || ln -sf %{_kernelsrcdir}/include/asm-powerpc/* o/include/asm    \
+       [ ! -d %{_kernelsrcdir}/include/asm-%{_target_base_arch} ] || ln -snf %{_kernelsrcdir}/include/asm-%{_target_base_arch}/* o/include/asm \
+%else                                                                                                                          \
+       ln -sf %{_kernelsrcdir}/include/asm-%{_target_base_arch} o/include/asm \
+%endif                                                                                                                         \
                                                                                                                                        \
        set +x                                                                                                                  \
        [ -z "$PATCH_SH" ] || echo "$PATCH_SH" | %__spec_build_shell    \
@@ -1228,4 +1272,43 @@ for MODULE in {%{-m*},}; do                                                                                      \
 done                                                                                                                           \
 %{nil}
 
+# patchset macros
+# Author: Elan Ruusamäe <glen@pld-linux.org>
+#
+# Usage:
+#   %patchset_source -f <seq(1) format> <start> [<end>]
+#   %patchset_patch <start> [<end>]
+#
+# If <end> is omited, it is assumed to be <start>.
+#
+# For example in preamble:
+#  %patchset_source -f ftp://ftp.vim.org/pub/editors/vim/patches/7.0/7.0.%03g 33 44
+# and in %prep:
+#  %patchset_patch 33 44
+
+# generate SourceX urls from range START STOP
+# Format can be SINGLE format char of %e, %f, %g, see seq(1)
+# The sources start from 10000
+%patchset_source(f:b:) %(
+       base=%{-b*}%{!-b*:10000};
+       start=$((%1 + $base));
+       end=$((%{?2}%{!?2:%{1}} + $base));
+       # we need to call seq twice as it doesn't allow two formats
+       seq -f 'Patch%g:' $start $end > %{tmpdir}/__ps1;
+       seq -f '%{-f*}' %1 %{?2}%{!?2:%{1}} > %{tmpdir}/__ps2;
+       paste %{tmpdir}/__ps{1,2};
+       rm -f %{tmpdir}/__ps{1,2};
+) %{nil}
+
+# apply sources from %patchset_source
+# -p specify -pX for %patch line
+# -b base offset: defaults to 10000
+%patchset_patch(f:p:b:) %(
+       base=%{-b*}%{!-b*:10000};
+       start=$((%1 + $base));
+       end=$((%{?2}%{!?2:%{1}} + $base));
+       echo ": patchset_patch %1%{?2: to %2}";
+       seq -f 'patch%g %{-p*:-p%{-p*}}' $start $end | sed -e s,^,%%,;
+) %{nil}
+
 # vim:ts=4 sw=4 noet syn=spec
This page took 0.067762 seconds and 4 git commands to generate.