OK so it dawned on me that PKGBUILDS are just bash scripts. This will help. I just need to get familiar with the PKGBUILD functions and consult BASH scripting if I don't know how to write something
https://unix.stackexchange.com/question … a-pkgbuild
https://wiki.archlinux.org/title/PKGBUILD
https://wiki.archlinux.org/title/Creating_packages
I see that in my Hyperbola install, I can look at PKGBUILD templates with all the variables under /usr/share/pacman:
PKGBUILD.proto : this is the most commonly used template, and you would copy the release version number from the source
PKGBUILD-split.proto : this one is used only when the package is a split package (rare and probably never gonna happen in Hyperbola)
PKGBUILD-vcs.proto : this one is used only when the source is only available on a version control system like git, in which case all version numbers must be whole integers and not decimal points.
proto.install : is a default template for a post-install script, if the source uses one
In order to package, then, we would consult the package source for the functions we need to include in the PKGBUILD.
ArchWiki wrote:Download the source tarball of the software you want to package, extract it, and follow the author's steps to install the program. Make a note of all commands and/or steps needed to compile and install it. You will be repeating those same commands in the PKGBUILD file.
For good hygiene, we should create a chroot, follow the compilation and install process and then create a PKGBUILD from that. If the install process fails, we should delete the chroot and start over with a clean one until the package compiles and installs successfully, Then PKGBUILD must draw from a successful install. Then, create a separate chroot for making a nice Hyperbola package, and using the PKGBUILD follow the Hyperbola install process. If it fails, delete chroot and make a fresh one, correct the PKGBUILD file, and try again. Sooner or later, the package will build, and so long as the Hyperbola Packaging Guidelines are followed you will have created a package that can be included.