| 1 | # Copyright 1999-2004 Gentoo Foundation |
1 | # Copyright 1999-2005 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.2 2004/08/07 03:40:19 pythonhead Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/wxwidgets.eclass,v 1.9 2005/05/11 23:45:18 pythonhead Exp $ |
| 4 | # |
4 | # |
| 5 | # Author Rob Cakebread <pythonhead@gentoo.org> |
5 | # Author Rob Cakebread <pythonhead@gentoo.org> |
| 6 | |
6 | |
| 7 | # This eclass helps you find the correct wx-config script so ebuilds |
7 | # This eclass helps you find the correct wx-config script so ebuilds |
| 8 | # can use gtk, gtk2 or gtk2+unicode versions of wxGTK |
8 | # can use gtk, gtk2 or gtk2+unicode versions of wxGTK |
| 9 | |
9 | |
| 10 | #FUNCTIONS: |
10 | # FUNCTIONS: |
| 11 | # need-wxwidgets: |
11 | # need-wxwidgets: |
| 12 | # Arguments: gtk, gtk2 or unicode |
12 | # Arguments: |
|
|
13 | # 2.4: gtk gtk2 unicode |
|
|
14 | # 2.6: gtk gtk2 unicode base base-unicode mac mac-unicode |
|
|
15 | # |
| 13 | # |
16 | # |
| 14 | # set-wxconfig |
17 | # set-wxconfig |
| 15 | # Arguments wxgtk, wxgtk2, or wxgtk2u |
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 |
| 16 | |
21 | |
| 17 | ECLASS=wxwidgets |
22 | ECLASS=wxwidgets |
| 18 | INHERITED="$INHERITED $ECLASS" |
23 | INHERITED="$INHERITED $ECLASS" |
| 19 | |
24 | |
| 20 | need-wxwidgets() { |
25 | need-wxwidgets() { |
|
|
26 | debug-print-function $FUNCNAME $* |
|
|
27 | #If you want to use wxGTK-2.6* export WX_GTK_VER in your ebuild: |
|
|
28 | if [ "${WX_GTK_VER}" = "2.6" ]; then |
|
|
29 | case $1 in |
|
|
30 | gtk) set-wxconfig gtk-ansi;; |
|
|
31 | gtk2) set-wxconfig gtk2-ansi;; |
|
|
32 | unicode) set-wxconfig gtk2-unicode;; |
|
|
33 | base) set-wxconfig base-ansi;; |
|
|
34 | base-unicode) set-wxconfig base-unicode;; |
|
|
35 | mac) set-wxconfig mac-ansi;; |
|
|
36 | mac-unicode) set-wxconfig mac-unicode;; |
|
|
37 | *) echo "!!! $FUNCNAME: Error: wxGTK was not comipled with $1." |
|
|
38 | echo "!!! Adjust your USE flags or re-emerge wxGTK with version you want." |
|
|
39 | exit 1;; |
|
|
40 | esac |
| 21 | |
41 | |
| 22 | debug-print-function $FUNCNAME $* |
42 | else |
| 23 | |
43 | WX_GTK_VER="2.4" |
| 24 | case $1 in |
44 | case $1 in |
| 25 | gtk) set-wxconfig wxgtk;; |
45 | gtk) set-wxconfig wxgtk;; |
| 26 | gtk2) set-wxconfig wxgtk2;; |
46 | gtk2) set-wxconfig wxgtk2;; |
| 27 | unicode) set-wxconfig wxgtk2u;; |
47 | unicode) set-wxconfig wxgtk2u;; |
| 28 | *) echo "!!! $FUNCNAME: Error: unrecognized wxconfig version $1 requested" |
48 | *) echo "!!! $FUNCNAME: Error: wxGTK was not comipled with $1." |
|
|
49 | echo "!!! Adjust your USE flags or re-emerge wxGTK with version you want." |
| 29 | exit 1;; |
50 | exit 1;; |
| 30 | esac |
51 | esac |
| 31 | |
52 | fi |
| 32 | } |
53 | } |
| 33 | |
54 | |
| 34 | |
55 | |
| 35 | set-wxconfig() { |
56 | set-wxconfig() { |
| 36 | |
57 | |
| 37 | debug-print-function $FUNCNAME $* |
58 | debug-print-function $FUNCNAME $* |
| 38 | |
59 | |
| 39 | local wxgtk_ver=`/usr/bin/wx-config --release` |
60 | if [ "${WX_GTK_VER}" = "2.6" ] ; then |
| 40 | local wxconfig="/usr/bin/${1}-${wxgtk_ver}-config" |
61 | wxconfig_prefix="/usr/lib/wx/config" |
| 41 | local wxconfig_debug="/usr/bin/${1}d-${wxgtk_ver}-config" |
62 | wxconfig_name="${1}-release-${WX_GTK_VER}" |
|
|
63 | wxconfig="${wxconfig_prefix}/${wxconfig_name}" |
|
|
64 | wxconfig_debug_name="${1}-debug-${WX_GTK_VER}" |
|
|
65 | wxconfig_debug="${wxconfig_prefix}/${wxconfig_debug_name}" |
|
|
66 | else |
|
|
67 | # Default is 2.4: |
|
|
68 | wxconfig_prefix="/usr/bin" |
|
|
69 | wxconfig_name="${1}-${WX_GTK_VER}-config" |
|
|
70 | wxconfig="${wxconfig_prefix}/${wxconfig_name}" |
|
|
71 | wxconfig_debug_name="${1}d-${WX_GTK_VER}-config" |
|
|
72 | wxconfig_debug="${wxconfig_prefix}/${wxconfig_debug_name}" |
|
|
73 | fi |
| 42 | |
74 | |
| 43 | if [ -e ${wxconfig} ] ; then |
75 | if [ -e ${wxconfig} ] ; then |
| 44 | export WX_CONFIG=${wxconfig} |
76 | export WX_CONFIG=${wxconfig} |
|
|
77 | export WX_CONFIG_NAME=${wxconfig_name} |
|
|
78 | export WXBASE_CONFIG_NAME=${wxconfig_name} |
| 45 | echo " * Using ${wxconfig}" |
79 | echo " * Using ${wxconfig}" |
| 46 | elif [ -e ${wxconfig_debug} ] ; then |
80 | elif [ -e ${wxconfig_debug} ] ; then |
| 47 | export WX_CONFIG=${wxconfig_debug} |
81 | export WX_CONFIG=${wxconfig_debug} |
|
|
82 | export WX_CONFIG_NAME=${wxconfig_debug_name} |
|
|
83 | export WXBASE_CONFIG_NAME=${wxconfig_debug_name} |
| 48 | echo " * Using ${wxconfig_debug}" |
84 | echo " * Using ${wxconfig_debug}" |
| 49 | else |
85 | else |
| 50 | echo "!!! $FUNCNAME: Error: Can't find normal or debug version:" |
86 | echo "!!! $FUNCNAME: Error: Can't find normal or debug version:" |
| 51 | echo "!!! $FUNCNAME: ${wxconfig} not found" |
87 | echo "!!! $FUNCNAME: ${wxconfig} not found" |
| 52 | echo "!!! $FUNCNAME: ${wxconfig_debug} not found" |
88 | echo "!!! $FUNCNAME: ${wxconfig_debug} not found" |
| 53 | case $1 in |
89 | case $1 in |
| 54 | wxgtk) echo "!!! You need to emerge wxGTK with -no_wxgtk1 in your USE";; |
90 | wxgtk) echo "!!! You need to emerge wxGTK with wxgtk1 in your USE";; |
| 55 | wxgtkd) echo "!!! You need to emerge wxGTK with -no_wxgtk1 in your USE";; |
91 | wxgtkd) echo "!!! You need to emerge wxGTK with wxgtk1 in your USE";; |
|
|
92 | gtk-ansi) echo "!!! You need to emerge wxGTK with wxgtk1 in your USE";; |
|
|
93 | gtkd-ansi) echo "!!! You need to emerge wxGTK with wxgtk1 in your USE";; |
|
|
94 | |
| 56 | wxgtk2) echo "!!! You need to emerge wxGTK with gtk2 in your USE";; |
95 | wxgtk2) echo "!!! You need to emerge wxGTK with gtk2 in your USE";; |
| 57 | wxgtk2d) echo "!!! You need to emerge wxGTK with gtk2 in your USE";; |
96 | wxgtk2d) echo "!!! You need to emerge wxGTK with gtk2 in your USE";; |
|
|
97 | gtk2-ansi) echo "!!! You need to emerge wxGTK with gtk2 in your USE";; |
|
|
98 | gtk2d-ansi) echo "!!! You need to emerge wxGTK with gtk2 in your USE";; |
|
|
99 | |
| 58 | wxgtk2u) echo "!!! You need to emerge wxGTK with unicode in your USE";; |
100 | wxgtk2u) echo "!!! You need to emerge wxGTK with unicode in your USE";; |
| 59 | wxgtk2ud) echo "!!! You need to emerge wxGTK with unicode in your USE";; |
101 | wxgtk2ud) echo "!!! You need to emerge wxGTK with unicode in your USE";; |
|
|
102 | gtk2-unicode) echo "!!! You need to emerge wxGTK with unicode in your USE";; |
|
|
103 | gtk2d-unicode) echo "!!! You need to emerge wxGTK with unicode in your USE";; |
| 60 | esac |
104 | esac |
| 61 | exit 1 |
105 | exit 1 |
| 62 | fi |
106 | fi |
| 63 | } |
107 | } |
| 64 | |
108 | |
| 65 | |
|
|