summaryrefslogtreecommitdiff
blob: c7dba1c94d8c789a6892bd4ba86e55ed2cbfec33 (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
#! /bin/sh
#
# Tiny startup wrapper for Eclipse
#
# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
# Copyright (c) 2007-2008, Jean-Noël Rivasseau <elvanor@gentoo.org>
# Copyright (c) 2004-2008, Gentoo Foundation
#
# Licensed under the GNU General Public License, version 2
#

SLOT="3.4"

[ -f "/etc/eclipserc" ] && source "/etc/eclipserc"
[ -f "$HOME/.gentoo/.eclipserc" ] && source "$HOME/.gentoo/.eclipserc"

ECLIPSE_HOME=${ECLIPSE_HOME:="/usr/lib/eclipse-${SLOT}"}
ECLIPSE_BIN="${ECLIPSE_HOME}/eclipse"

if [ ! -x ${ECLIPSE_BIN} ] ; then
	echo "Failed to find executable '${ECLIPSE_BIN}'" > /dev/stderr
	exit -1
fi

if [ $(id -u) -eq 0 ] ; then
	echo "Do not run eclipse as root user! Exiting ..."
	exit -1
fi

case "$(java-config -f)" in
	*gcj*)
		export JAVA_PKG_CLASSMAP="${ECLIPSE_HOME}/eclipse.gcjdb"
		;;
esac

eval $(gjl --package "swt-${SLOT}" --get-args)

[ -n "${ECLIPSE_XMS}" ] && VM_ARGS="${VM_ARGS} -Xms${ECLIPSE_XMS}"
[ -n "${ECLIPSE_XMX}" ] && VM_ARGS="${VM_ARGS} -Xmx${ECLIPSE_XMX}"
[ -n "${ECLIPSE_PERMSIZE}" ] && VM_ARGS="${VM_ARGS} -XX:PermSize=${ECLIPSE_PERMSIZE}"
[ -n "${ECLIPSE_MAX_PERMSIZE}" ] && VM_ARGS="${VM_ARGS} -XX:MaxPermSize=${ECLIPSE_MAX_PERMSIZE}"

exec ${ECLIPSE_BIN} -vm $(java-config --java) "$@" "${ECLIPSE_USER_ARGS}" -vmargs ${VM_ARGS}