Files
lz4-java/0003-remove-cpptasks.patch

101 lines
3.8 KiB
Diff

From 0dcab6e609e74be2137d4b85672d677c53cdc05f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch>
Date: Mon, 18 Sep 2023 18:04:41 +0200
Subject: [PATCH 3/5] remove-cpptasks
---
Makefile | 21 +++++++++++++++++++++
build.xml | 32 +++++---------------------------
2 files changed, 26 insertions(+), 27 deletions(-)
create mode 100644 Makefile
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..6f3be41
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,21 @@
+CC = gcc
+
+BUILD_DIR = build
+OBJ_DIR = $(BUILD_DIR)/objects
+OUT_FILE = $(BUILD_DIR)/jni/net/jpountz/util/$(PLATFORM)/$(ARCH)/liblz4-java.so
+JNI_HEADERS_DIR = $(BUILD_DIR)/jni-headers
+JNI_SOURCES_DIR = src/jni
+INCLUDE = -I src/lz4/lib -I $(JAVA_HOME)/include -I $(JAVA_HOME)/include/linux -I $(JNI_HEADERS_DIR)
+
+JNI_PREFIX = net_jpountz_
+
+default: all
+
+all:
+ $(CC) -fPIC -shared -I $(JNI_HEADERS_DIR) \
+ $(INCLUDE) \
+ -o $(BUILD_DIR)/jni/net/jpountz/util/$(PLATFORM)/$(ARCH)/liblz4-java.so \
+ $(JNI_SOURCES_DIR)/$(JNI_PREFIX)lz4_LZ4JNI.c \
+ $(JNI_SOURCES_DIR)/$(JNI_PREFIX)xxhash_XXHashJNI.c \
+ src/lz4/lib/lz4.c src/lz4/lib/lz4hc.c src/lz4/lib/xxhash.c
+
diff --git a/build.xml b/build.xml
index b8e5096..ceae5dd 100644
--- a/build.xml
+++ b/build.xml
@@ -15,7 +15,6 @@
-->
<project name="lz4" default="dist" basedir="."
- xmlns:cpptasks="antlib:net.sf.antcontrib.cpptasks"
xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:junit4="antlib:com.carrotsearch.junit4"
xmlns:mvn="antlib:org.apache.maven.artifact.ant">
@@ -80,13 +79,6 @@
<get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.jar.version}/${ivy.jar.name}" dest="${user.home}/.ant/lib/${ivy.jar.name}"/>
</target>
- <target name="install-cpptasks" unless="cpptasks.available">
- <ivy:cachepath organisation="ant-contrib" module="cpptasks" revision="1.0b5"
- inline="true" conf="default" transitive="true" pathid="cpptasks.classpath"/>
- <taskdef uri="antlib:net.sf.antcontrib.cpptasks" resource="net/sf/antcontrib/cpptasks/antlib.xml" classpathref="cpptasks.classpath"/>
- <property name="cpptasks.available" value="true"/>
- </target>
-
<target name="install-maven-ant-tasks" unless="maven-ant-tasks.available">
<ivy:cachepath organisation="org.apache.maven" module="maven-ant-tasks" revision="2.1.3"
inline="true" conf="default" transitive="true" pathid="maven-ant-tasks.classpath"/>
@@ -192,27 +184,13 @@
</javah>
</target>
- <target name="compile-jni" depends="install-cpptasks,generate-headers" unless="${skip.jni}">
+ <target name="compile-jni" depends="generate-headers" unless="${skip.jni}">
<mkdir dir="${build}/objects" />
<mkdir dir="${build}/jni/net/jpountz/util/${platform}/${os.arch}" />
- <cpptasks:cc
- debug="false"
- optimize="extreme"
- objdir="${build}/objects"
- outfile="${build}/jni/net/jpountz/util/${platform}/${os.arch}/lz4-java"
- outtype="shared">
- <includepath path="${src}/lz4/lib" />
- <includepath path="${java.home}/../include" />
- <includepath path="${java.home}/../include/${platform}/" />
- <!-- In Java 9, java.home points not to jre/ but to the top directory -->
- <includepath path="${java.home}/include" />
- <includepath path="${java.home}/include/${platform}/" />
- <includepath path="${build}/jni-headers" />
- <fileset dir="${src}/lz4/lib" includes="lz4.c, lz4hc.c, xxhash.c" />
- <fileset dir="${src}/jni" includes="*.c" />
- <linker />
- <compilerarg value="-mmacosx-version-min=10.9" if="isMacOS"/>
- </cpptasks:cc>
+ <exec executable="make" failonerror="true">
+ <env key="ARCH" value="${os.arch}"/>
+ <env key="PLATFORM" value="${platform}"/>
+ </exec>
</target>
<target name="compile" depends="compile-java, compile-jni" />
--
2.42.0