blob: 939880e8104a7d63a014a5690e8adc302b75dbec (
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
93
|
# Copyright 2023-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
JAVA_PKG_IUSE="doc source test"
MAVEN_ID="org.lz4:lz4-java:${PV}"
JAVA_TESTING_FRAMEWORKS="junit-4"
inherit java-pkg-2 java-pkg-simple toolchain-funcs
DESCRIPTION="LZ4 compression for Java"
HOMEPAGE="https://github.com/lz4/lz4-java"
SRC_URI="https://github.com/lz4/lz4-java/archive/${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${P}"
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="amd64 arm64 ppc64"
DEPEND="
app-arch/lz4:=
dev-java/mvel:0
dev-libs/xxhash:0
>=virtual/jdk-1.8:*
test? ( dev-java/randomized-runner:0 )"
RDEPEND="
app-arch/lz4:=
>=virtual/jre-1.8:*"
PATCHES=( "${FILESDIR}/${P}-fix-load.patch" )
DOCS=( CHANGES.md README.md )
JAVA_AUTOMATIC_MODULE_NAME="org.lz4.java"
JAVA_SRC_DIR=( src/java{,-unsafe} )
JAVA_TEST_GENTOO_CLASSPATH="junit-4 randomized-runner"
JAVA_TEST_RESOURCE_DIRS="src/test-resources"
JAVA_TEST_SRC_DIR="src/test"
src_prepare() {
default
}
src_compile() {
# remove precompiled native libraries
rm -r src/resources || die
# cannot include template 'decompressor.template': file not found.]
cp src/build/source_templates/* . || die
einfo "Code generation"
"$(java-config -J)" \
-Dout.dir="src/java" \
-cp "$(java-pkg_getjars --build-only mvel)" \
org.mvel2.sh.Main \
src/build/gen_sources.mvel \
|| die
java-pkg-simple_src_compile
einfo "Generate headers" # build.xml lines 194-204
ejavac -h build/jni-headers -classpath "target/classes" \
src/java/net/jpountz/xxhash/XXHashJNI.java \
src/java/net/jpountz/lz4/LZ4JNI.java || die
einfo "Generate native library"
# https://devmanual.gentoo.org/ebuild-writing/functions/src_compile/no-build-system
mkdir -p build/objects/src/jni
mkdir -p build/jni/net/jpountz/util/linux/amd64
"$(tc-getCC)" ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} \
$(java-pkg_get-jni-cflags) \
-Ibuild/jni-headers \
-c -o build/objects/src/jni/net_jpountz_lz4_LZ4JNI.o \
src/jni/net_jpountz_lz4_LZ4JNI.c
"$(tc-getCC)" ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} \
$(java-pkg_get-jni-cflags) \
-Ibuild/jni-headers \
-c -o build/objects/src/jni/net_jpountz_xxhash_XXHashJNI.o \
src/jni/net_jpountz_xxhash_XXHashJNI.c
"$(tc-getCC)" ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} \
-shared \
-Wl,-soname,liblz4-java.so \
-o liblz4-java.so \
build/objects/src/jni/net_jpountz_lz4_LZ4JNI.o \
build/objects/src/jni/net_jpountz_xxhash_XXHashJNI.o -llz4 -lxxhash
}
src_install() {
java-pkg-simple_src_install
java-pkg_doso liblz4-java.so
}
|