summaryrefslogtreecommitdiff
blob: 213188bdd96eef5ea9494105c5547889e8d2e3fc (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
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=5

BC_SLOT="1.45"
ADOBE_FILES="pcfi-2010.08.09.jar"
JAVA_PKG_IUSE="doc source"

inherit java-pkg-2 java-pkg-simple

DESCRIPTION="Java library and utilities for working with PDF documents"
HOMEPAGE="http://pdfbox.apache.org/"
SRC_URI="mirror://apache/${PN}/${PV}/${P}-src.zip
	http://repo2.maven.org/maven2/com/adobe/pdf/pcfi/2010.08.09/${ADOBE_FILES}"
LICENSE="Apache-2.0"
SLOT="1.8"
KEYWORDS="amd64 ~arm64 ppc64 x86"
IUSE="test"
RESTRICT="test" # Explosive even when manually using unmodified build.xml.

CDEPEND="dev-java/fontbox:${SLOT}
	dev-java/jempbox:${SLOT}
	dev-java/bcmail:${BC_SLOT}
	dev-java/bcprov:${BC_SLOT}
	>=dev-java/commons-logging-1.1.1:0
	dev-java/icu4j:55"

RDEPEND="${CDEPEND}
	>=virtual/jre-1.6"

DEPEND="${CDEPEND}
	>=virtual/jdk-1.6
	app-arch/unzip
	test? ( dev-java/junit:4 )"

S="${WORKDIR}/${P}/${PN}"
JAVA_SRC_DIR="src/main/java"
JAVA_ENCODING="ISO-8859-1"
JAVA_GENTOO_CLASSPATH="fontbox-${SLOT},jempbox-${SLOT},bcmail-${BC_SLOT},bcprov-${BC_SLOT},commons-logging,icu4j-55"

src_unpack() {
	unpack ${P}-src.zip
}

java_prepare() {
	local DIR=target/classes/org/apache/${PN}/resources
	mkdir -p "${DIR}/afm" || die

	unzip -j -d "${DIR}" "${DISTDIR}/${ADOBE_FILES}" com/adobe/pdf/pcfi/glyphlist.txt || die
	unzip -j -d "${DIR}/afm" "${DISTDIR}/${ADOBE_FILES}" com/adobe/pdf/pcfi/afm/*.afm || die

	echo "${PN}.version=${PV}" > ${DIR}/${PN}.version || die
}

src_compile() {
	java-pkg-simple_src_compile
	java-pkg_addres ${PN}.jar src/main/resources
}

src_install() {
	java-pkg-simple_src_install
	java-pkg_dolauncher ${PN} --main org.apache.${PN}.PDFBox
}

src_test() {
	local DIR=src/test/java
	local CP="${DIR}:${PN}.jar:$(java-pkg_getjars junit-4,${JAVA_GENTOO_CLASSPATH})"
	local TESTS=$(find ${DIR} -name "*Test.java")
	TESTS="${TESTS//src\/test\/java\/}"
	TESTS="${TESTS//.java}"
	TESTS="${TESTS//\//.}"

	ejavac -encoding ${JAVA_ENCODING} -cp "${CP}" -d ${DIR} $(find ${DIR} -name "*.java")
	ejunit4 -classpath "${CP}" ${TESTS}
}