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

Diff of /eclass/wxwidgets.eclass

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

Revision 1.1.1.1 Revision 1.38
1# Copyright 1999-2005 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.1.1.1 2005/11/30 09:59:30 chriswhite Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/wxwidgets.eclass,v 1.38 2013/12/30 08:25:35 dirtyepic Exp $
4
5# @ECLASS: wxwidgets.eclass
6# @MAINTAINER:
7# wxwidgets@gentoo.org
8# @BLURB: Manages build configuration for wxGTK-using packages.
9# @DESCRIPTION:
10# 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.
4# 13#
5# Author Rob Cakebread <pythonhead@gentoo.org> 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#
25# @CODE
26# inherit wxwidgets
27#
28# IUSE="X wxwidgets"
29# DEPEND="wxwidgets? ( x11-libs/wxGTK:2.8[X?] )"
30#
31# 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# @CODE
43#
44# 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#
53# Note: unless you know your package works with wxbase (which is very
54# doubtful), always depend on wxGTK[X].
6 55
7# This eclass helps you find the correct wx-config script so ebuilds 56inherit eutils multilib
8# can use gtk, gtk2 or gtk2+unicode versions of wxGTK
9 57
10# FUNCTIONS: 58# We do this in global scope so ebuilds can get sane defaults just by
11# need-wxwidgets: 59# inheriting.
12# Arguments: 60if [[ -z ${WX_CONFIG} ]]; then
13# 2.4: gtk gtk2 unicode 61 if [[ -n ${WX_GTK_VER} ]]; then
14# 2.6: gtk gtk2 unicode base base-unicode mac mac-unicode 62 for wxtoolkit in gtk2 base; do
63 # newer versions don't have a seperate debug profile
64 for wxdebug in xxx release- debug-; do
65 wxconf="${wxtoolkit}-unicode-${wxdebug/xxx/}${WX_GTK_VER}"
66
67 [[ -f ${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf} ]] || continue
68
69 WX_CONFIG="${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf}"
70 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
77fi
78
79# @FUNCTION: need-wxwidgets
80# @USAGE: <profile>
81# @DESCRIPTION:
15# 82#
83# Available configurations are:
16# 84#
17# set-wxconfig 85# unicode (USE="X")
18# Arguments: (wxGTK 2.4) wxgtk, wxgtk2, or wxgtk2u 86# base-unicode (USE="-X")
19# Arguments: (wxGTK 2.6) gtk-ansi gtk2-ansi unicode base-ansi base-unicode mac-ansi mac-unicode
20# Note: Don't call this function directly from ebuilds
21
22inherit multilib
23 87
24need-wxwidgets() { 88need-wxwidgets() {
25 debug-print-function $FUNCNAME $* 89 local wxtoolkit wxdebug wxconf
26 #If you want to use wxGTK-2.6* export WX_GTK_VER in your ebuild:
27 if [ "${WX_GTK_VER}" = "2.6" ]; then
28 case $1 in
29 gtk) set-wxconfig gtk-ansi;;
30 gtk2) set-wxconfig gtk2-ansi;;
31 unicode) set-wxconfig gtk2-unicode;;
32 base) set-wxconfig base-ansi;;
33 base-unicode) set-wxconfig base-unicode;;
34 mac) set-wxconfig mac-ansi;;
35 mac-unicode) set-wxconfig mac-unicode;;
36 *) echo "!!! $FUNCNAME: Error: wxGTK was not comipled with $1."
37 echo "!!! Adjust your USE flags or re-emerge wxGTK with version you want."
38 exit 1;;
39 esac
40 90
41 else 91 if [[ -z ${WX_GTK_VER} ]]; then
42 WX_GTK_VER="2.4" 92 eerror "WX_GTK_VER must be set before calling $FUNCNAME."
43 case $1 in 93 echo
44 gtk) set-wxconfig wxgtk;; 94 die
45 gtk2) set-wxconfig wxgtk2;;
46 unicode) set-wxconfig wxgtk2u;;
47 *) echo "!!! $FUNCNAME: Error: wxGTK was not compiled with $1."
48 echo "!!! Adjust your USE flags or re-emerge wxGTK with the version you want."
49 exit 1;;
50 esac
51 fi 95 fi
52} 96
53 97 if [[ ${WX_GTK_VER} != 2.8 && ${WX_GTK_VER} != 2.9 && ${WX_GTK_VER} != 3.0 ]]; then
54 98 eerror "Invalid WX_GTK_VER: ${WX_GTK_VER} - must be set to a valid wxGTK SLOT."
55set-wxconfig() { 99 echo
56 100 die
57 debug-print-function $FUNCNAME $*
58
59 if [ "${WX_GTK_VER}" = "2.6" ] ; then
60 wxconfig_prefix="/usr/$(get_libdir)/wx/config"
61 wxconfig_name="${1}-release-${WX_GTK_VER}"
62 wxconfig="${wxconfig_prefix}/${wxconfig_name}"
63 wxconfig_debug_name="${1}-debug-${WX_GTK_VER}"
64 wxconfig_debug="${wxconfig_prefix}/${wxconfig_debug_name}"
65 else
66 # Default is 2.4:
67 wxconfig_prefix="/usr/bin"
68 wxconfig_name="${1}-${WX_GTK_VER}-config"
69 wxconfig="${wxconfig_prefix}/${wxconfig_name}"
70 wxconfig_debug_name="${1}d-${WX_GTK_VER}-config"
71 wxconfig_debug="${wxconfig_prefix}/${wxconfig_debug_name}"
72 fi 101 fi
73 102
74 if [ -e ${wxconfig} ] ; then 103 case $1 in
75 export WX_CONFIG=${wxconfig} 104 unicode|base-unicode) ;;
76 export WX_CONFIG_NAME=${wxconfig_name} 105 *) eerror "Invalid $FUNCNAME profile: $1"
77 export WXBASE_CONFIG_NAME=${wxconfig_name} 106 echo
78 echo " * Using ${wxconfig}" 107 die
79 elif [ -e ${wxconfig_debug} ] ; then 108 ;;
80 export WX_CONFIG=${wxconfig_debug} 109 esac
81 export WX_CONFIG_NAME=${wxconfig_debug_name} 110
82 export WXBASE_CONFIG_NAME=${wxconfig_debug_name} 111 # wxbase is provided by both gtk2 and base installations
83 echo " * Using ${wxconfig_debug}" 112 if has_version "x11-libs/wxGTK:${WX_GTK_VER}[X]"; then
113 wxtoolkit="gtk2"
84 else 114 else
85 echo "!!! $FUNCNAME: Error: Can't find normal or debug version:" 115 wxtoolkit="base"
86 echo "!!! $FUNCNAME: ${wxconfig} not found" 116 fi
87 echo "!!! $FUNCNAME: ${wxconfig_debug} not found"
88 case $1 in
89 wxgtk) echo "!!! You need to emerge wxGTK with wxgtk1 in your USE";;
90 wxgtkd) echo "!!! You need to emerge wxGTK with wxgtk1 in your USE";;
91 gtk-ansi) echo "!!! You need to emerge wxGTK with wxgtk1 in your USE";;
92 gtkd-ansi) echo "!!! You need to emerge wxGTK with wxgtk1 in your USE";;
93 117
94 wxgtk2) echo "!!! You need to emerge wxGTK with gtk2 in your USE";; 118 # 2.8 has a separate debug element
95 wxgtk2d) echo "!!! You need to emerge wxGTK with gtk2 in your USE";; 119 if [[ ${WX_GTK_VER} == 2.8 ]]; then
96 gtk2-ansi) echo "!!! You need to emerge wxGTK with gtk2 in your USE";; 120 if has_version "x11-libs/wxGTK:${WX_GTK_VER}[debug]"; then
97 gtk2d-ansi) echo "!!! You need to emerge wxGTK with gtk2 in your USE";; 121 wxdebug="debug-"
122 else
123 wxdebug="release-"
124 fi
125 fi
98 126
99 wxgtk2u) echo "!!! You need to emerge wxGTK with unicode in your USE";; 127 wxconf="${wxtoolkit}-unicode-${wxdebug}${WX_GTK_VER}"
100 wxgtk2ud) echo "!!! You need to emerge wxGTK with unicode in your USE";; 128
101 gtk2-unicode) echo "!!! You need to emerge wxGTK with unicode in your USE";; 129 if [[ ! -f ${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf} ]]; then
102 gtk2d-unicode) echo "!!! You need to emerge wxGTK with unicode in your USE";; 130 echo
103 esac 131 eerror "Failed to find configuration ${wxconf}"
104 exit 1 132 echo
133 die
105 fi 134 fi
135
136 export WX_CONFIG="${EPREFIX}/usr/$(get_libdir)/wx/config/${wxconf}"
137 export WX_ECLASS_CONFIG="${WX_CONFIG}"
138
139 echo
140 einfo "Requested wxWidgets: ${1} ${WX_GTK_VER}"
141 einfo "Using wxWidgets: ${wxconf}"
142 echo
106} 143}
107

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.38

  ViewVC Help
Powered by ViewVC 1.1.20