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

Diff of /eclass/wxwidgets.eclass

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

Revision 1.36 Revision 1.37
1# Copyright 1999-2013 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.36 2013/11/16 10:25:39 dirtyepic Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/wxwidgets.eclass,v 1.37 2013/11/16 13:05:11 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.
9# @DESCRIPTION: 9# @DESCRIPTION:
10# The wxGTK libraries come in several different possible configurations 10# This eclass gives ebuilds the ability to build against a specific wxGTK
11# (release, debug, ansi, unicode, etc.) most of which can be installed 11# SLOT and profile without interfering with the system configuration. Any
12# side-by-side. The purpose of this eclass is to provide ebuilds the ability 12# ebuild with a x11-libs/wxGTK dependency must use this eclass.
13# to build against a specific type of profile without interfering with the
14# user-set system configuration.
15# 13#
16# Ebuilds that use wxGTK _must_ inherit this eclass. 14# There are two ways to do it:
17# 15#
18# - Using this eclass - 16# - set WX_GTK_VER before inheriting the eclass
17# - set WX_GTK_VER and call need-wxwidgets from a phase function
19# 18#
20# 1. set WX_GTK_VER to a valid wxGTK SLOT 19# (where WX_GTK_VER is the SLOT you want)
21# 2. inherit wxwidgets 20#
22# 3. add an appropriate DEPEND 21# If your package has optional support for wxGTK (ie. by a USE flag) then
23# 4. done 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# 24#
25# @CODE 25# @CODE
26# WX_GTK_VER="2.8" 26# inherit wxwidgets
27# 27#
28# inherit wxwidgets 28# IUSE="X wxwidgets"
29# DEPEND="wxwidgets? ( x11-libs/wxGTK:2.8[X?] )"
29# 30#
30# DEPEND="x11-libs/wxGTK:2.8[X]" 31# src_configure() {
31# RDEPEND="${DEPEND}" 32# if use wxwidgets; then
32# [...] 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# }
33# @CODE 42# @CODE
34# 43#
35# This will get you the default configuration, which is what you want 99% 44# That's about as complicated as it gets. 99% of ebuilds can get away with:
36# of the time.
37# 45#
38# If your package has optional wxGTK support controlled by a USE flag or you 46# @CODE
39# need to use the wxBase libraries (USE="-X") then you should not set 47# inherit wxwidgets
40# WX_GTK_VER before inherit and instead refer to the need-wxwidgets function 48# DEPEND="wxwidgets? ( x11-libs/wxGTK:2.8[X] )
41# below. 49# ...
50# WX_GTK_VER=2.8 need-wxwidgets unicode
51# @CODE
42# 52#
43# The variable WX_CONFIG is exported, containing the absolute path to the 53# Note: unless you know your package works with wxbase (which is very
44# wx-config file to use. Most configure scripts use this path if it's set in 54# doubtful), always depend on wxGTK[X].
45# the environment or accept --with-wx-config="${WX_CONFIG}".
46 55
47inherit eutils multilib 56inherit eutils multilib
48 57
49# We do this globally so ebuilds can get sane defaults just by inheriting. They 58# We do this in global scope so ebuilds can get sane defaults just by
50# can be overridden with need-wxwidgets later if need be. 59# inheriting.
51
52# ensure this only runs once
53if [[ -z ${WX_CONFIG} ]]; then 60if [[ -z ${WX_CONFIG} ]]; then
54 # and only if WX_GTK_VER is set before inherit
55 if [[ -n ${WX_GTK_VER} ]]; then 61 if [[ -n ${WX_GTK_VER} ]]; then
56 for wxtoolkit in gtk2 base; do 62 for wxtoolkit in gtk2 base; do
57 # newer versions don't have a seperate debug profile 63 # newer versions don't have a seperate debug profile
58 for wxdebug in xxx release- debug-; do 64 for wxdebug in xxx release- debug-; do
59 wxconf="${wxtoolkit}-unicode-${wxdebug/xxx/}${WX_GTK_VER}" 65 wxconf="${wxtoolkit}-unicode-${wxdebug/xxx/}${WX_GTK_VER}"
68 done 74 done
69 [[ -n ${WX_CONFIG} ]] && export WX_CONFIG WX_ECLASS_CONFIG 75 [[ -n ${WX_CONFIG} ]] && export WX_CONFIG WX_ECLASS_CONFIG
70 fi 76 fi
71fi 77fi
72 78
73# @FUNCTION: need-wxwidgets 79# @FUNCTION: need-wxwidgets
74# @USAGE: <configuration> 80# @USAGE: <profile>
75# @DESCRIPTION: 81# @DESCRIPTION:
76# 82#
77# Available configurations are: 83# Available configurations are:
78# 84#
79# unicode (USE="X") 85# unicode (USE="X")
80# base-unicode (USE="-X") 86# base-unicode (USE="-X")
81#
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#
86# @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#
98 87
99need-wxwidgets() { 88need-wxwidgets() {
100 debug-print-function $FUNCNAME $*
101
102 local wxtoolkit wxdebug wxconf 89 local wxtoolkit wxdebug wxconf
103 90
104 if [[ -z ${WX_GTK_VER} ]]; then 91 if [[ -z ${WX_GTK_VER} ]]; then
105 echo
106 eerror "WX_GTK_VER must be set before calling $FUNCNAME." 92 eerror "WX_GTK_VER must be set before calling $FUNCNAME."
107 echo 93 echo
108 die "WX_GTK_VER missing" 94 die
109 fi 95 fi
110 96
111 if [[ ${WX_GTK_VER} != 2.8 && ${WX_GTK_VER} != 2.9 ]]; then 97 if [[ ${WX_GTK_VER} != 2.8 && ${WX_GTK_VER} != 2.9 ]]; then
112 echo
113 eerror "Invalid WX_GTK_VER: ${WX_GTK_VER} - must be set to a valid wxGTK SLOT." 98 eerror "Invalid WX_GTK_VER: ${WX_GTK_VER} - must be set to a valid wxGTK SLOT."
114 echo 99 echo
115 die "Invalid WX_GTK_VER" 100 die
116 fi 101 fi
117
118 debug-print "WX_GTK_VER is ${WX_GTK_VER}"
119 102
120 case $1 in 103 case $1 in
121 unicode|base-unicode) ;; 104 unicode|base-unicode) ;;
122 *)
123 eerror "Invalid $FUNCNAME argument: $1" 105 *) eerror "Invalid $FUNCNAME profile: $1"
124 echo 106 echo
125 die 107 die
126 ;; 108 ;;
127 esac 109 esac
128 110
129 # TODO: remove built_with_use
130
131 # wxBase can be provided by both gtk2 and base installations 111 # wxbase is provided by both gtk2 and base installations
132 if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* X; then 112 if has_version "x11-libs/wxGTK:${WX_GTK_VER}[X]"; then
133 wxtoolkit="gtk2" 113 wxtoolkit="gtk2"
134 else 114 else
135 wxtoolkit="base" 115 wxtoolkit="base"
136 fi 116 fi
137 117
138 debug-print "wxtoolkit is ${wxtoolkit}"
139
140 # 2.8 has a separate debug tuple 118 # 2.8 has a separate debug tuple
141 if [[ ${WX_GTK_VER} == 2.8 ]]; then 119 if [[ ${WX_GTK_VER} == 2.8 ]]; then
142 if built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* debug; then 120 if has_version "x11-libs/wxGTK:${WX_GTK_VER}[debug]"; then
143 wxdebug="debug-" 121 wxdebug="debug-"
144 else 122 else
145 wxdebug="release-" 123 wxdebug="release-"
146 fi 124 fi
147 fi 125 fi
148 126
149 debug-print "wxdebug is ${wxdebug}"
150
151 # put it all together
152 wxconf="${wxtoolkit}-unicode-${wxdebug}${WX_GTK_VER}" 127 wxconf="${wxtoolkit}-unicode-${wxdebug}${WX_GTK_VER}"
153 128
154 debug-print "wxconf is ${wxconf}"
155
156 # if this doesn't work, something is seriously screwed
157 if [[ ! -f ${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf} ]]; then 129 if [[ ! -f ${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf} ]]; then
158 echo 130 echo
159 eerror "Failed to find configuration ${wxconf}" 131 eerror "Failed to find configuration ${wxconf}"
160 echo 132 echo
161 die "Missing wx-config" 133 die
162 fi 134 fi
163 135
164 debug-print "Found config ${wxconf} - setting WX_CONFIG"
165
166 export WX_CONFIG="${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf}" 136 export WX_CONFIG="${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf}"
167
168 debug-print "WX_CONFIG is ${WX_CONFIG}"
169
170 export WX_ECLASS_CONFIG="${WX_CONFIG}" 137 export WX_ECLASS_CONFIG="${WX_CONFIG}"
171 138
172 echo 139 echo
173 einfo "Requested wxWidgets: ${1} ${WX_GTK_VER}" 140 einfo "Requested wxWidgets: ${1} ${WX_GTK_VER}"
174 einfo "Using wxWidgets: ${wxconf}" 141 einfo "Using wxWidgets: ${wxconf}"

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

  ViewVC Help
Powered by ViewVC 1.1.20