aboutsummaryrefslogtreecommitdiffstats
path: root/community/java-snappy/add-linux-aarch64-support.patch
blob: 63b92f5694828e31ad13635910c9f0e455d57216 (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
From cfb114f92f720ab13966eef71f11644ba9dfa5d3 Mon Sep 17 00:00:00 2001
From: "Santiago M. Mola" <santi@mola.io>
Date: Mon, 7 Mar 2016 21:03:54 +0100
Subject: [PATCH] Add Linux aarch64 support.

diff --git a/Makefile.common b/Makefile.common
index e152b68..d198b1f 100755
--- a/Makefile.common
+++ b/Makefile.common
@@ -42,7 +42,7 @@ endif
 
 # os=Default is meant to be generic unix/linux
 
-known_os_archs := Linux-x86 Linux-x86_64 Linux-arm Linux-armhf Linux-ppc Linux-ppc64 Linux-s390 Linux-s390x Mac-x86 Mac-x86_64 FreeBSD-x86_64 Windows-x86 Windows-x86_64 SunOS-x86 SunOS-sparc SunOS-x86_64 AIX-ppc AIX-ppc64
+known_os_archs := Linux-x86 Linux-x86_64 Linux-arm Linux-armhf Linux-aarch64 Linux-ppc Linux-ppc64 Linux-s390 Linux-s390x Mac-x86 Mac-x86_64 FreeBSD-x86_64 Windows-x86 Windows-x86_64 SunOS-x86 SunOS-sparc SunOS-x86_64 AIX-ppc AIX-ppc64
 os_arch := $(OS_NAME)-$(OS_ARCH)
 IBM_JDK_7 := $(findstring IBM, $(shell $(JAVA) -version 2>&1 | grep IBM | grep "JRE 1.7"))
 
@@ -200,6 +200,13 @@ Linux-armhf_LINKFLAGS := -shared -static-libgcc
 Linux-armhf_LIBNAME   := libsnappyjava.so
 Linux-armhf_SNAPPY_FLAGS:= 
 
+Linux-aarch64_CXX       := $(CROSS_PREFIX)g++
+Linux-aarch64_STRIP     := $(CROSS_PREFIX)strip
+Linux-aarch64_CXXFLAGS  := -include lib/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden
+Linux-aarch64_LINKFLAGS := -shared -static-libgcc
+Linux-aarch64_LIBNAME   := libsnappyjava.so
+Linux-aarch64_SNAPPY_FLAGS:=
+
 Mac-x86_CXX       := g++ -arch i386
 Mac-x86_STRIP     := strip -x
 Mac-x86_CXXFLAGS  := -Ilib/inc_mac -I$(JAVA_HOME)/include -O2 -fPIC -mmacosx-version-min=10.4 -fvisibility=hidden
diff --git a/README.md b/README.md
index 89b40ec..977af0d 100755
--- a/README.md
+++ b/README.md
@@ -146,7 +146,7 @@ Older snapshots of snappy contain a buggy config.h.in that does not work properl
 ## Cross-compiling for other platforms
 The Makefile contains rules for cross-compiling the native library for other platforms so that the snappy-java JAR can support multiple platforms. For example, to build the native libraries for x86 Linux, x86 and x86-64 Windows, and soft- and hard-float ARM:
 
-    $ make linux32 win32 win64 linux-arm linux-armhf
+    $ make linux32 win32 win64 linux-arm linux-armhf linux-aarch64
 
 If you append `snappy` to the line above, it will also build the native library for the current platform and then build the snappy-java JAR (containing all native libraries built so far).
 
@@ -157,6 +157,7 @@ Of course, you must first have the necessary cross-compilers and development lib
   * win64: `sudo apt-get install g++-mingw-w64-x86-64`
   * arm: `sudo apt-get install g++-arm-linux-gnueabi`
   * armhf: `sudo apt-get install g++-arm-linux-gnueabihf`
+  * aarch64: `sudo apt-get install g++-aarch64-linux`
 
 Unfortunately, cross-compiling for Mac OS X is not currently possible; you must compile within OS X.
 
diff --git a/src/main/java/org/xerial/snappy/OSInfo.java b/src/main/java/org/xerial/snappy/OSInfo.java
index ff366fa..cf6b0bc 100755
--- a/src/main/java/org/xerial/snappy/OSInfo.java
+++ b/src/main/java/org/xerial/snappy/OSInfo.java
@@ -45,6 +45,7 @@
     public static final String PPC64 = "ppc64";
     public static final String IBMZ = "s390";
     public static final String IBMZ_64 = "s390x";
+    public static final String AARCH_64 = "aarch64";
 
     static {
         // x86 mappings
@@ -88,6 +89,9 @@
 
         // IBM z 64-bit mappings
         archMapping.put(IBMZ_64, IBMZ_64);
+
+        // Aarch64 mappings
+        archMapping.put(AARCH_64, AARCH_64);
     }
 
     public static void main(String[] args)