/[gentoo-x86]/eclass/java-vm-2.eclass
Gentoo

Diff of /eclass/java-vm-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.11 Revision 1.16
1# Copyright 1999-2004 Gentoo Foundation 1# Copyright 1999-2004 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/java-vm-2.eclass,v 1.11 2006/09/10 20:59:11 betelgeuse Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/java-vm-2.eclass,v 1.16 2006/11/11 00:13:22 betelgeuse Exp $
4 4
5# ----------------------------------------------------------------------------- 5# -----------------------------------------------------------------------------
6# @eclass-begin 6# @eclass-begin
7# @eclass-shortdesc Java Virtual Machine eclass 7# @eclass-shortdesc Java Virtual Machine eclass
8# @eclass-maintainer java@gentoo.org 8# @eclass-maintainer java@gentoo.org
10# This eclass provides functionality which assists with installing 10# This eclass provides functionality which assists with installing
11# virtual machines, and ensures that they are recognized by java-config. 11# virtual machines, and ensures that they are recognized by java-config.
12# 12#
13# ----------------------------------------------------------------------------- 13# -----------------------------------------------------------------------------
14 14
15inherit eutils 15inherit eutils fdo-mime
16 16
17DEPEND=" 17DEPEND="
18 =dev-java/java-config-2.0* 18 =dev-java/java-config-2.0*
19 >=sys-apps/portage-2.1" 19 >=sys-apps/portage-2.1"
20RDEPEND=" 20RDEPEND="
21 =dev-java/java-config-2.0*" 21 =dev-java/java-config-2.0*
22
23# If the VM supports generation-1, we need to depend on java-config-1
24if [[ ${JAVA_SUPPORTS_GENERATION_1} == 'true' ]]; then
25 DEPEND="${DEPEND} =dev-java/java-config-1.3*" 22 =dev-java/java-config-1.3*"
26 RDEPEND="${RDEPEND} =dev-java/java-config-1.3*"
27fi
28 23
29export WANT_JAVA_CONFIG=2 24export WANT_JAVA_CONFIG=2
30 25
31if [[ "${SLOT}" != "0" ]]; then 26if [[ "${SLOT}" != "0" ]]; then
32 VMHANDLE=${PN}-${SLOT} 27 VMHANDLE=${PN}-${SLOT}
35fi 30fi
36 31
37JAVA_VM_CONFIG_DIR="/usr/share/java-config-2/vm" 32JAVA_VM_CONFIG_DIR="/usr/share/java-config-2/vm"
38JAVA_VM_DIR="/usr/lib/jvm" 33JAVA_VM_DIR="/usr/lib/jvm"
39 34
40EXPORT_FUNCTIONS pkg_postinst pkg_prerm 35EXPORT_FUNCTIONS pkg_postinst pkg_prerm pkg_postrm
41 36
42java-vm-2_pkg_postinst() { 37java-vm-2_pkg_postinst() {
43 # Set the generation-2 system VM, if it isn't set 38 # Set the generation-2 system VM, if it isn't set
44 if [[ -z "$(java-config-2 -f)" ]]; then 39 if [[ -z "$(java-config-2 -f)" ]]; then
45 java_set_default_vm_ 40 java_set_default_vm_
60 fi 55 fi
61 ewarn "Setting generation-1 system-vm to ${VMHANDLE}" 56 ewarn "Setting generation-1 system-vm to ${VMHANDLE}"
62 java-config-1 --set-system-vm=${P} 2>/dev/null 57 java-config-1 --set-system-vm=${P} 2>/dev/null
63 # dirty check to see if we are upgrading current generation-1 system vm 58 # dirty check to see if we are upgrading current generation-1 system vm
64 elif [[ "${systemvm1}" = ${VMHANDLE}* ]]; then 59 elif [[ "${systemvm1}" = ${VMHANDLE}* ]]; then
65 einfo "Emerging the current generation-1 system-vm..." 60 einfo "Emerging the current generation-1 system-vm..."
66 einfo "Updating its config files." 61 einfo "Updating its config files."
67 java-config-1 --set-system-vm=${P} 2>/dev/null 62 java-config-1 --set-system-vm=${P} 2>/dev/null
68 # dirty check to see if current system vm is a jre - replace it with 63 # dirty check to see if current system vm is a jre - replace it with
69 elif [[ "${systemvm1}" = *jre* ]]; then 64 elif [[ "${systemvm1}" = *jre* ]]; then
70 ewarn "Current generation-1 system-vm is a JRE" 65 ewarn "Current generation-1 system-vm is a JRE"
71 ewarn "For the new and old Java systems to coexist," 66 ewarn "For the new and old Java systems to coexist,"
72 ewarn "the generation-1 system-vm must be a JDK." 67 ewarn "the generation-1 system-vm must be a JDK."
73 ewarn "Setting generation-1 system-vm to ${VMHANDLE}" 68 ewarn "Setting generation-1 system-vm to ${VMHANDLE}"
74 java-config-1 --set-system-vm=${P} 2>/dev/null 69 java-config-1 --set-system-vm=${P} 2>/dev/null
75 fi 70 fi
76 # else... some other VM is being updated, so we don't have to worry 71 # else... some other VM is being updated, so we don't have to worry
77 else 72 else
78 einfo "JREs and 1.5+ JDKs are not supported for use with generation-1." 73 einfo "JREs and 1.5+ JDKs are not supported for use with generation-1."
79 einfo "This is because generation-1 is only for use for building packages." 74 einfo "This is because generation-1 is only for use for building packages."
80 einfo "Only generation-2 should be used by end-users," 75 einfo "Only generation-2 should be used by end-users,"
81 einfo "where all JREs and JDKs will be available" 76 einfo "where all JREs and JDKs will be available"
82 fi 77 fi
83 78
79 echo
80
81 java-vm_check-nsplugin
82 java_mozilla_clean_
83 fdo-mime_desktop_database_update
84}
85
86java-vm_check-nsplugin() {
87 local libdir
88 if [[ ${VMHANDLE} =~ emul-linux-x86 ]]; then
89 libdir=lib32
90 else
91 libdir=lib
92 fi
84 # Install a default nsplugin if we don't already have one 93 # Install a default nsplugin if we don't already have one
85 if has nsplugin ${IUSE} && use nsplugin; then 94 if has nsplugin ${IUSE} && use nsplugin; then
86 if [[ ! -f /usr/lib/nsbrowser/plugins/javaplugin.so ]]; then 95 if [[ ! -f /usr/${libdir}/nsbrowser/plugins/javaplugin.so ]]; then
87 eselect java-nsplugin set ${VMHANDLE} 96 einfo "No system nsplugin currently set."
97 java-vm_set-nsplugin
98 else
99 einfo "System nsplugin is already set, not changing it."
88 fi 100 fi
101 einfo "You can change nsplugin with eselect java-nsplugin."
102 fi
103}
104
105java-vm_set-nsplugin() {
106 local extra_args
107 if use amd64; then
108 if [[ ${VMHANDLE} =~ emul-linux-x86 ]]; then
109 extra_args="32bit"
110 else
111 extra_args="64bit"
89 fi 112 fi
90 113 einfo "Setting ${extra_args} nsplugin to ${VMHANDLE}"
91 java_mozilla_clean_ 114 else
115 einfo "Setting nsplugin to ${VMHANDLE}..."
116 fi
117 eselect java-nsplugin set ${extra_args} ${VMHANDLE}
92} 118}
93 119
94java-vm-2_pkg_prerm() { 120java-vm-2_pkg_prerm() {
95 if [[ "$(java-config -f 2>/dev/null)" == "${VMHANDLE}" ]]; then 121 if [[ "$(java-config -f 2>/dev/null)" == "${VMHANDLE}" ]]; then
96 ewarn "It appears you are removing your system-vm!" 122 ewarn "It appears you are removing your system-vm!"
97 ewarn "Please run java-config -L to list available VMs," 123 ewarn "Please run java-config -L to list available VMs,"
98 ewarn "then use java-config -S to set a new system-vm!" 124 ewarn "then use java-config -S to set a new system-vm!"
99 fi 125 fi
126}
127
128java-vm-2_pkg_postrm() {
129 fdo-mime_desktop_database_update
100} 130}
101 131
102java_set_default_vm_() { 132java_set_default_vm_() {
103 java-config-2 --set-system-vm="${VMHANDLE}" 133 java-config-2 --set-system-vm="${VMHANDLE}"
104 134
135 -e "/^LDPATH=.*lib\\/\\\"/s|\"\\(.*\\)\"|\"\\1${platform}/:\\1${platform}/server/\"|" \ 165 -e "/^LDPATH=.*lib\\/\\\"/s|\"\\(.*\\)\"|\"\\1${platform}/:\\1${platform}/server/\"|" \
136 < ${source_env_file} \ 166 < ${source_env_file} \
137 > ${env_file} || die "sed failed" 167 > ${env_file} || die "sed failed"
138 168
139 echo "VMHANDLE=\"${VMHANDLE}\"" >> ${env_file} 169 echo "VMHANDLE=\"${VMHANDLE}\"" >> ${env_file}
140 170
141 # generation-1 compatibility 171 # generation-1 compatibility
142 # respect both variables for now... 172 # respect both variables for now...
143 if [[ ${JAVA_SUPPORTS_GENERATION_1} == 'true' && ${JAVA_VM_NO_GENERATION1} != 'true' ]]; then 173 if [[ ${JAVA_SUPPORTS_GENERATION_1} == 'true' && ${JAVA_VM_NO_GENERATION1} != 'true' ]]; then
144 einfo "Enabling generation-1 compatibility..." 174 einfo "Enabling generation-1 compatibility..."
145 dodir /etc/env.d/java # generation-1 compatibility 175 dodir /etc/env.d/java # generation-1 compatibility

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.16

  ViewVC Help
Powered by ViewVC 1.1.20