summaryrefslogtreecommitdiff
blob: 3a658666243d2a7d8511ee6a08ff5789981ad5c1 (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
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
# Build written by Andrew John Hughes (ahughes@redhat.com)

EAPI="5"

inherit autotools eutils readme.gentoo java-pkg-2 java-vm-2

DESCRIPTION="FOSS Java browser plugin and Web Start implementation"
HOMEPAGE="http://icedtea.classpath.org"
SRC_URI="http://icedtea.classpath.org/download/source/${P}.tar.gz"
LICENSE="GPL-2 GPL-2-with-linking-exception LGPL-2"
SLOT="0"
KEYWORDS="amd64 ~arm ~ppc64 x86"
IUSE="doc +icedtea7 javascript nsplugin tagsoup test"
RESTRICT="test"

COMMON_DEP="
	icedtea7? ( || (
		dev-java/icedtea:7 dev-java/icedtea-bin:7
	) )
	!icedtea7? ( || (
		dev-java/icedtea:7 dev-java/icedtea-bin:7
		dev-java/icedtea:6 dev-java/icedtea-bin:6
	) )
	app-eselect/eselect-java
	tagsoup? ( dev-java/tagsoup )
	nsplugin? (
		>=dev-libs/glib-2.16
	)"
RDEPEND="${COMMON_DEP}"
# Need system junit 4.8+. Bug #389795
DEPEND="${COMMON_DEP}
	virtual/pkgconfig
	app-arch/zip
	javascript? ( dev-java/rhino:1.6 )
	nsplugin? ( net-misc/npapi-sdk )
	test? (	>=dev-java/junit-4.8:4 )"

# http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2010-December/011221.html
pkg_setup() {
	JAVA_PKG_WANT_BUILD_VM="icedtea-7 icedtea-bin-7"
	if ! use icedtea7; then
		JAVA_PKG_WANT_BUILD_VM="${JAVA_PKG_WANT_BUILD_VM} icedtea-6 icedtea-bin-6"
	fi
	JAVA_PKG_WANT_SOURCE="1.6"
	JAVA_PKG_WANT_TARGET="1.6"

	java-pkg-2_pkg_setup
	java-vm-2_pkg_setup
}

src_prepare() {
	epatch "${FILESDIR}"/${PN}-1.5-respect-ldflags.patch # bug #356645
	eautoreconf
}

src_configure() {
	local tagsoup_jar
	local config

	# bug #527962
	use tagsoup && tagsoup_jar="$(java-pkg_getjars tagsoup)"

	config=(
		# javaws is managed by eselect java-vm and symlinked to by icedtea so
		# move it out of the way and symlink itweb-settings back to bin
		--bindir="${EPREFIX}"/usr/libexec/${PN}
		--with-jdk-home="${JAVA_HOME}"
		$(use_enable doc docs)
		$(use_enable nsplugin plugin)
		$(use_with javascript rhino)
		$(use_with tagsoup tagsoup ${tagsoup_jar})
	)

	unset JAVA_HOME JDK_HOME CLASSPATH JAVAC JAVACFLAGS
	econf "${config[@]}"
}

src_compile() {
	default
}

src_install() {
	default

	if use nsplugin; then
		install_mozilla_plugin "/usr/$(get_libdir)/IcedTeaPlugin.so"
	fi

	mkdir -p "${ED}"/usr/bin || die
	dosym /usr/libexec/${PN}/itweb-settings /usr/bin/itweb-settings || die

	# Should we patch system default lookup instead?
	mkdir -p "${ED}"/etc/.java/deployment/ || die
	echo "deployment.jre.dir=/etc/java-config-2/current-icedtea-web-vm" \
		> "${ED}"/etc/.java/deployment/deployment.properties || die

	readme.gentoo_create_doc
}

pkg_postinst() {
	VMHANDLE="icedtea-web@${GENTOO_VM}" java-vm_check-nsplugin
	java_mozilla_clean_
	readme.gentoo_print_elog
}

pkg_prerm() {
	# override the java-vm-2 eclass check for removing a system VM, as it
	# doesn't make sense here.
	:;
}