Gentoo Archives: gentoo-commits

From: "Vlastimil Babka (caster)" <caster@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: java-vm-2.eclass
Date: Thu, 01 Sep 2011 14:16:12
Message-Id: 20110901141557.815482004C@flycatcher.gentoo.org
1 caster 11/09/01 14:15:57
2
3 Modified: java-vm-2.eclass
4 Log:
5 Prefix support, thanks to sera and darkside.
6
7 Revision Changes Path
8 1.33 eclass/java-vm-2.eclass
9
10 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/java-vm-2.eclass?rev=1.33&view=markup
11 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/java-vm-2.eclass?rev=1.33&content-type=text/plain
12 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/java-vm-2.eclass?r1=1.32&r2=1.33
13
14 Index: java-vm-2.eclass
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/java-vm-2.eclass,v
17 retrieving revision 1.32
18 retrieving revision 1.33
19 diff -u -r1.32 -r1.33
20 --- java-vm-2.eclass 8 Jul 2011 11:35:01 -0000 1.32
21 +++ java-vm-2.eclass 1 Sep 2011 14:15:57 -0000 1.33
22 @@ -1,6 +1,6 @@
23 # Copyright 1999-2004 Gentoo Foundation
24 # Distributed under the terms of the GNU General Public License v2
25 -# $Header: /var/cvsroot/gentoo-x86/eclass/java-vm-2.eclass,v 1.32 2011/07/08 11:35:01 ssuominen Exp $
26 +# $Header: /var/cvsroot/gentoo-x86/eclass/java-vm-2.eclass,v 1.33 2011/09/01 14:15:57 caster Exp $
27
28 # -----------------------------------------------------------------------------
29 # @eclass-begin
30 @@ -12,7 +12,7 @@
31 #
32 # -----------------------------------------------------------------------------
33
34 -inherit eutils fdo-mime multilib
35 +inherit eutils fdo-mime multilib prefix
36
37 DEPEND="=dev-java/java-config-2*"
38 has "${EAPI}" 0 1 && DEPEND="${DEPEND} >=sys-apps/portage-2.1"
39 @@ -54,9 +54,12 @@
40 else
41 libdir=lib
42 fi
43 +
44 + has ${EAPI:-0} 0 1 2 && ! use prefix && EPREFIX=
45 +
46 # Install a default nsplugin if we don't already have one
47 if has nsplugin ${IUSE} && use nsplugin; then
48 - if [[ ! -f /usr/${libdir}/nsbrowser/plugins/javaplugin.so ]]; then
49 + if [[ ! -f "${EPREFIX}"/usr/${libdir}/nsbrowser/plugins/javaplugin.so ]]; then
50 einfo "No system nsplugin currently set."
51 java-vm_set-nsplugin
52 else
53 @@ -111,9 +114,12 @@
54 # TODO rename to something more evident, like install_env_file
55 set_java_env() {
56 debug-print-function ${FUNCNAME} $*
57 +
58 + has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
59 +
60 local platform="$(get_system_arch)"
61 - local env_file="${D}${JAVA_VM_CONFIG_DIR}/${VMHANDLE}"
62 - local old_env_file="${D}/etc/env.d/java/20${P}"
63 + local env_file="${ED}${JAVA_VM_CONFIG_DIR}/${VMHANDLE}"
64 + local old_env_file="${ED}/etc/env.d/java/20${P}"
65 if [[ ${1} ]]; then
66 local source_env_file="${1}"
67 else
68 @@ -141,12 +147,15 @@
69 echo "BUILD_ONLY=\"${JAVA_VM_BUILD_ONLY}\""
70 ) >> "${env_file}"
71
72 + eprefixify ${env_file}
73 +
74 [[ -n ${JAVA_PROVIDE} ]] && echo "PROVIDES=\"${JAVA_PROVIDE}\"" >> ${env_file}
75
76 local java_home=$(source "${env_file}"; echo ${JAVA_HOME})
77 [[ -z ${java_home} ]] && die "No JAVA_HOME defined in ${env_file}"
78
79 # Make the symlink
80 + dodir "${JAVA_VM_DIR}"
81 dosym ${java_home} ${JAVA_VM_DIR}/${VMHANDLE} \
82 || die "Failed to make VM symlink at ${JAVA_VM_DIR}/${VMHANDLE}"
83 }
84 @@ -165,10 +174,15 @@
85 # @param $1 - Path of the VM (defaults to /opt/${P} if not set)
86 # ------------------------------------------------------------------------------
87 java-vm_revdep-mask() {
88 - local VMROOT="${1-/opt/${P}}"
89 + if has ${EAPI:-0} 0 1 2 && ! use prefix; then
90 + ED="${D}"
91 + EPREFIX=
92 + fi
93 +
94 + local VMROOT="${1-"${EPREFIX}"/opt/${P}}"
95
96 dodir /etc/revdep-rebuild/
97 - echo "SEARCH_DIRS_MASK=\"${VMROOT}\""> "${D}/etc/revdep-rebuild/61-${VMHANDLE}"
98 + echo "SEARCH_DIRS_MASK=\"${VMROOT}\""> "${ED}/etc/revdep-rebuild/61-${VMHANDLE}"
99
100 elog "A revdep-rebuild control file was installed to prevent reinstalls due to"
101 elog "missing dependencies (see bug #177925 for more info). Note that some parts"
102 @@ -177,15 +191,17 @@
103 }
104
105 java_get_plugin_dir_() {
106 - echo /usr/$(get_libdir)/nsbrowser/plugins
107 + has ${EAPI:-0} 0 1 2 && ! use prefix && EPREFIX=
108 + echo "${EPREFIX}"/usr/$(get_libdir)/nsbrowser/plugins
109 }
110
111 install_mozilla_plugin() {
112 local plugin="${1}"
113 local variant="${2}"
114
115 - if [[ ! -f "${D}/${plugin}" ]]; then
116 - die "Cannot find mozilla plugin at ${D}/${plugin}"
117 + has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
118 + if [[ ! -f "${ED}/${plugin}" ]]; then
119 + die "Cannot find mozilla plugin at ${ED}/${plugin}"
120 fi
121
122 if [[ -n "${variant}" ]]; then