diff --git a/CHANGES.md b/CHANGES.md index 84f7cd21ad..b38caf0e59 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -45,6 +45,7 @@ Features * [#422](https://github.com/twall/jna/pull/422): Update libffi to v3.2.1 - [@tdaitx](https://github.com/tdaitx). * [#425](https://github.com/twall/jna/pull/425): Add support for PPCLE - [@tdaitx](https://github.com/tdaix). * [#428](https://github.com/twall/jna/pull/428): Added Wincon.h related functions and definitions to `com.sun.jna.platform.win32.Kernel32` - [@lgoldstein](https://github.com/lgoldstein). +* [#430](https://github.com/twall/jna/issues/430): Add android `aarch64`, `x86-64`, `mips`, and `mips64` targets - [@twall](https://github.com/twall). * [#431](https://github.com/twall/jna/pull/431): Added named pipe API support to `com.sun.jna.platform.win32.Kernel32` - [@lgoldstein](https://github.com/lgoldstein). * [#432](https://github.com/twall/jna/pull/432): Added SetLocalTime definition to 'com.sun.jna.platform.win32.Kernel32' - [@lgoldstein](https://github.com/lgoldstein). * [#434](https://github.com/twall/jna/pull/434): Added GetEnvironmentStrings to 'com.sun.jna.platform.win32.Kernel32' - [@lgoldstein](https://github.com/lgoldstein). diff --git a/build.xml b/build.xml index b426dde35f..e834ffd796 100644 --- a/build.xml +++ b/build.xml @@ -10,7 +10,7 @@ Cross-compile by specifying -Dos.prefix={name-arch} to ant (cross-compile currently only configured/tested on w32ce-arm and - android-arm/-x86) + android-{arm|aarch64|x86|x86-64|mips|mips64}) Use ANT_OPTS=-Dskip-native=false to build native parts, or directly invoke the native or test targets @@ -174,8 +174,12 @@ - - + + + + + + @@ -611,7 +615,11 @@ osname=macosx;processor=x86;processor=x86-64;processor=ppc + + + + @@ -670,10 +678,7 @@ osname=macosx;processor=x86;processor=x86-64;processor=ppc - - - - + @@ -683,9 +688,21 @@ osname=macosx;processor=x86;processor=x86-64;processor=ppc + + + + + + + + + + + + diff --git a/lib/native/android-aarch64.jar b/lib/native/android-aarch64.jar new file mode 100644 index 0000000000..09f856fb4d Binary files /dev/null and b/lib/native/android-aarch64.jar differ diff --git a/lib/native/android-arm.jar b/lib/native/android-arm.jar index 043f0302d5..5ec045f2d7 100755 Binary files a/lib/native/android-arm.jar and b/lib/native/android-arm.jar differ diff --git a/lib/native/android-mips.jar b/lib/native/android-mips.jar new file mode 100644 index 0000000000..9f61517140 Binary files /dev/null and b/lib/native/android-mips.jar differ diff --git a/lib/native/android-mips64.jar b/lib/native/android-mips64.jar new file mode 100644 index 0000000000..7098eb900a Binary files /dev/null and b/lib/native/android-mips64.jar differ diff --git a/lib/native/android-x86-64.jar b/lib/native/android-x86-64.jar new file mode 100644 index 0000000000..450544c80b Binary files /dev/null and b/lib/native/android-x86-64.jar differ diff --git a/lib/native/android-x86.jar b/lib/native/android-x86.jar index b1ac1c4c25..64a86cdf63 100755 Binary files a/lib/native/android-x86.jar and b/lib/native/android-x86.jar differ diff --git a/native/Makefile b/native/Makefile index 5215f0aed3..5acfa254d2 100644 --- a/native/Makefile +++ b/native/Makefile @@ -16,7 +16,7 @@ # Solaris (i386/amd64/sparc/sparcv9) # AIX (ppc/ppc64) # FreeBSD/OpenBSD/NetBSD (i386/amd64) -# Android (arm/x86) +# Android (arm/aarch64/x86/x86-64/mipsel/mips64el) # # Built, but with outstanding bugs (not necessarily within JNA): # @@ -28,7 +28,7 @@ # # The android build requires the android SDK+NDK for cross-compilation; # make the tools available on the path and compile with -# "ant -Dos.prefix=android-arm(-x86)". Put the NDK tools in the path and adjust +# "ant -Dos.prefix=android-{arm|x86}". Put the NDK tools in the path and adjust # NDK_PLATFORM below or set it in your environment. # # The windows build requires a cygwin installation. The build will use MSVC @@ -114,26 +114,52 @@ STRIP=strip -x # Android build (cross-compile) requires the android SDK+NDK. # Ensure the following tools are in your path and adjust NDK_PLATFORM as needed ifeq ($(OS),android) +AARCH=$(ARCH) +ALIBDIR=/usr/lib ifeq ($(ARCH),arm) PREFIX=arm-linux-androideabi- COPT+= -mthumb-interwork -march=armv5te -mtune=xscale -msoft-float -fstack-protector HOST=arm-linux-eabi -else -PREFIX=i686-android-linux- +else ifeq ($(ARCH),aarch64) +PREFIX=aarch64-linux-android- +HOST=aarch64-linux-android +AARCH=arm64 +ALIBDIR=/usr/lib64 +else ifeq ($(ARCH),x86) +PREFIX=i686-linux-android- COPT+= -march=i686 -HOST=i686-linux +HOST=i686-linux-android +else ifeq ($(ARCH),x86-64) +PREFIX=x86_64-linux-android- +COPT+= -m64 +HOST=x86_64-linux-android +AARCH=x86_64 +ALIBDIR=/usr/lib64 +else ifeq ($(ARCH),mips) +PREFIX=mipsel-linux-android- +HOST=mipsel-linux-android +COPT+= +else ifeq ($(ARCH),mips64) +PREFIX=mips64el-linux-android- +HOST=mips64el-linux-android +COPT+= +ALIBDIR=/usr/lib64 +else +ERROR = $(error "Unsupported android architecture '$(ARCH)'") endif -CC=$(PREFIX)gcc +NDK?=/Developer/Applications/android-ndk-r10e +NDK_PLATFORM?=$(NDK)/platforms/android-21 +SYSROOT=$(NDK_PLATFORM)/arch-$(AARCH) +CC=$(PREFIX)gcc --sysroot $(SYSROOT) CPP=$(PREFIX)cpp -LD=$(PREFIX)gcc +LD=$(CC) RANLIB=$(PREFIX)ranlib STRIP=$(PREFIX)strip -x CDEFINES=-DNO_JAWT -DNO_WEAK_GLOBALS -DFFI_MMAP_EXEC_WRIT=1 -DFFI_MMAP_EXEC_SELINUX=0 COPT+=-fpic -ffunction-sections -funwind-tables -fno-short-enums -NDK_PLATFORM?=/Developer/Applications/android-ndk-r7c/platforms/android-14 JAVA_INCLUDES= -CINCLUDES+=-I"$(NDK_PLATFORM)/arch-$(ARCH)/usr/include" # -I/usr/include -LIBS=-nostdlib -L"$(NDK_PLATFORM)/arch-$(ARCH)/usr/lib/" -lgcc -lc -ldl -lm +CINCLUDES+=-I"$(NDK_PLATFORM)/arch-$(AARCH)/usr/include" # -I/usr/include +LIBS=-nostdlib -L"$(NDK_PLATFORM)/arch-$(AARCH)$(ALIBDIR)/" -lgcc -lc -ldl -lm LDFLAGS+=-Wl,-shared,-Bsymbolic FFI_ENV=CPP="$(CPP)" CC="$(CC)" CFLAGS="$(COPT) $(CDEBUG) $(CINCLUDES)" CPPFLAGS="$(CDEFINES) $(CINCLUDES)" LIBS="$(LIBS)" RANLIB="$(RANLIB)" FFI_CONFIG=--enable-static --disable-shared --with-pic=yes --host=$(HOST)