summaryrefslogtreecommitdiff
blob: 994eaca5160fc3a3b8a2af5d5944ac350fa82740 (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
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-util/weka/weka-3.6.6-r1.ebuild,v 1.2 2012/08/01 08:02:06 jdhore Exp $

EAPI="3"

JAVA_PKG_IUSE="doc source"

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

MY_P="${PN}-$(replace_all_version_separators '-')"
DESCRIPTION="A Java data mining package"
SRC_URI="mirror://sourceforge/${PN}/${MY_P}.zip"
HOMEPAGE="http://www.cs.waikato.ac.nz/ml/weka/"
SLOT="0"
LICENSE="GPL-2"
KEYWORDS="~amd64 ~ppc x86"
DEPEND=">=virtual/jdk-1.5
	app-arch/unzip
	>=dev-java/javacup-0.11a_beta20060608:0"
RDEPEND=">=virtual/jre-1.5
	>=dev-java/javacup-0.11a_beta20060608:0"
IUSE=""

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

EANT_BUILD_TARGET="exejar"
EANT_DOC_TARGET="docs"
JAVA_ANT_IGNORE_SYSTEM_CLASSES="true"

weka_get_max_memory() {
	if use amd64; then
		echo 512m
	else
		echo 256m
	fi
}

java_prepare() {
	unzip -qq "${PN}-src.jar" -d . || die "Failed to unpack the source"
	rm -v *.jar lib/*.jar || die
	rm -rf doc || die
	java-pkg_jar-from --into lib javacup
	epatch "${FILESDIR}"/${P}-build.xml.patch
	sed -i -e "s/256m/$(weka_get_max_memory)/g" build.xml || die
}

src_install() {
	java-pkg_dojar dist/${PN}.jar
	java-pkg_dolauncher weka --main "${PN}.gui.GUIChooser"

	# Really need a virtual to list all available drivers and pull the ones
	# instaled
	java-pkg_register-optional-dependency hsqldb,jdbc-mysql,mckoi-1

	use source && java-pkg_dosrc src/main/java/weka/

	dodoc README || die
	if use doc; then
		java-pkg_dojavadoc doc/
		insinto /usr/share/doc/${PF}
		doins WekaManual.pdf || die
	fi

	dodir /usr/share/${PN}/data/
	insinto /usr/share/${PN}/data/
	doins data/*

	newicon "${S}/weka.gif" "${PN}".png
	make_desktop_entry "${PN}" "Waikato Environment for Knowledge Analysis" "${PN}" "Education;Science;ArtificialIntelligence;" "Comment=Start Weka"
}