| 1 |
# Copyright 1999-2005 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/eclass/wxwidgets.eclass,v 1.15 2006/03/18 16:43:20 flameeyes Exp $
|
| 4 |
#
|
| 5 |
# Author Rob Cakebread <pythonhead@gentoo.org>
|
| 6 |
|
| 7 |
# This eclass helps you find the correct wx-config script so ebuilds
|
| 8 |
# can use gtk, gtk2 or gtk2+unicode versions of wxGTK
|
| 9 |
|
| 10 |
# FUNCTIONS:
|
| 11 |
# need-wxwidgets:
|
| 12 |
# Arguments:
|
| 13 |
# 2.4: gtk gtk2 unicode
|
| 14 |
# 2.6: gtk gtk2 unicode base base-unicode mac mac-unicode
|
| 15 |
#
|
| 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 |
inherit multilib flag-o-matic
|
| 23 |
|
| 24 |
need-wxwidgets() {
|
| 25 |
debug-print-function $FUNCNAME $*
|
| 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 |
|
| 41 |
else
|
| 42 |
WX_GTK_VER="2.4"
|
| 43 |
case $1 in
|
| 44 |
gtk) set-wxconfig wxgtk;;
|
| 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
|
| 52 |
|
| 53 |
local ldver=$( $(tc-getLD) --version | head -n 1 | \
|
| 54 |
sed -e 's:.*version \([0-9.]\+\) .*:\1:')
|
| 55 |
local ldmaj=$(echo $ldver | cut -f1 -d.)
|
| 56 |
local ldmin=$(echo $ldver | cut -f2 -d.)
|
| 57 |
local ldmicro=$(echo $ldver | cut -f3 -d.)
|
| 58 |
|
| 59 |
if [[ $ldmaj -lt 1 || ( $ldmaj == 2 && $ldmin < 16 && $ldmicro < 92 ) ]]; then
|
| 60 |
filter-ldflags -Wl,--as-needed --as-needed
|
| 61 |
filter-flags -Wl,--as-needed --as-needed
|
| 62 |
fi
|
| 63 |
}
|
| 64 |
|
| 65 |
|
| 66 |
set-wxconfig() {
|
| 67 |
|
| 68 |
debug-print-function $FUNCNAME $*
|
| 69 |
|
| 70 |
if [ "${WX_GTK_VER}" = "2.6" ] ; then
|
| 71 |
wxconfig_prefix="/usr/$(get_libdir)/wx/config"
|
| 72 |
wxconfig_name="${1}-release-${WX_GTK_VER}"
|
| 73 |
wxconfig="${wxconfig_prefix}/${wxconfig_name}"
|
| 74 |
wxconfig_debug_name="${1}-debug-${WX_GTK_VER}"
|
| 75 |
wxconfig_debug="${wxconfig_prefix}/${wxconfig_debug_name}"
|
| 76 |
else
|
| 77 |
# Default is 2.4:
|
| 78 |
wxconfig_prefix="/usr/bin"
|
| 79 |
wxconfig_name="${1}-${WX_GTK_VER}-config"
|
| 80 |
wxconfig="${wxconfig_prefix}/${wxconfig_name}"
|
| 81 |
wxconfig_debug_name="${1}d-${WX_GTK_VER}-config"
|
| 82 |
wxconfig_debug="${wxconfig_prefix}/${wxconfig_debug_name}"
|
| 83 |
fi
|
| 84 |
|
| 85 |
if [ -e ${wxconfig} ] ; then
|
| 86 |
export WX_CONFIG=${wxconfig}
|
| 87 |
export WX_CONFIG_NAME=${wxconfig_name}
|
| 88 |
export WXBASE_CONFIG_NAME=${wxconfig_name}
|
| 89 |
echo " * Using ${wxconfig}"
|
| 90 |
elif [ -e ${wxconfig_debug} ] ; then
|
| 91 |
export WX_CONFIG=${wxconfig_debug}
|
| 92 |
export WX_CONFIG_NAME=${wxconfig_debug_name}
|
| 93 |
export WXBASE_CONFIG_NAME=${wxconfig_debug_name}
|
| 94 |
echo " * Using ${wxconfig_debug}"
|
| 95 |
else
|
| 96 |
echo "!!! $FUNCNAME: Error: Can't find normal or debug version:"
|
| 97 |
echo "!!! $FUNCNAME: ${wxconfig} not found"
|
| 98 |
echo "!!! $FUNCNAME: ${wxconfig_debug} not found"
|
| 99 |
case $1 in
|
| 100 |
wxgtk) echo "!!! You need to emerge wxGTK with wxgtk1 in your USE";;
|
| 101 |
wxgtkd) echo "!!! You need to emerge wxGTK with wxgtk1 in your USE";;
|
| 102 |
gtk-ansi) echo "!!! You need to emerge wxGTK with wxgtk1 in your USE";;
|
| 103 |
gtkd-ansi) echo "!!! You need to emerge wxGTK with wxgtk1 in your USE";;
|
| 104 |
|
| 105 |
wxgtk2) echo "!!! You need to emerge wxGTK with gtk2 in your USE";;
|
| 106 |
wxgtk2d) echo "!!! You need to emerge wxGTK with gtk2 in your USE";;
|
| 107 |
gtk2-ansi) echo "!!! You need to emerge wxGTK with gtk2 in your USE";;
|
| 108 |
gtk2d-ansi) echo "!!! You need to emerge wxGTK with gtk2 in your USE";;
|
| 109 |
|
| 110 |
wxgtk2u) echo "!!! You need to emerge wxGTK with unicode in your USE";;
|
| 111 |
wxgtk2ud) echo "!!! You need to emerge wxGTK with unicode in your USE";;
|
| 112 |
gtk2-unicode) echo "!!! You need to emerge wxGTK with unicode in your USE";;
|
| 113 |
gtk2d-unicode) echo "!!! You need to emerge wxGTK with unicode in your USE";;
|
| 114 |
esac
|
| 115 |
exit 1
|
| 116 |
fi
|
| 117 |
}
|
| 118 |
|