# and that both p and q are package names (i.e. no version/release).
%_dependency_whiteout %{nil}
+%_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\
+ && RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
+ [ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-j$RPM_BUILD_NCPUS")
#-----------------------------------------------------------------
#
if [ -d "$RPM_BUILD_ROOT" ]; then \
if [ -d $RPM_BUILD_ROOT/lib/modules ]; then \
modulelist=$(find $RPM_BUILD_ROOT/lib/modules -name '*o' -type f -print); \
- printf "Stripping %d kernel modules..." $(echo "$modulelist" | wc -l); \
- echo "$modulelist" | xargs -l512 chmod u+w; \
- echo "$modulelist" | xargs -l512 %{__strip} --strip-unneeded --remove-section=.comment --remove-section=.note.GNU-stack; \
- echo "DONE"; \
+ modulecount=$(echo -n "$modulelist" | wc -l); \
+ if [ "$modulecount" -gt 0 ]; then \
+ printf "Stripping %d kernel modules..."; \
+ echo "$modulelist" | xargs -l512 chmod u+w; \
+ echo "$modulelist" | xargs -l512 %{__strip} --strip-unneeded --remove-section=.comment --remove-section=.note.GNU-stack; \
+ echo "DONE"; \
+ fi; \
fi; \
- filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*\.debug" ! -regex ".*%{_docdir}/.*" ! -regex ".*%{_includedir}/.*" %{?_noautostrip:! -regex "%{_noautostrip}"}`; \
+ filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*libpthread-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*\.debug" ! -regex ".*%{_docdir}/.*" ! -regex ".*%{_includedir}/.*" %{?_noautostrip:! -regex "%{_noautostrip}"}`; \
# vim - " \
if [ -z "$filelist" ]; then \
return; \
%update_desktop_database_post() {{ \
umask 022; \
/usr/bin/update-desktop-database -q; \
-}}
+}} \
+%{nil}
%update_desktop_database_postun() {{ \
if [ $1 = 0 ]; then \
umask 022; \
/usr/bin/update-desktop-database -q; \
fi \
-}}
+}} \
+%{nil}
#-----------------------------------------------------------------
# Update shared MIME info database
%update_mime_database() {{ \
umask 022; \
/usr/bin/update-mime-database %{_datadir}/mime; \
-}}
+}} \
+%{nil}
#-----------------------------------------------------------------
# Update icon cache
%update_icon_cache() {{ \
umask 022; \
/usr/bin/gtk-update-icon-cache -qf %{_datadir}/icons/%1; \
-}}
+}} \
+%{nil}
#-----------------------------------------------------------------
# Update scrollkeeper database
%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)
+%php_includedir %(php-config --include-dir 2>/dev/null || echo ERROR)
-# directory where php includes are installed on system.
-%__php_includedir /usr/include/php
# extract php/zend api versions
-%php_major_version %(awk '/#define PHP_MAJOR_VERSION/{print $3}' %{__php_includedir}/main/php_version.h 2>/dev/null || echo ERROR)
-%php_api_version %(awk '/#define PHP_API_VERSION/{print $3}' %{__php_includedir}/main/php.h 2>/dev/null || echo ERROR)
-%php_pdo_api_version %(awk '/#define PDO_DRIVER_API/{print $3}' %{__php_includedir}/ext/pdo/php_pdo_driver.h 2>/dev/null || echo ERROR)
-%php_debug %(awk '/#define ZEND_DEBUG/{print $3}' %{__php_includedir}/main/php_config.h 2>/dev/null || echo ERROR)
-%zend_module_api %(awk '/#define ZEND_MODULE_API_NO/{print $3}' %{__php_includedir}/Zend/zend_modules.h 2>/dev/null || echo ERROR)
-%zend_extension_api %(awk '/#define ZEND_EXTENSION_API_NO/{print $3}' %{__php_includedir}/Zend/zend_extensions.h 2>/dev/null || echo ERROR)
-%zend_zts %(Z=$(grep -sc '^#define ZTS 1' %{__php_includedir}/main/php_config.h); echo ${Z:-ERROR})
+%php_major_version %(awk '/#define PHP_MAJOR_VERSION/{print $3}' %{php_includedir}/main/php_version.h 2>/dev/null || echo ERROR)
+%php_api_version %(awk '/#define PHP_API_VERSION/{print $3}' %{php_includedir}/main/php.h 2>/dev/null || echo ERROR)
+%php_pdo_api_version %(awk '/#define PDO_DRIVER_API/{print $3}' %{php_includedir}/ext/pdo/php_pdo_driver.h 2>/dev/null || echo ERROR)
+%php_debug %(awk '/#define ZEND_DEBUG/{print $3}' %{php_includedir}/main/php_config.h 2>/dev/null || echo ERROR)
+%zend_module_api %(awk '/#define ZEND_MODULE_API_NO/{print $3}' %{php_includedir}/Zend/zend_modules.h 2>/dev/null || echo ERROR)
+%zend_extension_api %(awk '/#define ZEND_EXTENSION_API_NO/{print $3}' %{php_includedir}/Zend/zend_extensions.h 2>/dev/null || echo ERROR)
+%zend_zts %(Z=$(grep -sc '^#define ZTS 1' %{php_includedir}/main/php_config.h); echo ${Z:-ERROR})
# helper macro
%__php_api_requires(v:) Requires: php%{-v*}(%{expand:%1}) = %{expand:%{%{!?2:%{1}}%{?2}}}
fi \
%{nil}
+
+# X.org helper macros
+%__xorg_abi_requires() Requires: xorg-xserver-server(%{expand:%1}-abi) = %{expand:%{%{!?2:%{1}}%{?2}}}
+#
+%xorg_xserver_ansic_abi %(awk '/#define ABI_ANSIC_VERSION/ { split($0,A,/[(,)]/); printf("%d.%d",A[2], A[3]); }' /usr/include/xorg/xf86Module.h 2> /dev/null || echo ERROR)
+%xorg_xserver_extension_abi %(awk '/#define ABI_EXTENSION_VERSION/ { split($0,A,/[(,)]/); printf("%d.%d",A[2], A[3]); }' /usr/include/xorg/xf86Module.h 2> /dev/null || echo ERROR)
+%xorg_xserver_font_abi %(awk '/#define ABI_FONT_VERSION/ { split($0,A,/[(,)]/); printf("%d.%d",A[2], A[3]); }' /usr/include/xorg/xf86Module.h 2> /dev/null | echo ERROR)
+%xorg_xserver_videodrv_abi %(awk '/#define ABI_VIDEODRV_VERSION/ { split($0,A,/[(,)]/); printf("%d.%d",A[2], A[3]); }' /usr/include/xorg/xf86Module.h 2> /dev/null || echo ERROR)
+%xorg_xserver_xinput_abi %(awk '/#define ABI_XINPUT_VERSION/ { split($0,A,/[(,)]/); printf("%d.%d",A[2], A[3]); }' /usr/include/xorg/xf86Module.h 2> /dev/null || echo ERROR)
+
+%requires_xorg_xserver_extension %{__xorg_abi_requires ansic xorg_xserver_ansic_abi} \
+%{__xorg_abi_requires extension xorg_xserver_extension_abi}
+%requires_xorg_xserver_xinput %{__xorg_abi_requires ansic xorg_xserver_ansic_abi} \
+%{__xorg_abi_requires xinput xorg_xserver_xinput_abi}
+%requires_xorg_xserver_font %{__xorg_abi_requires ansic xorg_xserver_ansic_abi} \
+%{__xorg_abi_requires font xorg_xserver_font_abi}
+%requires_xorg_xserver_videodrv %{__xorg_abi_requires ansic xorg_xserver_ansic_abi} \
+%{__xorg_abi_requires videodrv xorg_xserver_videodrv_abi}
+
# Python specific macro definitions.
# python main version
%py_ver %(python -c "import sys; print sys.version[:3]")
%__spec_install_post_py_hardlink {\
%{!?no_install_post_py_hardlink: __spec_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/')"; \
+ b="${a%.pyc}.pyo"; \
if cmp -s "$a" "$b"; then \
ln -f "$a" "$b"; \
fi; \
# command invoking pear cli
%__pear /usr/bin/pear
-# The main macro.
-# using this macro will append optional-packages.txt to the nocompressdoc list
-# as it's displayed to user after package install. and adding additional gzip
-# dep is just waste ;)
-%pear_package_setup(a:n:zD) \
-%define srcdir %{-n*}%{!-n:%{_pearname}-%{version}} \
-%define builddir %{_builddir}/%{srcdir} \
-%setup -q -c -T %{-D:-D} -n %{srcdir} \
-%{-z:tar zxf %{S:0}; %{-a:tar zxf %{S:%{-a*}}}} \
-%{-z:_P=package2.xml; [ -f $_P ] || _P=package.xml; _N=%{srcdir}; mv $_P $_N; cd $_N} \
+%pear_install(a:n:zD) \
%__pear \\\
-c pearrc \\\
-d doc_dir=/docs \\\
--offline \\\
--nodeps \\\
%{-f:--force} \\\
- %{!-z:%{S:%{-a*}%{!-a:0}}}%{-z:$_P} > .install.log || { c=$?; cat .install.log; exit $c; } \
+ %{!-z:%{S:%{-a*}%{!-a:0}}}%{-z:$_P} > .install.log || { c=$?; cat .install.log; exit $c; }; \
+%{nil}
+
+# The main macro.
+# using this macro will append optional-packages.txt to the nocompressdoc list
+# as it's displayed to user after package install. and adding additional gzip
+# dep is just waste ;)
+%pear_package_setup(a:n:zD) \
+%define srcdir %{-n*}%{!-n:%{_pearname}-%{version}} \
+%define builddir %{_builddir}/%{srcdir} \
+%setup -q -c -T %{-D:-D} -n %{srcdir} \
+%{-z:tar zxf %{S:0}; %{-a:tar zxf %{S:%{-a*}}}} \
+%{-z:_P=package2.xml; [ -f $_P ] || _P=package.xml; _N=%{srcdir}; mv $_P $_N; cd $_N} \
+%pear_install \
%{-z:cd ..} \
cat %{-z:$_N/}.install.log | %__pear_install_log \
\