Skip to content

Commit

Permalink
dev-java/lz4-java: switch to newer mvel:2.5 - W I P
Browse files Browse the repository at this point in the history
- uses java-pkg-simple.eclass instead of java-ant-2.eclass
- Java code generation with mvel translated to ebuild
- compiled java classes are complete, no differences

- headers created using ejavac -h, should be checked
- shared object file created with gcc. should also be checked
  https://github.com/lz4/lz4-java/blob/1.8.0/build.xml#L206-L227

- Tests to be completed
- Shared object file to be compared with upstream.

Bug: https://bugs.gentoo.org/916973
Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
  • Loading branch information
vaukai committed Nov 8, 2023
1 parent f40170e commit 92e3326
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions dev-java/lz4-java/lz4-java-1.8.0-r2.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Copyright 2023 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:1.8.0"
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"

DEPEND="
dev-java/mvel:2.5
>=virtual/jdk-1.8:*
test? ( dev-java/randomized-runner:0 )"
RDEPEND=">=virtual/jre-1.8:*"

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_compile() {
# remove precompiled native libraries
rm -r src/resources || die

# cannot include template 'decompressor.template': file not found.]
cp src/build/source_templates/* . || die

"$(java-config -J)" \
-Dout.dir="src/java" \
-cp "$(java-pkg_getjars --build-only mvel-2.5)" \
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"
mkdir -p build/objects/src/jni
mkdir -p build/jni/net/jpountz/util/linux/amd64
"$(tc-getCC)" -fPIC -march=native -O2 -pipe -frecord-gcc-switches \
-I$(java-config -O)/../include -I$(java-config -O)/../include/linux \
-I$(java-config -O)/include -I$(java-config -O)/include/linux \
-Ibuild/jni-headers \
-o build/objects/src/jni/net_jpountz_lz4_LZ4JNI.o \
src/jni/net_jpountz_lz4_LZ4JNI.c
"$(tc-getCC)" -fPIC -march=native -O2 -pipe -frecord-gcc-switches \
-I$(java-config -O)/../include -I$(java-config -O)/../include/linux \
-I$(java-config -O)/include -I$(java-config -O)/include/linux \
-Ibuild/jni-headers \
-o build/objects/src/jni/net_jpountz_xxhash_XXHashJNI.o \
src/jni/net_jpountz_xxhash_XXHashJNI.c

"$(tc-getCC)" -shared -o liblz4-java.so \
build/objects/src/jni/net_jpountz_lz4_LZ4JNI.o \
build/objects/src/jni/net_jpountz_xxhash_XXHashJNI.o

# Still need to check the resulting "liblz4-java.so"
}

0 comments on commit 92e3326

Please sign in to comment.