summaryrefslogtreecommitdiff
blob: d896760e3268197486f60fbc5d29478b7f499641 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-emulation/emul-linux-x86-java/emul-linux-x86-java-1.4.2.03-r1.ebuild,v 1.5 2006/03/09 01:49:19 flameeyes Exp $

inherit multilib java versionator

JREV="03"

JV="${PV}"
JV=$(get_version_component_range 1-3 ${JV})
DESCRIPTION="32bit java emulation for amd64"
J_URI="mirror://blackdown.org/JDK-${JV}"
SRC_URI="${J_URI}/i386/${JREV}/j2re-${JV}-${JREV}-linux-i586.bin"

HOMEPAGE="http://www.blackdown.org"

SLOT="1.4.2"
LICENSE="sun-bcla-java-vm"
KEYWORDS="-* amd64"
IUSE="nsplugin"
DEPEND="virtual/libc
	>=sys-apps/sed-4"
RDEPEND="virtual/libc
	app-emulation/emul-linux-x86-xlibs
	app-emulation/emul-linux-x86-soundlibs"

S="${WORKDIR}/j2re${JV}"

JAVAHOME="${D}/opt/java32"

# 32bit binary package
pkg_setup() {
	ABI="x86"
}

RESTRICT="nostrip"

# Extract the 'skip' value (offset of tarball) we should pass to tail
get_offset() {
	[ ! -f "$1" ] && return

	local offset="`gawk '
		/^[[:space:]]*skip[[:space:]]*=/ {

			sub(/^[[:space:]]*skip[[:space:]]*=/, "")
			SKIP = $0
		}

		END { print SKIP }
	' $1`"

	eval echo $offset
}

src_unpack () {
	local offset="`get_offset ${DISTDIR}/${A}`"

	if [ -z "${offset}" ] ; then
		eerror "Failed to get offset of tarball!"
		die "Failed to get offset of tarball!"
	fi

	echo ">>> Unpacking ${A}..."
	tail -n +${offset} ${DISTDIR}/${A} | tar --no-same-owner -jxpf -
}

unpack_jars() {
	# New to 1.4.2
	local PACKED_JARS="lib/tools.jar lib/rt.jar lib/jsse.jar lib/charsets.jar lib/ext/localedata.jar lib/plugin.jar javaws/javaws.jar"
	local UNPACK_CMD=""
	if [ -f "$JAVAHOME/lib/unpack" ]; then
		UNPACK_CMD="$JAVAHOME/lib/unpack"
		chmod +x "$UNPACK_CMD"
		#packerror=""
		sed -i 's#/tmp/unpack.log#/dev/null\x00\x00\x00\x00\x00\x00#g' $UNPACK_CMD
		for i in $PACKED_JARS; do
			if [ -f "$JAVAHOME/${i%.jar}.pack" ]; then
				einfo "Creating ${JAVAHOME}/${i}"
				"$UNPACK_CMD" "$JAVAHOME/${i%.jar}.pack" "$JAVAHOME/$i"
				if [ ! -f "$JAVAHOME/$i" ]; then
					die "Failed to unpack jar files ${i}." # Please refer\n"
					#ewarn "to the Troubleshooting section of the Installation\n"
					#ewarn "Instructions on the download page for more information.n"
					#packerror="1"
				fi
				rm -f "$JAVAHOME/${i%.jar}.pack"
			fi
		done
	fi
	rm -f "$UNPACK_CMD"
}

src_install() {
	typeset platform

	dodir /opt/java32

	cp -pPR ${S}/{bin,lib,man,plugin,javaws} ${JAVAHOME} || die "failed to copy"

	dodoc COPYRIGHT README
	dohtml README.html

	# Install mozilla plugin
	if use nsplugin ; then
		install_mozilla_plugin /opt/java32/plugin/i386/mozilla/libjavaplugin_oji.so
	fi

	sed -i "s/standard symbols l/symbol/g" ${D}/opt/java32/lib/font.properties

	find ${JAVAHOME} -type f -name "*.so" -exec chmod +x \{\} \;

	unpack_jars

	# Install java settings file for openoffice so that it will not try
	# to use the native 64bit jre and cause 2 minute startup...
	dodir /usr/$(get_libdir)/openoffice/share/config
	insinto /usr/$(get_libdir)/openoffice/share/config
	doins ${FILESDIR}/javasettings_Linux_x86.xml
}