Arch uses the pacman package manager and the package format is tar.zst. Arch provides a number of tools for creating tar.zst packages, first you need to install the base-devel package and the devtools package.
Arch’s packaging process works like this, starting with writing a PKGBUILD file that describes all the information needed to build a package, such as where to download the source code from, what the dependencies are, what the build version is, how to build, etc.
A basic PKGBUILD format is as follows.
Take dtkcore as an example, the whole configuration file is very clear and straightforward, at a glance you can see how the build tool makes a package step by step.
Save the configuration file to a directory named after PKGBUILD and then execute makepkg.
makepkg is the tool used to execute the PKGBUILD file and it builds the package according to the description in the file.
How to submit a package to aur
When you want your package to be used by others, you usually request to upload it to the official repository, but the process of entering the official repository is exceptionally tedious and can be demanding for contributors. arch provides a user repository for users to freely share configuration files, and all you need to do is download the configuration file and package it locally.
According to aur’s contribution guidelines, we can easily upload our own configuration files and borrow aur tools like yay to download and build packages automatically.
Users can share PKGBUILD through the Arch User Repository. AUR does not contain any binary packages, only PKGBUILD uploaded by users for other users to download and use. All packages are unofficial and are used at your own risk.
Before submitting aur, it is necessary to understand some requirements of aur. Rules of submission provides some rules to upload and maintain our own packages as long as we follow them.
First you need to go to the aur website and register an account and upload your ssh key We do this by cloning a new repository as a way to upload.
Take dtkcore for example, change the pkgname to dtkcore when cloning.
If it is the first time you create it, you will be prompted for an empty repository that you cloned.
Copy the PKGBUILD file to the cloned directory, then run
makepkg --printsrcinfo > .SRCINFO to create a package message, add both the
PKGBUILD files to git, then commit the commit message and push it to the server.
Note: If you forget to include .SRCINFO in your initial commit, you can use rebasing with -root or filtering the tree to make the AUR accept your first push
Tip: To keep your working directory and commits as clean as possible, you can create a gitignore file to exclude all files, and then add files as needed.