diff options
author | Owen Stampflee <owen@gentoo.org> | 2002-09-07 23:45:00 +0000 |
---|---|---|
committer | Owen Stampflee <owen@gentoo.org> | 2002-09-07 23:45:00 +0000 |
commit | 55045a647d7eaae3a1a0852445e550baad4c2a1d (patch) | |
tree | 8a1c6c8f3456c2becf74ca807e388385182475ee /dev-java | |
parent | new version (diff) | |
download | gentoo-2-55045a647d7eaae3a1a0852445e550baad4c2a1d.tar.gz gentoo-2-55045a647d7eaae3a1a0852445e550baad4c2a1d.tar.bz2 gentoo-2-55045a647d7eaae3a1a0852445e550baad4c2a1d.zip |
new version of java-config
Diffstat (limited to 'dev-java')
-rw-r--r-- | dev-java/java-config/ChangeLog | 5 | ||||
-rw-r--r-- | dev-java/java-config/files/digest-java-config-0.2.5 | 0 | ||||
-rw-r--r-- | dev-java/java-config/files/java-config-0.2.5 | 326 | ||||
-rw-r--r-- | dev-java/java-config/java-config-0.2.5.ebuild | 18 |
4 files changed, 348 insertions, 1 deletions
diff --git a/dev-java/java-config/ChangeLog b/dev-java/java-config/ChangeLog index 820b03886005..c4f9984ec43d 100644 --- a/dev-java/java-config/ChangeLog +++ b/dev-java/java-config/ChangeLog @@ -1,6 +1,9 @@ # ChangeLog for dev-java/java-config # Copyright 2002 Gentoo Technologies, Inc.; Distributed under the GPL -# $Header: /var/cvsroot/gentoo-x86/dev-java/java-config/ChangeLog,v 1.9 2002/08/09 19:47:16 gerk Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-java/java-config/ChangeLog,v 1.10 2002/09/07 23:45:00 owen Exp $ +*java-config-0.2.5 (07 Sep 2002) + 07 Sep 2002; Owen Stampflee <owen@gentoo.org> java-config-0.2.5.ebuild files/digest-java-config-0.2.5 files/java-config-0.2.5 : + New Version to handle "." in CLASSPATH. *java-config-0.2.4-r1 (24 Jun 2002) 09 Aug 2002; Mark Guertin <gerk@gentoo.org> java-config-0.2.4-r1.ebuild : diff --git a/dev-java/java-config/files/digest-java-config-0.2.5 b/dev-java/java-config/files/digest-java-config-0.2.5 new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/dev-java/java-config/files/digest-java-config-0.2.5 diff --git a/dev-java/java-config/files/java-config-0.2.5 b/dev-java/java-config/files/java-config-0.2.5 new file mode 100644 index 000000000000..427b14b176f4 --- /dev/null +++ b/dev-java/java-config/files/java-config-0.2.5 @@ -0,0 +1,326 @@ +#! /bin/sh +# +# Copyright 1999-2001 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License, v2 or later +# Maintainer: Tools Team <tools@gentoo.org> +# Author: Karl Trygve Kalleberg <karltk@gentoo.org> +# $Header: /var/cvsroot/gentoo-x86/dev-java/java-config/files/java-config-0.2.5,v 1.1 2002/09/07 23:45:00 owen Exp $ + +version=0.2.0 +all_params="$*" + +SYSTEM_ARCH=`echo $ARCH |\ + sed -e s/[i]*.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/` + +if [ -z "$SYSTEM_ARCH" ] ; then + SYSTEM_ARCH=`uname -m |\ + sed -e s/[i]*.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/` +fi + +PFORM="i386" + +CLASSPATH=`echo ${CLASSPATH} | sed "s/:\.//g"` +case $SYSTEM_ARCH in + ppc) PFORM="ppc";; + i386) PFORM="i386";; + sparc64)PFORM="sparc64";; + sparc) PFORM="arm";; + arm) PFORM="arm";; +esac + +if [ $UID != 0 ] && [ -f $HOME/.gentoo/java-env ] ; then + . $HOME/.gentoo/java-env +elif [ -f /etc/env.d/20java ] ; then + oldpath=$PATH + . /etc/env.d/20java + PATH=$oldpath:$PATH +fi + +function eerror() { + echo "!!! $1" 1>&2 +} +svm=`echo $1|egrep "\-\-(set-(system|user)-vm|list-available-vms)"` +if [ -z "$JAVA_HOME" ] && [ -z "$svm" ] && [ "$1" != "--help" ]; then + eerror "No Java installation found" + eerror "Use --set-system-vm to select default system JVM" + eerror "Alternatively, use --set-user-vm to select default system JVM" + exit 1 +fi + +usage() { + cat <<EOF +Usage: java-config [OPTIONS] [LIBRARIES] +Options: + [--javac] + [--java] + [--jar] + [--jdk-home] + [--jre-home] + [--java-version] + [--classpath[=package1,package2,...]] + [--full-classpath=package1,package2,...] + [--exec=filename] + [--list-available-packages] + [--list-available-vms] + [--set-system-vm=<vm-id>] + [--set-user-vm=<vm-id>] + [--set-system-classpath=package1,package2,...] + [--set-user-classpath=package1,package2,...] +EOF + echo "Using ${JAVA_HOME}" + exit $1 +} + +find_exec() { + if [ -f ${JAVA_HOME}/bin/$1 ] ; then + echo ${JAVA_HOME}/bin/$1 + elif [ -f ${JAVA_HOME}/jre/bin/$1 ] ; then + echo ${JAVA_HOME}/jre/bin/$1 + else + eerror "$1 not found" + exit 1 + fi +} + +classpathfor() +{ + local pkgs=`echo $1 | sed "s/,/ /g"` + local total="" + for i in $pkgs ; do + if [ -f /usr/share/${i}/classpath.env ] ; then + total="${total}`cat /usr/share/${i}/classpath.env`" + elif [ -f /usr/share/${i}/package.env ] ; then + pf=/usr/share/${i}/package.env + addcp=`grep "CLASSPATH=" $pf | sed "s/CLASSPATH=//"` + total="${total}:${addcp}" + else + eerror "Package ${i} not found" + exit 1 + fi + done + echo $total | sed "s/::/:/g" +} + +findpluginpath() { + + # This covers Sun and Blackdown + + rootpath=${JAVA_HOME}/jre/plugin/${PFORM} + + if [ $1 == "ns4" ] || [ $1 == "netscape4" ] ; then + for i in ${rootpath}/{ns4,netscape4}/javaplugin.so ; do + if [ -e $i ] ; then + echo $i + break + fi + done + elif [ $1 == "ns6" ] || [ $1 == "netscape6" ] || [ $1 == "moz" ] || [ $1 == "mozilla" ] ; then + for i in ${rootpath}/{mozilla,ns600,netscape6}/{libjavaplugin_oji,javaplugin_oji}.so ; do + if [ -e $i ] ; then + echo $i + break + fi + done + else + eerror "Browser [$1] unknown" + fi + + # This covers IBM + + rootpath=${JAVA_HOME} + if [ $1 == "ns4" ] || [ $1 == "netscape4" ] ; then + for i in ${rootpath}/{,jre}/bin/javaplugin.so ; do + if [ -e $i ] ; then + echo $i + break + fi + done + elif [ $1 == "ns6" ] || [ $1 == "netscape6" ] || [ $1 == "moz" ] || [ $1 == "mozilla" ] ; then + for i in ${rootpath}/{,jre}/bin/libjavaplugin_oji.so ; do + if [ -e $i ] ; then + echo $i + break + fi + done + fi +} + +function vm_shortname() { + basename $1 | sed -e "s/20//" #-e "s/-[0-9]\..*//" +} + +function vm_version() { + ( . $1 ; echo "$VERSION ($i)" ) +} + +function vm_envvars() { + local file=$1 + local system="$2" + + ( . $file ; + for i in $ENV_VARS ; do + if [ $i == "ADDPATH" ] && [ -z "$system" ]; then + echo "PATH=\${PATH}:${!i}" + elif [ $i == "ADDPATH" ] && [ "$system" ]; then + echo "PATH=${!i}" + echo "ROOTPATH=${!i}" + elif [ $i == "ADDLDPATH" ] ; then + if [ "$system" ]; then + echo "LDPATH=${!i}" + fi + else + echo "${i}=${!i}" + fi + done + ) +} + +function source_java_classpath() { + echo "if [ -f $HOME/.gentoo/java-env-classpath ] ; then" + echo " . $HOME/.gentoo/java-env-classpath" + echo "fi" +} + +function set_vm() { + local vm=$1 + local cfgpath=$2 + local cfgfile=$3 + local system="" + if [ "$cfgpath" == "/etc/env.d" ] ; then + system="yes" + fi + local found="" + + for i in /etc/env.d/java/20*-* ; do + if [ $vm == `vm_shortname $i` ] ; then + echo "Now using `vm_version $i`" + mkdir -p $cfgpath + echo "# Autogenerated by java-config $version" > ${cfgpath}/${cfgfile} + echo "# Cmd: $0 $all_params" >> ${cfgpath}/${cfgfile} + vm_envvars $i $system >> ${cfgpath}/${cfgfile} + if [ -z $system ] ; then + source_java_classpath >> $HOME/.gentoo/java-env + fi + found="yes" + fi + done + if [ -z "$found" ] ; then + echo "$vm not found" + fi +} + +function calc_full_classpath() { + echo "${CLASSPATH}:`classpathfor $1`:." | sed "s/::/:/g" +} + +if [ $# == 0 ] ; then + echo "Usage: java-config [OPTIONS] [LIBRARIES]" + exit 1 +fi + +while test $# -gt 0; do + + case "$1" in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case $1 in + --debug) + set -x + ;; + --browser-plugin=*) + pluginpath=`findpluginpath $optarg` + if [ -n "$pluginpath" ] ; then + echo `basename $pluginpath` + else + eerror "Plugin not found" + fi + ;; + --full-browser-plugin-path=*) + findpluginpath $optarg + ;; + --classpath) + echo ${CLASSPATH} + ;; + --classpath=*) + classpathfor $optarg + ;; + --full-classpath=*) + calc_full_classpath $optarg + ;; + --jdk-home) + echo ${JDK_HOME} + ;; + --jre-home) + echo ${JRE_HOME} + ;; + --javac) + find_exec javac + ;; + --java) + find_exec java + ;; + --jar) + find_exec jar + ;; + --java-version) + `find_exec java` -version + ;; + --exec=*) + find_exec $optarg + ;; + --version) + echo java-config $version + ;; + --list-available-packages) + # Old env var file + for i in /usr/share/*/classpath.env ; do + if [ ! -f $i ] ; then continue ; fi + dn=`dirname $i` + echo "[`basename $dn`] No description ($i)" + done + # New env var file + for i in /usr/share/*/package.env ; do + if [ ! -f $i ] ; then continue ; fi + dn=`dirname $i` + id=`basename $dn` + desc=`grep DESC $i | sed "s/DESCRIPTION=//"` + echo "[${id}] ${desc} ($i)" + done + + ;; + --list-available-vms) + for i in /etc/env.d/java/20*-* ; do + echo "[`vm_shortname $i`] `vm_version $i`" + done + ;; + --set-system-classpath=*) + echo "CLASSPATH=`calc_full_classpath $optarg`" > \ + /etc/env.d/21java-classpath + ;; + --set-user-classpath=*) + mkdir -p $HOME/.gentoo + echo "CLASSPATH=\${CLASSPATH}:`calc_full_classpath $optarg`" > \ + $HOME/.gentoo/java-env-classpath + if [ ! -f $HOME/.gentoo/java-env ] ; then + source_java_classpath > $HOME/.gentoo/java-env + fi + ;; + --set-system-vm=*) + set_vm $optarg /etc/env.d 20java + ;; + --set-user-vm=*) + if [ $UID == 0 ] ; then + eerror "ERROR: root should _always_ use the system-vm" + eerror "NOTE : user-vm for root not set." + else + set_vm $optarg $HOME/.gentoo java-env + fi + ;; + *) + usage + ;; + esac + shift +done diff --git a/dev-java/java-config/java-config-0.2.5.ebuild b/dev-java/java-config/java-config-0.2.5.ebuild new file mode 100644 index 000000000000..12c0c4e03209 --- /dev/null +++ b/dev-java/java-config/java-config-0.2.5.ebuild @@ -0,0 +1,18 @@ +# Copyright 1999-2002 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License, v2 or later +# $Header: /var/cvsroot/gentoo-x86/dev-java/java-config/java-config-0.2.5.ebuild,v 1.1 2002/09/07 23:45:00 owen Exp $ + +S=${WORKDIR}/${P} +DESCRIPTION="Gentoo-specific configuration for Java" +SRC_URI="" +HOMEPAGE="http://www.gentoo.org/~karltk/projects/java-config" +DEPEND="" +#RDEPEND="" +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="x86 ppc sparc sparc64" + +src_install () { + dobin ${FILESDIR}/java-config-0.2.5 + doman ${FILESDIR}/java-config.1 +} |