#!/bin/sh # This script sets up the environment to run Eclipse in newer # versions of Linux which are slightly incompatible with Eclipse 3.4.2. help() { echo "Note: xulrunner 1.8 should be installed if Eclipse hangs on startup with" echo " an empty dialog, crashes in Help > Welcome, fails to show hover help," echo " crashes in certain wizards, etc." echo "" echo "This script will detect xulrunner on PATH, in /usr/lib/xulrunner," echo "/usr/local/lib/xulrunner, or specified via the XULRUNNER environment variable." echo "" echo "Try: sudo apt-get install xulrunner in Ubuntu" echo "" echo "See https://garage.maemo.org/tracker/index.php?func=detail&aid=4689&group_id=192&atid=1420" } check_version() { PROG="$1" if [ ! -z "$PROG" ] && [ -e "$PROG" ] ; then FULL_VERSION=`$PROG -v 2>&1 | awk '{print $3}'` VERSION2=`echo $FULL_VERSION | cut -d. -f1,2` test "$VERSION2" = "1.8" #VERSION3=`echo $FULL_VERSION | cut -d. -f1-3` #test "$VERSION2" = "1.8" -o \( "$VERSION2" = "1.9" -a "$VERSION3" != "1.9.0" \) else return 1 fi } # Add arguments for -vmargs parsed from *.ini file. # # NOTE: this produces an extra "-vmargs" in the JVM command line but Eclipse and/or the JRE doesn't seem to mind. add_vmargs_from_ini_file() { INI="$1" if [ -e "$INI" ] ; then # eat up -vmargs lines through EOF VMARGOPTS="$VMARGOPTS `sed -n '/-vmargs/,$ p' < "$INI" `" fi } # first, Eclipse depends on an old version of xulrunner. if [ -z "$XULRUNNER" ] ; then XULRUNNER=`which xulrunner` if ! check_version $XULRUNNER ; then XULRUNNER=/usr/lib/xulrunner/xulrunner if ! check_version $XULRUNNER ; then XULRUNNER=/usr/local/lib/xulrunner/xulrunner if ! check_version $XULRUNNER ; then XULRUNNER="" fi fi fi fi XULOPTS="" if [ -z "$XULRUNNER" ] ; then help else XULOPTS="-vmargs -Dorg.eclipse.swt.browser.XULRunnerPath=`dirname $XULRUNNER`" echo "Using xulrunner: $XULRUNNER" fi # This is a fix for dependencies on GTK 2.16 (and older) behavior, which # if unfixed, results in annoying dialog behavior where the mouse cannot # properly click buttons, use tables, etc. export GDK_NATIVE_WINDOWS=true PROGRAM=esbox INSTALL_DIR=`dirname $0` if [ ! -e "$INSTALL_DIR/$PROGRAM" ] ; then INSTALL_DIR=. ; fi # If -vmargs is specified, it overrides the *.ini file, so explicitly include them VMARGOPTS= if [ ! -z "$XULOPTS" ] ; then add_vmargs_from_ini_file "$INSTALL_DIR/${PROGRAM}.ini" fi "$INSTALL_DIR"/$PROGRAM $XULOPTS $VMARGOPTS "$@"