Blame SOURCES/2-remove-cpptasks.patch

96de09
diff --git a/Makefile b/Makefile
96de09
new file mode 100644
96de09
index 0000000..01934f1
96de09
--- /dev/null
96de09
+++ b/Makefile
96de09
@@ -0,0 +1,33 @@
96de09
+CC = gcc
96de09
+
96de09
+BUILD_DIR = build
96de09
+OBJECTS_DIR = $(BUILD_DIR)/objects
96de09
+JNI_HEADERS_DIR = $(BUILD_DIR)/jni-headers
96de09
+JNI_SOURCES_DIR = src/jni
96de09
+INCLUDE = -I $(JAVA_HOME)/include -I $(JAVA_HOME)/include/linux
96de09
+
96de09
+LIBS = -llz4 -lxxhash
96de09
+JNI_PREFIX = net_jpountz_
96de09
+
96de09
+default: all move_objects generate_so
96de09
+
96de09
+all:
96de09
+	$(CC) -fPIC -I $(JNI_HEADERS_DIR) \
96de09
+		$(INCLUDE) \
96de09
+		$(LIBS) \
96de09
+		-c $(JNI_SOURCES_DIR)/$(JNI_PREFIX)lz4_LZ4JNI.c
96de09
+
96de09
+	$(CC) -fPIC  -I $(JNI_HEADERS_DIR) \
96de09
+		$(INCLUDE) \
96de09
+		$(LIBS) \
96de09
+		-c $(JNI_SOURCES_DIR)/$(JNI_PREFIX)xxhash_XXHashJNI.c
96de09
+
96de09
+move_objects:
96de09
+	mv *.o $(OBJECTS_DIR)
96de09
+
96de09
+generate_so:
96de09
+	gcc -fPIC -shared \
96de09
+		$(OBJECTS_DIR)/*.o \
96de09
+		$(LIB_DIR)/liblz4.so \
96de09
+		$(LIB_DIR)/libxxhash.so \
96de09
+		-o $(BUILD_DIR)/jni/net/jpountz/util/$(PLATFORM)/$(ARCH)/liblz4-java.so
96de09
diff --git a/build.xml b/build.xml
96de09
index 1d4cff5..13d8ce3 100644
96de09
--- a/build.xml
96de09
+++ b/build.xml
96de09
@@ -13,7 +13,6 @@
96de09
 -->
96de09
 
96de09
 
96de09
-    xmlns:cpptasks="antlib:net.sf.antcontrib.cpptasks"
96de09
     xmlns:ivy="antlib:org.apache.ivy.ant"
96de09
     xmlns:junit4="antlib:com.carrotsearch.junit4"
96de09
     xmlns:mvn="antlib:org.apache.maven.artifact.ant">
96de09
@@ -78,13 +77,6 @@
96de09
     <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}"/>
96de09
   </target>
96de09
 
96de09
-  <target name="install-cpptasks" unless="cpptasks.available">
96de09
-    
96de09
-      inline="true" conf="default" transitive="true" pathid="cpptasks.classpath"/>
96de09
-    <taskdef uri="antlib:net.sf.antcontrib.cpptasks" resource="net/sf/antcontrib/cpptasks/antlib.xml" classpathref="cpptasks.classpath"/>
96de09
-    <property name="cpptasks.available" value="true"/>
96de09
-  </target>
96de09
-
96de09
   <target name="install-maven-ant-tasks" unless="maven-ant-tasks.available">
96de09
     
96de09
       inline="true" conf="default" transitive="true" pathid="maven-ant-tasks.classpath"/>
96de09
@@ -184,27 +176,13 @@
96de09
     </javah>
96de09
   </target>
96de09
 
96de09
-  <target name="compile-jni" depends="install-cpptasks,generate-headers" unless="${skip.jni}">
96de09
+  <target name="compile-jni" depends="generate-headers" unless="${skip.jni}">
96de09
     <mkdir dir="${build}/objects" />
96de09
     <mkdir dir="${build}/jni/net/jpountz/util/${platform}/${os.arch}" />
96de09
-    
96de09
-      debug="false"
96de09
-      optimize="extreme"
96de09
-      objdir="${build}/objects"
96de09
-      outfile="${build}/jni/net/jpountz/util/${platform}/${os.arch}/lz4-java"
96de09
-      outtype="shared">
96de09
-      <includepath path="${src}/lz4/lib" />
96de09
-      <includepath path="${java.home}/../include" />
96de09
-      <includepath path="${java.home}/../include/${platform}/" />
96de09
-      
96de09
-      <includepath path="${java.home}/include" />
96de09
-      <includepath path="${java.home}/include/${platform}/" />
96de09
-      <includepath path="${build}/jni-headers" />
96de09
-      <fileset dir="${src}/lz4/lib" includes="lz4.c, lz4hc.c, xxhash.c" />
96de09
-      <fileset dir="${src}/jni" includes="*.c" />
96de09
-      <linker />
96de09
-      <compilerarg value="-mmacosx-version-min=10.9" if="isMacOS"/>
96de09
-    </cpptasks:cc>
96de09
+    <exec executable="make" failonerror="true">
96de09
+        <env key="ARCH" value="${os.arch}"/>
96de09
+        <env key="PLATFORM" value="${platform}"/>
96de09
+    </exec>
96de09
   </target>
96de09
 
96de09
   <target name="compile" depends="compile-java, compile-jni" />