Building Zola for Android
2024-07-29
This page is built using Zola, a static site generator. At the time of this writing there are no official builds or packages that can be used in Termux on Android. Rust and Cargo exists as packages in Termux, so one option would be to build it directly on the mobile, but for some reason Termux kept closing/crashing (probably oom killer or similar), so here's how to cross compile it on a beefier machine. The steps are for Arch Linux.
Steps
Get the code for Zola, e.g.:
$ git clone --depth 1 https://github.com/getzola/zola.git
Install android-sdk
from AUR using your favorite method.
Install cargo ndk:
# pacman -S cargo-ndk
Install the correct target platform for Rust, e.g.,
$ rustup target add aarch64-linux-android
Build! The path to android-ndk
need to be specified for
cargo ndk
to find it.
$ ANDROID_NDK_HOME=/opt/android-ndk/ cargo ndk -t aarch64-linux-android build --release
Now you should have a binary in target/<platform>/release/zola
that should
work in Termux. Good luck!