summaryrefslogtreecommitdiff
blob: 86d2e0b31500045b6285989e25a157196e7def43 (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
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-java/jaffl/jaffl-0.3.ebuild,v 1.3 2010/01/16 21:02:00 betelgeuse Exp $

EAPI="2"

JAVA_PKG_IUSE="doc source"

inherit java-pkg-2 java-ant-2

DESCRIPTION="An abstracted interface to invoking native functions from java"
HOMEPAGE="http://kenai.com/projects/jaffl"
SRC_URI="mirror://gentoo/${P}.tar.bz2"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="test"

CDEPEND="dev-java/jffi:0.4
	dev-java/jna:0"

RDEPEND=">=virtual/jre-1.5
	${CDEPEND}"
DEPEND=">=virtual/jdk-1.5
	app-arch/unzip
	${CDEPEND}
	test? (
		dev-java/junit:4
		dev-java/ant-junit4:0
	)"

java_prepare() {
	find . -iname 'junit*.jar' -delete

	epatch "${FILESDIR}/library-path.patch"

	java-pkg_jar-from --into lib jffi-0.4
	java-pkg_jar-from --into lib jna

	sed -i -e '/file.reference.jffi-complete.jar=/d' \
		nbproject/project.properties || die
	sed -i -e '/reference.JNA_Library.jar=/d' \
		nbproject/project.properties || die

	mv nbproject/project.properties nbproject.properties.bak || die
	(
		echo "file.reference.jffi-complete.jar=lib/jffi.jar"
		echo "reference.JNA_Library.jar=lib/jna.jar"
	) > nbproject/project.properties
	cat nbproject.properties.bak >> nbproject/project.properties
}

src_install() {
	java-pkg_dojar "dist/${PN}.jar"
	use doc && java-pkg_dojavadoc dist/javadoc
	use source && java-pkg_dosrc src/*
}

src_test() {
	java-pkg_jar-from --build-only --into lib/junit_4 junit-4 junit.jar junit-4.1.jar
	local paths="$(java-config -di jna,jffi-0.4):${S}/build"
	ANT_TASKS="ant-junit4" eant test \
		-Drun.jvmargs="-Djava.library.path=${paths}"
}