[experimental] Add native lib for Linux loongarch64 (#526)

* Build on loongarch64

Signed-off-by: Leslie Zhai <zhaixiang@loongson.cn>

* Remove linux-loongarch64 dockcross

* Remove linux-loongarch64 from native-all

---------

Signed-off-by: Leslie Zhai <zhaixiang@loongson.cn>
This commit is contained in:
Leslie Zhai 2023-12-08 05:14:12 +08:00 committed by GitHub
parent a072b39bb3
commit bce1ff6c8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 1 deletions

View File

@ -51,7 +51,7 @@ endif
# os=Default is meant to be generic unix/linux
# To support new CPU architecture, add a new target name here
known_os_archs := Linux-x86 Linux-x86_64 Linux-arm Linux-armv6 Linux-armv7 Linux-android-arm Linux-android-aarch64 Linux-aarch64 Linux-ppc Linux-ppc64 Linux-ppc64le Linux-s390 Linux-s390x Mac-x86 Mac-x86_64 Mac-aarch64 FreeBSD-x86_64 Windows-x86 Windows-x86_64 Windows-aarch64 SunOS-x86 SunOS-sparc SunOS-x86_64 AIX-ppc AIX-ppc64 Linux-riscv Linux-riscv64
known_os_archs := Linux-x86 Linux-x86_64 Linux-arm Linux-armv6 Linux-armv7 Linux-android-arm Linux-android-aarch64 Linux-aarch64 Linux-ppc Linux-ppc64 Linux-ppc64le Linux-s390 Linux-s390x Mac-x86 Mac-x86_64 Mac-aarch64 FreeBSD-x86_64 Windows-x86 Windows-x86_64 Windows-aarch64 SunOS-x86 SunOS-sparc SunOS-x86_64 AIX-ppc AIX-ppc64 Linux-riscv Linux-riscv64 Linux-loongarch Linux-loongarch64
os_arch := $(OS_NAME)-$(OS_ARCH)
IBM_JDK_7 := $(findstring IBM, $(shell $(JAVA) -version 2>&1 | grep IBM | grep "JRE 1.7"))
@ -310,6 +310,20 @@ Windows-aarch64_CXXFLAGS := -Ilib/inc_mac -I$(JAVA_HOME)/include -O2 -fPIC -mar
Windows-aarch64_LINKFLAGS := -Wl,--kill-at -shared -static
Windows-aarch64_LIBNAME := snappyjava.dll
Linux-loongarch_CXX := $(CROSS_PREFIX)g++
Linux-loongarch_STRIP := $(CROSS_PREFIX)strip
Linux-loongarch_CXXFLAGS := -Ilib/inc_linux -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden -std=c++11
Linux-loongarch_LINKFLAGS := -shared
Linux-loongarch_LIBNAME := libsnappyjava.so
Linux-loongarch_SNAPPY_FLAGS:=
Linux-loongarch64_CXX := $(CROSS_PREFIX)g++
Linux-loongarch64_STRIP := $(CROSS_PREFIX)strip
Linux-loongarch64_CXXFLAGS := -Ilib/inc_linux -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden -std=c++11
Linux-loongarch64_LINKFLAGS := -shared
Linux-loongarch64_LIBNAME := libsnappyjava.so
Linux-loongarch64_SNAPPY_FLAGS:=
CXX := $($(os_arch)_CXX)
STRIP := $($(os_arch)_STRIP)

View File

@ -110,6 +110,7 @@ OsgiKeys.additionalHeaders := Map(
"org/xerial/snappy/native/Linux/armv7/libsnappyjava.so;osname=linux;processor=arm_le",
"org/xerial/snappy/native/Linux/ppc64/libsnappyjava.so;osname=linux;processor=ppc64le",
"org/xerial/snappy/native/Linux/s390x/libsnappyjava.so;osname=linux;processor=s390x",
"org/xerial/snappy/native/Linux/loongarch64/libsnappyjava.so;osname=linux;processor=loongarch64",
"org/xerial/snappy/native/AIX/ppc/libsnappyjava.a;osname=aix;processor=ppc",
"org/xerial/snappy/native/AIX/ppc64/libsnappyjava.a;osname=aix;processor=ppc64",
"org/xerial/snappy/native/SunOS/x86/libsnappyjava.so;osname=sunos;processor=x86",

View File

@ -48,6 +48,7 @@ public class OSInfo {
public static final String IBMZ_64 = "s390x";
public static final String AARCH_64 = "aarch64";
public static final String RISCV_64 = "riscv64";
public static final String LOONGARCH_64 = "loongarch64";
static {
// x86 mappings
@ -97,6 +98,9 @@ public class OSInfo {
// RISC-V mappings
archMapping.put(RISCV_64, RISCV_64);
// LoongArch64 mappings
archMapping.put(LOONGARCH_64, LOONGARCH_64);
}
public static void main(String[] args) {