User:Encode/XDG package building

From Alpine Linux
This material is work-in-progress ...

I customize some packages locally, if you plan to develop you will probably need to also do a few more things (for example: "PACKAGER" in /etc/abuild.conf).
(Last edited by Encode on 11 Jan 2023.)

Todo: Use a dedicated user.
abuild-keygen should put the key in ${XDG_DATA_HOME}/abuild.


Prerequisites

Install the alpine-sdk and abuild-rootbld packages; the first is a metapackage that pulls in most essential packages, the second is for building in a clean chroot:

# apk add alpine-sdk abuild-rootbld

Add the package building user to the abuild group to use $ abuild rootbld:

# addgroup USER abuild

In ~/.profile you will need:

Contents of ~/.profile

... export ABUILD_USERDIR="${XDG_CONFIG_HOME:=$HOME/.config}"/abuild ...
Note: You will need to log out/in for these to take effect.

Make the directory to hold sources and configure the security keys:

$ mkdir ~/src $ abuild-keygen -a -i

When it says "Enter file in which to save the key:..." you should see:

 [/home/USER/$XDG_CONFIG_HOME/abuild/....rsa]

hit Enter. Enter your pass to install into /etc/apk/keys/.

Change where built packages go:

Contents of /etc/abuild.conf

... REPODEST="${XDG_DATA_HOME:=$HOME/.local/share}/abuild/" ...

Fetch latest APKBUILD files

This will clone them into ~/src/aports:

$ cd ~/src/ $ git clone 'https://git.alpinelinux.org/aports'

Build the package

Change into the directory for the package:

$ cd ~/src/aports/REPO/PACKAGE

Edit the APKBUILD as needed and update the checksum:

$ abuild checksum

Build the package & install the local package:

$ abuild rootbld # apk add -uX "${XDG_DATA_HOME}"/abuild/community/ PACKAGE

See also