summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalph Sennhauser <sera@gentoo.org>2012-06-12 09:17:33 +0000
committerRalph Sennhauser <sera@gentoo.org>2012-06-12 09:17:33 +0000
commit1c6bcc045f49eb43b517ca4a5f3b49c7ffb02c0d (patch)
tree4e9b5d10a3c58fc8e304888fe22fe4f76f7e964b /eclass/java-vm-2.eclass
parentStable for amd64, wrt bug #420125 (diff)
downloadgentoo-2-1c6bcc045f49eb43b517ca4a5f3b49c7ffb02c0d.tar.gz
gentoo-2-1c6bcc045f49eb43b517ca4a5f3b49c7ffb02c0d.tar.bz2
gentoo-2-1c6bcc045f49eb43b517ca4a5f3b49c7ffb02c0d.zip
Convert docs to eclass-manpages.
Diffstat (limited to 'eclass/java-vm-2.eclass')
-rw-r--r--eclass/java-vm-2.eclass172
1 files changed, 133 insertions, 39 deletions
diff --git a/eclass/java-vm-2.eclass b/eclass/java-vm-2.eclass
index 48fb6bd03ebd..67127b80abc2 100644
--- a/eclass/java-vm-2.eclass
+++ b/eclass/java-vm-2.eclass
@@ -1,19 +1,19 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/java-vm-2.eclass,v 1.43 2012/06/11 19:46:32 sera Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/java-vm-2.eclass,v 1.44 2012/06/12 09:17:33 sera Exp $
-# -----------------------------------------------------------------------------
-# @eclass-begin
-# @eclass-shortdesc Java Virtual Machine eclass
-# @eclass-maintainer java@gentoo.org
-#
+# @ECLASS: java-vm-2.eclass
+# @MAINTAINER:
+# java@gentoo.org
+# @BLURB: Java Virtual Machine eclass
+# @DESCRIPTION:
# This eclass provides functionality which assists with installing
# virtual machines, and ensures that they are recognized by java-config.
-#
-# -----------------------------------------------------------------------------
inherit eutils fdo-mime multilib pax-utils prefix
+EXPORT_FUNCTIONS pkg_setup pkg_postinst pkg_prerm pkg_postrm
+
RDEPEND="
=dev-java/java-config-2*
|| ( app-admin/eselect-java <dev-java/java-config-2.2 )"
@@ -22,12 +22,36 @@ has "${EAPI}" 0 1 && DEPEND="${DEPEND} >=sys-apps/portage-2.1"
export WANT_JAVA_CONFIG=2
+
+# @ECLASS-VARIABLE: JAVA_VM_CONFIG_DIR
+# @INTERNAL
+# @DESCRIPTION:
+# Where to place the vm env file.
JAVA_VM_CONFIG_DIR="/usr/share/java-config-2/vm"
+
+# @ECLASS-VARIABLE: JAVA_VM_DIR
+# @INTERNAL
+# @DESCRIPTION:
+# Base directory for vm links.
JAVA_VM_DIR="/usr/lib/jvm"
+
+# @ECLASS-VARIABLE: JAVA_VM_SYSTEM
+# @INTERNAL
+# @DESCRIPTION:
+# Link for system-vm
JAVA_VM_SYSTEM="/etc/java-config-2/current-system-vm"
+
+# @ECLASS-VARIABLE: JAVA_VM_BUILD_ONLY
+# @DESCRIPTION:
+# Set to YES to mark a vm as build-only.
JAVA_VM_BUILD_ONLY="${JAVA_VM_BUILD_ONLY:-FALSE}"
-EXPORT_FUNCTIONS pkg_setup pkg_postinst pkg_prerm pkg_postrm
+
+# @FUNCTION: java-vm-2_pkg_setup
+# @DESCRIPTION:
+# default pkg_setup
+#
+# Initialize vm handle.
java-vm-2_pkg_setup() {
if [[ "${SLOT}" != "0" ]]; then
@@ -37,8 +61,15 @@ java-vm-2_pkg_setup() {
fi
}
+
+# @FUNCTION: java-vm-2_pkg_postinst
+# @DESCRIPTION:
+# default pkg_postinst
+#
+# Set the generation-2 system VM and Java plugin, if it isn't set or the
+# setting is invalid. Also update mime database.
+
java-vm-2_pkg_postinst() {
- # Set the generation-2 system VM, if it isn't set or the setting is invalid
# Note that we cannot rely on java-config here, as it will silently recognize
# e.g. icedtea6-bin as valid system VM if icedtea6 is set but invalid (e.g. due
# to the migration to icedtea-6)
@@ -57,6 +88,12 @@ java-vm-2_pkg_postinst() {
fdo-mime_desktop_database_update
}
+
+# @FUNCTION: java-vm_check-nsplugin
+# @INTERNAL
+# @DESCRIPTION:
+# Check if the nsplugin needs updating
+
java-vm_check-nsplugin() {
local libdir
if [[ ${VMHANDLE} =~ emul-linux-x86 ]]; then
@@ -79,6 +116,12 @@ java-vm_check-nsplugin() {
fi
}
+
+# @FUNCTION: java-vm_set-nsplugin
+# @INTERNAL
+# @DESCRIPTION:
+# Set the nsplugin implemetation.
+
java-vm_set-nsplugin() {
local extra_args
if use amd64; then
@@ -94,6 +137,13 @@ java-vm_set-nsplugin() {
eselect java-nsplugin set ${extra_args} ${VMHANDLE}
}
+
+# @FUNCTION: java-vm-2_pkg_prerm
+# @DESCRIPTION:
+# default pkg_prerm
+#
+# Warn user if removing system-vm.
+
java-vm-2_pkg_prerm() {
# Although REPLACED_BY_VERSION is EAPI=4, we shouldn't need to check EAPI for this use case
if [[ "$(GENTOO_VM="" java-config -f 2>/dev/null)" == "${VMHANDLE}" && -z "${REPLACED_BY_VERSION}" ]]; then
@@ -103,16 +153,34 @@ java-vm-2_pkg_prerm() {
fi
}
+
+# @FUNCTION: java-vm-2_pkg_postrm
+# @DESCRIPTION:
+# default pkg_postrm
+#
+# Update mime database.
+
java-vm-2_pkg_postrm() {
fdo-mime_desktop_database_update
}
+
+# @FUNCTION: java_set_default_vm_
+# @INTERNAL
+# @DESCRIPTION:
+# Set system-vm.
+
java_set_default_vm_() {
java-config-2 --set-system-vm="${VMHANDLE}"
einfo " ${P} set as the default system-vm."
}
+
+# @FUNCTION: get_system_arch
+# @DESCRIPTION:
+# Get Java specific arch name.
+
get_system_arch() {
local sarch
sarch=$(echo ${ARCH} | sed -e s/[i]*.86/i386/ -e s/x86_64/amd64/ -e s/sun4u/sparc/ -e s/sparc64/sparc/ -e s/arm.*/arm/ -e s/sa110/arm/)
@@ -122,6 +190,11 @@ get_system_arch() {
echo ${sarch}
}
+
+# @FUNCTION: set_java_env
+# @DESCRIPTION:
+# Installs a vm env file.
+
# TODO rename to something more evident, like install_env_file
set_java_env() {
debug-print-function ${FUNCNAME} $*
@@ -175,9 +248,9 @@ set_java_env() {
|| die "Failed to make VM symlink at ${JAVA_VM_DIR}/${VMHANDLE}"
}
-# -----------------------------------------------------------------------------
-# @ebuild-function java-vm_set-pax-markings
-#
+
+# @FUNCTION: java-vm_set-pax-markings
+# @DESCRIPTION:
# Set PaX markings on all JDK/JRE executables to allow code-generation on
# the heap by the JIT compiler.
#
@@ -186,12 +259,15 @@ set_java_env() {
# generating cacerts. Otherwise a PaX enabled kernel will kill the VM.
# Bug #215225 #389751
#
-# @example
-# java-vm_set-pax-markings "${S}"
-# java-vm_set-pax-markings "${ED}"/opt/${P}
+# @CODE
+# Parameters:
+# $1 - JDK/JRE base directory.
#
-# @param $1 - JDK/JRE base directory.
-# -----------------------------------------------------------------------------
+# Examples:
+# java-vm_set-pax-markings "${S}"
+# java-vm_set-pax-markings "${ED}"/opt/${P}
+# @CODE
+
java-vm_set-pax-markings() {
debug-print-function ${FUNCNAME} "$*"
[[ $# -ne 1 ]] && die "${FUNCNAME}: takes exactly one argument"
@@ -209,19 +285,23 @@ java-vm_set-pax-markings() {
pax-mark ${pax_markings} $(list-paxables "${executables[@]}")
}
-# -----------------------------------------------------------------------------
-# @ebuild-function java-vm_revdep-mask
-#
+
+# @FUNCTION: java-vm_revdep-mask
+# @DESCRIPTION:
# Installs a revdep-rebuild control file which SEARCH_DIR_MASK set to the path
# where the VM is installed. Prevents pointless rebuilds - see bug #177925.
# Also gives a notice to the user.
#
-# @example
-# java-vm_revdep-mask
-# java-vm_revdep-mask /path/to/jdk/
+# @CODE
+# Parameters:
+# $1 - Path of the VM (defaults to /opt/${P} if not set)
+#
+# Examples:
+# java-vm_revdep-mask
+# java-vm_revdep-mask /path/to/jdk/
#
-# @param $1 - Path of the VM (defaults to /opt/${P} if not set)
-# ------------------------------------------------------------------------------
+# @CODE
+
java-vm_revdep-mask() {
if has ${EAPI:-0} 0 1 2 && ! use prefix; then
ED="${D}"
@@ -234,15 +314,17 @@ java-vm_revdep-mask() {
echo "SEARCH_DIRS_MASK=\"${VMROOT}\""> "${ED}/etc/revdep-rebuild/61-${VMHANDLE}"
}
-# -----------------------------------------------------------------------------
-# @ebuild-function java-vm_sandbox-predict
-#
+
+# @FUNCTION: java-vm_sandbox-predict
+# @DESCRIPTION:
# Install a sandbox control file. Specified paths won't cause a sandbox
# violation if opened read write but no write takes place. See bug 388937#c1
#
-# @example
-# java-vm_sandbox-predict /dev/random /proc/self/coredump_filter
-# -----------------------------------------------------------------------------
+# @CODE
+# Examples:
+# java-vm_sandbox-predict /dev/random /proc/self/coredump_filter
+# @CODE
+
java-vm_sandbox-predict() {
debug-print-function ${FUNCNAME} "$*"
[[ -z "${1}" ]] && die "${FUNCNAME} takes at least one argument"
@@ -258,11 +340,22 @@ java-vm_sandbox-predict() {
|| die "Failed to write sandbox control file"
}
+
+# @FUNCTION: java_get_plugin_dir_
+# @INTERNAL
+# @DESCRIPTION:
+# Get the java plugin dir.
+
java_get_plugin_dir_() {
has ${EAPI:-0} 0 1 2 && ! use prefix && EPREFIX=
echo "${EPREFIX}"/usr/$(get_libdir)/nsbrowser/plugins
}
+
+# @FUNCTION: install_mozilla_plugin
+# @DESCRIPTION:
+# Register a netscape java-plugin.
+
install_mozilla_plugin() {
local plugin="${1}"
local variant="${2}"
@@ -281,10 +374,15 @@ install_mozilla_plugin() {
dosym "${plugin}" "${plugin_dir}/${VMHANDLE}${variant}-javaplugin.so"
}
+
+# @FUNCTION: java_mozilla_clean_
+# @INTERNAL
+# @DESCRIPTION:
+# Because previously some ebuilds installed symlinks outside of pkg_install
+# and are left behind, which forces you to manualy remove them to select the
+# jdk/jre you want to use for java
+
java_mozilla_clean_() {
- # Because previously some ebuilds installed symlinks outside of pkg_install
- # and are left behind, which forces you to manualy remove them to select the
- # jdk/jre you want to use for java
local plugin_dir=$(java_get_plugin_dir_)
for file in ${plugin_dir}/javaplugin_*; do
rm -f ${file}
@@ -293,7 +391,3 @@ java_mozilla_clean_() {
rm -f ${file}
done
}
-
-# ------------------------------------------------------------------------------
-# @eclass-end
-# ------------------------------------------------------------------------------