Rewrite eclipse startup script to support the JAVACMD env var.

Now the startup script checks JAVACMD, JAVA_HOME, java found
in PATH then a default JAVACMD value. discussed with ian@
This commit is contained in:
kurt 2006-07-19 17:27:15 +00:00
parent a1a32f1041
commit 1637e30e73
2 changed files with 29 additions and 28 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.17 2006/07/07 01:48:54 kurt Exp $ # $OpenBSD: Makefile,v 1.18 2006/07/19 17:27:15 kurt Exp $
ONLY_FOR_ARCHS= amd64 i386 ONLY_FOR_ARCHS= amd64 i386
@ -8,9 +8,9 @@ COMMENT-mozilla= "mozilla integration library for eclipse HTML Browser Widget"
ECLIPSE_VER= 3.2 ECLIPSE_VER= 3.2
DISTNAME= eclipse-sourceBuild-srcIncluded-${ECLIPSE_VER} DISTNAME= eclipse-sourceBuild-srcIncluded-${ECLIPSE_VER}
PKGNAME= eclipse-sdk-${ECLIPSE_VER} PKGNAME= eclipse-sdk-${ECLIPSE_VER}p0
PKGNAME-gnome= eclipse-sdk-gnome-${ECLIPSE_VER} PKGNAME-gnome= eclipse-sdk-gnome-${ECLIPSE_VER}p0
PKGNAME-mozilla= eclipse-sdk-mozilla-${ECLIPSE_VER} PKGNAME-mozilla= eclipse-sdk-mozilla-${ECLIPSE_VER}p0
SHARED_LIBS= swt-atk-gtk-3232 3.0 \ SHARED_LIBS= swt-atk-gtk-3232 3.0 \
swt-cde-gtk-3232 3.0 \ swt-cde-gtk-3232 3.0 \
swt-awt-gtk-3232 3.0 \ swt-awt-gtk-3232 3.0 \
@ -143,8 +143,8 @@ do-install:
@tar xzf ${WRKBUILD}/result/${ECLIPSE_OS}-${ECLIPSE_WS}-${ECLIPSE_ARCH}-sdk.tar.gz \ @tar xzf ${WRKBUILD}/result/${ECLIPSE_OS}-${ECLIPSE_WS}-${ECLIPSE_ARCH}-sdk.tar.gz \
-C ${PREFIX} -C ${PREFIX}
@sed -e "s+%%ECLIPSE_HOME%%+${TRUEPREFIX}/eclipse+g" \ @sed -e "s+%%ECLIPSE_HOME%%+${TRUEPREFIX}/eclipse+g" \
-e "s+%%JAVA_HOME%%+${JAVA_HOME}+g" \ -e "s+%%DEFAULT_JAVACMD%%+${JAVA_HOME}/bin/java+g" \
-e "s+%%LOCALBASE%%+${TRUEPREFIX}+g" \ -e "s+%%MOZILLA_FIVE_HOME%%+${TRUEPREFIX}/mozilla+g" \
${WRKBUILD}/eclipse.in > ${WRKBUILD}/eclipse.tmp ${WRKBUILD}/eclipse.in > ${WRKBUILD}/eclipse.tmp
${INSTALL_SCRIPT} ${WRKBUILD}/eclipse.tmp $(PREFIX)/bin/eclipse ${INSTALL_SCRIPT} ${WRKBUILD}/eclipse.tmp $(PREFIX)/bin/eclipse
${INSTALL_PROGRAM} ${WRKBUILD}/launchertmp/eclipse ${PREFIX}/eclipse/eclipse ${INSTALL_PROGRAM} ${WRKBUILD}/launchertmp/eclipse ${PREFIX}/eclipse/eclipse

View File

@ -1,20 +1,17 @@
$OpenBSD: patch-eclipse_in,v 1.3 2005/09/07 15:44:36 kurt Exp $ $OpenBSD: patch-eclipse_in,v 1.4 2006/07/19 17:27:15 kurt Exp $
--- eclipse.in.orig Mon Aug 8 12:14:58 2005 --- eclipse.in.orig Sat Jul 15 09:38:05 2006
+++ eclipse.in Wed Aug 10 12:57:51 2005 +++ eclipse.in Mon Jul 17 13:59:52 2006
@@ -0,0 +1,49 @@ @@ -0,0 +1,50 @@
+#!/bin/sh +#!/bin/sh
+# +#
+# $OpenBSD: patch-eclipse_in,v 1.4 2006/07/19 17:27:15 kurt Exp $
+#
+# OpenBSD-specific startup script for Eclipse Platform +# OpenBSD-specific startup script for Eclipse Platform
+# +#
+# See: http://www.eclipse.org
+#
+# $FreeBSD: ports/java/eclipse/files/eclipse.in,v 1.1 2003/06/17 17:39:48 nork Exp $
+#
+ +
+DEFAULT_JAVA_HOME=%%JAVA_HOME%%
+ECLIPSE_HOME=%%ECLIPSE_HOME%% +ECLIPSE_HOME=%%ECLIPSE_HOME%%
+DEFAULT_JAVA_CMD=java +DEFAULT_JAVACMD=%%DEFAULT_JAVACMD%%
+export MOZILLA_FIVE_HOME=%%LOCALBASE%%/mozilla +export MOZILLA_FIVE_HOME=%%MOZILLA_FIVE_HOME%%
+export LD_LIBRARY_PATH=$MOZILLA_FIVE_HOME:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=$MOZILLA_FIVE_HOME:$LD_LIBRARY_PATH
+ +
+ +
@ -22,24 +19,28 @@ $OpenBSD: patch-eclipse_in,v 1.3 2005/09/07 15:44:36 kurt Exp $
+# Determine configuration settings +# Determine configuration settings
+#----------------------------------------------------------------------------- +#-----------------------------------------------------------------------------
+ +
+# Determine the JDK home directory +# Determine JAVACMD if not set
+if [ -z "${JAVA_HOME}" ]; then
+ JAVA_HOME=${DEFAULT_JAVA_HOME}
+fi
+
+# Determine 'java' executable
+if [ -z "${JAVACMD}" ]; then +if [ -z "${JAVACMD}" ]; then
+ if [ -n "${JAVA_HOME}" ]; then + if [ -n "${JAVA_HOME}" ]; then
+ # assume Sun style java executable location and command
+ JAVACMD="${JAVA_HOME}/bin/java" + JAVACMD="${JAVA_HOME}/bin/java"
+ if [ ! -x "$JAVACMD" ]; then
+ echo "Error: JAVA_HOME is not defined correctly: ${JAVA_HOME}"
+ echo " Unable to find ${JAVACMD} or it is not executable"
+ exit 1
+ fi
+ else + else
+ JAVACMD=${DEFAULT_JAVACMD} + # assume Sun style java command and check path
+ JAVACMD=`which java > /dev/null 2>&1 && which java`
+ if [ -z "$JAVACMD" ] ; then
+ JAVACMD=${DEFAULT_JAVACMD}
+ fi
+ fi + fi
+fi +fi
+ +
+# Check if 'java' executable can be found
+if [ ! -x "$JAVACMD" ]; then +if [ ! -x "$JAVACMD" ]; then
+ echo "Error: JAVA_HOME is not defined correctly: ${JAVA_HOME}" + echo "Error: JAVACMD is not defined correctly: ${JAVACMD}"
+ echo " Unable to find ${JAVACMD}" + echo " Unable to find ${JAVACMD} or it is not executable"
+ exit 1 + exit 1
+fi +fi
+ +
@ -50,4 +51,4 @@ $OpenBSD: patch-eclipse_in,v 1.3 2005/09/07 15:44:36 kurt Exp $
+ exit 1 + exit 1
+fi +fi
+ +
+PATH=${JAVA_HOME}/bin:$PATH "${ECLIPSE_HOME}/eclipse" $@ +exec "${ECLIPSE_HOME}/eclipse" -vm ${JAVACMD} $@