Skip to content

Commit cef2d76

Browse files
committed
Add win32-aarch64 to build.xml
1 parent 36a70d0 commit cef2d76

5 files changed

Lines changed: 29 additions & 5 deletions

File tree

build.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,8 @@ com/sun/jna/win32-x86/jnidispatch.dll;
465465
processor=x86;osname=win,
466466
com/sun/jna/win32-x86-64/jnidispatch.dll;
467467
processor=x86-64;osname=win,
468+
com/sun/jna/win32-aarch64/jnidispatch.dll;
469+
processor=aarch64;osname=win,
468470
com/sun/jna/w32ce-arm/jnidispatch.dll;
469471
processor=arm;osname=wince,
470472
@@ -627,6 +629,9 @@ osname=macosx;processor=x86;processor=x86-64;processor=ppc
627629
<zipfileset src="${lib.native}/win32-x86-64.jar"
628630
includes="*jnidispatch*"
629631
prefix="com/sun/jna/win32-x86-64"/>
632+
<zipfileset src="${lib.native}/win32-aarch64.jar"
633+
includes="*jnidispatch*"
634+
prefix="com/sun/jna/win32-aarch64"/>
630635
<zipfileset src="${lib.native}/w32ce-arm.jar"
631636
includes="*jnidispatch*"
632637
prefix="com/sun/jna/w32ce-arm"/>
@@ -784,6 +789,7 @@ osname=macosx;processor=x86;processor=x86-64;processor=ppc
784789
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/darwin.jar" overwrite="true"/>
785790
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/win32-x86.jar" overwrite="true"/>
786791
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/win32-x86-64.jar" overwrite="true"/>
792+
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/win32-aarch64.jar" overwrite="true"/>
787793
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/w32ce-arm.jar" overwrite="true"/>
788794
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/linux-x86.jar" overwrite="true"/>
789795
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/linux-x86-64.jar" overwrite="true"/>
@@ -876,7 +882,7 @@ osname=macosx;processor=x86;processor=x86-64;processor=ppc
876882
<equals arg1="${os.prefix}" arg2="android-armv7"/>
877883
</condition>
878884
<condition property="ARCH" value="aarch64">
879-
<equals arg1="${os.prefix}" arg2="android-aarch64"/>
885+
<matches string="${os.prefix}" pattern="-aarch64$"/>
880886
</condition>
881887
<condition property="ARCH" value="x86">
882888
<equals arg1="${os.prefix}" arg2="android-x86"/>

lib/native/win32-aarch64.jar

92.6 KB
Binary file not shown.

native/Makefile

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,12 @@ WINDRES=$(MINGW_PREFIX)windres
232232
MINGW=$(MINGW_PREFIX)gcc
233233

234234
ifeq ($(USE_MSVC),true)
235+
ifeq ($(ARCH),aarch64)
236+
# Force $(CC) fallback; avoid arch mismatch
237+
WINDRES=false
238+
# Disable mingw; no aarch64 support
239+
MINGW=
240+
endif
235241
# MS compiler
236242
CC=$(FFI_SRC)/msvcc.sh
237243
CDEFINES+=-DHAVE_PROTECTION
@@ -246,8 +252,15 @@ LIBS=psapi.lib
246252
ARSFX=.lib
247253
ifeq ($(ARCH),amd64)
248254
CC+= -m64
249-
endif
250-
FFI_CONFIG+= && rm -f include/ffitarget.h && cp $(FFI_SRC)/include/*.h $(FFI_SRC)/src/x86/ffitarget.h include
255+
FFI_TARGET=$(FFI_SRC)/src/x86/ffitarget.h
256+
else ifeq ($(ARCH),aarch64)
257+
CC+= -marm64
258+
FFI_CONFIG+=--host=aarch64-cygwin
259+
# Disable ASMFN for aarch64, don't bulid dll-callback.o
260+
DLLCB=$(BUILD)/callback.o
261+
endif
262+
FFI_TARGET?=$(FFI_SRC)/src/$(ARCH)/ffitarget.h
263+
FFI_CONFIG+= && rm -f include/ffitarget.h && cp $(FFI_SRC)/include/*.h $(FFI_TARGET) include
251264
FFI_ENV+=LD="$(LD)" CPP="$(CPP)" CXXCPP="$(CPP)"
252265
EXTRAOBJS+=$(DLLCB)
253266

@@ -452,6 +465,10 @@ install:
452465
ifeq ($(ARCH), amd64)
453466
$(DLLCB): dll-callback.c
454467
$(MINGW) -DDEFINE_CALLBACKS -c $< $(COUT)
468+
else ifeq ($(ARCH), aarch64)
469+
# Build without ASMFN support
470+
$(DLLCB): callback.c
471+
$(CC) -DDEFINE_CALLBACKS -DASMFN_OFF $(CINCLUDES) $(CDEFINES) -c $< $(COUT)
455472
endif
456473

457474
$(RSRC): $(BUILD)/jnidispatch.rc $(BUILD)/$(JNA_JNI_VERSION).stamp

native/callback.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
extern "C" {
5252
#endif
5353

54-
#if defined(_WIN32) && !defined(_WIN32_WCE)
54+
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(ASMFN_OFF)
5555
#include "com_sun_jna_win32_DLLCallback.h"
5656
#ifdef _WIN64
5757
#ifdef _MSC_VER

src/com/sun/jna/Platform.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,9 @@ else if (osName.equalsIgnoreCase("netbsd")) {
129129
RO_FIELDS = osType != WINDOWSCE;
130130
C_LIBRARY_NAME = osType == WINDOWS ? "msvcrt" : osType == WINDOWSCE ? "coredll" : "c";
131131
MATH_LIBRARY_NAME = osType == WINDOWS ? "msvcrt" : osType == WINDOWSCE ? "coredll" : "m";
132-
HAS_DLL_CALLBACKS = osType == WINDOWS;
133132
ARCH = getCanonicalArchitecture(System.getProperty("os.arch"), osType);
133+
// Windows aarch64 callbacks disabled via ASMFN_OFF (no mingw support)
134+
HAS_DLL_CALLBACKS = osType == WINDOWS && !ARCH.startsWith("aarch");
134135
RESOURCE_PREFIX = getNativeLibraryResourcePrefix();
135136
}
136137
private Platform() { }

0 commit comments

Comments
 (0)