packages: rpm-build-macros/rpm-build-macros.spec, rpm-build-macros/rpm.macr...

sparky sparky at pld-linux.org
Wed Nov 18 19:18:26 CET 2009


Author: sparky                       Date: Wed Nov 18 18:18:26 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- Added macros to convert bconds to configure options, please read
  "RFC: Convert bconds to autoconf-like options." @ pld-devel-en

---- Files affected:
packages/rpm-build-macros:
   rpm-build-macros.spec (1.224 -> 1.225) , rpm.macros (1.526 -> 1.527) 

---- Diffs:

================================================================
Index: packages/rpm-build-macros/rpm-build-macros.spec
diff -u packages/rpm-build-macros/rpm-build-macros.spec:1.224 packages/rpm-build-macros/rpm-build-macros.spec:1.225
--- packages/rpm-build-macros/rpm-build-macros.spec:1.224	Fri Oct 16 07:42:01 2009
+++ packages/rpm-build-macros/rpm-build-macros.spec	Wed Nov 18 19:18:20 2009
@@ -1,5 +1,5 @@
 # $Revision$, $Date$
-%define		rpm_macros_rev	1.524
+%define		rpm_macros_rev	1.527
 %define		find_lang_rev	1.32
 Summary:	PLD Linux RPM build macros
 Summary(pl.UTF-8):	Makra do budowania pakietów RPM dla Linuksa PLD
@@ -90,6 +90,10 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.225  2009/11/18 18:18:20  sparky
+- Added macros to convert bconds to configure options, please read
+  "RFC: Convert bconds to autoconf-like options." @ pld-devel-en
+
 Revision 1.224  2009/10/16 05:42:01  glen
 - v1.524: add %_initddir
 

================================================================
Index: packages/rpm-build-macros/rpm.macros
diff -u packages/rpm-build-macros/rpm.macros:1.526 packages/rpm-build-macros/rpm.macros:1.527
--- packages/rpm-build-macros/rpm.macros:1.526	Tue Nov 17 18:49:26 2009
+++ packages/rpm-build-macros/rpm.macros	Wed Nov 18 19:18:20 2009
@@ -264,6 +264,44 @@
 	%{?configure_cache:--cache-file=%{configure_cache_file}} \
 }
 
+# Simple macros to simplify adding bconded options to configure scripts.
+#   Each macro requires bcond name and accepts optional option name, if option
+# isn't specified bcond name is used as option name. Options returning
+# --with and --enable also allow third argument which will be added as value
+# ( --with-option=value or --enable-option=value ) in case or positive
+# condition, but won't be added otherwise ( nothing or just --disable-option ).
+
+# Requirements:
+# BuildRequires: rpmbuild(macros) >= 1.527
+
+# Usage example:
+# %{__enable bcond} - returns --enable-bcond iff build condition is set
+# %{__disable bcond option} - returns --enable-option iff bcond is not set
+# %{__enable_disable bcond option value} - returns --enable-option=value if
+#    bcond is set, returns --disable-option otherwise
+
+# expand bconds to --enable-something and --disable-something
+%__enable() %{expand:%%{?with_%{1}:--enable-%{?2}%{!?2:%{1}}%{?3:=%{3}}}}
+%__disable() %{expand:%%{!?with_%{1}:--disable-%{?2}%{!?2:%{1}}}}
+%__enable_disable() %{expand:%%{?with_%{1}:--enable-%{?2}%{!?2:%{1}}%{?3:=%{3}}}%%{!?with_%{1}:--disable-%{?2}%{!?2:%{1}}}}
+
+# same as above, but condition inverted
+%__enable_unless() %{expand:%%{!?with_%{1}:--enable-%{?2}%{!?2:%{1}}%{?3:=%{3}}}}
+%__disable_if() %{expand:%%{?with_%{1}:--disable-%{?2}%{!?2:%{1}}}}
+%__enable_disable_not() %{expand:%%{!?with_%{1}:--enable-%{?2}%{!?2:%{1}}%{?3:=%{3}}}%%{?with_%{1}:--disable-%{?2}%{!?2:%{1}}}}
+
+# expand bconds to --with-something and --without-something
+%__with() %{expand:%%{?with_%{1}:--with-%{?2}%{!?2:%{1}}%{?3:=%{3}}}}
+%__without() %{expand:%%{!?with_%{1}:--without-%{?2}%{!?2:%{1}}}}
+%__with_without() %{expand:%%{?with_%{1}:--with-%{?2}%{!?2:%{1}}%{?3:=%{3}}}%%{!?with_%{1}:--without-%{?2}%{!?2:%{1}}}}
+
+# same as above, but condition inverted
+%__with_unless() %{expand:%%{!?with_%{1}:--with-%{?2}%{!?2:%{1}}%{?3:=%{3}}}}
+%__without_if() %{expand:%%{?with_%{1}:--without-%{?2}%{!?2:%{1}}}}
+%__with_without_not() %{expand:%%{!?with_%{1}:--with-%{?2}%{!?2:%{1}}%{?3:=%{3}}}%%{?with_%{1}:--without-%{?2}%{!?2:%{1}}}}
+
+#-----------------------------------------------------------------
+
 # overload to insert debuginfo package
 %prep \
 %if 0%{?_enable_debug_packages}\
@@ -534,6 +572,8 @@
 	fi; \
 fi; }; __spec_install_post_chrpath } } }
 
+# vim: "
+
 #-----------------------------------------------------------------
 # Find all shared object files with unresolved symbols. Warn
 # and terminate if any found (termination can be turned off by define).
@@ -771,6 +811,7 @@
 %xorg_xserver_font_abi		%{expand:%%global 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_font_abi
 %xorg_xserver_videodrv_abi	%{expand:%%global 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_videodrv_abi
 %xorg_xserver_xinput_abi	%{expand:%%global 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)}%xorg_xserver_xinput_abi
+# vim: '
 
 %requires_xorg_xserver_extension \
 %{__xorg_abi_requires_ge ansic xorg_xserver_ansic_abi} \
@@ -1007,6 +1048,7 @@
 		%{expand:%{%{#}}} 1>&2 || exit $? \
 	[ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i passwd || : \
 fi;
+# vim: "
 
 # Usage:
 #   %groupadd [-P package] [-g gid] group
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/rpm-build-macros/rpm-build-macros.spec?r1=1.224&r2=1.225&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/rpm-build-macros/rpm.macros?r1=1.526&r2=1.527&f=u



More information about the pld-cvs-commit mailing list