/[gentoo-x86]/eclass/wxwidgets.eclass
Gentoo

Diff of /eclass/wxwidgets.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.24 Revision 1.28
1# Copyright 1999-2007 Gentoo Foundation 1# Copyright 1999-2007 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/wxwidgets.eclass,v 1.24 2007/12/21 04:32:41 dirtyepic Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/wxwidgets.eclass,v 1.28 2009/09/07 00:29:47 dirtyepic Exp $
4 4
5# @ECLASS: wxwidgets.eclass 5# @ECLASS: wxwidgets.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# wxwindows@gentoo.org 7# wxwidgets@gentoo.org
8# @BLURB: Manages build configuration for wxGTK-using packages. 8# @BLURB: Manages build configuration for wxGTK-using packages.
9# @DESCRIPTION: 9# @DESCRIPTION:
10# The wxGTK libraries come in several different possible configurations 10# The wxGTK libraries come in several different possible configurations
11# (release/debug, ansi/unicode, etc.) some of which can be installed 11# (release, debug, ansi, unicode, etc.) most of which can be installed
12# side-by-side. The purpose of this eclass is to provide ebuilds the ability 12# side-by-side. The purpose of this eclass is to provide ebuilds the ability
13# to build against a specific type without interfering with the user-set 13# to build against a specific type of profile without interfering with the
14# system configuration. 14# user-set system configuration.
15# 15#
16# Ebuilds that use wxGTK must inherit this eclass. Otherwise the system 16# Ebuilds that use wxGTK _must_ inherit this eclass. Otherwise the system
17# default will be used, which would be anything the user set it to through 17# profile will be used, meaning whatever the user happened to set it to
18# eselect-wxwidgets. 18# through eselect-wxwidgets.
19# 19#
20# Ebuilds are also required to set the variable WX_GTK_VER, containing 20# Ebuilds are also required to set the variable WX_GTK_VER, containing
21# the wxGTK SLOT the ebuild requires. You can either set this before the 21# the wxGTK SLOT the ebuild requires.
22# inherit line to get the default type for that SLOT, or later before calling
23# the need-wxwidgets function.
24# 22#
25# Simple Usage: 23# Simple Usage:
26# 24#
27# @CODE 25# @CODE
28# WX_GTK_VER="2.6" 26# WX_GTK_VER="2.8"
29# 27#
30# inherit wxwidgets 28# inherit wxwidgets
31# 29#
32# DEPEND="=x11-libs/wxGTK-2.6*" (or x11-libs/wxGTK:2.6 for EAPI 1) 30# DEPEND="=x11-libs/wxGTK-2.8*" (or x11-libs/wxGTK:2.8 for >=EAPI 1)
33# RDEPEND="${DEPEND}" 31# RDEPEND="${DEPEND}"
34# [...] 32# [...]
35# @CODE 33# @CODE
36# 34#
37# The eclass will select the default configuration, which is "ansi" in 2.6 35# In this case the eclass will use the default configuration, which is the GTK
38# and "unicode" in >=2.8. These are the defaults because they're always 36# libraries and either the "ansi" (in 2.6) or "unicode" (>=2.8) charsets.
39# guaranteed to exist.
40# 37#
41# If you need more control over which version you need to use, see the 38# If you need more control over which profile(s) you need to use, see the
42# need-wxwidgets function below. 39# need-wxwidgets function below.
43 40
44inherit eutils multilib 41inherit eutils multilib
42
43case "${EAPI:-0}" in
44 0|1)
45 EXPORT_FUNCTIONS pkg_setup
46 ;;
47 *)
48 ;;
49esac
45 50
46# We do this globally so ebuilds can get sane defaults just by inheriting. They 51# We do this globally so ebuilds can get sane defaults just by inheriting. They
47# can be overridden with need-wxwidgets later if need be. 52# can be overridden with need-wxwidgets later if need be.
48 53
49if [[ -z ${WX_CONFIG} ]]; then 54if [[ -z ${WX_CONFIG} ]]; then
55 fi 60 fi
56 61
57 for wxtoolkit in gtk2 base; do 62 for wxtoolkit in gtk2 base; do
58 for wxdebug in release debug; do 63 for wxdebug in release debug; do
59 wxconf="${wxtoolkit}-${wxchar}-${wxdebug}-${WX_GTK_VER}" 64 wxconf="${wxtoolkit}-${wxchar}-${wxdebug}-${WX_GTK_VER}"
60 [[ -f /usr/$(get_libdir)/wx/config/${wxconf} ]] || continue 65 if [[ -f /usr/$(get_libdir)/wx/config/${wxconf} ]]; then
66 [[ ${wxtoolkit} == "base" ]] && WXBASE_DIE=1 # see wxwidgets_pkg_setup
67 else
68 continue
69 fi
61 WX_CONFIG="/usr/$(get_libdir)/wx/config/${wxconf}" 70 WX_CONFIG="/usr/$(get_libdir)/wx/config/${wxconf}"
62 # TODO: needed for the wx-config wrapper
63 WX_ECLASS_CONFIG="${WX_CONFIG}" 71 WX_ECLASS_CONFIG="${WX_CONFIG}"
64 break 72 break
65 done 73 done
66 [[ -n ${WX_CONFIG} ]] && break 74 [[ -n ${WX_CONFIG} ]] && break
67 done 75 done
68 [[ -n ${WX_CONFIG} ]] && export WX_CONFIG WX_ECLASS_CONFIG 76 [[ -n ${WX_CONFIG} ]] && export WX_CONFIG WX_ECLASS_CONFIG
69 fi 77 fi
70fi 78fi
71 79
80# @FUNCTION: wxwidgets_pkg_setup
81# @DESCRIPTION:
82#
83# 99.99% of the time, packages building against wxGTK need the GTK libraries.
84# When using the "Simple Usage" case above (WX_GTK_VER before inherit), we have
85# to take into account that the user may have only installed the base libraries
86# (with USE="-X"). Since we can't die in global scope we instead check for
87# the presence of a base profile and then die here if found.
88#
89# If you do need to build against the wxBase libraries, you'll have to use
90# need-wxwidgets to do so.
91#
92# Note that with an EAPI 2 ebuild you should just DEPEND on x11-libs/wxGTK:2.8[X]
93# and ignore all this nonsense.
94
95wxwidgets_pkg_setup() {
96 [[ -n $WXBASE_DIE ]] && check_wxuse X
97}
72 98
73# @FUNCTION: need-wxwidgets 99# @FUNCTION: need-wxwidgets
74# @USAGE: <configuration> 100# @USAGE: <configuration>
75# @DESCRIPTION: 101# @DESCRIPTION:
76# 102#
224# flag enabled. 250# flag enabled.
225 251
226check_wxuse() { 252check_wxuse() {
227 debug-print-function $FUNCNAME $* 253 debug-print-function $FUNCNAME $*
228 254
229 [[ -n ${WX_GTK_VER} ]] \ 255 if [[ -z ${WX_GTK_VER} ]]; then
256 echo
230 || _wxerror "WX_GTK_VER must be set before calling" 257 eerror "WX_GTK_VER must be set before calling $FUNCNAME."
231 258 echo
259 die "WX_GTK_VER missing"
260 fi
232 261
233 ebegin "Checking wxGTK-${WX_GTK_VER} for ${1} support" 262 ebegin "Checking wxGTK-${WX_GTK_VER} for ${1} support"
234 if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* "${1}"; then 263 if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* "${1}"; then
235 eend 0 264 eend 0
236 else 265 else

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.28

  ViewVC Help
Powered by ViewVC 1.1.20