summaryrefslogtreecommitdiff
blob: 393f86131f8bd9603e702e9c6cecabf304f78550 (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
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-java/jffi/jffi-0.6.0.2-r1.ebuild,v 1.2 2010/01/24 20:56:13 betelgeuse Exp $

# Probably best to leave the CFLAGS as they are here. See...
# http://weblogs.java.net/blog/kellyohair/archive/2006/01/compilation_of_1.html

EAPI="2"
JAVA_PKG_IUSE="source test"
WANT_ANT_TASKS="ant-nodeps"
inherit java-pkg-2 java-ant-2 toolchain-funcs flag-o-matic versionator

DESCRIPTION="An optimized Java interface to libffi"
HOMEPAGE="http://kenai.com/projects/jffi"
SRC_URI="mirror://gentoo//${P}.tar.bz2"
LICENSE="LGPL-3"
SLOT="0.4"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE=""

RDEPEND=">=virtual/jre-1.5
	virtual/libffi"

DEPEND=">=virtual/jdk-1.5
	virtual/libffi
	test? ( dev-java/ant-junit4 )"

JAVA_PKG_BSFIX_NAME="build-impl.xml"
JAVA_PKG_FILTER_COMPILER="ecj-3.3 ecj-3.4 ecj-3.5"

java_prepare() {
	# Delete the bundled JARs.
	find lib -name "*.jar" -delete || die
	# Delete the bundled libffi
	rm -rf jni/libffi || die

	# bug #271533 and #272058
	epatch "${FILESDIR}/${PV}-makefile-flags.patch"

	# bug #272058
	append-cflags $(pkg-config --cflags-only-I libffi)

	# any better function for this, excluding get_system_arch in java-vm-2 which is incorrect to inherit ?
	local arch=""
	use x86 && arch="i386"
	use amd64 && arch="x86_64"
	use ppc && arch="ppc"

	# Fetch our own prebuilt libffi.
	mkdir -p "build/jni/libffi-${arch}-linux/.libs" || die

	ln -snf "/usr/$(get_libdir)/libffi.so" \
		"build/jni/libffi-${arch}-linux/.libs/libffi_convenience.a" || die

	# Don't include prebuilt files for other archs.
	sed -i '/<zipfileset src="archive\//d' custom-build.xml || die
	sed -i '/libs.CopyLibs.classpath/d' lib/nblibraries.properties || die
	sed -i '/copylibstask.jar/d' lib/nblibraries.properties || die
}

src_install() {
	java-pkg_dojar dist/${PN}.jar
	java-pkg_doso build/jni/lib${PN}-$(get_version_component_range 1-2).so
	use source && java-pkg_dosrc src/*
}

src_test() {
	ANT_TASKS="ant-junit4 ant-nodeps" eant test \
		-Dlibs.junit_4.classpath="$(java-pkg_getjars --with-dependencies junit-4)"
}