Creating -libre packages

From ParabolaWiki
Jump to: navigation, search

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

1 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.

2 Creating a libre Package

We refer to a libre package as a package that replaces a non-libre package from Arch's official repositories. 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

3 How to edit the PKGBUILD

3.1 The easy part

To make a libre package the original PKGBUILD needs to be changed.

  • A libre package needs to replace the non-libre one, previously this was achieved with
provides=("nonlibrepackage=$pkgver")
replaces=('nonlibrepackage')
conflicts=('nonlibrepackage')
Nowadays .parabola${PARABOLA_RELEASE_COUNT} is appended to pkgrel, for instance:
pkgrel=5
becomes
pkgrel=5.parabola1
  • Non-libre dependencies must be removed. To identify them, there's a libretools script called pkgbuild-check-nonfree for checking if a PKGBUILD has non-free dependencies. Remove non-free dependencies from
depends=()
  • If a patch is needed add it to
sources=()
  • If the parts we removed were the only ones which had a custom license, remove "custom" from
license=()
  • Add an indication of the change to
pkgdesc='description.'

3.2 The hard part

3.2.1 The mksource and prepare functions

This article or section needs expansion.
Please help expand this article so the intended scope is covered in sufficient detail. (Discuss)

3.2.2 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.

3.2.3 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.

4 Building

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

# libremakepkg

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 :-) .

5 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

6 Add package details to libre-packages article

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

7 Adopting and Maintaining

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