summaryrefslogtreecommitdiff
blob: 9d2e3ead20b2ce4325265fab97ae7d7fb247fc43 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

JAVA_PKG_IUSE="doc source test"
MAVEN_ID="com.gitlab.pdftk-java:pdftk-java:3.3.3"
JAVA_TESTING_FRAMEWORKS="junit-4"

inherit java-pkg-2 java-pkg-simple

DESCRIPTION="A port of pdftk into java"
HOMEPAGE="https://gitlab.com/pdftk-java/pdftk"

if [[ ${PV} == 9999 ]] ; then
	inherit git-r3
	EGIT_REPO_URI="https://gitlab.com/pdftk-java/pdftk/"
	SRC_URI="https://gitlab.com/pdftk-java/pdftk/-/commit/3f1918c831c919d0a8fcf18c36cf40118398b995.patch ->
		${P}-bc176.patch"
	S="${WORKDIR}/pdftk-${PV}"
else
	SRC_URI="https://gitlab.com/pdftk-java/pdftk/-/archive/v${PV}/pdftk-v${PV}.tar.bz2"
	KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
	S="${WORKDIR}/pdftk-v${PV}"
fi

LICENSE="GPL-2"
SLOT="0"

# Switch back to bcprov:0 once pdftk updates its bcprov dependency.
CP_DEPEND="
	dev-java/bcprov:0
	dev-java/commons-lang:3.6
"

DEPEND="
	>=virtual/jdk-1.8:*
	${CP_DEPEND}
	test? (
		app-text/poppler[cairo]
		dev-java/system-rules:0
	)
"

RDEPEND="
	>=virtual/jre-1.8:*
	${CP_DEPEND}"

DOCS=( CHANGELOG.md README.md )

PATCHES=( "${DISTDIR}/pdftk-9999-bc176.patch" )

JAVA_MAIN_CLASS="com.gitlab.pdftk_java.pdftk"
JAVA_RESOURCE_DIRS="resources/java"
JAVA_SRC_DIR="java"

JAVA_TEST_GENTOO_CLASSPATH="junit-4,system-rules"
JAVA_TEST_SRC_DIR="test"

src_prepare() {
	default #780585
	java-pkg-2_src_prepare
	mkdir resources || die
	cp -r {,resources/}java || die
	find resources/java -type f \( -name '*.java' -o -name '*.sh' \) -exec rm -rf {} + || die
}

src_test() {
	# some tests seem to need special treatment
	einfo "Runnig first test"
	JAVA_TEST_RUN_ONLY=(
		com.gitlab.pdftk_java.CatTest
		com.gitlab.pdftk_java.DataTest
		com.gitlab.pdftk_java.FormTest
		com.gitlab.pdftk_java.MultipleTest
	)
	java-pkg-simple_src_test
	einfo "Running second test"
	JAVA_TEST_RUN_ONLY=()
	JAVA_TEST_EXCLUDES=(
		com.gitlab.pdftk_java.CatTest
		com.gitlab.pdftk_java.DataTest
		com.gitlab.pdftk_java.FormTest
		com.gitlab.pdftk_java.MultipleTest
	)
	java-pkg-simple_src_test
}

src_install() {
	java-pkg-simple_src_install
	doman "${PN}.1"
}