[pacman-dev] My first splitted package

Pierre Schmitz pierre at archlinux.de
Sat Jan 17 06:49:57 EST 2009

Hi pacman-devs,

I have just installed Allan's makepkg-git package and played with the 
splitting feature. I think its quite elegant and will make packaging a lot 
easier and cleaner.

I have two general questions (so far)
1) Are dependencies and makedependencies of sub-packages are treated by 
makepkg in any way? If yes there might be a problem if the sub-packages depend 
on each other.
2) Is it possible to use build_pkg1 etc.? That's not very improtant as one 
could abuse the package functions for such a use case.

So, let's have a look at a real world example. I have chosen phonon for this. 
Its quite small but its really useful to split it into three parts. Optdepends 
do not work here because phonon detects its backends at runtime; and if those 
are linked against something we have not installed we'll have a problem.

The following PKGBUILD works fine and the resulting packages are valid and 
functional. I am not sure if this is the best way to use splitting; so 
comments are welcome. One problem is that phonon and its backends depend on 
each other. the backends are linked against phonon and if you use phonon 
you'll have to install at least one backend.

Long story short; here it is:

pkgname=('phonon' 'phonon-backend-xine' 'phonon-backend-gstreamer')
pkgdesc='The multimedia API for KDE 4'
arch=('i686' 'x86_64')
makedepends=('pkgconfig' 'cmake' 'automoc4')

build() {
	cd $srcdir
	mkdir build
	cd build
	cmake ../${pkgname}-${pkgver} \

package_phonon() {
	depends=('qt' 'phonon-backend')
	cd $srcdir/build/phonon
	make DESTDIR=$pkgdir install
	cd $srcdir/build/includes
	make DESTDIR=$pkgdir install

package_phonon-backend-xine() {
	pkgdesc='Xine backend for Phonon'
	depends=('phonon' 'xine-lib')
	cd $srcdir/build/xine
	make DESTDIR=$pkgdir install

package_phonon-backend-gstreamer() {
	pkgdesc='Gstreamer backend for Phonon'
	depends=('phonon' 'gstreamer0.10-base')
	cd $srcdir/build/gstreamer
	make DESTDIR=$pkgdir install


Pierre Schmitz

Clemens-August-Straße 76
53115 Bonn

Telefon		0228 9716608
Mobil		0160 95269831
Jabber		pierre at jabber.archlinux.de
WWW		http://www.archlinux.de

More information about the pacman-dev mailing list