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

Diff of /eclass/wxwidgets.eclass

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

Revision 1.23 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.23 2007/11/25 14:19:39 swegener 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# dirtyepic@gentoo.org
8# wxwindows@gentoo.org 7# wxwidgets@gentoo.org
9# @BLURB: Manages build configuration for wxGTK-using packages. 8# @BLURB: Manages build configuration for wxGTK-using packages.
10# @DESCRIPTION: 9# @DESCRIPTION:
11# The wxGTK libraries come in several different possible configurations 10# The wxGTK libraries come in several different possible configurations
12# (release/debug, ansi/unicode, etc.), most of which can be installed 11# (release, debug, ansi, unicode, etc.) most of which can be installed
13# side-by-side. The purpose of this eclass is to give ebuilds the ability to 12# side-by-side. The purpose of this eclass is to provide ebuilds the ability
14# specify what particular flavour they require to build against without 13# to build against a specific type of profile without interfering with the
15# interfering with the user-set system configuration. 14# user-set system configuration.
16# 15#
17# Ebuilds that use wxGTK must inherit this eclass. Otherwise the system 16# Ebuilds that use wxGTK _must_ inherit this eclass. Otherwise the system
18# default will be used, which would be anything the user set it to. 17# profile will be used, meaning whatever the user happened to set it to
18# through eselect-wxwidgets.
19# 19#
20# Ebuilds are also required to set the global 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. Note that in order for this to work, 21# the wxGTK SLOT the ebuild requires.
22# WX_GTK_VER needs to be set before inheriting the eclass.
23# 22#
24# Simple Usage: 23# Simple Usage:
25# 24#
25# @CODE
26# WX_GTK_VER="2.6" 26# WX_GTK_VER="2.8"
27#
27# inherit wxwidgets 28# inherit wxwidgets
28# DEPEND="=x11-libs/wxGTK-2.6*"
29# RDEPEND="=x11-libs/wxGTK-2.6*"
30# 29#
31# That's it. The eclass will select a sane default configuration to use. In 30# DEPEND="=x11-libs/wxGTK-2.8*" (or x11-libs/wxGTK:2.8 for >=EAPI 1)
32# wxGTK-2.6 the default is ansi. In wxGTK-2.8 and later it's unicode. These 31# RDEPEND="${DEPEND}"
33# are the defaults because they are always guaranteed to exist. 32# [...]
33# @CODE
34# 34#
35# You'll often find yourself in need of a bit more control. For that see the 35# In this case the eclass will use the default configuration, which is the GTK
36# libraries and either the "ansi" (in 2.6) or "unicode" (>=2.8) charsets.
37#
38# If you need more control over which profile(s) you need to use, see the
36# need-wxwidgets function below. 39# need-wxwidgets function below.
37 40
38inherit eutils multilib 41inherit eutils multilib
42
43case "${EAPI:-0}" in
44 0|1)
45 EXPORT_FUNCTIONS pkg_setup
46 ;;
47 *)
48 ;;
49esac
39 50
40# 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
41# can be overridden with need-wxwidgets later if need be. 52# can be overridden with need-wxwidgets later if need be.
42 53
43if [[ -z ${WX_CONFIG} ]]; then 54if [[ -z ${WX_CONFIG} ]]; then
49 fi 60 fi
50 61
51 for wxtoolkit in gtk2 base; do 62 for wxtoolkit in gtk2 base; do
52 for wxdebug in release debug; do 63 for wxdebug in release debug; do
53 wxconf="${wxtoolkit}-${wxchar}-${wxdebug}-${WX_GTK_VER}" 64 wxconf="${wxtoolkit}-${wxchar}-${wxdebug}-${WX_GTK_VER}"
54 [[ -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
55 WX_CONFIG="/usr/$(get_libdir)/wx/config/${wxconf}" 70 WX_CONFIG="/usr/$(get_libdir)/wx/config/${wxconf}"
56 # TODO: needed for the wx-config wrapper
57 WX_ECLASS_CONFIG="${WX_CONFIG}" 71 WX_ECLASS_CONFIG="${WX_CONFIG}"
58 break 72 break
59 done 73 done
60 [[ -n ${WX_CONFIG} ]] && break 74 [[ -n ${WX_CONFIG} ]] && break
61 done 75 done
62 [[ -n ${WX_CONFIG} ]] && export WX_CONFIG WX_ECLASS_CONFIG 76 [[ -n ${WX_CONFIG} ]] && export WX_CONFIG WX_ECLASS_CONFIG
63 fi 77 fi
64fi 78fi
65 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}
66 98
67# @FUNCTION: need-wxwidgets 99# @FUNCTION: need-wxwidgets
68# @USAGE: <configuration> 100# @USAGE: <configuration>
69# @DESCRIPTION: 101# @DESCRIPTION:
102#
70# need-wxwidgets is called with one argument, the wxGTK configuration to use. 103# need-wxwidgets is called with one argument, the wxGTK configuration to use.
71# 104#
72# Available configurations are: 105# Available configurations are:
73# 106#
74# ansi 107# ansi
75# unicode 108# unicode
76# base-ansi 109# base-ansi
77# base-unicode 110# base-unicode
78# 111#
79# Note that in >=wxGTK-2.8, only the unicode versions are available. The 112# Note that in >=wxGTK-2.8, only the unicode versions are available. The
80# eclass will automatically map ansi to unicode if WX_GTK_VER is set to 2.8 or 113# eclass will automatically map ansi to unicode for you if WX_GTK_VER is
81# later. 114# set to 2.8 or later.
82# 115#
83# There is one deprecated configuration, gtk2, that is equivalent to ansi. 116# There is one deprecated configuration, "gtk2", which is equivalent to ansi.
84# It is around for historical reasons and shouldn't be used by new ebuilds. 117# This is leftover from 2.4 when we had gtk1 and gtk2 builds and shouldn't
118# be used by new ebuilds.
85# 119#
86# This function will set the variable WX_CONFIG to the path of the wx-config 120# This function will export the variable WX_CONFIG, containing the absolute
87# script to use. In most cases you shouldn't have to use it since the 121# path to the wx-config script to use. In most cases you shouldn't need to
88# /usr/bin/wx-config wrapper points to ${WX_CONFIG} when called from portage. 122# use it since the /usr/bin/wx-config wrapper will already point to that
123# location when called from the eclass, but it's here if you do.
89 124
90need-wxwidgets() { 125need-wxwidgets() {
91 debug-print-function $FUNCNAME $* 126 debug-print-function $FUNCNAME $*
92 127
93 local wxtoolkit wxchar wxdebug wxconf 128 local wxtoolkit wxchar wxdebug wxconf
159 debug-print "wxchar is ${wxchar}" 194 debug-print "wxchar is ${wxchar}"
160 195
161 # since we're no longer in global scope we call built_with_use instead of 196 # since we're no longer in global scope we call built_with_use instead of
162 # all the crazy looping 197 # all the crazy looping
163 198
164 # base can be provided by both gtk2 and base installations 199 # wxBase can be provided by both gtk2 and base installations
165 if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* X; then 200 if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* X; then
166 wxtoolkit="gtk2" 201 wxtoolkit="gtk2"
167 else 202 else
168 wxtoolkit="base" 203 wxtoolkit="base"
169 fi 204 fi
192 die "Missing wx-config" 227 die "Missing wx-config"
193 fi 228 fi
194 229
195 debug-print "Found config ${wxconf} - setting WX_CONFIG" 230 debug-print "Found config ${wxconf} - setting WX_CONFIG"
196 231
197 # This is exported as some configure scripts will check for its presence in
198 # the environment.
199 export WX_CONFIG="/usr/$(get_libdir)/wx/config/${wxconf}" 232 export WX_CONFIG="/usr/$(get_libdir)/wx/config/${wxconf}"
200 233
201 debug-print "WX_CONFIG is ${WX_CONFIG}" 234 debug-print "WX_CONFIG is ${WX_CONFIG}"
202 235
203 # TODO: Used by the wx-config wrapper
204 export WX_ECLASS_CONFIG="${WX_CONFIG}" 236 export WX_ECLASS_CONFIG="${WX_CONFIG}"
205 237
206 echo 238 echo
207 einfo "Requested wxWidgets: ${1} ${WX_GTK_VER}" 239 einfo "Requested wxWidgets: ${1} ${WX_GTK_VER}"
208 einfo "Using wxWidgets: ${wxconf}" 240 einfo "Using wxWidgets: ${wxconf}"
211 243
212 244
213# @FUNCTION: check_wxuse 245# @FUNCTION: check_wxuse
214# @USAGE: <USE flag> 246# @USAGE: <USE flag>
215# @DESCRIPTION: 247# @DESCRIPTION:
248#
216# Provides a consistant way to check if wxGTK was built with a particular USE 249# Provides a consistant way to check if wxGTK was built with a particular USE
217# flag enabled. 250# flag enabled.
218 251
219check_wxuse() { 252check_wxuse() {
220 debug-print-function $FUNCNAME $* 253 debug-print-function $FUNCNAME $*
221 254
222 [[ -n ${WX_GTK_VER} ]] \ 255 if [[ -z ${WX_GTK_VER} ]]; then
256 echo
223 || _wxerror "WX_GTK_VER must be set before calling" 257 eerror "WX_GTK_VER must be set before calling $FUNCNAME."
224 258 echo
259 die "WX_GTK_VER missing"
260 fi
225 261
226 ebegin "Checking wxGTK-${WX_GTK_VER} for ${1} support" 262 ebegin "Checking wxGTK-${WX_GTK_VER} for ${1} support"
227 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
228 eend 0 264 eend 0
229 else 265 else

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

  ViewVC Help
Powered by ViewVC 1.1.20