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

Contents of /eclass/wxwidgets.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.36 - (hide annotations) (download)
Sat Nov 16 10:25:39 2013 UTC (11 months ago) by dirtyepic
Branch: MAIN
Changes since 1.35: +4 -65 lines
Drop wxwidgets_pkg_setup and check_wxuse.

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.36 # $Header: /var/cvsroot/gentoo-x86/eclass/wxwidgets.eclass,v 1.35 2013/11/16 08:21:23 dirtyepic 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.20 # We do this globally so ebuilds can get sane defaults just by inheriting. They
50     # can be overridden with need-wxwidgets later if need be.
51 pythonhead 1.1
52 dirtyepic 1.29 # ensure this only runs once
53 dirtyepic 1.21 if [[ -z ${WX_CONFIG} ]]; then
54 dirtyepic 1.29 # and only if WX_GTK_VER is set before inherit
55 dirtyepic 1.20 if [[ -n ${WX_GTK_VER} ]]; then
56     for wxtoolkit in gtk2 base; do
57 dirtyepic 1.29 # newer versions don't have a seperate debug profile
58     for wxdebug in xxx release- debug-; do
59 dirtyepic 1.35 wxconf="${wxtoolkit}-unicode-${wxdebug/xxx/}${WX_GTK_VER}"
60 dirtyepic 1.36
61     [[ -f ${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf} ]] || continue
62    
63 heroxbd 1.33 WX_CONFIG="${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf}"
64 dirtyepic 1.20 WX_ECLASS_CONFIG="${WX_CONFIG}"
65     break
66     done
67     [[ -n ${WX_CONFIG} ]] && break
68     done
69     [[ -n ${WX_CONFIG} ]] && export WX_CONFIG WX_ECLASS_CONFIG
70     fi
71     fi
72 pythonhead 1.1
73 dirtyepic 1.20 # @FUNCTION: need-wxwidgets
74     # @USAGE: <configuration>
75     # @DESCRIPTION:
76 dirtyepic 1.24 #
77 dirtyepic 1.29 # Available configurations are:
78     #
79 dirtyepic 1.35 # unicode (USE="X")
80     # base-unicode (USE="-X")
81 dirtyepic 1.29 #
82     # If your package has optional wxGTK support controlled by a USE flag, set
83     # WX_GTK_VER inside a conditional rather than before inherit. Some broken
84     # configure scripts will force wxGTK on if they find ${WX_CONFIG} set.
85 dirtyepic 1.20 #
86 dirtyepic 1.29 # @CODE
87     # src_configure() {
88     # if use wxwidgets; then
89     # WX_GTK_VER="2.8"
90     # if use X; then
91     # need-wxwidgets unicode
92     # else
93     # need-wxwidgets base-unicode
94     # fi
95     # fi
96     # @CODE
97 dirtyepic 1.20 #
98 pythonhead 1.1
99     need-wxwidgets() {
100     debug-print-function $FUNCNAME $*
101    
102 dirtyepic 1.35 local wxtoolkit wxdebug wxconf
103 dirtyepic 1.20
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.35 if [[ ${WX_GTK_VER} != 2.8 && ${WX_GTK_VER} != 2.9 ]]; then
112 dirtyepic 1.20 echo
113     eerror "Invalid WX_GTK_VER: ${WX_GTK_VER} - must be set to a valid wxGTK SLOT."
114     echo
115     die "Invalid WX_GTK_VER"
116     fi
117 pythonhead 1.1
118 dirtyepic 1.20 debug-print "WX_GTK_VER is ${WX_GTK_VER}"
119 pythonhead 1.1
120 dirtyepic 1.20 case $1 in
121 dirtyepic 1.35 unicode|base-unicode) ;;
122 dirtyepic 1.20 *)
123     eerror "Invalid $FUNCNAME argument: $1"
124     echo
125 dirtyepic 1.35 die
126 dirtyepic 1.20 ;;
127     esac
128    
129 dirtyepic 1.29 # TODO: remove built_with_use
130 dirtyepic 1.20
131 dirtyepic 1.24 # wxBase can be provided by both gtk2 and base installations
132 swegener 1.23 if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* X; then
133 dirtyepic 1.20 wxtoolkit="gtk2"
134 pythonhead 1.4 else
135 dirtyepic 1.20 wxtoolkit="base"
136     fi
137    
138     debug-print "wxtoolkit is ${wxtoolkit}"
139    
140 dirtyepic 1.35 # 2.8 has a separate debug tuple
141     if [[ ${WX_GTK_VER} == 2.8 ]]; then
142 dirtyepic 1.29 if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* debug; then
143     wxdebug="debug-"
144     else
145     wxdebug="release-"
146     fi
147 dirtyepic 1.20 fi
148    
149     debug-print "wxdebug is ${wxdebug}"
150    
151     # put it all together
152 dirtyepic 1.35 wxconf="${wxtoolkit}-unicode-${wxdebug}${WX_GTK_VER}"
153 dirtyepic 1.20
154     debug-print "wxconf is ${wxconf}"
155    
156     # if this doesn't work, something is seriously screwed
157 heroxbd 1.34 if [[ ! -f ${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf} ]]; then
158 dirtyepic 1.20 echo
159     eerror "Failed to find configuration ${wxconf}"
160     echo
161     die "Missing wx-config"
162 pythonhead 1.1 fi
163 dirtyepic 1.20
164     debug-print "Found config ${wxconf} - setting WX_CONFIG"
165    
166 heroxbd 1.34 export WX_CONFIG="${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf}"
167 dirtyepic 1.20
168     debug-print "WX_CONFIG is ${WX_CONFIG}"
169    
170     export WX_ECLASS_CONFIG="${WX_CONFIG}"
171    
172     echo
173 dirtyepic 1.22 einfo "Requested wxWidgets: ${1} ${WX_GTK_VER}"
174     einfo "Using wxWidgets: ${wxconf}"
175 dirtyepic 1.20 echo
176 pythonhead 1.1 }

  ViewVC Help
Powered by ViewVC 1.1.20