summaryrefslogtreecommitdiff
blob: 27b30c936a2107a1842d147f6a6727e83a2ca3e2 (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
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-tv/channeleditor/channeleditor-1.9.2.1-r1.ebuild,v 1.2 2010/01/16 17:33:21 fauli Exp $

EAPI="2"

inherit eutils java-pkg-2 java-ant-2

DESCRIPTION="Editor for VDR channels.conf"
HOMEPAGE="http://renier.re.funpic.de/"
SRC_URI="mirror://sourceforge/${PN}/${P/-/_}_src.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="x86"
IUSE="java5 java6 source"

RDEPEND="java6? ( >=virtual/jre-1.6 )
	!java6? ( java5? ( >=virtual/jre-1.5 ) )
	!java6? ( !java5? ( >=virtual/jre-1.4 ) )"

DEPEND="java6? ( >=virtual/jdk-1.6 )
	!java6? ( java5? ( >=virtual/jdk-1.5 ) )
	!java6? ( !java5? ( >=virtual/jdk-1.4 ) )
	source? ( app-arch/zip )"

S="${WORKDIR}/${PN}"

mainclass() {
	# read Main-Class from MANIFEST.MF
	sed -n "s/^Main-Class: \([^ ]\+\).*/\1/p" "${S}/MANIFEST.MF" \
	|| die "reading Main-Class failed"
}

src_prepare() {
	# move files out of build and remove stuff not needed in the package
	mv build/* "${S}" || die "cleaning build dir failed"
	rm -f src/java/org/javalobby/icons/{README,COPYRIGHT} \
		|| die "removing files failed"

	# copy build.xml
	if use java6; then
		sed 's:\(value=\"\)1\.4\(\"\):\11.6\2:g' \
			"${FILESDIR}/build-${PV}.xml" > build.xml \
			|| die "copying build.xml failed"
	elif use java5; then
		sed 's:\(value=\"\)1\.4\(\"\):\11.5\2:g' \
			"${FILESDIR}/build-${PV}.xml" > build.xml \
			|| die "copying build.xml failed"
	else
		cp -f "${FILESDIR}/build-${PV}.xml" build.xml \
			|| die "copying build.xml failed"
	fi

	# convert CRLF to LF
	edos2unix MANIFEST.MF

	# include localisation changes
	epatch "${FILESDIR}"/${P}-messages.properties.patch
	epatch "${FILESDIR}"/${P}-messages_en.properties.patch
}

src_compile() {
	eant build -Dmanifest.mainclass=$(mainclass)
}

src_install() {
	java-pkg_dojar dist/${PN}.jar
	java-pkg_dolauncher ${PN} --main $(mainclass)

	use source && java-pkg_dosrc src

	make_desktop_entry channeleditor Channeleditor "" "Utility"
}