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

Contents of /eclass/wxwidgets.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.19 - (show annotations) (download)
Mon Jul 30 01:34:13 2007 UTC (6 years, 11 months ago) by dirtyepic
Branch: MAIN
Changes since 1.18: +29 -5 lines
Add check_wxuse, a small utility fuction to make checking wxGTK USE flags consistent.

1 # Copyright 1999-2007 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4 #
5 # Original Author: Rob Cakebread <pythonhead@gentoo.org>
6 # Current Maintainers: wxWidgets team <wxwidgets@gentoo.org>
7
8 # This eclass helps you find the correct wx-config script so ebuilds
9 # can use gtk, gtk2 or gtk2+unicode versions of wxGTK
10
11 # FUNCTIONS:
12 # need-wxwidgets:
13 # Arguments:
14 # 2.4: gtk gtk2 unicode !!! 2.4 is being removed from the tree !!!
15 # 2.6: gtk2 unicode base base-unicode mac mac-unicode
16 #
17 # set-wxconfig
18 # Arguments: (wxGTK 2.4) wxgtk, wxgtk2, or wxgtk2u
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 #
22 # check_wxuse
23 # Check if wxGTK was built with the specified USE flag.
24 # Usage: check_wxuse <USE flag>
25 # Note: for now, requires WX_GTK_VER to be set.
26
27 inherit multilib flag-o-matic
28
29 need-wxwidgets() {
30 debug-print-function $FUNCNAME $*
31 #If you want to use wxGTK-2.6* export WX_GTK_VER in your ebuild:
32 if [ "${WX_GTK_VER}" = "2.6" ]; then
33 case $1 in
34 gtk) set-wxconfig gtk-ansi;;
35 gtk2) set-wxconfig gtk2-ansi;;
36 unicode) set-wxconfig gtk2-unicode;;
37 base) set-wxconfig base-ansi;;
38 base-unicode) set-wxconfig base-unicode;;
39 mac) set-wxconfig mac-ansi;;
40 mac-unicode) set-wxconfig mac-unicode;;
41 *) echo "!!! $FUNCNAME: Error: wxGTK was not comipled with $1."
42 echo "!!! Adjust your USE flags or re-emerge wxGTK with version you want."
43 exit 1;;
44 esac
45
46 else
47 WX_GTK_VER="2.4"
48 case $1 in
49 gtk) set-wxconfig wxgtk;;
50 gtk2) set-wxconfig wxgtk2;;
51 unicode) set-wxconfig wxgtk2u;;
52 *) echo "!!! $FUNCNAME: Error: wxGTK was not compiled with $1."
53 echo "!!! Adjust your USE flags or re-emerge wxGTK with the version you want."
54 exit 1;;
55 esac
56 fi
57 }
58
59 set-wxconfig() {
60
61 debug-print-function $FUNCNAME $*
62
63 if [ "${WX_GTK_VER}" = "2.6" ] ; then
64 wxconfig_prefix="/usr/$(get_libdir)/wx/config"
65 wxconfig_name="${1}-release-${WX_GTK_VER}"
66 wxconfig="${wxconfig_prefix}/${wxconfig_name}"
67 wxconfig_debug_name="${1}-debug-${WX_GTK_VER}"
68 wxconfig_debug="${wxconfig_prefix}/${wxconfig_debug_name}"
69 else
70 # Default is 2.4:
71 wxconfig_prefix="/usr/bin"
72 wxconfig_name="${1}-${WX_GTK_VER}-config"
73 wxconfig="${wxconfig_prefix}/${wxconfig_name}"
74 wxconfig_debug_name="${1}d-${WX_GTK_VER}-config"
75 wxconfig_debug="${wxconfig_prefix}/${wxconfig_debug_name}"
76 fi
77
78 if [ -e ${wxconfig} ] ; then
79 export WX_CONFIG=${wxconfig}
80 export WX_CONFIG_NAME=${wxconfig_name}
81 export WXBASE_CONFIG_NAME=${wxconfig_name}
82 echo " * Using ${wxconfig}"
83 elif [ -e ${wxconfig_debug} ] ; then
84 export WX_CONFIG=${wxconfig_debug}
85 export WX_CONFIG_NAME=${wxconfig_debug_name}
86 export WXBASE_CONFIG_NAME=${wxconfig_debug_name}
87 echo " * Using ${wxconfig_debug}"
88 else
89 echo "!!! $FUNCNAME: Error: Can't find normal or debug version:"
90 echo "!!! $FUNCNAME: ${wxconfig} not found"
91 echo "!!! $FUNCNAME: ${wxconfig_debug} not found"
92 case $1 in
93 wxgtk) echo "!!! You need to emerge wxGTK with wxgtk1 in your USE";;
94 wxgtkd) echo "!!! You need to emerge wxGTK with wxgtk1 in your USE";;
95 gtk-ansi) echo "!!! GTK-1 support is not available in wxGTK-2.6."
96 echo "!!! Please search bugzilla for this package and file a new bug if one is not already present.";;
97 gtkd-ansi) echo "!!! GTK-1 support is not available in wxGTK-2.6.";;
98
99 wxgtk2) echo "!!! You need to emerge wxGTK with gtk in your USE";;
100 wxgtk2d) echo "!!! You need to emerge wxGTK with gtk in your USE";;
101 gtk2-ansi) echo "!!! You need to emerge wxGTK with gtk in your USE";;
102 gtk2d-ansi) echo "!!! You need to emerge wxGTK with gtk in your USE";;
103
104 wxgtk2u) echo "!!! You need to emerge wxGTK with unicode in your USE";;
105 wxgtk2ud) echo "!!! You need to emerge wxGTK with unicode in your USE";;
106 gtk2-unicode) echo "!!! You need to emerge wxGTK with unicode in your USE";;
107 gtk2d-unicode) echo "!!! You need to emerge wxGTK with unicode in your USE";;
108 esac
109 exit 1
110 fi
111 }
112
113 check_wxuse() {
114 if [[ -z ${WX_GTK_VER} ]]; then
115 echo
116 eerror "You need to set WX_GTK_VER before calling ${FUNCNAME}."
117 die "Missing WX_GTK_VER."
118 fi
119
120 ebegin "Checking wxGTK-${WX_GTK_VER} for ${1} support"
121 if $(built_with_use =x11-libs/wxGTK-${WX_GTK_VER}* ${1}); then
122 eend 0
123 else
124 eend 1
125 echo
126 eerror "${FUNCNAME} - You have requested functionality that requires ${1} support to"
127 eerror "have been built into x11-libs/wxGTK."
128 eerror
129 eerror "Please re-merge =x11-libs/wxGTK-${WX_GTK_VER}* with the ${1} USE flag enabled."
130 die "Missing USE flags."
131 fi
132 }

  ViewVC Help
Powered by ViewVC 1.1.20