[PATCH 1/3] Support XORG_MULTILIB to enable multilib support.

Michał Górny <[email protected]> Sun, 20 Jan 2013 20:08:26 +0100
Newsgroups gmane.linux.gentoo.desktop
Message-ID <[email protected]>
---
 eclass/xorg-2.eclass | 37 ++++++++++++++++++++++++++++++-------
 1 file changed, 30 insertions(+), 7 deletions(-)

diff --git a/eclass/xorg-2.eclass b/eclass/xorg-2.eclass
index 87d31f6..f63b882 100644
--- a/eclass/xorg-2.eclass
+++ b/eclass/xorg-2.eclass
@@ -37,10 +37,20 @@ if [[ ${PN} == font* \
 	FONT_ECLASS="font"
 fi
 
+# @ECLASS-VARIABLE: XORG_MULTILIB
+# @DESCRIPTION:
+# If set to 'yes', the multilib support for package will be enabled. Set
+# before inheriting this eclass.
+: ${XORG_MULTILIB:="no"}
+
 # we need to inherit autotools first to get the deps
 inherit autotools autotools-utils eutils libtool multilib toolchain-funcs \
 	flag-o-matic ${FONT_ECLASS} ${GIT_ECLASS}
 
+if [[ ${XORG_MULTILIB} == yes ]]; then
+	inherit autotools-multilib
+fi
+
 EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_postinst pkg_postrm"
 case "${EAPI:-0}" in
 	3|4|5) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure" ;;
@@ -438,7 +448,11 @@ xorg-2_src_configure() {
 		"${xorgconfadd[@]}"
 	)
 
-	autotools-utils_src_configure "$@"
+	if [[ ${XORG_MULTILIB} == yes ]]; then
+		autotools-multilib_src_configure "$@"
+	else
+		autotools-utils_src_configure "$@"
+	fi
 }
 
 # @FUNCTION: xorg-2_src_compile
@@ -447,7 +461,11 @@ xorg-2_src_configure() {
 xorg-2_src_compile() {
 	debug-print-function ${FUNCNAME} "$@"
 
-	autotools-utils_src_compile "$@"
+	if [[ ${XORG_MULTILIB} == yes ]]; then
+		autotools-multilib_src_compile "$@"
+	else
+		autotools-utils_src_compile "$@"
+	fi
 }
 
 # @FUNCTION: xorg-2_src_install
@@ -457,13 +475,18 @@ xorg-2_src_compile() {
 xorg-2_src_install() {
 	debug-print-function ${FUNCNAME} "$@"
 
+	local install_args=( docdir="${EPREFIX}/usr/share/doc/${PF}" )
+
 	if [[ ${CATEGORY} == x11-proto ]]; then
-		autotools-utils_src_install \
-			${PN/proto/}docdir="${EPREFIX}/usr/share/doc/${PF}" \
-			docdir="${EPREFIX}/usr/share/doc/${PF}"
+		install_args+=(
+			${PN/proto/}docdir="${EPREFIX}/usr/share/doc/${PF}"
+		)
+	fi
+
+	if [[ ${XORG_MULTILIB} == yes ]]; then
+		autotools-multilib_src_install "${install_args[@]}"
 	else
-		autotools-utils_src_install \
-			docdir="${EPREFIX}/usr/share/doc/${PF}"
+		autotools-utils_src_install "${install_args[@]}"
 	fi
 
 	if [[ -n ${GIT_ECLASS} ]]; then
-- 
1.8.1.1