pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang/java-wrapper Initial import of java-wrapper, vers...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/257794f6e65a
branches:  trunk
changeset: 476168:257794f6e65a
user:      jmmv <jmmv%pkgsrc.org@localhost>
date:      Fri Jun 04 16:35:07 2004 +0000

description:
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:

 lang/java-wrapper/DESCR                   |    2 +
 lang/java-wrapper/Makefile                |   52 ++++++++++++++
 lang/java-wrapper/PLIST                   |   11 +++
 lang/java-wrapper/files/java-wrapper.1    |  106 ++++++++++++++++++++++++++++++
 lang/java-wrapper/files/java-wrapper.conf |   19 +++++
 lang/java-wrapper/files/java-wrapper.sh   |   67 ++++++++++++++++++
 6 files changed, 257 insertions(+), 0 deletions(-)

diffs (281 lines):

diff -r 55e585d31370 -r 257794f6e65a lang/java-wrapper/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/java-wrapper/DESCR   Fri Jun 04 16:35:07 2004 +0000
@@ -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 -r 55e585d31370 -r 257794f6e65a lang/java-wrapper/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/java-wrapper/Makefile        Fri Jun 04 16:35:07 2004 +0000
@@ -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@localhost
+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 -r 55e585d31370 -r 257794f6e65a lang/java-wrapper/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/java-wrapper/PLIST   Fri Jun 04 16:35:07 2004 +0000
@@ -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 -r 55e585d31370 -r 257794f6e65a lang/java-wrapper/files/java-wrapper.1
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/java-wrapper/files/java-wrapper.1    Fri Jun 04 16:35:07 2004 +0000
@@ -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@localhost>
+.\"
+.\" 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@localhost
diff -r 55e585d31370 -r 257794f6e65a lang/java-wrapper/files/java-wrapper.conf
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/java-wrapper/files/java-wrapper.conf Fri Jun 04 16:35:07 2004 +0000
@@ -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 -r 55e585d31370 -r 257794f6e65a lang/java-wrapper/files/java-wrapper.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/java-wrapper/files/java-wrapper.sh   Fri Jun 04 16:35:07 2004 +0000
@@ -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@localhost>
+#
+# 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} "$@"



Home | Main Index | Thread Index | Old Index