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

Contents of /eclass/wxwidgets.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.25 - (hide annotations) (download)
Tue Dec 25 14:46:29 2007 UTC (6 years, 6 months ago) by leio
Branch: MAIN
Changes since 1.24: +7 -4 lines
Use the same erroring logic for WX_GTK_VER==unset case in check_wxuse as in need-wxwidgets to solve bug 203298 (unknown function _wxerror)

1 dirtyepic 1.19 # Copyright 1999-2007 Gentoo Foundation
2 pythonhead 1.1 # Distributed under the terms of the GNU General Public License v2
3 leio 1.25 # $Header: /var/cvsroot/gentoo-x86/eclass/wxwidgets.eclass,v 1.24 2007/12/21 04:32:41 dirtyepic Exp $
4 dirtyepic 1.20
5     # @ECLASS: wxwidgets.eclass
6     # @MAINTAINER:
7     # wxwindows@gentoo.org
8     # @BLURB: Manages build configuration for wxGTK-using packages.
9     # @DESCRIPTION:
10     # The wxGTK libraries come in several different possible configurations
11 dirtyepic 1.24 # (release/debug, ansi/unicode, etc.) some of which can be installed
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
14     # system configuration.
15 dirtyepic 1.20 #
16     # Ebuilds that use wxGTK must inherit this eclass. Otherwise the system
17 dirtyepic 1.24 # default will be used, which would be anything the user set it to through
18     # eselect-wxwidgets.
19 dirtyepic 1.20 #
20 dirtyepic 1.24 # 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
22     # inherit line to get the default type for that SLOT, or later before calling
23     # the need-wxwidgets function.
24 dirtyepic 1.20 #
25     # Simple Usage:
26     #
27 dirtyepic 1.24 # @CODE
28     # WX_GTK_VER="2.6"
29 dirtyepic 1.20 #
30 dirtyepic 1.24 # inherit wxwidgets
31     #
32     # DEPEND="=x11-libs/wxGTK-2.6*" (or x11-libs/wxGTK:2.6 for EAPI 1)
33     # RDEPEND="${DEPEND}"
34     # [...]
35     # @CODE
36     #
37     # The eclass will select the default configuration, which is "ansi" in 2.6
38     # and "unicode" in >=2.8. These are the defaults because they're always
39     # guaranteed to exist.
40     #
41     # If you need more control over which version you need to use, see the
42 dirtyepic 1.20 # need-wxwidgets function below.
43    
44     inherit eutils multilib
45 pythonhead 1.1
46 dirtyepic 1.20 # 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.
48 pythonhead 1.1
49 dirtyepic 1.21 if [[ -z ${WX_CONFIG} ]]; then
50 dirtyepic 1.20 if [[ -n ${WX_GTK_VER} ]]; then
51     if [[ ${WX_GTK_VER} == 2.6 ]]; then
52     wxchar="ansi"
53     elif [[ ${WX_GTK_VER} == 2.8 ]]; then
54     wxchar="unicode"
55     fi
56    
57     for wxtoolkit in gtk2 base; do
58     for wxdebug in release debug; do
59     wxconf="${wxtoolkit}-${wxchar}-${wxdebug}-${WX_GTK_VER}"
60     [[ -f /usr/$(get_libdir)/wx/config/${wxconf} ]] || continue
61     WX_CONFIG="/usr/$(get_libdir)/wx/config/${wxconf}"
62     # TODO: needed for the wx-config wrapper
63     WX_ECLASS_CONFIG="${WX_CONFIG}"
64     break
65     done
66     [[ -n ${WX_CONFIG} ]] && break
67     done
68     [[ -n ${WX_CONFIG} ]] && export WX_CONFIG WX_ECLASS_CONFIG
69     fi
70     fi
71 pythonhead 1.1
72 dirtyepic 1.20
73     # @FUNCTION: need-wxwidgets
74     # @USAGE: <configuration>
75     # @DESCRIPTION:
76 dirtyepic 1.24 #
77 dirtyepic 1.20 # need-wxwidgets is called with one argument, the wxGTK configuration to use.
78     #
79     # Available configurations are:
80     #
81 dirtyepic 1.24 # ansi
82     # unicode
83     # base-ansi
84     # base-unicode
85 dirtyepic 1.20 #
86     # Note that in >=wxGTK-2.8, only the unicode versions are available. The
87 dirtyepic 1.24 # eclass will automatically map ansi to unicode for you if WX_GTK_VER is
88     # set to 2.8 or later.
89 dirtyepic 1.20 #
90 dirtyepic 1.24 # There is one deprecated configuration, "gtk2", which is equivalent to ansi.
91     # This is leftover from 2.4 when we had gtk1 and gtk2 builds and shouldn't
92     # be used by new ebuilds.
93     #
94     # This function will export the variable WX_CONFIG, containing the absolute
95     # path to the wx-config script to use. In most cases you shouldn't need to
96     # use it since the /usr/bin/wx-config wrapper will already point to that
97     # location when called from the eclass, but it's here if you do.
98 pythonhead 1.1
99     need-wxwidgets() {
100     debug-print-function $FUNCNAME $*
101    
102 dirtyepic 1.20 local wxtoolkit wxchar wxdebug wxconf
103    
104     if [[ -z ${WX_GTK_VER} ]]; then
105     echo
106     eerror "WX_GTK_VER must be set before calling $FUNCNAME."
107     echo
108     die "WX_GTK_VER missing"
109 pythonhead 1.4 fi
110 pythonhead 1.1
111 dirtyepic 1.20 if [[ ${WX_GTK_VER} != 2.6 \
112     && ${WX_GTK_VER} != 2.8 ]]; then
113     echo
114     eerror "Invalid WX_GTK_VER: ${WX_GTK_VER} - must be set to a valid wxGTK SLOT."
115     echo
116     die "Invalid WX_GTK_VER"
117     fi
118 pythonhead 1.1
119 dirtyepic 1.20 debug-print "WX_GTK_VER is ${WX_GTK_VER}"
120 pythonhead 1.1
121 dirtyepic 1.20 case $1 in
122     ansi)
123     debug-print-section ansi
124     if [[ ${WX_GTK_VER} == 2.6 ]]; then
125     wxchar="ansi"
126     else
127     wxchar="unicode"
128     fi
129     check_wxuse X
130     ;;
131     unicode)
132     debug-print-section unicode
133     check_wxuse X
134     [[ ${WX_GTK_VER} == 2.6 ]] && check_wxuse unicode
135     wxchar="unicode"
136     ;;
137     base)
138     debug-print-section base
139     if [[ ${WX_GTK_VER} == 2.6 ]]; then
140     wxchar="ansi"
141     else
142     wxchar="unicode"
143     fi
144     ;;
145     base-unicode)
146     debug-print-section base-unicode
147     [[ ${WX_GTK_VER} == 2.6 ]] && check_wxuse unicode
148     wxchar="unicode"
149     ;;
150     # backwards compatibility
151     gtk2)
152     debug-print-section gtk2
153     if [[ ${WX_GTK_VER} == 2.6 ]]; then
154     wxchar="ansi"
155     else
156     wxchar="unicode"
157     fi
158     check_wxuse X
159     ;;
160     *)
161     echo
162     eerror "Invalid $FUNCNAME argument: $1"
163     echo
164     die "Invalid argument"
165     ;;
166     esac
167    
168     debug-print "wxchar is ${wxchar}"
169    
170     # since we're no longer in global scope we call built_with_use instead of
171     # all the crazy looping
172    
173 dirtyepic 1.24 # wxBase can be provided by both gtk2 and base installations
174 swegener 1.23 if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* X; then
175 dirtyepic 1.20 wxtoolkit="gtk2"
176 pythonhead 1.4 else
177 dirtyepic 1.20 wxtoolkit="base"
178     fi
179    
180     debug-print "wxtoolkit is ${wxtoolkit}"
181    
182     # debug or release?
183 swegener 1.23 if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* debug; then
184 dirtyepic 1.20 wxdebug="debug"
185 pythonhead 1.1 else
186 dirtyepic 1.20 wxdebug="release"
187     fi
188    
189     debug-print "wxdebug is ${wxdebug}"
190    
191     # put it all together
192     wxconf="${wxtoolkit}-${wxchar}-${wxdebug}-${WX_GTK_VER}"
193    
194     debug-print "wxconf is ${wxconf}"
195    
196     # if this doesn't work, something is seriously screwed
197     if [[ ! -f /usr/$(get_libdir)/wx/config/${wxconf} ]]; then
198     echo
199     eerror "Failed to find configuration ${wxconf}"
200     echo
201     die "Missing wx-config"
202 pythonhead 1.1 fi
203 dirtyepic 1.20
204     debug-print "Found config ${wxconf} - setting WX_CONFIG"
205    
206     export WX_CONFIG="/usr/$(get_libdir)/wx/config/${wxconf}"
207    
208     debug-print "WX_CONFIG is ${WX_CONFIG}"
209    
210     export WX_ECLASS_CONFIG="${WX_CONFIG}"
211    
212     echo
213 dirtyepic 1.22 einfo "Requested wxWidgets: ${1} ${WX_GTK_VER}"
214     einfo "Using wxWidgets: ${wxconf}"
215 dirtyepic 1.20 echo
216 pythonhead 1.1 }
217    
218 dirtyepic 1.20
219     # @FUNCTION: check_wxuse
220     # @USAGE: <USE flag>
221     # @DESCRIPTION:
222 dirtyepic 1.24 #
223 dirtyepic 1.20 # Provides a consistant way to check if wxGTK was built with a particular USE
224     # flag enabled.
225    
226 dirtyepic 1.19 check_wxuse() {
227 dirtyepic 1.20 debug-print-function $FUNCNAME $*
228    
229 leio 1.25 if [[ -z ${WX_GTK_VER} ]]; then
230     echo
231     eerror "WX_GTK_VER must be set before calling $FUNCNAME."
232     echo
233     die "WX_GTK_VER missing"
234     fi
235 dirtyepic 1.19
236     ebegin "Checking wxGTK-${WX_GTK_VER} for ${1} support"
237 swegener 1.23 if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* "${1}"; then
238 dirtyepic 1.19 eend 0
239     else
240     eend 1
241     echo
242     eerror "${FUNCNAME} - You have requested functionality that requires ${1} support to"
243     eerror "have been built into x11-libs/wxGTK."
244     eerror
245     eerror "Please re-merge =x11-libs/wxGTK-${WX_GTK_VER}* with the ${1} USE flag enabled."
246     die "Missing USE flags."
247     fi
248     }

  ViewVC Help
Powered by ViewVC 1.1.20