Creating -libre packages

This article describes the process of creating -libre packages, that is, how to replace packages from Archlinux that contain non-free code or dependencies.

Prerequisites

  • Basic knowledge of how an Arch package is built is needed (PKGBUILDs, makepkg + its flags, etc.). Having practiced with the amazing AUR is a good experience.
  • Hang around on #parabola and/or subscribe to packages on our mailing list.
  • Follow instructions on our Package maintainer guide
  • Update makepkg.conf from makepkg.conf.pacnew if you haven't already.
  • Configure ~/.makepkg.conf especially the PACKAGE OUTPUT section, that's near the end of the file.

Creating a -libre Package

We refer to a -libre package as a package that replaces a non-libre package from Arch Linux's official repositories. For example, kernel26 becomes kernel26-libre. Sometimes the package doesn't share the same name, like firefox becoming icecat.

A -libre package is created in the following cases:

  • The package is non-libre but a libre replacement is available.
  • The package has some non-libre parts, but is functional without them.
  • The package depends on other non-libre packages, but is functional

without them.

  • The package recommends non-libre software.
Note: In the last case there may be no need to recompile, so we use a rePKGBUILD

How to edit the PKGBUILD

The easy part

For making a -libre package, PKGBUILD needs to be changed.

  • A -libre package needs to replace the non-libre one, so you should add
File: PKGBUILD
provides=("nonlibrepackage=$pkgver")
replaces=('nonlibrepackage')
conflicts=('nonlibrepackage')
  • Non-libre dependencies must be removed. To identify them, there's a script called pkgbuild-check-nonfree for checking if a PKGBUILD has non-free dependencies. Remove non-free dependencies from
    File: PKGBUILD
    depends=()
  • If a patch is needed add it to
File: PKGBUILD
sources=()
  • If the parts we removed were the only ones which had a custom license,
remove "custom" from
File: PKGBUILD
license=()
  • Add an indication that the package is libre to
File: PKGBUILD
pkgdesc='description.'

The hard part

The mksource function

This function now resides in the SRCBUILD files that Parabola has started using in addition to PKGBUILD.

The build function

Find if any option on the build function contains the building steps of the software. Make all the modifications needed to build only free sources.

The package function

If the PKGBUILD contains a package function, take the steps needed to avoid installing non-libre stuff. Also make sure the corresponding licenses are correctly installed on /usr/share/licenses/$pkgname if they're not the common licenses.

Building

The best way to package is using a clean chroot if you have followed the Package maintainer guide:

# libremakepkg -cu [makepkg flags] [-M --long-opt1] [-M --long-opt2] 

If everything went OK, test it.

Now, if you're already a Parabola Package Monkey (with a badge and access to the server) you'll have to stage the package and upload it. For signing several packages/sources, you can run gpg-agent, so you'll only have to enter your password once.

$ librestage $repo
$ gpg-agent
$ librerelease

After the next db-update run it will be included in the repository database. librerelease runs db-update, so the package(s) will be included in the repo(s) immediately.

If you are not a package monkey, run
$ makepkg --source
send the *.src.tar.gz for revision and expect some applause :-) .

Add PKGBUILD to abslibre

Clone the git repo containing ABSLibre:

* git clone gparabola:abslibre.git
    

Change to the repo dir

* cd abslibre/$repo
    

Create dir same as your package name

* mkdir yourpackage
    

Copy PKGBUILD and build related files (patches) to that dir. Add these copied files to the git

* git add yourpackage/yourfiles
    

(Make sure that ~/.gitconfig does have 'name' and 'email' fields in it.)

After a succesful build, commit using following command

* git commit -m"Adding yourpackage\n\nSome more information"
    

Sync the repo

* git push

Add package details to libre-packages article

After creating the libre-package, please add details on the Libre-packages page on this wiki.

Adopting and Maintaining

If you want to maintain a package (please do!) ask another packager for commit permissions.