What is it?
toAPK is a package conversion tool in the same vein as alien, but for Alpine Linux's APKBUILDs. It is my attempt to lower the barrier of entry for Alpine's package maintenance.
Currently toAPK is capable of converting Arch Linux PKGBUILDs with a high degree of accuracy, and to a much lesser degree VOID Linux templates & Gentoo Linux ebuilds. This has been so wonderfully successful that you can create a working APKBUILD with just about any AUR package. I've personally merged a handful of packages produced with toAPK, and these have required absolutely minimal editting before being accepted.
toAPK also supports remote conversion as well, a feature I showcased briefly at Fennelconf 2020. You can now invoke toAPK with the -u flag, which will pull a package from a distro's package repo, and return the converted APKBUILD. With this change you simply need to do something like, toAPK -u -a fennel aur > APKBUILD to create a package!
toAPK is written in Fennel, a tiny little lisp that runs on top of Lua. Fennel was chosen for a few reasons:
- It has a Lisp-1 syntax style, much like Clojure
- Since Fennel is built on Lua you have access to Lua's wide birth of libraries
- At the time of toAPK's inception SBCL could not compile on musl libc outside of x86_64 implementations
I wanted to write a tool that could be used by more than just myself, that could reduce some of the overhead it takes getting new packages into Alpine. Arch Linux's AUR repo's provide a plethora of packages to work with, and while running one through toAPK doesn't ensure you'll get a 100% working APKBUILD, it gets you much closer than wildly staring at your screen trying to google the differences between the packaging systems. That's how I got started as a package maintainer, and I imagine a lot of people are turned away because of the mental gymnastics it all requires.
Because I needed the tool to be adopted, and I couldn't get SBCL to compile on all Alpine platforms (until recently!), I looked to other languages. Lua came to mind, it was simple to learn, but the syntax is less than enjoyable when you're used to lisp like languages. Fennel offers a wonderful bridge between the two, and has the added benefit of compiling the code out to Lua. If someone doesn't want to deal with Fennel itself, they can just pull the compiled Lua version. Additional work has since been done to compile Fennel to static binaries, which is how toAPK is now distributed.
toAPK is by no means done, I'd eventually like to see Gentoo Linux Ebuild -> APKBUILD conversion, and better handling of VOID Templates. If I can really carve out the time APKBUILD -> PKGBUILD conversion is high up on my list of hopes. I package all of my software with APKBUILDs in mind, and try and make sure what I make ends up in Alpine's repos, if I could take the same packages and programmatically spit out PKGBUILDS, RPMs, and even DEBs.
That's the dream at least. There's a solid amount of work left to get to that point.
If you'd like to contact me about my software, ponderings, or just to chat; you can reach me at email@example.com.