summaryrefslogtreecommitdiff
blob: b3671e0eba0071dc74876f01a6608cc94705b384 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/wxwidgets.eclass,v 1.3 2004/08/16 16:42:40 pythonhead Exp $
#
# Author Rob Cakebread <pythonhead@gentoo.org>

# This eclass helps you find the correct wx-config script so ebuilds
# can use gtk, gtk2 or gtk2+unicode versions of wxGTK 

#FUNCTIONS:
# need-wxwidgets:
#   Arguments: gtk, gtk2 or unicode
#
# set-wxconfig
#   Arguments wxgtk, wxgtk2, or wxgtk2u

ECLASS=wxwidgets
INHERITED="$INHERITED $ECLASS"

need-wxwidgets() {

	debug-print-function $FUNCNAME $*

	case $1 in
		gtk)		set-wxconfig wxgtk;;
		gtk2)		set-wxconfig wxgtk2;;
		unicode)	set-wxconfig wxgtk2u;;
		*)		echo "!!! $FUNCNAME: Error: unrecognized wxconfig version $1 requested"
		exit 1;;
	esac

}


set-wxconfig() {

	debug-print-function $FUNCNAME $*

	local wxgtk_ver=`/usr/bin/wx-config --release`
	local wxconfig="/usr/bin/${1}-${wxgtk_ver}-config"
	local wxconfig_debug="/usr/bin/${1}d-${wxgtk_ver}-config"

	if [ -e ${wxconfig} ] ; then
		export WX_CONFIG=${wxconfig}
		export WX_CONFIG_NAME="${1}-${wxgtk_ver}-config"
		export WXBASE_CONFIG_NAME="${1}-${wxgtk_ver}-config"
		echo ${WX_CONFIG_NAME}
		echo " * Using ${wxconfig}"
	elif [ -e ${wxconfig_debug} ] ; then
		export WX_CONFIG=${wxconfig_debug}
		export WX_CONFIG_NAME="${1}d-${wxgtk_ver}-config"
		export WXBASE_CONFIG_NAME="${1}d-${wxgtk_ver}-config"
		echo " * Using ${wxconfig_debug}"
	else
		echo "!!! $FUNCNAME: Error:  Can't find normal or debug version:"
		echo "!!! $FUNCNAME:         ${wxconfig} not found"
		echo "!!! $FUNCNAME:         ${wxconfig_debug} not found"
		case $1 in
			wxgtk)	 echo "!!! You need to emerge wxGTK with -no_wxgtk1 in your USE";;
			wxgtkd)	 echo "!!! You need to emerge wxGTK with -no_wxgtk1 in your USE";;
			wxgtk2)	 echo "!!! You need to emerge wxGTK with gtk2 in your USE";;
			wxgtk2d) echo "!!! You need to emerge wxGTK with gtk2 in your USE";;
			wxgtk2u) echo "!!! You need to emerge wxGTK with unicode in your USE";;
			wxgtk2ud) echo "!!! You need to emerge wxGTK with unicode in your USE";;
		esac
		exit 1
	fi
}