Diff snappy-1.1.7.8-r1 with a snappy-1.1.10.1-r1

/usr/portage/dev-java/snappy/snappy-1.1.10.1-r1.ebuild 2023-10-09 14:52:29.444368349 +0300
1
# Copyright 1999-2022 Gentoo Authors
1
# Copyright 1999-2023 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4 4
EAPI=8
5 5

  
6 6
JAVA_PKG_IUSE="doc source test"
7
MAVEN_ID="org.xerial.snappy:snappy-java:1.1.7.8"
7
MAVEN_ID="org.xerial.snappy:snappy-java:${PV}"
8
JAVA_TESTING_FRAMEWORKS="junit-4"
8 9

  
9
inherit java-pkg-2 java-ant-2 toolchain-funcs
10

  
11
MY_PN="${PN}-java"
12
MY_P="${MY_PN}-${PV}"
10
inherit java-pkg-2 java-pkg-simple toolchain-funcs check-reqs
13 11

  
14 12
DESCRIPTION="Snappy compressor/decompressor for Java"
15 13
HOMEPAGE="https://github.com/xerial/snappy-java/"
16
SRC_URI="https://github.com/xerial/${MY_PN}/archive/${PV}.tar.gz -> ${MY_P}.tar.gz"
14
# ::gentoo does not have hadoop-common packaged. Currently we bundle the binary version.
15
# It's used for testing only and does not get installed.
16
HCV="3.3.5"
17
SRC_URI="https://github.com/xerial/snappy-java/archive/v${PV}.tar.gz -> ${P}.tar.gz
18
	test? ( https://repo1.maven.org/maven2/org/apache/hadoop/hadoop-common/${HCV}/hadoop-common-${HCV}.jar )"
19
S="${WORKDIR}/snappy-java-${PV}"
17 20

  
18 21
LICENSE="Apache-2.0"
19 22
SLOT="1.1"
20
KEYWORDS="amd64 ~arm arm64 ppc64 x86"
23
KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
21 24

  
22
# Tests require org.apache.hadoop:hadoop-common:2.7.*, which is yet to be
23
# packaged.  Some extra steps are required before running the tests:
24
# 1. Download hadoop-common 2.7.x from https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-common
25
# 2. Set EANT_GENTOO_CLASSPATH_EXTRA to the path to hadoop-common-2.7.*.jar
26
# 3. Set ALLOW_TEST="all"
27
RESTRICT="test"
25
CP_DEPEND="dev-java/osgi-core:0"
28 26

  
29
CDEPEND="dev-java/osgi-core:0
27
CDEPEND="
30 28
	app-arch/snappy
31
	dev-libs/bitshuffle"
29
	dev-libs/bitshuffle
30
"
32 31

  
33 32
DEPEND=">=virtual/jdk-1.8:*
33
	${CP_DEPEND}
34 34
	${CDEPEND}
35 35
	test? (
36 36
		dev-java/ant-junit4:0
37 37
		dev-java/commons-io:1
38
		dev-java/commons-lang:2.1
38
		dev-java/commons-lang:3.6
39 39
		dev-java/plexus-classworlds:0
40 40
		dev-java/xerial-core:0
41 41
	)"
42 42

  
43 43
RDEPEND=">=virtual/jre-1.8:*
44
	${CP_DEPEND}
44 45
	${CDEPEND}"
45 46

  
46
S="${WORKDIR}/${MY_P}"
47
PATCHES=(
48
	"${FILESDIR}/1.1.7.8-java-version-target.patch"
49
	"${FILESDIR}/snappy-1.1.10.1-unbundle-snappy.patch"
50
	"${FILESDIR}/1.1.7.8-unbundle-bitshuffle.patch"
51
	"${FILESDIR}/1.1.7.8-gentoo.patch"
52
	"${FILESDIR}/snappy-1.1.10.1-SnappyOutputStreamTest.patch"
53
	"${FILESDIR}/snappy-1.1.10.1-commons-lang3.patch"
54
)
47 55

  
48
JAVA_ANT_REWRITE_CLASSPATH="true"
49
JAVA_ANT_CLASSPATH_TAGS="javac javadoc"
50
EANT_GENTOO_CLASSPATH="osgi-core"
51
EANT_TEST_GENTOO_CLASSPATH="
52
	${EANT_GENTOO_CLASSPATH}
56
JAVA_RESOURCE_DIRS="src/main/resources"
57
JAVA_SRC_DIR="src/main/java"
58

  
59
JAVA_TEST_GENTOO_CLASSPATH="
53 60
	commons-io-1
54
	commons-lang-2.1
61
	commons-lang-3.6
62
	junit-4
55 63
	plexus-classworlds
56 64
	xerial-core
57 65
"
66
JAVA_TEST_RESOURCE_DIRS="src/test/resources"
67
JAVA_TEST_SRC_DIR="src/test/java"
68

  
69
check_env() {
70
	if use test; then
71
		# this is needed only for tests
72
		CHECKREQS_MEMORY="2560M"
73
		check-reqs_pkg_pretend
74
	fi
75
}
76

  
77
pkg_pretend() {
78
	check_env
79
}
80

  
81
pkg_setup() {
82
	check_env
83
	java-pkg-2_pkg_setup
84
}
58 85

  
59 86
src_prepare() {
60
	cp "${FILESDIR}/1.x-build.xml" build.xml || die
61
	rm -r src/main/resources/org/xerial/snappy/native || die
62
	eapply "${FILESDIR}/${PV}-java-version-target.patch"
63
	eapply "${FILESDIR}/${PV}-remove-perl-usage.patch"
64
	eapply "${FILESDIR}/${PV}-unbundle-snappy.patch"
65
	eapply "${FILESDIR}/${PV}-unbundle-bitshuffle.patch"
66
	eapply "${FILESDIR}/${PV}-gentoo.patch"
87
	default
67 88
	java-pkg-2_src_prepare
89
	# remove pre-compiled sofiles
90
	rm -r src/main/resources/org/xerial/snappy/native || die
91
	rm -r src/test/resources/lib || die
68 92
}
69 93

  
70 94
src_compile() {
......
72 96
		CXX="$(tc-getCXX)" \
73 97
		JAVA_SOURCE="$(java-pkg_get-source)" \
74 98
		JAVA_TARGET="$(java-pkg_get-target)"
75
	java-pkg-2_src_compile
99

  
100
	java-pkg-simple_src_compile
76 101
}
77 102

  
78 103
src_test() {
79
	cp -r src/test/resources/org/xerial/snappy/* \
80
		src/test/java/org/xerial/snappy || die
81
	java-pkg-2_src_test
104
	JAVA_GENTOO_CLASSPATH_EXTRA="${DISTDIR}/hadoop-common-${HCV}.jar"
105
	JAVA_TEST_EXTRA_ARGS=( -Xmx${CHECKREQS_MEMORY} )
106
	local vm_version="$(java-config -g PROVIDES_VERSION)"
107
	if ver_test "${vm_version}" -ge 17; then
108
		java-pkg-simple_src_test
109
	else
110
		einfo "Tests need jdk-17 to pass."
111
	fi
82 112
}
83 113

  
84 114
src_install() {
115
	java-pkg-simple_src_install
116

  
85 117
	local jniext=.so
86 118
	if [[ ${CHOST} == *-darwin* ]] ; then
87 119
		jniext=.jnilib
......
90 122
			"target/libsnappyjava${jniext}"
91 123
	fi
92 124
	java-pkg_doso "target/libsnappyjava${jniext}"
93
	java-pkg_dojar "target/${PN}.jar"
94

  
95
	use source && java-pkg_dosrc src/main/java/*
96
	use doc && java-pkg_dojavadoc target/site/apidocs
97 125
}
Thank you!