summaryrefslogtreecommitdiff
blob: e4d44465a5c02d44f1c1f1f3099ec1e4978bd9b9 (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
#!/bin/sh -
#
# /usr/bin/wxrc
#
#  a lame wxrc wrapper (bugs to wxwidgets@gentoo.org)

EPREFIX=''
LIBDIR="lib"

_wxerror() {
	cat >&2 <<- EOF
		An error occurred while calling wxrc:

		${1}

		Please use \`eselect wxwidgets\` to select an available profile and try again.
	EOF
	exit 1
}

if [ -n "${WX_ECLASS_CONFIG}" ]; then
	exec "$("${WX_ECLASS_CONFIG}" --utility=wxrc)" "$@"
else
	if [ -e "${EPREFIX}"/var/lib/wxwidgets/current ]; then
		. "${EPREFIX}"/var/lib/wxwidgets/current
	else
		_wxerror "Cannot find the wxWidgets profile configuration ( ${EPREFIX}/var/lib/wxwidgets/current )"
	fi

	if [ -z "${WXCONFIG}" ] || [ "${WXCONFIG}" = none ]; then
		_wxerror "No profile currently selected"
	fi

	if [ -x "${EPREFIX}/usr/${LIBDIR}/wx/config/${WXCONFIG}" ]; then
		exec "$("${EPREFIX}/usr/${LIBDIR}/wx/config/${WXCONFIG}" --utility=wxrc)" "$@"
	else
		_wxerror "Cannot find wxWidgets profile ( ${WXCONFIG} )"
	fi
fi