/[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.26 Revision 1.27
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.26 2009/02/11 16:13:38 betelgeuse Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/java-vm-2.eclass,v 1.27 2009/04/17 22:50:41 caster 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
18hasq "${EAPI}" 0 1 && DEPEND="${DEPEND} >=sys-apps/portage-2.1" 18hasq "${EAPI}" 0 1 && DEPEND="${DEPEND} >=sys-apps/portage-2.1"
19 19
20RDEPEND=" 20RDEPEND="
21 =dev-java/java-config-2*" 21 =dev-java/java-config-2*"
22 22
23# bug #176784
24if [[ ${JAVA_SUPPORTS_GENERATION_1} == 'true' && ${JAVA_VM_NO_GENERATION1} != 'true' ]]; then
25 DEPEND="${DEPEND} =dev-java/java-config-1.3*"
26 RDEPEND="${RDEPEND} =dev-java/java-config-1.3*"
27fi
28
29export WANT_JAVA_CONFIG=2 23export WANT_JAVA_CONFIG=2
30 24
31JAVA_VM_CONFIG_DIR="/usr/share/java-config-2/vm" 25JAVA_VM_CONFIG_DIR="/usr/share/java-config-2/vm"
32JAVA_VM_DIR="/usr/lib/jvm" 26JAVA_VM_DIR="/usr/lib/jvm"
33 27
44java-vm-2_pkg_postinst() { 38java-vm-2_pkg_postinst() {
45 # Set the generation-2 system VM, if it isn't set 39 # Set the generation-2 system VM, if it isn't set
46 if [[ -z "$(java-config-2 -f)" ]]; then 40 if [[ -z "$(java-config-2 -f)" ]]; then
47 java_set_default_vm_ 41 java_set_default_vm_
48 fi 42 fi
49
50 # support both variables for now
51 if [[ ${JAVA_SUPPORTS_GENERATION_1} == 'true' && ${JAVA_VM_NO_GENERATION1} != 'true' ]]; then
52 local systemvm1="$(java-config-1 -f 2>/dev/null)"
53 # no generation-1 system-vm was previously set
54 if [[ -z "${systemvm1}" ]]; then
55 # if 20java exists, must be using old VM
56 if [[ -f /etc/env.d/20java ]]; then
57 ewarn "The current generation-1 system-vm is using an out-of-date VM,"
58 ewarn "as in, it hasn't been updated for use with the new Java sytem."
59 # othewise, it must not have been set before
60 else
61 ewarn "No generation-1 system-vm previously set."
62 fi
63 ewarn "Setting generation-1 system-vm to ${VMHANDLE}"
64 java-config-1 --set-system-vm=${P} 2>/dev/null
65 # dirty check to see if we are upgrading current generation-1 system vm
66 elif [[ "${systemvm1}" = ${VMHANDLE}* ]]; then
67 einfo "Emerging the current generation-1 system-vm..."
68 einfo "Updating its config files."
69 java-config-1 --set-system-vm=${P} 2>/dev/null
70 # dirty check to see if current system vm is a jre - replace it with
71 elif [[ "${systemvm1}" = *jre* ]]; then
72 ewarn "Current generation-1 system-vm is a JRE"
73 ewarn "For the new and old Java systems to coexist,"
74 ewarn "the generation-1 system-vm must be a JDK."
75 ewarn "Setting generation-1 system-vm to ${VMHANDLE}"
76 java-config-1 --set-system-vm=${P} 2>/dev/null
77 fi
78 # else... some other VM is being updated, so we don't have to worry
79 else
80 einfo "JREs and 1.5+ JDKs are not supported for use with generation-1."
81 einfo "This is because generation-1 is only for use for building packages."
82 einfo "Only generation-2 should be used by end-users,"
83 einfo "where all JREs and JDKs will be available"
84 fi
85
86 echo
87 43
88 java-vm_check-nsplugin 44 java-vm_check-nsplugin
89 java_mozilla_clean_ 45 java_mozilla_clean_
90 fdo-mime_desktop_database_update 46 fdo-mime_desktop_database_update
91} 47}
177 -e "/^LDPATH=.*lib\\/\\\"/s|\"\\(.*\\)\"|\"\\1${platform}/:\\1${platform}/server/\"|" \ 133 -e "/^LDPATH=.*lib\\/\\\"/s|\"\\(.*\\)\"|\"\\1${platform}/:\\1${platform}/server/\"|" \
178 < ${source_env_file} \ 134 < ${source_env_file} \
179 > ${env_file} || die "sed failed" 135 > ${env_file} || die "sed failed"
180 136
181 echo "VMHANDLE=\"${VMHANDLE}\"" >> ${env_file} 137 echo "VMHANDLE=\"${VMHANDLE}\"" >> ${env_file}
182
183 # generation-1 compatibility
184 # respect both variables for now...
185 if [[ ${JAVA_SUPPORTS_GENERATION_1} == 'true' && ${JAVA_VM_NO_GENERATION1} != 'true' ]]; then
186 einfo "Enabling generation-1 compatibility..."
187 dodir /etc/env.d/java # generation-1 compatibility
188 # We need to strip some things out of the new style env,
189 # because these end up going in the env
190 sed -e 's/.*CLASSPATH.*//' \
191 -e 's/.*PROVIDES.*//' \
192 ${env_file} \
193 > ${old_env_file} || die "failed to create generation-1 env file"
194 else
195 ewarn "Disabling generation-1 compatibility..."
196 fi
197 138
198 [[ -n ${JAVA_PROVIDE} ]] && echo "PROVIDES=\"${JAVA_PROVIDE}\"" >> ${env_file} 139 [[ -n ${JAVA_PROVIDE} ]] && echo "PROVIDES=\"${JAVA_PROVIDE}\"" >> ${env_file}
199 140
200 local java_home=$(source ${env_file}; echo ${JAVA_HOME}) 141 local java_home=$(source ${env_file}; echo ${JAVA_HOME})
201 [[ -z ${java_home} ]] && die "No JAVA_HOME defined in ${env_file}" 142 [[ -z ${java_home} ]] && die "No JAVA_HOME defined in ${env_file}"

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.27

  ViewVC Help
Powered by ViewVC 1.1.20