-
Notifications
You must be signed in to change notification settings - Fork 25
Description
I recently experimented with custom built AppImage runtimes for my fre:ac project and managed to build AppImages for FreeBSD x86-64 and aarch64 with GitHub Actions.
I'm using vmactions/freebsd-vm for the build. Here is my workflow file for setting up the VMs.
I'm only building the runtimes and use the Linux AppImageTool for packaging. It would be great if a native AppImageTool and runtimes would be available for FreeBSD.
Here is the relevant part of my build script for building the runtime: type2-runtime build
I'm using libfuse 3.17.2 for this which has lots of fixes for BSDs over 3.16.2. I'm also patching the runtime with this patch for FreeBSD support. Main changes:
- Use the
KERN_PROC_PATHNAME
sysctl to get the AppImage path as /proc might not be available on FreeBSD - Don't search for a FUSE usermount prog; this should always be mount_fusefs on FreeBSD
- Wait for image to become available after mount
As for the last one, I'm not sure why this is necessary, but without it, the AppImage contents are not found when trying to execute AppRun. In my tests, waiting for an additional 10-20ms usually was enough for the files to become available. Maybe there are better ways to solve this.
Also, the aarch64 runtime is built with the ELF OS ABI set to GNU/Linux. I suspect this is a bug in the GNU binutils for FreeBSD aarch64 triggered by the presence of IFUNCs (which are imported from libmd.a). I'm calling elfedit --output-osabi FreeBSD $@
in the makefile to fix this.
x86-64 FreeBSD build times are only slightly longer than for Linux builds, mainly due to the time taken to setup the VM. aarch64 builds unfortunately are ~12x slower due to emulation and while GitHub Actions now has native aarch64 runners, those don't support nested virtualization.
Latest fre:ac AppImages for FreeBSD are available here.
It may also be possible to support other BSDs with a similar approach. @vmactions also has VMs for NetBSD, OpenBSD and DragonflyBSD. I'm not planning to try this anytime soon though.