diff --git a/CHANGES.md b/CHANGES.md index 67a41b7117..bb87972615 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ Next Release (5.15.0) Features -------- +* [#1578](https://github.com/java-native-access/jna/pull/1578): Add support for FreeBSD aarch64 - [@alexdupre](https://github.com/alexdupre). Bug Fixes --------- diff --git a/build.xml b/build.xml index c8b6f55499..8b2b432146 100644 --- a/build.xml +++ b/build.xml @@ -401,6 +401,8 @@ com/sun/jna/freebsd-x86/libjnidispatch.so; processor=x86;osname=freebsd, com/sun/jna/freebsd-x86-64/libjnidispatch.so; processor=x86-64;osname=freebsd, +com/sun/jna/freebsd-aarch64/libjnidispatch.so; +processor=aarch64;osname=freebsd, com/sun/jna/openbsd-x86/libjnidispatch.so; processor=x86;osname=openbsd, @@ -532,6 +534,9 @@ osname=macosx;processor=aarch64 + @@ -720,6 +725,7 @@ osname=macosx;processor=aarch64 + diff --git a/lib/native/freebsd-aarch64.jar b/lib/native/freebsd-aarch64.jar new file mode 100644 index 0000000000..9a00c26493 Binary files /dev/null and b/lib/native/freebsd-aarch64.jar differ diff --git a/native/Makefile b/native/Makefile index 98bf357d8e..bdd277580c 100644 --- a/native/Makefile +++ b/native/Makefile @@ -15,7 +15,8 @@ # Linux (i386/amd64/ppc/arm) # Solaris (i386/amd64/sparc/sparcv9) # AIX (ppc/ppc64) -# FreeBSD/OpenBSD/NetBSD (i386/amd64) +# FreeBSD (i386/amd64/aarch64) +# OpenBSD/NetBSD (i386/amd64) # Android (arm/armv7/aarch64/x86/x86-64/mipsel/mips64el) # # Built, but with outstanding bugs (not necessarily within JNA): diff --git a/www/FreeBSD.md b/www/FreeBSD.md new file mode 100644 index 0000000000..c2ccd79c8b --- /dev/null +++ b/www/FreeBSD.md @@ -0,0 +1,60 @@ +Building JNA for FreeBSD +======================== + +This recipe was used to build the FreeBSD aarch64 native library on amd64: + +``` +# Fetch FreeBSD 13.2 image and extract it +wget https://download.freebsd.org/snapshots/VM-IMAGES/13.2-STABLE/aarch64/20231216/FreeBSD-13.2-STABLE-arm64-aarch64-20231216-9986fd59d855-256898.qcow2.xz +xz -d FreeBSD-13.2-STABLE-arm64-aarch64-20231216-9986fd59d855-256898.qcow2.xz + +# Ensure there is enough space in the image +qemu-img resize FreeBSD-13.2-STABLE-arm64-aarch64-20231216-9986fd59d855-256898.qcow2 +5G + +# Launch aarch64 emulator with downloaded image +qemu-system-aarch64 -m 4096M -cpu cortex-a57 -M virt \ + -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin \ + -serial telnet::4444,server -nographic \ + -drive if=none,file=PATH_TO_IMAGE/FreeBSD-13.2-STABLE-arm64-aarch64-20231216-9986fd59d855-256898.qcow2,id=hd0 \ + -device virtio-blk-device,drive=hd0 \ + -device virtio-net-device,netdev=net0 \ + -netdev user,id=net0 + +# Connect to terminal for emulated system and boot into single user mode with default shell +telnet localhost 4444 + +# Resize partitions +gpart show /dev/vtbd0 +gpart recover /dev/vtbd0 +gpart show /dev/vtbd0 +gpart resize -i 3 /dev/vtbd0 +growfs / + +# Exit single user mode (BSD boots to multi-user) +exit + +# Login as root + +# Install prerequisites - part 1 - java, build system, rsync +pkg install openjdk17 wget automake rsync gmake gcc +# Adjust fstab (optional, only needed if reboot is planned) +# fdesc /dev/fd fdescfs rw 0 0 +# proc /proc procfs rw 0 0 + +# Install prerequisites - part 2 - ant +wget https://dlcdn.apache.org//ant/binaries/apache-ant-1.10.14-bin.zip +unzip apache-ant-1.10.14-bin.zip + +# Transfer JNA source code to build environment +rsync -a --exclude=.git USER@BUILD_HOST:src/jnalib/ jnalib/ + +# Set current date and time (YYYYMMDDHHMM) +date 202312231627 + +# Build JNA and run unittests +cd jnalib +/root/apache-ant-1.10.14/bin/ant + +# Copy jna native library back to host system + +```