[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')
pkgver=4.2.96
pkgrel=1
pkgdesc='The multimedia API for KDE 4'
arch=('i686' 'x86_64')
url='http://phonon.kde.org'
license=('LGPL')
makedepends=('pkgconfig' 'cmake' 'automoc4')
source=("http://download.kde.org/unstable/4.1.96/src/${pkgname}-${pkgver}.tar.bz2")
md5sums=('35b64db6e850df7d492f812a85b16982')

build() {
	cd $srcdir
	mkdir build
	cd build
	cmake ../${pkgname}-${pkgver} \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr
	make
}

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'
	provides=('phonon-backend')
	depends=('phonon' 'xine-lib')
	cd $srcdir/build/xine
	make DESTDIR=$pkgdir install
}

package_phonon-backend-gstreamer() {
	pkgdesc='Gstreamer backend for Phonon'
	provides=('phonon-backend')
	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