Building a JAR containing shared libraries compiled across architectures

I’ve decided I want to create my own SQLite library for Java. SQLite is a C code base. I want to run this library on as many platforms as possible. Several potential users of my code base have HP-UX, AIX, and other uncommon architectures.

I have been using xerial/sqlite-jdbc for a long time and saw how it is building its JAR. It spins up several docker containers for each architecture, compiles SQLite and writes the compiled library files back to the resources/ directory.

It detects whatever architecture the JAR is running on, loading up the correct shared library. I am not clear on this step, so some guidance on how to reliably detect the architecture and make sure JNI finds the correct .so/.dll would be helpful.

Is creating docker images and Makefiles the recommended practice? Does someone have a starting point for various architectures, where I can just customize the Makefile/source folder? It feels like every time a new architecture comes out (like M1 recently) it means a lot of work for a lot of projects of this nature.

Mostly, I’m just confirming there’s not something already out that other Java libraries are already using, before I invest a lot of time in this. Any additional guidance would be appreciated. Hopefully this question is specific enough.

Source: Docker Questions