summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorBenda Xu <heroxbd@gentoo.org>2014-12-04 18:06:29 +0900
committerBenda Xu <heroxbd@gentoo.org>2014-12-04 18:06:29 +0900
commit03cbb0c39bf7720f85819ed6fe5c2f0eaf87694f (patch)
tree663252f748affe2a2711880c5853b7e05b0e36b6 /eclass
parentsci-R/densityvis: track R density tool for ggplot2 (diff)
downloadandroid-03cbb0c39bf7720f85819ed6fe5c2f0eaf87694f.tar.gz
android-03cbb0c39bf7720f85819ed6fe5c2f0eaf87694f.tar.bz2
android-03cbb0c39bf7720f85819ed6fe5c2f0eaf87694f.zip
dev-python/wxpython from gx86 directly: the version from prefix is old.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/wxwidgets.eclass276
1 files changed, 68 insertions, 208 deletions
diff --git a/eclass/wxwidgets.eclass b/eclass/wxwidgets.eclass
index 16a0cc5..aa8f920 100644
--- a/eclass/wxwidgets.eclass
+++ b/eclass/wxwidgets.eclass
@@ -1,82 +1,71 @@
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/wxwidgets.eclass,v 1.34 2013/08/16 07:59:17 heroxbd Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/wxwidgets.eclass,v 1.39 2014/04/21 21:55:31 ottxor 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)
#
-# @CODE
-# WX_GTK_VER="2.8"
-#
-# inherit wxwidgets
+# 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.
#
-# DEPEND="x11-libs/wxGTK:2.8[X]"
-# RDEPEND="${DEPEND}"
-# [...]
+# @CODE
+# inherit wxwidgets
+#
+# IUSE="X wxwidgets"
+# DEPEND="wxwidgets? ( x11-libs/wxGTK:2.8[X?] )"
+#
+# 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 (in 2.6 the default is "ansi", all other versions default to
-# "unicode").
+# 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
-case "${EAPI:-0}" in
- 0|1)
- EXPORT_FUNCTIONS pkg_setup
- ;;
- *)
- ;;
-esac
-
-# 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
- if [[ ${WX_GTK_VER} == 2.6 ]]; then
- wxchar="ansi"
- else
- wxchar="unicode"
- fi
- for wxtoolkit in gtk2 base; do
+ for wxtoolkit in mac gtk2 base; do
# newer versions don't have a seperate debug profile
for wxdebug in xxx release- debug-; do
- wxconf="${wxtoolkit}-${wxchar}-${wxdebug/xxx/}${WX_GTK_VER}"
- if [[ -f ${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf} ]]; then
- # if this is a wxBase install, die in pkg_setup
- [[ ${wxtoolkit} == "base" ]] && WXBASE_DIE=1
- else
- continue
- fi
+ wxconf="${wxtoolkit}-unicode-${wxdebug/xxx/}${WX_GTK_VER}"
+
+ [[ -f ${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf} ]] || continue
+
WX_CONFIG="${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf}"
WX_ECLASS_CONFIG="${WX_CONFIG}"
break
@@ -87,161 +76,66 @@ if [[ -z ${WX_CONFIG} ]]; then
fi
fi
-# @FUNCTION: wxwidgets_pkg_setup
-# @DESCRIPTION:
-#
-# It's possible for wxGTK to be installed with USE="-X", resulting in something
-# called wxBase. There's only ever been a couple packages in the tree that use
-# wxBase so this is probably not what you want. Whenever possible, use EAPI 2
-# USE dependencies(tm) to ensure that wxGTK was built with USE="X". This
-# function is only exported for EAPI 0 or 1 and catches any remaining cases.
-#
-# If you do use wxBase, don't set WX_GTK_VER before inherit. Use
-# need-wxwidgets() instead.
-
-wxwidgets_pkg_setup() {
- [[ -n $WXBASE_DIE ]] && check_wxuse X
-}
-
-# @FUNCTION: need-wxwidgets
-# @USAGE: <configuration>
+# @FUNCTION: need-wxwidgets
+# @USAGE: <profile>
# @DESCRIPTION:
#
# Available configurations are:
#
-# [2.6] ansi [>=2.8] unicode
-# unicode base-unicode
-# base
-# base-unicode
-#
-# 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
-#
+# unicode (USE="X")
+# base-unicode (USE="-X")
need-wxwidgets() {
- debug-print-function $FUNCNAME $*
-
- local wxtoolkit wxchar wxdebug wxconf
+ 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.6 && ${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"
+
+ if [[ ${WX_GTK_VER} != 2.8 && ${WX_GTK_VER} != 2.9 && ${WX_GTK_VER} != 3.0 ]]; then
+ eerror "Invalid WX_GTK_VER: ${WX_GTK_VER} - must be set to a valid wxGTK SLOT."
+ echo
+ die
fi
- debug-print "WX_GTK_VER is ${WX_GTK_VER}"
-
case $1 in
- ansi)
- debug-print-section ansi
- if [[ ${WX_GTK_VER} == 2.6 ]]; then
- wxchar="ansi"
- else
- wxchar="unicode"
- fi
- check_wxuse X
- ;;
- unicode)
- debug-print-section unicode
- check_wxuse X
- [[ ${WX_GTK_VER} == 2.6 ]] && check_wxuse unicode
- wxchar="unicode"
- ;;
- base)
- debug-print-section base
- if [[ ${WX_GTK_VER} == 2.6 ]]; then
- wxchar="ansi"
- else
- wxchar="unicode"
- fi
- ;;
- base-unicode)
- debug-print-section base-unicode
- [[ ${WX_GTK_VER} == 2.6 ]] && check_wxuse unicode
- wxchar="unicode"
- ;;
- # backwards compatibility
- gtk2)
- debug-print-section gtk2
- if [[ ${WX_GTK_VER} == 2.6 ]]; then
- wxchar="ansi"
- else
- wxchar="unicode"
- fi
- check_wxuse X
- ;;
- *)
- echo
- eerror "Invalid $FUNCNAME argument: $1"
+ unicode|base-unicode) ;;
+ *) eerror "Invalid $FUNCNAME profile: $1"
echo
- die "Invalid argument"
+ die
;;
esac
- debug-print "wxchar is ${wxchar}"
-
- # 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}[aqua]"; then
+ wxtoolkit="mac"
+ elif has_version "x11-libs/wxGTK:${WX_GTK_VER}[X]"; then
wxtoolkit="gtk2"
else
wxtoolkit="base"
fi
- debug-print "wxtoolkit is ${wxtoolkit}"
-
- # debug or release?
- if [[ ${WX_GTK_VER} == 2.6 || ${WX_GTK_VER} == 2.8 ]]; then
- if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* debug; then
+ # 2.8 has a separate debug element
+ if [[ ${WX_GTK_VER} == 2.8 ]]; 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}-${wxchar}-${wxdebug}${WX_GTK_VER}"
+ 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
@@ -249,37 +143,3 @@ need-wxwidgets() {
einfo "Using wxWidgets: ${wxconf}"
echo
}
-
-
-# @FUNCTION: check_wxuse
-# @USAGE: <USE flag>
-# @DESCRIPTION:
-#
-# Provides a consistant way to check if wxGTK was built with a particular USE
-# flag enabled. A better way is EAPI 2 USE dependencies (hint hint).
-
-check_wxuse() {
- debug-print-function $FUNCNAME $*
-
- if [[ -z ${WX_GTK_VER} ]]; then
- echo
- eerror "WX_GTK_VER must be set before calling $FUNCNAME."
- echo
- die "WX_GTK_VER missing"
- fi
-
- # TODO: Remove built_with_use
-
- ebegin "Checking wxGTK-${WX_GTK_VER} for ${1} support"
- if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* "${1}"; then
- eend 0
- else
- eend 1
- echo
- eerror "${FUNCNAME} - You have requested functionality that requires ${1} support to"
- eerror "have been built into x11-libs/wxGTK."
- eerror
- eerror "Please re-merge =x11-libs/wxGTK-${WX_GTK_VER}* with the ${1} USE flag enabled."
- die "Missing USE flags."
- fi
-}