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

Diff of /eclass/wxwidgets.eclass

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

Revision 1.31 Revision 1.36
1# Copyright 1999-2007 Gentoo Foundation 1# Copyright 1999-2013 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.31 2011/07/17 19:58:39 dirtyepic Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/wxwidgets.eclass,v 1.36 2013/11/16 10:25:39 dirtyepic Exp $
4 4
5# @ECLASS: wxwidgets.eclass 5# @ECLASS: wxwidgets.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# wxwidgets@gentoo.org 7# wxwidgets@gentoo.org
8# @BLURB: Manages build configuration for wxGTK-using packages. 8# @BLURB: Manages build configuration for wxGTK-using packages.
31# RDEPEND="${DEPEND}" 31# RDEPEND="${DEPEND}"
32# [...] 32# [...]
33# @CODE 33# @CODE
34# 34#
35# This will get you the default configuration, which is what you want 99% 35# This will get you the default configuration, which is what you want 99%
36# of the time (in 2.6 the default is "ansi", all other versions default to 36# of the time.
37# "unicode").
38# 37#
39# If your package has optional wxGTK support controlled by a USE flag or you 38# If your package has optional wxGTK support controlled by a USE flag or you
40# need to use the wxBase libraries (USE="-X") then you should not set 39# need to use the wxBase libraries (USE="-X") then you should not set
41# WX_GTK_VER before inherit and instead refer to the need-wxwidgets function 40# WX_GTK_VER before inherit and instead refer to the need-wxwidgets function
42# below. 41# below.
45# wx-config file to use. Most configure scripts use this path if it's set in 44# wx-config file to use. Most configure scripts use this path if it's set in
46# the environment or accept --with-wx-config="${WX_CONFIG}". 45# the environment or accept --with-wx-config="${WX_CONFIG}".
47 46
48inherit eutils multilib 47inherit eutils multilib
49 48
50case "${EAPI:-0}" in
51 0|1)
52 EXPORT_FUNCTIONS pkg_setup
53 ;;
54 *)
55 ;;
56esac
57
58# We do this globally so ebuilds can get sane defaults just by inheriting. They 49# We do this globally so ebuilds can get sane defaults just by inheriting. They
59# can be overridden with need-wxwidgets later if need be. 50# can be overridden with need-wxwidgets later if need be.
60 51
61# ensure this only runs once 52# ensure this only runs once
62if [[ -z ${WX_CONFIG} ]]; then 53if [[ -z ${WX_CONFIG} ]]; then
63 # and only if WX_GTK_VER is set before inherit 54 # and only if WX_GTK_VER is set before inherit
64 if [[ -n ${WX_GTK_VER} ]]; then 55 if [[ -n ${WX_GTK_VER} ]]; then
65 if [[ ${WX_GTK_VER} == 2.6 ]]; then
66 wxchar="ansi"
67 else
68 wxchar="unicode"
69 fi
70 for wxtoolkit in gtk2 base; do 56 for wxtoolkit in gtk2 base; do
71 # newer versions don't have a seperate debug profile 57 # newer versions don't have a seperate debug profile
72 for wxdebug in xxx release- debug-; do 58 for wxdebug in xxx release- debug-; do
73 wxconf="${wxtoolkit}-${wxchar}-${wxdebug/xxx/}${WX_GTK_VER}" 59 wxconf="${wxtoolkit}-unicode-${wxdebug/xxx/}${WX_GTK_VER}"
60
74 if [[ -f /usr/$(get_libdir)/wx/config/${wxconf} ]]; then 61 [[ -f ${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf} ]] || continue
75 # if this is a wxBase install, die in pkg_setup 62
76 [[ ${wxtoolkit} == "base" ]] && WXBASE_DIE=1
77 else
78 continue
79 fi
80 WX_CONFIG="/usr/$(get_libdir)/wx/config/${wxconf}" 63 WX_CONFIG="${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf}"
81 WX_ECLASS_CONFIG="${WX_CONFIG}" 64 WX_ECLASS_CONFIG="${WX_CONFIG}"
82 break 65 break
83 done 66 done
84 [[ -n ${WX_CONFIG} ]] && break 67 [[ -n ${WX_CONFIG} ]] && break
85 done 68 done
86 [[ -n ${WX_CONFIG} ]] && export WX_CONFIG WX_ECLASS_CONFIG 69 [[ -n ${WX_CONFIG} ]] && export WX_CONFIG WX_ECLASS_CONFIG
87 fi 70 fi
88fi 71fi
89 72
90# @FUNCTION: wxwidgets_pkg_setup
91# @DESCRIPTION:
92#
93# It's possible for wxGTK to be installed with USE="-X", resulting in something
94# called wxBase. There's only ever been a couple packages in the tree that use
95# wxBase so this is probably not what you want. Whenever possible, use EAPI 2
96# USE dependencies(tm) to ensure that wxGTK was built with USE="X". This
97# function is only exported for EAPI 0 or 1 and catches any remaining cases.
98#
99# If you do use wxBase, don't set WX_GTK_VER before inherit. Use
100# need-wxwidgets() instead.
101
102wxwidgets_pkg_setup() {
103 [[ -n $WXBASE_DIE ]] && check_wxuse X
104}
105
106# @FUNCTION: need-wxwidgets 73# @FUNCTION: need-wxwidgets
107# @USAGE: <configuration> 74# @USAGE: <configuration>
108# @DESCRIPTION: 75# @DESCRIPTION:
109# 76#
110# Available configurations are: 77# Available configurations are:
111# 78#
112# [2.6] ansi [>=2.8] unicode 79# unicode (USE="X")
113# unicode base-unicode 80# base-unicode (USE="-X")
114# base
115# base-unicode
116# 81#
117# If your package has optional wxGTK support controlled by a USE flag, set 82# If your package has optional wxGTK support controlled by a USE flag, set
118# WX_GTK_VER inside a conditional rather than before inherit. Some broken 83# WX_GTK_VER inside a conditional rather than before inherit. Some broken
119# configure scripts will force wxGTK on if they find ${WX_CONFIG} set. 84# configure scripts will force wxGTK on if they find ${WX_CONFIG} set.
120# 85#
132# 97#
133 98
134need-wxwidgets() { 99need-wxwidgets() {
135 debug-print-function $FUNCNAME $* 100 debug-print-function $FUNCNAME $*
136 101
137 local wxtoolkit wxchar wxdebug wxconf 102 local wxtoolkit wxdebug wxconf
138 103
139 if [[ -z ${WX_GTK_VER} ]]; then 104 if [[ -z ${WX_GTK_VER} ]]; then
140 echo 105 echo
141 eerror "WX_GTK_VER must be set before calling $FUNCNAME." 106 eerror "WX_GTK_VER must be set before calling $FUNCNAME."
142 echo 107 echo
143 die "WX_GTK_VER missing" 108 die "WX_GTK_VER missing"
144 fi 109 fi
145 110
146 if [[ ${WX_GTK_VER} != 2.6 && ${WX_GTK_VER} != 2.8 && ${WX_GTK_VER} != 2.9 ]]; then 111 if [[ ${WX_GTK_VER} != 2.8 && ${WX_GTK_VER} != 2.9 ]]; then
147 echo 112 echo
148 eerror "Invalid WX_GTK_VER: ${WX_GTK_VER} - must be set to a valid wxGTK SLOT." 113 eerror "Invalid WX_GTK_VER: ${WX_GTK_VER} - must be set to a valid wxGTK SLOT."
149 echo 114 echo
150 die "Invalid WX_GTK_VER" 115 die "Invalid WX_GTK_VER"
151 fi 116 fi
152 117
153 debug-print "WX_GTK_VER is ${WX_GTK_VER}" 118 debug-print "WX_GTK_VER is ${WX_GTK_VER}"
154 119
155 case $1 in 120 case $1 in
156 ansi) 121 unicode|base-unicode) ;;
157 debug-print-section ansi
158 if [[ ${WX_GTK_VER} == 2.6 ]]; then
159 wxchar="ansi"
160 else
161 wxchar="unicode"
162 fi
163 check_wxuse X
164 ;;
165 unicode)
166 debug-print-section unicode
167 check_wxuse X
168 [[ ${WX_GTK_VER} == 2.6 ]] && check_wxuse unicode
169 wxchar="unicode"
170 ;;
171 base)
172 debug-print-section base
173 if [[ ${WX_GTK_VER} == 2.6 ]]; then
174 wxchar="ansi"
175 else
176 wxchar="unicode"
177 fi
178 ;;
179 base-unicode)
180 debug-print-section base-unicode
181 [[ ${WX_GTK_VER} == 2.6 ]] && check_wxuse unicode
182 wxchar="unicode"
183 ;;
184 # backwards compatibility
185 gtk2)
186 debug-print-section gtk2
187 if [[ ${WX_GTK_VER} == 2.6 ]]; then
188 wxchar="ansi"
189 else
190 wxchar="unicode"
191 fi
192 check_wxuse X
193 ;;
194 *) 122 *)
195 echo
196 eerror "Invalid $FUNCNAME argument: $1" 123 eerror "Invalid $FUNCNAME argument: $1"
197 echo 124 echo
198 die "Invalid argument" 125 die
199 ;; 126 ;;
200 esac 127 esac
201
202 debug-print "wxchar is ${wxchar}"
203 128
204 # TODO: remove built_with_use 129 # TODO: remove built_with_use
205 130
206 # wxBase can be provided by both gtk2 and base installations 131 # wxBase can be provided by both gtk2 and base installations
207 if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* X; then 132 if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* X; then
210 wxtoolkit="base" 135 wxtoolkit="base"
211 fi 136 fi
212 137
213 debug-print "wxtoolkit is ${wxtoolkit}" 138 debug-print "wxtoolkit is ${wxtoolkit}"
214 139
215 # debug or release? 140 # 2.8 has a separate debug tuple
216 if [[ ${WX_GTK_VER} == 2.6 || ${WX_GTK_VER} == 2.8 ]]; then 141 if [[ ${WX_GTK_VER} == 2.8 ]]; then
217 if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* debug; then 142 if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* debug; then
218 wxdebug="debug-" 143 wxdebug="debug-"
219 else 144 else
220 wxdebug="release-" 145 wxdebug="release-"
221 fi 146 fi
222 fi 147 fi
223 148
224 debug-print "wxdebug is ${wxdebug}" 149 debug-print "wxdebug is ${wxdebug}"
225 150
226 # put it all together 151 # put it all together
227 wxconf="${wxtoolkit}-${wxchar}-${wxdebug}${WX_GTK_VER}" 152 wxconf="${wxtoolkit}-unicode-${wxdebug}${WX_GTK_VER}"
228 153
229 debug-print "wxconf is ${wxconf}" 154 debug-print "wxconf is ${wxconf}"
230 155
231 # if this doesn't work, something is seriously screwed 156 # if this doesn't work, something is seriously screwed
232 if [[ ! -f /usr/$(get_libdir)/wx/config/${wxconf} ]]; then 157 if [[ ! -f ${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf} ]]; then
233 echo 158 echo
234 eerror "Failed to find configuration ${wxconf}" 159 eerror "Failed to find configuration ${wxconf}"
235 echo 160 echo
236 die "Missing wx-config" 161 die "Missing wx-config"
237 fi 162 fi
238 163
239 debug-print "Found config ${wxconf} - setting WX_CONFIG" 164 debug-print "Found config ${wxconf} - setting WX_CONFIG"
240 165
241 export WX_CONFIG="/usr/$(get_libdir)/wx/config/${wxconf}" 166 export WX_CONFIG="${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf}"
242 167
243 debug-print "WX_CONFIG is ${WX_CONFIG}" 168 debug-print "WX_CONFIG is ${WX_CONFIG}"
244 169
245 export WX_ECLASS_CONFIG="${WX_CONFIG}" 170 export WX_ECLASS_CONFIG="${WX_CONFIG}"
246 171
247 echo 172 echo
248 einfo "Requested wxWidgets: ${1} ${WX_GTK_VER}" 173 einfo "Requested wxWidgets: ${1} ${WX_GTK_VER}"
249 einfo "Using wxWidgets: ${wxconf}" 174 einfo "Using wxWidgets: ${wxconf}"
250 echo 175 echo
251} 176}
252
253
254# @FUNCTION: check_wxuse
255# @USAGE: <USE flag>
256# @DESCRIPTION:
257#
258# Provides a consistant way to check if wxGTK was built with a particular USE
259# flag enabled. A better way is EAPI 2 USE dependencies (hint hint).
260
261check_wxuse() {
262 debug-print-function $FUNCNAME $*
263
264 if [[ -z ${WX_GTK_VER} ]]; then
265 echo
266 eerror "WX_GTK_VER must be set before calling $FUNCNAME."
267 echo
268 die "WX_GTK_VER missing"
269 fi
270
271 # TODO: Remove built_with_use
272
273 ebegin "Checking wxGTK-${WX_GTK_VER} for ${1} support"
274 if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* "${1}"; then
275 eend 0
276 else
277 eend 1
278 echo
279 eerror "${FUNCNAME} - You have requested functionality that requires ${1} support to"
280 eerror "have been built into x11-libs/wxGTK."
281 eerror
282 eerror "Please re-merge =x11-libs/wxGTK-${WX_GTK_VER}* with the ${1} USE flag enabled."
283 die "Missing USE flags."
284 fi
285}

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.36

  ViewVC Help
Powered by ViewVC 1.1.20