summaryrefslogtreecommitdiff
path: root/lang/java-wrapper
diff options
context:
space:
mode:
authorjmmv <jmmv@pkgsrc.org>2004-06-04 16:35:07 +0000
committerjmmv <jmmv@pkgsrc.org>2004-06-04 16:35:07 +0000
commit9b5e774b9fef8a285e676592a90b5fdaa09b3f64 (patch)
tree35226b88aee257589d2962df2cc76b1b8d113203 /lang/java-wrapper
parent53fa0870ae1fe38cc9ff18d5287fb1b332256ee2 (diff)
downloadpkgsrc-9b5e774b9fef8a285e676592a90b5fdaa09b3f64.tar.gz
Initial import of java-wrapper, version 1.0:
java-wrapper is a small wrapper that overrides the most common Java programs. It executes the right Java implementation based on user's preference.
Diffstat (limited to 'lang/java-wrapper')
-rw-r--r--lang/java-wrapper/DESCR2
-rw-r--r--lang/java-wrapper/Makefile52
-rw-r--r--lang/java-wrapper/PLIST11
-rw-r--r--lang/java-wrapper/files/java-wrapper.1106
-rw-r--r--lang/java-wrapper/files/java-wrapper.conf19
-rw-r--r--lang/java-wrapper/files/java-wrapper.sh67
6 files changed, 257 insertions, 0 deletions
diff --git a/lang/java-wrapper/DESCR b/lang/java-wrapper/DESCR
new file mode 100644
index 00000000000..0ad98e0ced5
--- /dev/null
+++ b/lang/java-wrapper/DESCR
@@ -0,0 +1,2 @@
+java-wrapper is a small wrapper that overrides the most common Java programs.
+It executes the right Java implementation based on user's preference.
diff --git a/lang/java-wrapper/Makefile b/lang/java-wrapper/Makefile
new file mode 100644
index 00000000000..8a1c1ce647a
--- /dev/null
+++ b/lang/java-wrapper/Makefile
@@ -0,0 +1,52 @@
+# $NetBSD: Makefile,v 1.1.1.1 2004/06/04 16:35:07 jmmv Exp $
+#
+
+DISTNAME= java-wrapper-1.0
+CATEGORIES= lang
+MASTER_SITES= # empty
+DISTFILES= # empty
+
+MAINTAINER= jmmv@NetBSD.org
+COMMENT= Runs different Java implementations transparently
+
+NO_BUILDLINK= YES
+NO_CHECKSUM= YES
+NO_CONFIGURE= YES
+USE_PKGINSTALL= YES
+WRKSRC= ${WRKDIR}
+
+EGDIR= ${PREFIX}/share/examples/java-wrapper
+CONF_FILES= ${EGDIR}/java-wrapper.conf \
+ ${PKG_SYSCONFDIR}/java-wrapper.conf
+
+SUBST_CLASSES+= build
+SUBST_STAGE.build= do-build
+SUBST_MESSAGE.build= Setting up paths.
+SUBST_FILES.build= java-wrapper.1
+SUBST_FILES.build+= java-wrapper.conf
+SUBST_FILES.build+= java-wrapper.sh
+SUBST_SED.build= -e 's|@PKG_SYSCONFDIR@|${PKG_SYSCONFDIR}|g'
+SUBST_SED.build+= -e 's|@PREFIX@|${PREFIX}|g'
+SUBST_SED.build+= -e 's|@SH@|${SH}|g'
+SUBST_SED.build+= -e 's|@TR@|${TR}|g'
+
+INSTALLATION_DIRS= bin man/man1
+
+do-extract:
+ ${CP} ${FILESDIR}/java-wrapper.1 ${WRKSRC}
+ ${CP} ${FILESDIR}/java-wrapper.conf ${WRKSRC}
+ ${CP} ${FILESDIR}/java-wrapper.sh ${WRKSRC}
+
+do-build:
+ @${DO_NADA}
+
+do-install:
+.for f in appletviewer jar java javac javadoc javah javap
+ ${INSTALL_SCRIPT} ${WRKSRC}/java-wrapper.sh ${PREFIX}/bin/${f}
+.endfor
+.undef f
+ ${INSTALL_DATA} ${WRKSRC}/java-wrapper.1 ${PREFIX}/man/man1
+ ${INSTALL_DATA_DIR} ${EGDIR}
+ ${INSTALL_DATA} ${WRKSRC}/java-wrapper.conf ${EGDIR}
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/lang/java-wrapper/PLIST b/lang/java-wrapper/PLIST
new file mode 100644
index 00000000000..f3a9b5e526c
--- /dev/null
+++ b/lang/java-wrapper/PLIST
@@ -0,0 +1,11 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2004/06/04 16:35:07 jmmv Exp $
+bin/appletviewer
+bin/jar
+bin/java
+bin/javac
+bin/javadoc
+bin/javah
+bin/javap
+man/man1/java-wrapper.1
+share/examples/java-wrapper/java-wrapper.conf
+@dirrm share/examples/java-wrapper
diff --git a/lang/java-wrapper/files/java-wrapper.1 b/lang/java-wrapper/files/java-wrapper.1
new file mode 100644
index 00000000000..b5023bd5d6d
--- /dev/null
+++ b/lang/java-wrapper/files/java-wrapper.1
@@ -0,0 +1,106 @@
+.\" $NetBSD: java-wrapper.1,v 1.1.1.1 2004/06/04 16:35:07 jmmv Exp $
+.\"
+.\" java-wrapper - Runs different Java implementations transparently.
+.\" Copyright (c) 2004 Julio M. Merino Vidal <jmmv@NetBSD.org>
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Neither the name of The NetBSD Foundation nor the names of its
+.\" contributors may be used to endorse or promote products derived
+.\" from this software without specific prior written permission.
+.\" 3. Neither the name of author nor the names of its contributors may
+.\" be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd June 4, 2004
+.Dt JAVA-WRAPPER 1
+.Os
+.Sh NAME
+.Nm java-wrapper
+.Nd runs different Java implementations transparently
+.Sh SYNOPSIS
+.Nm appletviewer
+.Op Ar arg1 .. argN
+.Nm jar
+.Op Ar arg1 .. argN
+.Nm java
+.Op Ar arg1 .. argN
+.Nm javac
+.Op Ar arg1 .. argN
+.Nm javadoc
+.Op Ar arg1 .. argN
+.Nm javah
+.Op Ar arg1 .. argN
+.Nm javap
+.Op Ar arg1 .. argN
+.Sh DESCRIPTION
+.Nm
+is a small wrapper that overrides the most common Java programs.
+It executes the right Java implementation based on user's preference.
+.Pp
+A configuration file is used to specify which Java implementation is chosen.
+The wrapper first tries to read
+.Pa ~/.java-wrapper.conf ,
+falling back to
+.Pa @PKG_SYSCONFDIR@/java-wrapper.conf
+if not found (note that one of them must exist; otherwise it will simply
+abort execution).
+.Pp
+The configuration file simply defines some variables that map Java programs
+to Java implementations.
+Each variable contains the name of an implementation, installed from pkgsrc,
+like
+.Sq sun14
+or
+.Sq kaffe .
+Variables doing this mapping have the same name as the Java program, but in
+uppercase letters:
+.Va APPLETVIEWER ,
+.Va JAR ,
+.Va JAVA ,
+.Va JAVAC ,
+.Va JAVADOC ,
+.Va JAVAH ,
+and
+.Va JAVAP .
+Even though, there is an special variable called
+.Va DEFAULT .
+This one sets the name of the implementation used in case any of the specific
+variables are unset or empty.
+.Pp
+The real binary is then searched in
+.Pa @PREFIX@/bin/,
+using the name given in the variable, followed by a dash, followed by the
+Java program.
+For example, if you set
+.Sq JAVA=sun14 ,
+whenever you run
+.Nm java ,
+you will be really executing
+.Pa @PREFIX@/bin/sun14-java .
+.Sh FILES
+.Bl -tag -width @PKG_SYSCONFDIR@/java-wrapper.conf -compact
+.It Pa @PREFIX@/bin/
+Location of real Java binaries.
+.It Pa @PKG_SYSCONFDIR@/java-wrapper.conf
+System wide configuration file.
+.It Pa ~/.java-wrapper.conf
+User specific configuration file.
+.El
+.Sh AUTHORS
+.An Julio M. Merino Vidal Aq jmmv@NetBSD.org
diff --git a/lang/java-wrapper/files/java-wrapper.conf b/lang/java-wrapper/files/java-wrapper.conf
new file mode 100644
index 00000000000..027d4fa8d82
--- /dev/null
+++ b/lang/java-wrapper/files/java-wrapper.conf
@@ -0,0 +1,19 @@
+# $NetBSD: java-wrapper.conf,v 1.1.1.1 2004/06/04 16:35:07 jmmv Exp $
+#
+# @PKG_SYSCONFDIR@/java-wrapper.conf
+#
+# System wide configuration file for java-wrapper.
+# See java-wrapper(1) for more information.
+#
+
+# Default Java implementation to use. I.e., 'sun14', 'wonka', etc.
+DEFAULT=
+
+# Override the above setting on a command basis.
+APPLETVIEWER=
+JAR=
+JAVA=
+JAVAC=
+JAVADOC=
+JAVAH=
+JAVAP=
diff --git a/lang/java-wrapper/files/java-wrapper.sh b/lang/java-wrapper/files/java-wrapper.sh
new file mode 100644
index 00000000000..7476ac7f048
--- /dev/null
+++ b/lang/java-wrapper/files/java-wrapper.sh
@@ -0,0 +1,67 @@
+#! @SH@
+#
+# $NetBSD: java-wrapper.sh,v 1.1.1.1 2004/06/04 16:35:07 jmmv Exp $
+#
+# java-wrapper - Runs different Java implementations transparently.
+# Copyright (c) 2004 Julio M. Merino Vidal <jmmv@NetBSD.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name of author nor the names of its contributors may
+# be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+PREFIX="@PREFIX@"
+PKG_SYSCONFDIR="@PKG_SYSCONFDIR@"
+TR="@TR@"
+
+progname=${0##*/}
+
+err() {
+ echo "${progname}: $*" 1>&2
+ echo "${progname}: See java-wrapper(1) for more information." 1>&2
+ exit 1
+}
+
+if [ -f ${HOME}/.java-wrapper.conf ]; then
+ . ${HOME}/.java-wrapper.conf
+elif [ -f ${PKG_SYSCONFDIR}/java-wrapper.conf ]; then
+ . ${PKG_SYSCONFDIR}/java-wrapper.conf
+else
+ err "cannot open configuration file."
+fi
+
+varname=$(echo ${progname} | ${TR} a-z A-Z)
+eval impl=\"\$${varname}\"
+
+if [ -z "${impl}" -a -z "${DEFAULT}" ]; then
+ err "no mapping defined (${varname} and DEFAULT are empty)."
+fi
+
+bin=${PREFIX}/bin/${impl:-${DEFAULT}}-${progname}
+
+if [ ! -f ${bin} ]; then
+ err "cannot locate ${bin} (incorrect mapping or missing package)."
+fi
+
+${bin} "$@"