Skip to content

Commit eda004a

Browse files
Merge pull request #1581 from matthiasblaesing/pr-1578
Add support for FreeBSD aarch64 (it's now a Tier 1 arch).
2 parents dc50d9f + c715412 commit eda004a

File tree

5 files changed

+69
-1
lines changed

5 files changed

+69
-1
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Next Release (5.15.0)
77

88
Features
99
--------
10+
* [#1578](https://github.com/java-native-access/jna/pull/1578): Add support for FreeBSD aarch64 - [@alexdupre](https://github.com/alexdupre).
1011

1112
Bug Fixes
1213
---------

build.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,8 @@ com/sun/jna/freebsd-x86/libjnidispatch.so;
401401
processor=x86;osname=freebsd,
402402
com/sun/jna/freebsd-x86-64/libjnidispatch.so;
403403
processor=x86-64;osname=freebsd,
404+
com/sun/jna/freebsd-aarch64/libjnidispatch.so;
405+
processor=aarch64;osname=freebsd,
404406
405407
com/sun/jna/openbsd-x86/libjnidispatch.so;
406408
processor=x86;osname=openbsd,
@@ -532,6 +534,9 @@ osname=macosx;processor=aarch64
532534
<zipfileset src="${lib.native}/freebsd-x86-64.jar"
533535
includes="*jnidispatch*"
534536
prefix="com/sun/jna/freebsd-x86-64"/>
537+
<zipfileset src="${lib.native}/freebsd-aarch64.jar"
538+
includes="*jnidispatch*"
539+
prefix="com/sun/jna/freebsd-aarch64"/>
535540
<zipfileset src="${lib.native}/openbsd-x86.jar"
536541
includes="*jnidispatch*"
537542
prefix="com/sun/jna/openbsd-x86"/>
@@ -720,6 +725,7 @@ osname=macosx;processor=aarch64
720725
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/linux-riscv64.jar" overwrite="true"/>
721726
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/freebsd-x86.jar" overwrite="true"/>
722727
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/freebsd-x86-64.jar" overwrite="true"/>
728+
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/freebsd-aarch64.jar" overwrite="true"/>
723729
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/openbsd-x86.jar" overwrite="true"/>
724730
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/openbsd-x86-64.jar" overwrite="true"/>
725731
<copy file="${lib.native}/out-of-date.jar" tofile="${lib.native}/sunos-x86.jar" overwrite="true"/>

lib/native/freebsd-aarch64.jar

44.6 KB
Binary file not shown.

native/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
# Linux (i386/amd64/ppc/arm)
1616
# Solaris (i386/amd64/sparc/sparcv9)
1717
# AIX (ppc/ppc64)
18-
# FreeBSD/OpenBSD/NetBSD (i386/amd64)
18+
# FreeBSD (i386/amd64/aarch64)
19+
# OpenBSD/NetBSD (i386/amd64)
1920
# Android (arm/armv7/aarch64/x86/x86-64/mipsel/mips64el)
2021
#
2122
# Built, but with outstanding bugs (not necessarily within JNA):

www/FreeBSD.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
Building JNA for FreeBSD
2+
========================
3+
4+
This recipe was used to build the FreeBSD aarch64 native library on amd64:
5+
6+
```
7+
# Fetch FreeBSD 13.2 image and extract it
8+
wget https://download.freebsd.org/snapshots/VM-IMAGES/13.2-STABLE/aarch64/20231216/FreeBSD-13.2-STABLE-arm64-aarch64-20231216-9986fd59d855-256898.qcow2.xz
9+
xz -d FreeBSD-13.2-STABLE-arm64-aarch64-20231216-9986fd59d855-256898.qcow2.xz
10+
11+
# Ensure there is enough space in the image
12+
qemu-img resize FreeBSD-13.2-STABLE-arm64-aarch64-20231216-9986fd59d855-256898.qcow2 +5G
13+
14+
# Launch aarch64 emulator with downloaded image
15+
qemu-system-aarch64 -m 4096M -cpu cortex-a57 -M virt \
16+
-bios /usr/lib/u-boot/qemu_arm64/u-boot.bin \
17+
-serial telnet::4444,server -nographic \
18+
-drive if=none,file=PATH_TO_IMAGE/FreeBSD-13.2-STABLE-arm64-aarch64-20231216-9986fd59d855-256898.qcow2,id=hd0 \
19+
-device virtio-blk-device,drive=hd0 \
20+
-device virtio-net-device,netdev=net0 \
21+
-netdev user,id=net0
22+
23+
# Connect to terminal for emulated system and boot into single user mode with default shell
24+
telnet localhost 4444
25+
26+
# Resize partitions
27+
gpart show /dev/vtbd0
28+
gpart recover /dev/vtbd0
29+
gpart show /dev/vtbd0
30+
gpart resize -i 3 /dev/vtbd0
31+
growfs /
32+
33+
# Exit single user mode (BSD boots to multi-user)
34+
exit
35+
36+
# Login as root
37+
38+
# Install prerequisites - part 1 - java, build system, rsync
39+
pkg install openjdk17 wget automake rsync gmake gcc
40+
# Adjust fstab (optional, only needed if reboot is planned)
41+
# fdesc /dev/fd fdescfs rw 0 0
42+
# proc /proc procfs rw 0 0
43+
44+
# Install prerequisites - part 2 - ant
45+
wget https://dlcdn.apache.org//ant/binaries/apache-ant-1.10.14-bin.zip
46+
unzip apache-ant-1.10.14-bin.zip
47+
48+
# Transfer JNA source code to build environment
49+
rsync -a --exclude=.git USER@BUILD_HOST:src/jnalib/ jnalib/
50+
51+
# Set current date and time (YYYYMMDDHHMM)
52+
date 202312231627
53+
54+
# Build JNA and run unittests
55+
cd jnalib
56+
/root/apache-ant-1.10.14/bin/ant
57+
58+
# Copy jna native library back to host system
59+
60+
```

0 commit comments

Comments
 (0)