Mere Linux uses pacman as its package manager, with some customizations. Each package has its own directory under the packages directory, which contains at least a PKGBUILD file.
Some PKGBUILD
files may create multiple, related packages, called 'split packages'.
A typical example would be a package that provides a run-time library and a
corresponding -dev
package that provides library headers, development documentation,
static libraries, or other components required for using the library at build-time.
While packages can be built using only the makepkg
utility provided with the
pacman-build
package, Mere's build utilities are designed around building inside
a Docker container. This helps achieve isolation and an easily repeatable
environment when building a package, resulting in fewer build issues. This also
has the advantage of detaching a build host system from the build requirements.
For example, it is easy to create a Mere package on a MacOS system running Docker
Desktop by simply using the same build utilities.
- Create a new directory under packages
- Copy template.PKGBUILD to
packages/<newpkg>/PKGBUILD
. - Edit the new
PKGBUILD
file, adjusting thepkgname
,pkgver
,pkgdesc
,url
andlicense
variables. You may also need to adjust thesources
variable to match the full url of your source archive, andmakedepends
if your package has additional build-time dependencies. - Adjust the
build
andpackage
functions as necessary to correctly compile and install the package contents. (For examples of more advanced configurations, see the musl or s6PKGBUILD
files.) - Run
./buildpkg.sh packages/<newpkg> gen
. This will launch a docker container and update theChangeLog
file with a description of the changes based on short input, and then download the sources and add sha256 hash sums of each source to thesha256sums
bash array in thePKGBUILD
file. - Run
./buildpkg.sh packages/<newpkg>
to launch the build inside a Docker container. This will create a temporary directory in your system's tmpdir location, copy the contents ofpackages/<newpkg>
to it and mount it as the working directory inside the container. When the build is complete, or if it exits with an error, the name of the temporary directory will be displayed and you can inspect its contents. If you prefer to develop inside the container interactively, you can run./buildpkg.sh packages/<newpkg> sh
instead. You will land at a shell prompt inside the build environment container, in the same working directory. To then run all the commands that would have been run automatically, runbuild-in-docker
.