--infodir=%{_infodir} \
}
+# ------------------------------------------------------------------------
+# Conditional build stuff.
+
+# Check if symbol is defined.
+# Example usage: %if %{defined with_foo} && %{undefined with_bar} ...
+%defined() %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
+%undefined() %{expand:%%{?%{1}:0}%%{!?%{1}:1}}
+
+# Shorthand for %if %{defined ...}
+%ifdef() %if %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
+%ifndef() %if %{expand:%%{?%{1}:0}%%{!?%{1}:1}}
+
+# Shorthand for %{defined with_...}
+%with() %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
+%without() %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
+
+# Shorthand for %if %{with ...}
+%ifwith() %if %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
+%ifwithout() %if %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
+
+# Handle conditional builds. %bcond_with is for case when feature is
+# default off and needs to be activated with --with ... command line
+# switch. %bcond_without is for the dual case.
+#
+# %bcond_with foo defines symbol with_foo if --with foo was specified on
+# command line.
+# %bcond_without foo defines symbol with_foo if --without foo was *not*
+# specified on command line.
+#
+# For example:
+#
+# %bcond_with extra_fonts
+# %bcond_without static
+# %ifdef with_extra_fonts
+# ...
+# %endif
+# %ifdef with_static
+# ...
+# %endif
+# %{?with_static: ... }
+# %{!?with_static: ... }
+# %{?with_extra_fonts: ... }
+# %{!?with_extra_fonts: ... }
+#
+# The bottom line: never use without_foo, _with_foo nor _without_foo, only
+# with_foo. This way changing default set of bconds for given spec is just
+# a matter of changing single line in it and syntax is more readable.
+%bcond_with() %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
+%bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}
+# ------------------------------------------------------------------------
+
# Location of autoconf macros
%_aclocaldir %(aclocal --print-ac-dir)
strip --strip-debug --remove-section=.note --remove-section=.comment $elfarchiveslist; \
fi; } \
} }
-
+#-----------------------------------------------------------------
+# remove all RPATH from executable binaries and shared object files
+#
+# Requires: find, awk, cut, xargs, chrpath, uname
+#
+#%no_install_post_chrpath 1
+%__spec_install_post_chrpath {%{!?debug: \
+%{!?no_install_post_chrpath: \
+ %{?verbose:set -x;} \
+echo "Remove RPATH from executable binaries and shared object files."; \
+if [ "$(uname -m)" != alpha ] ; then \
+find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" | xargs -r file | \
+ awk '/ELF.*(executable|shared object)/ {print $1}' | cut -d: -f1 | \
+while read file ; do \
+ rpath= ; \
+ chmod u+w "$file"; \
+ for dir in `chrpath -l "$file" | \
+ awk '/RPATH=/ { gsub(/.*RPATH=/,""); gsub(/:/," "); print $0 }'` ; do \
+ case $dir in \
+ /home/* | /tmp/* | /usr/lib | /lib | /usr/local/lib | /usr/X11R6/lib ) \
+ echo "remove-rpath: $dir in $file"; \
+ ;; \
+ * ) \
+ if [ "$rpath" = "" ] ; then rpath="$dir" ; \
+ else rpath="$rpath:$dir" ; fi ; \
+ ;; \
+ esac ; \
+ done ; \
+ if [ "$rpath" = "" ] ; then chrpath -d "$file" > /dev/null ; \
+ else chrpath -r "$rpath" "$file" > /dev/null ; fi ; \
+done; fi; } \
+} }
#-----------------------------------------------------------------
# Find and gzip all kernel modules
#
%{?_noautocompressdoc:echo '%{_noautocompressdoc}' > %{_builddir}/__rpm_noautocompressdoc}\
%{nil}
-%__os_install_post \
-%{?_noautoreqfiles:for f in %{_noautoreqfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoreqfiles ; done }\
-%{?_noautoreq:for f in %{_noautoreq} ; do echo "$f" >> %{_builddir}/__rpm_noautoreq ; done }\
-%{?_noautoreqdep:for f in %{_noautoreqdep} ; do echo "$f" >> %{_builddir}/__rpm_noautoreqdep ; done }\
-%{?_noautoprovfiles:for f in %{_noautoprovfiles} ; do echo %{?buildroot:%{buildroot}}$f >> %{_builddir}/__rpm_noautoprovfiles ; done }\
-%{?_noautoprov:for f in %{_noautoprov} ; do echo "$f" >> %{_builddir}/__rpm_noautoprov ; done }\
-%{__spec_install_post_strip}\
-%{__spec_install_post_compress_docs}\
-%{__spec_install_post_compress_modules}\
-%{__arch_install_post}\
-%{nil}
%__spec_clean_pre %{___build_pre}\
_autoreqprov=n \
# unchanged
%pyrequires_eq() Requires: %1 >= %py_ver %1 < %(echo `python -c "import sys; import string; ver=sys.version[:3].split('.'); ver[1]=str(int(ver[1])+1); print string.join(ver, '.')"`)
+# depmod macro
+%depmod() { \
+if [ -e /boot/System.map-%1 ]; then \
+ /sbin/depmod -a -F /boot/System.map-%1 %1; \
+else \
+ if [ -e /boot/System.map ]; then \
+ /sbin/depmod -a -F /boot/System.map %1; \
+ else \
+ /sbin/depmod -a %1; \
+ fi \
+fi; \
+}
+