summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Hill <rhill@gentoo.org>2013-11-16 13:05:11 +0000
committerRyan Hill <rhill@gentoo.org>2013-11-16 13:05:11 +0000
commitfd5450fb24a7b49be109f0df8254de3189b37232 (patch)
tree2258bc4bbe74a6a4389d23405c97f25731babb57 /eclass/wxwidgets.eclass
parentVersion bump. (diff)
downloadhistorical-fd5450fb24a7b49be109f0df8254de3189b37232.tar.gz
historical-fd5450fb24a7b49be109f0df8254de3189b37232.tar.bz2
historical-fd5450fb24a7b49be109f0df8254de3189b37232.zip
Cleanup.
Diffstat (limited to 'eclass/wxwidgets.eclass')
-rw-r--r--eclass/wxwidgets.eclass127
1 files changed, 47 insertions, 80 deletions
diff --git a/eclass/wxwidgets.eclass b/eclass/wxwidgets.eclass
index c560825f1c9b..eaf91a8ab04b 100644
--- a/eclass/wxwidgets.eclass
+++ b/eclass/wxwidgets.eclass
@@ -1,57 +1,63 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/wxwidgets.eclass,v 1.36 2013/11/16 10:25:39 dirtyepic Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/wxwidgets.eclass,v 1.37 2013/11/16 13:05:11 dirtyepic Exp $
# @ECLASS: wxwidgets.eclass
# @MAINTAINER:
# wxwidgets@gentoo.org
# @BLURB: Manages build configuration for wxGTK-using packages.
# @DESCRIPTION:
-# The wxGTK libraries come in several different possible configurations
-# (release, debug, ansi, unicode, etc.) most of which can be installed
-# side-by-side. The purpose of this eclass is to provide ebuilds the ability
-# to build against a specific type of profile without interfering with the
-# user-set system configuration.
+# This eclass gives ebuilds the ability to build against a specific wxGTK
+# SLOT and profile without interfering with the system configuration. Any
+# ebuild with a x11-libs/wxGTK dependency must use this eclass.
#
-# Ebuilds that use wxGTK _must_ inherit this eclass.
+# There are two ways to do it:
#
-# - Using this eclass -
+# - set WX_GTK_VER before inheriting the eclass
+# - set WX_GTK_VER and call need-wxwidgets from a phase function
#
-# 1. set WX_GTK_VER to a valid wxGTK SLOT
-# 2. inherit wxwidgets
-# 3. add an appropriate DEPEND
-# 4. done
+# (where WX_GTK_VER is the SLOT you want)
+#
+# If your package has optional support for wxGTK (ie. by a USE flag) then
+# you should use need-wxwidgets. This is important because some packages
+# will force-enable wxGTK if they find WX_CONFIG set in the environment.
#
# @CODE
-# WX_GTK_VER="2.8"
+# inherit wxwidgets
#
-# inherit wxwidgets
+# IUSE="X wxwidgets"
+# DEPEND="wxwidgets? ( x11-libs/wxGTK:2.8[X?] )"
#
-# DEPEND="x11-libs/wxGTK:2.8[X]"
-# RDEPEND="${DEPEND}"
-# [...]
+# src_configure() {
+# if use wxwidgets; then
+# WX_GTK_VER="2.8"
+# if use X; then
+# need-wxwidgets unicode
+# else
+# need-wxwidgets base-unicode
+# fi
+# fi
+# econf --with-wx-config="${WX_CONFIG}"
+# }
# @CODE
#
-# This will get you the default configuration, which is what you want 99%
-# of the time.
+# That's about as complicated as it gets. 99% of ebuilds can get away with:
#
-# If your package has optional wxGTK support controlled by a USE flag or you
-# need to use the wxBase libraries (USE="-X") then you should not set
-# WX_GTK_VER before inherit and instead refer to the need-wxwidgets function
-# below.
+# @CODE
+# inherit wxwidgets
+# DEPEND="wxwidgets? ( x11-libs/wxGTK:2.8[X] )
+# ...
+# WX_GTK_VER=2.8 need-wxwidgets unicode
+# @CODE
#
-# The variable WX_CONFIG is exported, containing the absolute path to the
-# wx-config file to use. Most configure scripts use this path if it's set in
-# the environment or accept --with-wx-config="${WX_CONFIG}".
+# Note: unless you know your package works with wxbase (which is very
+# doubtful), always depend on wxGTK[X].
inherit eutils multilib
-# We do this globally so ebuilds can get sane defaults just by inheriting. They
-# can be overridden with need-wxwidgets later if need be.
-
-# ensure this only runs once
+# We do this in global scope so ebuilds can get sane defaults just by
+# inheriting.
if [[ -z ${WX_CONFIG} ]]; then
- # and only if WX_GTK_VER is set before inherit
if [[ -n ${WX_GTK_VER} ]]; then
for wxtoolkit in gtk2 base; do
# newer versions don't have a seperate debug profile
@@ -70,103 +76,64 @@ if [[ -z ${WX_CONFIG} ]]; then
fi
fi
-# @FUNCTION: need-wxwidgets
-# @USAGE: <configuration>
+# @FUNCTION: need-wxwidgets
+# @USAGE: <profile>
# @DESCRIPTION:
#
# Available configurations are:
#
# unicode (USE="X")
# base-unicode (USE="-X")
-#
-# If your package has optional wxGTK support controlled by a USE flag, set
-# WX_GTK_VER inside a conditional rather than before inherit. Some broken
-# configure scripts will force wxGTK on if they find ${WX_CONFIG} set.
-#
-# @CODE
-# src_configure() {
-# if use wxwidgets; then
-# WX_GTK_VER="2.8"
-# if use X; then
-# need-wxwidgets unicode
-# else
-# need-wxwidgets base-unicode
-# fi
-# fi
-# @CODE
-#
need-wxwidgets() {
- debug-print-function $FUNCNAME $*
-
local wxtoolkit wxdebug wxconf
if [[ -z ${WX_GTK_VER} ]]; then
- echo
eerror "WX_GTK_VER must be set before calling $FUNCNAME."
echo
- die "WX_GTK_VER missing"
+ die
fi
-
+
if [[ ${WX_GTK_VER} != 2.8 && ${WX_GTK_VER} != 2.9 ]]; then
- echo
eerror "Invalid WX_GTK_VER: ${WX_GTK_VER} - must be set to a valid wxGTK SLOT."
echo
- die "Invalid WX_GTK_VER"
+ die
fi
- debug-print "WX_GTK_VER is ${WX_GTK_VER}"
-
case $1 in
unicode|base-unicode) ;;
- *)
- eerror "Invalid $FUNCNAME argument: $1"
+ *) eerror "Invalid $FUNCNAME profile: $1"
echo
die
;;
esac
- # TODO: remove built_with_use
-
- # wxBase can be provided by both gtk2 and base installations
- if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* X; then
+ # wxbase is provided by both gtk2 and base installations
+ if has_version "x11-libs/wxGTK:${WX_GTK_VER}[X]"; then
wxtoolkit="gtk2"
else
wxtoolkit="base"
fi
- debug-print "wxtoolkit is ${wxtoolkit}"
-
# 2.8 has a separate debug tuple
if [[ ${WX_GTK_VER} == 2.8 ]]; then
- if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* debug; then
+ if has_version "x11-libs/wxGTK:${WX_GTK_VER}[debug]"; then
wxdebug="debug-"
else
wxdebug="release-"
fi
fi
- debug-print "wxdebug is ${wxdebug}"
-
- # put it all together
wxconf="${wxtoolkit}-unicode-${wxdebug}${WX_GTK_VER}"
- debug-print "wxconf is ${wxconf}"
-
- # if this doesn't work, something is seriously screwed
if [[ ! -f ${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf} ]]; then
echo
eerror "Failed to find configuration ${wxconf}"
echo
- die "Missing wx-config"
+ die
fi
- debug-print "Found config ${wxconf} - setting WX_CONFIG"
-
export WX_CONFIG="${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf}"
-
- debug-print "WX_CONFIG is ${WX_CONFIG}"
-
export WX_ECLASS_CONFIG="${WX_CONFIG}"
echo