Creating a PKGBUILD from scratch and putting it online on AUR – from A till AUR

In this video we will create a PKGBUILD for openbox themes coming from Adhi Pambudi.

https://github.com/addy-dclxvi/openbox-theme-collections

First we check that there is not already a package providing these openbox themes. 

There can be no doubles on AUR

We open up some of the links mentioned on the page and start reading.

We start from the PKGBUILD prototype that we found online but there are also examples on your computer.

/usr/share/pacman

First we choose a name – we follow some common sense so that people can actually find your package.

It is about Openbox and themes and from Adhi Pambudi so we go for

openbox-themes-pambudi-git

We put the -git later on as the source is from github.

We investigate the LICENSE. Your computer has the most common licences

/usr/share/licenses/common

The code the install the LICENCE is this 

install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

Source is the most important part.

Where is your data coming from?
How is it packaged?
How do you get it?

source=("$pkgname-$pkgver.tar.gz::https://github.com/coder/program/archive/v$pkgver.tar.gz"

Since it is coming from github we need to find online what to do. We can not find (July/2019) on the Arch Wiki.

We find per accident how to number packages if it is coming from github.

https://wiki.archlinux.org/index.php/VCS_package_guidelines

We copy/paste code to number our package rather than sticking to 1.1 as numbering.

Rewatching the video I did see now a way the manpage of pacman is trying to help us with the source.

https://www.archlinux.org/pacman/PKGBUILD.5.html

 

Excerpt

Using VCS Sources

Building a developmental version of a package using sources from a version control system (VCS) is enabled by specifying the source in the form source=('directory::url#fragment?query'). Currently makepkg supports the Bazaar, Git, Subversion, and Mercurial version control systems. For other version control systems, manual cloning of upstream repositories must be done in the prepare() function.

The source URL is divided into four components:

directory

(optional) Specifies an alternate directory name for makepkg to download the VCS source into.

url

The URL to the VCS repository. This must include the VCS in the URL protocol for makepkg to recognize this as a VCS source. If the protocol does not include the VCS name, it can be added by prefixing the URL with vcs+. For example, using a Git repository over HTTPS would have a source URL in the form: git+https://....

This is the final source code that we will use

source=(${pkgname}::"git+https://github.com/addy-dclxvi/openbox-theme-collections")

We keep on editing the PKGBUILD. This time we are in the pkgver element.

We run makepkg in the same folder as the PKGBUILD. Use -f to force the makepkg if you already have build a package.

The md5sum is blocking our pkgbuild. We need to figure if we can do that with a github. You can do it with a package like

md5sum yourpackage

will result in a long string of characters that you need to copy/paste in the PKGBUILD.

f4cac56f6e17f1711c2baf287f9ceebf

Running the makepkg command has changed our number in the PKGBUILD.

pkgver=r24.b25c465

Now we are in package()  and look how to get our data over from the source directory to the pkg directory.

We analyze a few PKGBUILD from other package builder to find something we understand.

We create the directories and copy/paste all themes over after cleaning the source.

HERE I HAVE MADE A MISTAKE

The command I should have used is the complete package name – I stopped too early and cut off the name. 

Ofcourse pacman could not find it.

sudo pacman - U openbox-themes-pambudi-git-r24.b25c465-2-x86_64.pkg.tar.xz

Run into an error – start from scratch

We quickly change our themes.

I looked at the wrong tab in lxappearance but you can also change your openbox theme via obconf.

We change also the /etc/makepkg.conf on your system. We need to give it a packager name.

Look for the words John Doe and change it into your name.

Let us rebuild the package and now the name of the maintainer will be included in your package.

Next step is getting our PKGBUILD online on AUR website so other people can also use Adhi Pambudi’s openbox themes.

https://wiki.archlinux.org/index.php/AUR_submission_guidelines

Read this page from beginning to end – the guidelines are important.

Then we need to be allowed to post to the AUR repo.

First start with making an account.

Follow the Arch wiki together with my video and you can put your package online on the AUR.

After the video

I have added the missing url and deleted some more empty lines and updated the package release number to 2 and pushed it to AUR again and everyone (that has this package installed) will get an update in.