Skip to content

Commit

Permalink
Code cleanup, initial win32-aarch64.jar
Browse files Browse the repository at this point in the history
  • Loading branch information
tresf committed Nov 11, 2020
1 parent 2113f71 commit c4f11b0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 26 deletions.
12 changes: 6 additions & 6 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,8 @@ com/sun/jna/win32-x86/jnidispatch.dll;
processor=x86;osname=win,
com/sun/jna/win32-x86-64/jnidispatch.dll;
processor=x86-64;osname=win,
com/sun/jna/win32-arm64/jnidispatch.dll;
processor=arm64;osname=win,
com/sun/jna/win32-aarch64/jnidispatch.dll;
processor=aarch64;osname=win,
com/sun/jna/w32ce-arm/jnidispatch.dll;
processor=arm;osname=wince,
Expand Down Expand Up @@ -629,9 +629,9 @@ osname=macosx;processor=x86;processor=x86-64;processor=ppc
<zipfileset src="${lib.native}/win32-x86-64.jar"
includes="*jnidispatch*"
prefix="com/sun/jna/win32-x86-64"/>
<zipfileset src="${lib.native}/win32-arm64.jar"
<zipfileset src="${lib.native}/win32-aarch64.jar"
includes="*jnidispatch*"
prefix="com/sun/jna/win32-arm64"/>
prefix="com/sun/jna/win32-aarch64"/>
<zipfileset src="${lib.native}/w32ce-arm.jar"
includes="*jnidispatch*"
prefix="com/sun/jna/w32ce-arm"/>
Expand Down Expand Up @@ -789,7 +789,7 @@ osname=macosx;processor=x86;processor=x86-64;processor=ppc
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/darwin.jar" overwrite="true"/>
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/win32-x86.jar" overwrite="true"/>
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/win32-x86-64.jar" overwrite="true"/>
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/win32-arm64.jar" overwrite="true"/>
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/win32-aarch64.jar" overwrite="true"/>
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/w32ce-arm.jar" overwrite="true"/>
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/linux-x86.jar" overwrite="true"/>
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/linux-x86-64.jar" overwrite="true"/>
Expand Down Expand Up @@ -882,7 +882,7 @@ osname=macosx;processor=x86;processor=x86-64;processor=ppc
<equals arg1="${os.prefix}" arg2="android-armv7"/>
</condition>
<condition property="ARCH" value="aarch64">
<equals arg1="${os.prefix}" arg2="android-aarch64"/>
<matches string="${os.prefix}" pattern="-aarch64$"/>
</condition>
<condition property="ARCH" value="x86">
<equals arg1="${os.prefix}" arg2="android-x86"/>
Expand Down
Binary file added lib/native/win32-aarch64.jar
Binary file not shown.
40 changes: 21 additions & 19 deletions native/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,9 @@ JAVA_INCLUDES=-I"$(JAVA_HOME)/include" \
BUILD=../build/native
JAVAH=$(BUILD)
INSTALLDIR=../build/$(OS)
##fixme!!
JNIDISPATCH_OBJS=$(BUILD)/dispatch.o $(EXTRAOBJS)
#JNIDISPATCH_OBJS=$(BUILD)/dispatch.o $(BUILD)/callback.o $(EXTRAOBJS)
JNIDISPATCH_OBJS=$(BUILD)/dispatch.o $(BUILD)/callback.o $(EXTRAOBJS)
RSRC=$(BUILD)/rsrc.o
DLLCB=$(BUILD)/dll-callback.o
FAUXCB=$(BUILD)/callback.o
ifneq ($(DYNAMIC_LIBFFI),true)
FFI_SRC=$(shell pwd)/libffi
FFI_BUILD=$(BUILD)/libffi
Expand Down Expand Up @@ -231,12 +228,16 @@ FFI_CONFIG+=--host=i686-w64-mingw32
MINGW_PREFIX?=i686-w64-mingw32-
endif
# Need windres from mingw distribution, even if building with MSVC
#### disable windres for arm64
#WINDRES=$(MINGW_PREFIX)windres
WINDRES=false
WINDRES=$(MINGW_PREFIX)windres
MINGW=$(MINGW_PREFIX)gcc

ifeq ($(USE_MSVC),true)
ifeq ($(ARCH),aarch64)
# Force $(CC) fallback; avoid arch mismatch
WINDRES=false
# Disable mingw; no aarch64 support
MINGW=
endif
# MS compiler
CC=$(FFI_SRC)/msvcc.sh
CDEFINES+=-DHAVE_PROTECTION
Expand All @@ -250,17 +251,18 @@ LDFLAGS=/DLL /OUT:$@
LIBS=psapi.lib
ARSFX=.lib
ifeq ($(ARCH),amd64)
#fixme!!!!
#CC+= =m64
CC+= -m64
FFI_TARGET=$(FFI_SRC)/src/x86/ffitarget.h
else ifeq ($(ARCH),aarch64)
CC+= -marm64
endif
#fixme!!!!
FFI_CONFIG+=--host=aarch64-cygwin
#FFI_CONFIG+= && rm -f include/ffitarget.h && cp $(FFI_SRC)/include/*.h $(FFI_SRC)/src/x86/ffitarget.h include
FFI_CONFIG+= && rm -f include/ffitarget.h && cp $(FFI_SRC)/include/*.h $(FFI_SRC)/src/aarch64/ffitarget.h include
# Disable ASMFN for aarch64, don't bulid dll-callback.o
DLLCB=$(BUILD)/callback.o
endif
FFI_TARGET?=$(FFI_SRC)/src/$(ARCH)/ffitarget.h
FFI_CONFIG+= && rm -f include/ffitarget.h && cp $(FFI_SRC)/include/*.h $(FFI_TARGET) include
FFI_ENV+=LD="$(LD)" CPP="$(CPP)" CXXCPP="$(CPP)"
#fixme!!
EXTRAOBJS+=$(FAUXCB)
EXTRAOBJS+=$(DLLCB)

else
# Mingw compiler
Expand Down Expand Up @@ -460,13 +462,13 @@ install:
mkdir $(INSTALLDIR)
cp $(LIBRARY) $(INSTALLDIR)

# fixme!!
ifeq ($(ARCH), amd64)
$(DLLCB): dll-callback.c
$(MINGW) -DDEFINE_CALLBACKS -c $< $(COUT)
$(FAUXCB): callback.c
# TODO: Fix: Lazily and incorrectly set WINCE flag to avoid dll-callback support
$(CC) -DDEFINE_CALLBACKS -D_WIN32_WCE $(CINCLUDES) -c $< $(COUT)
else ifeq ($(ARCH), aarch64)
# Build without ASMFN support
$(DLLCB): callback.c
$(CC) -DDEFINE_CALLBACKS -DASMFN_OFF $(CINCLUDES) -c $< $(COUT)
endif

$(RSRC): $(BUILD)/jnidispatch.rc $(BUILD)/$(JNA_JNI_VERSION).stamp
Expand Down
2 changes: 1 addition & 1 deletion native/callback.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
extern "C" {
#endif

#if defined(_WIN32) && !defined(_WIN32_WCE)
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(ASMFN_OFF)
#include "com_sun_jna_win32_DLLCallback.h"
#ifdef _WIN64
#ifdef _MSC_VER
Expand Down

0 comments on commit c4f11b0

Please sign in to comment.