1 |
dirtyepic 10/02/16 01:06:24 |
2 |
|
3 |
Modified: wxwidgets.eclass |
4 |
Log: |
5 |
Add support for 2.9 development builds, which no longer have seperate ansi/unicode and debug/release libraries. Clarify documentation. |
6 |
|
7 |
Revision Changes Path |
8 |
1.29 eclass/wxwidgets.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/wxwidgets.eclass?rev=1.29&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/wxwidgets.eclass?rev=1.29&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/wxwidgets.eclass?r1=1.28&r2=1.29 |
13 |
|
14 |
Index: wxwidgets.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/wxwidgets.eclass,v |
17 |
retrieving revision 1.28 |
18 |
retrieving revision 1.29 |
19 |
diff -u -r1.28 -r1.29 |
20 |
--- wxwidgets.eclass 7 Sep 2009 00:29:47 -0000 1.28 |
21 |
+++ wxwidgets.eclass 16 Feb 2010 01:06:24 -0000 1.29 |
22 |
@@ -1,6 +1,6 @@ |
23 |
# Copyright 1999-2007 Gentoo Foundation |
24 |
# Distributed under the terms of the GNU General Public License v2 |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/wxwidgets.eclass,v 1.28 2009/09/07 00:29:47 dirtyepic Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/wxwidgets.eclass,v 1.29 2010/02/16 01:06:24 dirtyepic Exp $ |
27 |
|
28 |
# @ECLASS: wxwidgets.eclass |
29 |
# @MAINTAINER: |
30 |
@@ -13,30 +13,37 @@ |
31 |
# to build against a specific type of profile without interfering with the |
32 |
# user-set system configuration. |
33 |
# |
34 |
-# Ebuilds that use wxGTK _must_ inherit this eclass. Otherwise the system |
35 |
-# profile will be used, meaning whatever the user happened to set it to |
36 |
-# through eselect-wxwidgets. |
37 |
+# Ebuilds that use wxGTK _must_ inherit this eclass. |
38 |
# |
39 |
-# Ebuilds are also required to set the variable WX_GTK_VER, containing |
40 |
-# the wxGTK SLOT the ebuild requires. |
41 |
+# - Using this eclass - |
42 |
# |
43 |
-# Simple Usage: |
44 |
+# 1. set WX_GTK_VER to a valid wxGTK SLOT |
45 |
+# 2. inherit wxwidgets |
46 |
+# 3. add an appropriate DEPEND |
47 |
+# 4. done |
48 |
# |
49 |
# @CODE |
50 |
# WX_GTK_VER="2.8" |
51 |
# |
52 |
# inherit wxwidgets |
53 |
# |
54 |
-# DEPEND="=x11-libs/wxGTK-2.8*" (or x11-libs/wxGTK:2.8 for >=EAPI 1) |
55 |
+# DEPEND="x11-libs/wxGTK:2.8[X]" |
56 |
# RDEPEND="${DEPEND}" |
57 |
# [...] |
58 |
# @CODE |
59 |
# |
60 |
-# In this case the eclass will use the default configuration, which is the GTK |
61 |
-# libraries and either the "ansi" (in 2.6) or "unicode" (>=2.8) charsets. |
62 |
-# |
63 |
-# If you need more control over which profile(s) you need to use, see the |
64 |
-# need-wxwidgets function below. |
65 |
+# This will get you the default configuration, which is what you want 99% |
66 |
+# of the time (in 2.6 the default is "ansi", all other versions default to |
67 |
+# "unicode"). |
68 |
+# |
69 |
+# If your package has optional wxGTK support controlled by a USE flag or you |
70 |
+# need to use the wxBase libraries (USE="-X") then you should not set |
71 |
+# WX_GTK_VER before inherit and instead refer to the need-wxwidgets function |
72 |
+# below. |
73 |
+# |
74 |
+# The variable WX_CONFIG is exported, containing the absolute path to the |
75 |
+# wx-config file to use. Most configure scripts use this path if it's set in |
76 |
+# the environment or accept --with-wx-config="${WX_CONFIG}". |
77 |
|
78 |
inherit eutils multilib |
79 |
|
80 |
@@ -51,19 +58,22 @@ |
81 |
# We do this globally so ebuilds can get sane defaults just by inheriting. They |
82 |
# can be overridden with need-wxwidgets later if need be. |
83 |
|
84 |
+# ensure this only runs once |
85 |
if [[ -z ${WX_CONFIG} ]]; then |
86 |
+ # and only if WX_GTK_VER is set before inherit |
87 |
if [[ -n ${WX_GTK_VER} ]]; then |
88 |
if [[ ${WX_GTK_VER} == 2.6 ]]; then |
89 |
wxchar="ansi" |
90 |
- elif [[ ${WX_GTK_VER} == 2.8 ]]; then |
91 |
+ else |
92 |
wxchar="unicode" |
93 |
fi |
94 |
- |
95 |
for wxtoolkit in gtk2 base; do |
96 |
- for wxdebug in release debug; do |
97 |
- wxconf="${wxtoolkit}-${wxchar}-${wxdebug}-${WX_GTK_VER}" |
98 |
+ # newer versions don't have a seperate debug profile |
99 |
+ for wxdebug in xxx release- debug-; do |
100 |
+ wxconf="${wxtoolkit}-${wxchar}-${wxdebug/xxx/}${WX_GTK_VER}" |
101 |
if [[ -f /usr/$(get_libdir)/wx/config/${wxconf} ]]; then |
102 |
- [[ ${wxtoolkit} == "base" ]] && WXBASE_DIE=1 # see wxwidgets_pkg_setup |
103 |
+ # if this is a wxBase install, die in pkg_setup |
104 |
+ [[ ${wxtoolkit} == "base" ]] && WXBASE_DIE=1 |
105 |
else |
106 |
continue |
107 |
fi |
108 |
@@ -80,17 +90,14 @@ |
109 |
# @FUNCTION: wxwidgets_pkg_setup |
110 |
# @DESCRIPTION: |
111 |
# |
112 |
-# 99.99% of the time, packages building against wxGTK need the GTK libraries. |
113 |
-# When using the "Simple Usage" case above (WX_GTK_VER before inherit), we have |
114 |
-# to take into account that the user may have only installed the base libraries |
115 |
-# (with USE="-X"). Since we can't die in global scope we instead check for |
116 |
-# the presence of a base profile and then die here if found. |
117 |
-# |
118 |
-# If you do need to build against the wxBase libraries, you'll have to use |
119 |
-# need-wxwidgets to do so. |
120 |
+# It's possible for wxGTK to be installed with USE="-X", resulting in something |
121 |
+# called wxBase. There's only ever been a couple packages in the tree that use |
122 |
+# wxBase so this is probably not what you want. Whenever possible, use EAPI 2 |
123 |
+# USE dependencies(tm) to ensure that wxGTK was built with USE="X". This |
124 |
+# function is only exported for EAPI 0 or 1 and catches any remaining cases. |
125 |
# |
126 |
-# Note that with an EAPI 2 ebuild you should just DEPEND on x11-libs/wxGTK:2.8[X] |
127 |
-# and ignore all this nonsense. |
128 |
+# If you do use wxBase, don't set WX_GTK_VER before inherit. Use |
129 |
+# need-wxwidgets() instead. |
130 |
|
131 |
wxwidgets_pkg_setup() { |
132 |
[[ -n $WXBASE_DIE ]] && check_wxuse X |
133 |
@@ -100,27 +107,29 @@ |
134 |
# @USAGE: <configuration> |
135 |
# @DESCRIPTION: |
136 |
# |
137 |
-# need-wxwidgets is called with one argument, the wxGTK configuration to use. |
138 |
-# |
139 |
# Available configurations are: |
140 |
# |
141 |
-# ansi |
142 |
-# unicode |
143 |
-# base-ansi |
144 |
-# base-unicode |
145 |
-# |
146 |
-# Note that in >=wxGTK-2.8, only the unicode versions are available. The |
147 |
-# eclass will automatically map ansi to unicode for you if WX_GTK_VER is |
148 |
-# set to 2.8 or later. |
149 |
-# |
150 |
-# There is one deprecated configuration, "gtk2", which is equivalent to ansi. |
151 |
-# This is leftover from 2.4 when we had gtk1 and gtk2 builds and shouldn't |
152 |
-# be used by new ebuilds. |
153 |
-# |
154 |
-# This function will export the variable WX_CONFIG, containing the absolute |
155 |
-# path to the wx-config script to use. In most cases you shouldn't need to |
156 |
-# use it since the /usr/bin/wx-config wrapper will already point to that |
157 |
-# location when called from the eclass, but it's here if you do. |
158 |
+# [2.6] ansi [>=2.8] unicode |
159 |
+# unicode base-unicode |
160 |
+# base |
161 |
+# base-unicode |
162 |
+# |
163 |
+# If your package has optional wxGTK support controlled by a USE flag, set |
164 |
+# WX_GTK_VER inside a conditional rather than before inherit. Some broken |
165 |
+# configure scripts will force wxGTK on if they find ${WX_CONFIG} set. |
166 |
+# |
167 |
+# @CODE |
168 |
+# src_configure() { |
169 |
+# if use wxwidgets; then |
170 |
+# WX_GTK_VER="2.8" |
171 |
+# if use X; then |
172 |
+# need-wxwidgets unicode |
173 |
+# else |
174 |
+# need-wxwidgets base-unicode |
175 |
+# fi |
176 |
+# fi |
177 |
+# @CODE |
178 |
+# |
179 |
|
180 |
need-wxwidgets() { |
181 |
debug-print-function $FUNCNAME $* |
182 |
@@ -134,8 +143,7 @@ |
183 |
die "WX_GTK_VER missing" |
184 |
fi |
185 |
|
186 |
- if [[ ${WX_GTK_VER} != 2.6 \ |
187 |
- && ${WX_GTK_VER} != 2.8 ]]; then |
188 |
+ if [[ ${WX_GTK_VER} != 2.6 && ${WX_GTK_VER} != 2.8 && ${WX_GTK_VER} != 2.9 ]]; then |
189 |
echo |
190 |
eerror "Invalid WX_GTK_VER: ${WX_GTK_VER} - must be set to a valid wxGTK SLOT." |
191 |
echo |
192 |
@@ -193,8 +201,7 @@ |
193 |
|
194 |
debug-print "wxchar is ${wxchar}" |
195 |
|
196 |
- # since we're no longer in global scope we call built_with_use instead of |
197 |
- # all the crazy looping |
198 |
+ # TODO: remove built_with_use |
199 |
|
200 |
# wxBase can be provided by both gtk2 and base installations |
201 |
if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* X; then |
202 |
@@ -206,16 +213,18 @@ |
203 |
debug-print "wxtoolkit is ${wxtoolkit}" |
204 |
|
205 |
# debug or release? |
206 |
- if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* debug; then |
207 |
- wxdebug="debug" |
208 |
- else |
209 |
- wxdebug="release" |
210 |
+ if [[ ${WX_GTK_VER} == 2.6 || ${WX_GTK_VER} == 2.8 ]]; then |
211 |
+ if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* debug; then |
212 |
+ wxdebug="debug-" |
213 |
+ else |
214 |
+ wxdebug="release-" |
215 |
+ fi |
216 |
fi |
217 |
|
218 |
debug-print "wxdebug is ${wxdebug}" |
219 |
|
220 |
# put it all together |
221 |
- wxconf="${wxtoolkit}-${wxchar}-${wxdebug}-${WX_GTK_VER}" |
222 |
+ wxconf="${wxtoolkit}-${wxchar}-${wxdebug}${WX_GTK_VER}" |
223 |
|
224 |
debug-print "wxconf is ${wxconf}" |
225 |
|
226 |
@@ -247,7 +256,7 @@ |
227 |
# @DESCRIPTION: |
228 |
# |
229 |
# Provides a consistant way to check if wxGTK was built with a particular USE |
230 |
-# flag enabled. |
231 |
+# flag enabled. A better way is EAPI 2 USE dependencies (hint hint). |
232 |
|
233 |
check_wxuse() { |
234 |
debug-print-function $FUNCNAME $* |
235 |
@@ -259,6 +268,8 @@ |
236 |
die "WX_GTK_VER missing" |
237 |
fi |
238 |
|
239 |
+ # TODO: Remove built_with_use |
240 |
+ |
241 |
ebegin "Checking wxGTK-${WX_GTK_VER} for ${1} support" |
242 |
if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* "${1}"; then |
243 |
eend 0 |