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

Contents of /eclass/wxwidgets.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.37 - (hide annotations) (download)
Sat Nov 16 13:05:11 2013 UTC (9 months ago) by dirtyepic
Branch: MAIN
Changes since 1.36: +51 -84 lines
Cleanup.

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.37 # $Header: /var/cvsroot/gentoo-x86/eclass/wxwidgets.eclass,v 1.36 2013/11/16 10:25:39 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 dirtyepic 1.37 # This eclass gives ebuilds the ability to build against a specific wxGTK
11     # SLOT and profile without interfering with the system configuration. Any
12     # ebuild with a x11-libs/wxGTK dependency must use this eclass.
13     #
14     # There are two ways to do it:
15     #
16     # - set WX_GTK_VER before inheriting the eclass
17     # - set WX_GTK_VER and call need-wxwidgets from a phase function
18     #
19     # (where WX_GTK_VER is the SLOT you want)
20     #
21     # If your package has optional support for wxGTK (ie. by a USE flag) then
22     # you should use need-wxwidgets. This is important because some packages
23     # will force-enable wxGTK if they find WX_CONFIG set in the environment.
24 dirtyepic 1.20 #
25 dirtyepic 1.24 # @CODE
26 dirtyepic 1.37 # inherit wxwidgets
27 dirtyepic 1.20 #
28 dirtyepic 1.37 # IUSE="X wxwidgets"
29     # DEPEND="wxwidgets? ( x11-libs/wxGTK:2.8[X?] )"
30 dirtyepic 1.24 #
31 dirtyepic 1.37 # src_configure() {
32     # if use wxwidgets; then
33     # WX_GTK_VER="2.8"
34     # if use X; then
35     # need-wxwidgets unicode
36     # else
37     # need-wxwidgets base-unicode
38     # fi
39     # fi
40     # econf --with-wx-config="${WX_CONFIG}"
41     # }
42 dirtyepic 1.24 # @CODE
43     #
44 dirtyepic 1.37 # That's about as complicated as it gets. 99% of ebuilds can get away with:
45     #
46     # @CODE
47     # inherit wxwidgets
48     # DEPEND="wxwidgets? ( x11-libs/wxGTK:2.8[X] )
49     # ...
50     # WX_GTK_VER=2.8 need-wxwidgets unicode
51     # @CODE
52 dirtyepic 1.29 #
53 dirtyepic 1.37 # Note: unless you know your package works with wxbase (which is very
54     # doubtful), always depend on wxGTK[X].
55 dirtyepic 1.20
56 dirtyepic 1.31 inherit eutils multilib
57 pythonhead 1.1
58 dirtyepic 1.37 # We do this in global scope so ebuilds can get sane defaults just by
59     # inheriting.
60 dirtyepic 1.21 if [[ -z ${WX_CONFIG} ]]; then
61 dirtyepic 1.20 if [[ -n ${WX_GTK_VER} ]]; then
62     for wxtoolkit in gtk2 base; do
63 dirtyepic 1.29 # newer versions don't have a seperate debug profile
64     for wxdebug in xxx release- debug-; do
65 dirtyepic 1.35 wxconf="${wxtoolkit}-unicode-${wxdebug/xxx/}${WX_GTK_VER}"
66 dirtyepic 1.36
67     [[ -f ${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf} ]] || continue
68    
69 heroxbd 1.33 WX_CONFIG="${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf}"
70 dirtyepic 1.20 WX_ECLASS_CONFIG="${WX_CONFIG}"
71     break
72     done
73     [[ -n ${WX_CONFIG} ]] && break
74     done
75     [[ -n ${WX_CONFIG} ]] && export WX_CONFIG WX_ECLASS_CONFIG
76     fi
77     fi
78 pythonhead 1.1
79 dirtyepic 1.37 # @FUNCTION: need-wxwidgets
80     # @USAGE: <profile>
81 dirtyepic 1.20 # @DESCRIPTION:
82 dirtyepic 1.24 #
83 dirtyepic 1.29 # Available configurations are:
84     #
85 dirtyepic 1.35 # unicode (USE="X")
86     # base-unicode (USE="-X")
87 pythonhead 1.1
88     need-wxwidgets() {
89 dirtyepic 1.35 local wxtoolkit wxdebug wxconf
90 dirtyepic 1.20
91     if [[ -z ${WX_GTK_VER} ]]; then
92     eerror "WX_GTK_VER must be set before calling $FUNCNAME."
93     echo
94 dirtyepic 1.37 die
95 pythonhead 1.4 fi
96 dirtyepic 1.37
97 dirtyepic 1.35 if [[ ${WX_GTK_VER} != 2.8 && ${WX_GTK_VER} != 2.9 ]]; then
98 dirtyepic 1.20 eerror "Invalid WX_GTK_VER: ${WX_GTK_VER} - must be set to a valid wxGTK SLOT."
99     echo
100 dirtyepic 1.37 die
101 dirtyepic 1.20 fi
102 pythonhead 1.1
103 dirtyepic 1.20 case $1 in
104 dirtyepic 1.35 unicode|base-unicode) ;;
105 dirtyepic 1.37 *) eerror "Invalid $FUNCNAME profile: $1"
106 dirtyepic 1.20 echo
107 dirtyepic 1.35 die
108 dirtyepic 1.20 ;;
109     esac
110    
111 dirtyepic 1.37 # wxbase is provided by both gtk2 and base installations
112     if has_version "x11-libs/wxGTK:${WX_GTK_VER}[X]"; then
113 dirtyepic 1.20 wxtoolkit="gtk2"
114 pythonhead 1.4 else
115 dirtyepic 1.20 wxtoolkit="base"
116     fi
117    
118 dirtyepic 1.35 # 2.8 has a separate debug tuple
119     if [[ ${WX_GTK_VER} == 2.8 ]]; then
120 dirtyepic 1.37 if has_version "x11-libs/wxGTK:${WX_GTK_VER}[debug]"; then
121 dirtyepic 1.29 wxdebug="debug-"
122     else
123     wxdebug="release-"
124     fi
125 dirtyepic 1.20 fi
126    
127 dirtyepic 1.35 wxconf="${wxtoolkit}-unicode-${wxdebug}${WX_GTK_VER}"
128 dirtyepic 1.20
129 heroxbd 1.34 if [[ ! -f ${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf} ]]; then
130 dirtyepic 1.20 echo
131     eerror "Failed to find configuration ${wxconf}"
132     echo
133 dirtyepic 1.37 die
134 pythonhead 1.1 fi
135 dirtyepic 1.20
136 heroxbd 1.34 export WX_CONFIG="${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf}"
137 dirtyepic 1.20 export WX_ECLASS_CONFIG="${WX_CONFIG}"
138    
139     echo
140 dirtyepic 1.22 einfo "Requested wxWidgets: ${1} ${WX_GTK_VER}"
141     einfo "Using wxWidgets: ${wxconf}"
142 dirtyepic 1.20 echo
143 pythonhead 1.1 }

  ViewVC Help
Powered by ViewVC 1.1.20