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

Contents of /eclass/wxwidgets.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.35 - (hide annotations) (download)
Sat Nov 16 08:21:23 2013 UTC (11 months ago) by dirtyepic
Branch: MAIN
Changes since 1.34: +13 -61 lines
Drop support for 2.6.

1 dirtyepic 1.35 # Copyright 1999-2013 Gentoo Foundation
2 pythonhead 1.1 # Distributed under the terms of the GNU General Public License v2
3 dirtyepic 1.35 # $Header: /var/cvsroot/gentoo-x86/eclass/wxwidgets.eclass,v 1.34 2013/08/16 07:59:17 heroxbd Exp $
4 dirtyepic 1.20
5     # @ECLASS: wxwidgets.eclass
6     # @MAINTAINER:
7 dirtyepic 1.27 # wxwidgets@gentoo.org
8 dirtyepic 1.20 # @BLURB: Manages build configuration for wxGTK-using packages.
9     # @DESCRIPTION:
10     # The wxGTK libraries come in several different possible configurations
11 dirtyepic 1.26 # (release, debug, ansi, unicode, etc.) most of which can be installed
12 dirtyepic 1.24 # side-by-side. The purpose of this eclass is to provide ebuilds the ability
13 dirtyepic 1.26 # to build against a specific type of profile without interfering with the
14     # user-set system configuration.
15 dirtyepic 1.20 #
16 dirtyepic 1.29 # Ebuilds that use wxGTK _must_ inherit this eclass.
17 dirtyepic 1.20 #
18 dirtyepic 1.29 # - Using this eclass -
19 dirtyepic 1.20 #
20 dirtyepic 1.29 # 1. set WX_GTK_VER to a valid wxGTK SLOT
21     # 2. inherit wxwidgets
22     # 3. add an appropriate DEPEND
23     # 4. done
24 dirtyepic 1.20 #
25 dirtyepic 1.24 # @CODE
26 dirtyepic 1.26 # WX_GTK_VER="2.8"
27 dirtyepic 1.20 #
28 dirtyepic 1.24 # inherit wxwidgets
29     #
30 dirtyepic 1.29 # DEPEND="x11-libs/wxGTK:2.8[X]"
31 dirtyepic 1.24 # RDEPEND="${DEPEND}"
32     # [...]
33     # @CODE
34     #
35 dirtyepic 1.29 # This will get you the default configuration, which is what you want 99%
36 dirtyepic 1.35 # of the time.
37 dirtyepic 1.29 #
38     # If your package has optional wxGTK support controlled by a USE flag or you
39     # need to use the wxBase libraries (USE="-X") then you should not set
40     # WX_GTK_VER before inherit and instead refer to the need-wxwidgets function
41     # below.
42     #
43     # The variable WX_CONFIG is exported, containing the absolute path to the
44     # wx-config file to use. Most configure scripts use this path if it's set in
45     # the environment or accept --with-wx-config="${WX_CONFIG}".
46 dirtyepic 1.20
47 dirtyepic 1.31 inherit eutils multilib
48 pythonhead 1.1
49 dirtyepic 1.28 case "${EAPI:-0}" in
50     0|1)
51     EXPORT_FUNCTIONS pkg_setup
52     ;;
53     *)
54     ;;
55     esac
56 dirtyepic 1.26
57 dirtyepic 1.20 # We do this globally so ebuilds can get sane defaults just by inheriting. They
58     # can be overridden with need-wxwidgets later if need be.
59 pythonhead 1.1
60 dirtyepic 1.29 # ensure this only runs once
61 dirtyepic 1.21 if [[ -z ${WX_CONFIG} ]]; then
62 dirtyepic 1.29 # and only if WX_GTK_VER is set before inherit
63 dirtyepic 1.20 if [[ -n ${WX_GTK_VER} ]]; then
64     for wxtoolkit in gtk2 base; do
65 dirtyepic 1.29 # newer versions don't have a seperate debug profile
66     for wxdebug in xxx release- debug-; do
67 dirtyepic 1.35 wxconf="${wxtoolkit}-unicode-${wxdebug/xxx/}${WX_GTK_VER}"
68 heroxbd 1.34 if [[ -f ${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf} ]]; then
69 dirtyepic 1.29 # if this is a wxBase install, die in pkg_setup
70     [[ ${wxtoolkit} == "base" ]] && WXBASE_DIE=1
71 dirtyepic 1.26 else
72     continue
73     fi
74 heroxbd 1.33 WX_CONFIG="${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf}"
75 dirtyepic 1.20 WX_ECLASS_CONFIG="${WX_CONFIG}"
76     break
77     done
78     [[ -n ${WX_CONFIG} ]] && break
79     done
80     [[ -n ${WX_CONFIG} ]] && export WX_CONFIG WX_ECLASS_CONFIG
81     fi
82     fi
83 pythonhead 1.1
84 dirtyepic 1.26 # @FUNCTION: wxwidgets_pkg_setup
85     # @DESCRIPTION:
86     #
87 dirtyepic 1.29 # It's possible for wxGTK to be installed with USE="-X", resulting in something
88     # called wxBase. There's only ever been a couple packages in the tree that use
89     # wxBase so this is probably not what you want. Whenever possible, use EAPI 2
90     # USE dependencies(tm) to ensure that wxGTK was built with USE="X". This
91     # function is only exported for EAPI 0 or 1 and catches any remaining cases.
92 dirtyepic 1.26 #
93 dirtyepic 1.29 # If you do use wxBase, don't set WX_GTK_VER before inherit. Use
94     # need-wxwidgets() instead.
95 dirtyepic 1.26
96     wxwidgets_pkg_setup() {
97     [[ -n $WXBASE_DIE ]] && check_wxuse X
98     }
99 dirtyepic 1.20
100     # @FUNCTION: need-wxwidgets
101     # @USAGE: <configuration>
102     # @DESCRIPTION:
103 dirtyepic 1.24 #
104 dirtyepic 1.29 # Available configurations are:
105     #
106 dirtyepic 1.35 # unicode (USE="X")
107     # base-unicode (USE="-X")
108 dirtyepic 1.29 #
109     # If your package has optional wxGTK support controlled by a USE flag, set
110     # WX_GTK_VER inside a conditional rather than before inherit. Some broken
111     # configure scripts will force wxGTK on if they find ${WX_CONFIG} set.
112 dirtyepic 1.20 #
113 dirtyepic 1.29 # @CODE
114     # src_configure() {
115     # if use wxwidgets; then
116     # WX_GTK_VER="2.8"
117     # if use X; then
118     # need-wxwidgets unicode
119     # else
120     # need-wxwidgets base-unicode
121     # fi
122     # fi
123     # @CODE
124 dirtyepic 1.20 #
125 pythonhead 1.1
126     need-wxwidgets() {
127     debug-print-function $FUNCNAME $*
128    
129 dirtyepic 1.35 local wxtoolkit wxdebug wxconf
130 dirtyepic 1.20
131     if [[ -z ${WX_GTK_VER} ]]; then
132     echo
133     eerror "WX_GTK_VER must be set before calling $FUNCNAME."
134     echo
135     die "WX_GTK_VER missing"
136 pythonhead 1.4 fi
137 pythonhead 1.1
138 dirtyepic 1.35 if [[ ${WX_GTK_VER} != 2.8 && ${WX_GTK_VER} != 2.9 ]]; then
139 dirtyepic 1.20 echo
140     eerror "Invalid WX_GTK_VER: ${WX_GTK_VER} - must be set to a valid wxGTK SLOT."
141     echo
142     die "Invalid WX_GTK_VER"
143     fi
144 pythonhead 1.1
145 dirtyepic 1.20 debug-print "WX_GTK_VER is ${WX_GTK_VER}"
146 pythonhead 1.1
147 dirtyepic 1.20 case $1 in
148 dirtyepic 1.35 unicode|base-unicode) ;;
149 dirtyepic 1.20 *)
150     eerror "Invalid $FUNCNAME argument: $1"
151     echo
152 dirtyepic 1.35 die
153 dirtyepic 1.20 ;;
154     esac
155    
156 dirtyepic 1.29 # TODO: remove built_with_use
157 dirtyepic 1.20
158 dirtyepic 1.24 # wxBase can be provided by both gtk2 and base installations
159 swegener 1.23 if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* X; then
160 dirtyepic 1.20 wxtoolkit="gtk2"
161 pythonhead 1.4 else
162 dirtyepic 1.20 wxtoolkit="base"
163     fi
164    
165     debug-print "wxtoolkit is ${wxtoolkit}"
166    
167 dirtyepic 1.35 # 2.8 has a separate debug tuple
168     if [[ ${WX_GTK_VER} == 2.8 ]]; then
169 dirtyepic 1.29 if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* debug; then
170     wxdebug="debug-"
171     else
172     wxdebug="release-"
173     fi
174 dirtyepic 1.20 fi
175    
176     debug-print "wxdebug is ${wxdebug}"
177    
178     # put it all together
179 dirtyepic 1.35 wxconf="${wxtoolkit}-unicode-${wxdebug}${WX_GTK_VER}"
180 dirtyepic 1.20
181     debug-print "wxconf is ${wxconf}"
182    
183     # if this doesn't work, something is seriously screwed
184 heroxbd 1.34 if [[ ! -f ${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf} ]]; then
185 dirtyepic 1.20 echo
186     eerror "Failed to find configuration ${wxconf}"
187     echo
188     die "Missing wx-config"
189 pythonhead 1.1 fi
190 dirtyepic 1.20
191     debug-print "Found config ${wxconf} - setting WX_CONFIG"
192    
193 heroxbd 1.34 export WX_CONFIG="${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf}"
194 dirtyepic 1.20
195     debug-print "WX_CONFIG is ${WX_CONFIG}"
196    
197     export WX_ECLASS_CONFIG="${WX_CONFIG}"
198    
199     echo
200 dirtyepic 1.22 einfo "Requested wxWidgets: ${1} ${WX_GTK_VER}"
201     einfo "Using wxWidgets: ${wxconf}"
202 dirtyepic 1.20 echo
203 pythonhead 1.1 }
204    
205 dirtyepic 1.20
206     # @FUNCTION: check_wxuse
207     # @USAGE: <USE flag>
208     # @DESCRIPTION:
209 dirtyepic 1.24 #
210 dirtyepic 1.20 # Provides a consistant way to check if wxGTK was built with a particular USE
211 dirtyepic 1.29 # flag enabled. A better way is EAPI 2 USE dependencies (hint hint).
212 dirtyepic 1.20
213 dirtyepic 1.19 check_wxuse() {
214 dirtyepic 1.20 debug-print-function $FUNCNAME $*
215    
216 leio 1.25 if [[ -z ${WX_GTK_VER} ]]; then
217     echo
218     eerror "WX_GTK_VER must be set before calling $FUNCNAME."
219     echo
220     die "WX_GTK_VER missing"
221     fi
222 dirtyepic 1.19
223 dirtyepic 1.29 # TODO: Remove built_with_use
224    
225 dirtyepic 1.19 ebegin "Checking wxGTK-${WX_GTK_VER} for ${1} support"
226 swegener 1.23 if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* "${1}"; then
227 dirtyepic 1.19 eend 0
228     else
229     eend 1
230     echo
231     eerror "${FUNCNAME} - You have requested functionality that requires ${1} support to"
232     eerror "have been built into x11-libs/wxGTK."
233     eerror
234     eerror "Please re-merge =x11-libs/wxGTK-${WX_GTK_VER}* with the ${1} USE flag enabled."
235     die "Missing USE flags."
236     fi
237     }

  ViewVC Help
Powered by ViewVC 1.1.20