summaryrefslogtreecommitdiff
blob: 3c32c01ce151b3993813a9837e01866b229a859e (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
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

JAVA_SUPPORTS_GENERATION_1="true"
inherit java-vm-2 eutils

DESCRIPTION="Links to Apple's version of Sun's J2SE Development Kit"
HOMEPAGE="http://java.sun.com/j2se/1.6.0/"
SLOT="1.6"
LICENSE="public-domain"
KEYWORDS="-* ~x64-macos ~x86-macos"
IUSE=""

JAVA_PROVIDE="jdbc-stdext"

APPLE_JAVA_DIR="/System/Library/Frameworks/JavaVM.framework/Versions/${PV}/Home"

pkg_preinst() {
	[[ ! -d ${APPLE_JAVA_DIR} ]] && die "Java 6 not installed!"
}

src_install() {
	local dirs="bin include lib man"
	dodir /opt/${P}

	for d in ${dirs}; do
		ln -s "${APPLE_JAVA_DIR}"/${d} "${ED}"/opt/${P}/${d}
	done
	# Apple just puts al JRE stuff in the Home dir next to the JDK stuff,
	# "emulate" it to make the wrappers happy
	ln -s "${APPLE_JAVA_DIR}" "${ED}"/opt/${P}/jre

	# create dir for system preferences
	dodir /opt/${P}/.systemPrefs
	# Create files used as storage for system preferences.
	touch "${ED}/opt/${P}/.systemPrefs/.system.lock"
	chmod 644 "${ED}/opt/${P}/.systemPrefs/.system.lock"
	touch "${ED}/opt/${P}/.systemPrefs/.systemRootModFile"
	chmod 644 "${ED}/opt/${P}/.systemPrefs/.systemRootModFile"

	set_java_env
}

pkg_postinst() {
	# Set as default VM if none exists
	java-vm-2_pkg_postinst

	elog "Note: you're using your OSX (pre-)installed Java installation"
}