APKBUILD 3.6 KB
Newer Older
Leonardo Arena's avatar
Leonardo Arena committed
1
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
Leonardo Arena's avatar
Leonardo Arena committed
2
pkgname=libvirt
3
vmajor="1.0.0"
4
vminor="rc3"
5 6 7
pkgver="${vmajor}_${vminor}"
_ver="${pkgver/_rc/-rc}"
pkgrel=0
Leonardo Arena's avatar
Leonardo Arena committed
8 9
pkgdesc="A virtualization API for several hypervisor and container systems"
url="http://libvirt.org/"
10
arch="all"
Leonardo Arena's avatar
Leonardo Arena committed
11
license="LGPL"
12
depends="bridge-utils dmidecode iptables netcat-openbsd pm-utils python"
13
makedepends="augeas-dev bridge-utils cyrus-sasl-dev device-mapper 
14 15
	e2fsprogs-dev gnutls-dev libcap-ng-dev libgpg-error-dev 
	libnetcf-dev libnl-dev libxml2-dev libxslt-dev libtasn1-dev 
16
	lvm2-dev lxc-dev gnutls-dev libgcrypt-dev parted-dev perl pkgconfig 
17
	udev-dev xen-dev zlib-dev yajl-dev libpcap-dev curl-dev"
Leonardo Arena's avatar
Leonardo Arena committed
18
install=
19 20
subpackages="$pkgname-client $pkgname-daemon $pkgname-dev $pkgname-doc $pkgname-lang
	$pkgname-lxc $pkgname-qemu $pkgname-xen $pkgname-uml"
21
source="http://libvirt.org/sources/$pkgname-$_ver.tar.gz
Leonardo Arena's avatar
Leonardo Arena committed
22
	libvirt.confd
23
	libvirt.initd
24
	uclibc-physmem.patch
25
	libvirt-1.0.0-uclibc-mkostemp.patch
26
	"
Leonardo Arena's avatar
Leonardo Arena committed
27

28
_builddir="$srcdir"/$pkgname-$vmajor
Leonardo Arena's avatar
Leonardo Arena committed
29

30 31
prepare() {
	cd "$_builddir"
32 33 34 35 36
	for patch in $(ls ../*.patch)
	do
		msg "Applying patch $patch"
		patch -p1 < ../$patch || return 1
	done	
37
}
Leonardo Arena's avatar
Leonardo Arena committed
38 39 40

build() {
	cd "$_builddir"
41
	export LDFLAGS="$LDFLAGS -lm"
Leonardo Arena's avatar
Leonardo Arena committed
42 43 44 45
	./configure --prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
46 47 48
		--libexec=/usr/lib/"$pkgname" \
		--without-libxl \
		|| return 1
49
	make || return 1
Leonardo Arena's avatar
Leonardo Arena committed
50 51 52 53
}

package() {
	cd "$_builddir"
Natanael Copa's avatar
Natanael Copa committed
54
	make DESTDIR="$pkgdir" install || return 1
Natanael Copa's avatar
Natanael Copa committed
55
	find "$pkgdir" -name '*.la' -delete
Leonardo Arena's avatar
Leonardo Arena committed
56 57 58 59
	install -D -m755 $srcdir/$pkgname.initd $pkgdir/etc/init.d/libvirtd
	install -D -m755 $srcdir/$pkgname.confd $pkgdir/etc/conf.d/libvirtd
}

60 61 62
daemon() {
	cd "$_builddir"
	pkgdesc="libvirt daemon package"
63
	depends="libvirt-client logrotate"
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
	daemon="libvirtd"
	replaces="libvirt"
	mkdir -p "$subpkgdir"/etc/$pkgname \
	 "$subpkgdir"/etc/logrotate.d \
	 "$subpkgdir"/usr/sbin
	# mkdir -p "$subpkgdir"/usr/sbin
	mv "$pkgdir"/etc/init.d "$subpkgdir"/etc
	mv "$pkgdir"/etc/conf.d "$subpkgdir"/etc
	mv "$pkgdir"/etc/$pkgname/$daemon.conf "$subpkgdir"/etc/libvirt/
	mv "$pkgdir"/usr/sbin/$daemon "$subpkgdir"/usr/sbin/
	mv "$pkgdir"/etc/logrotate.d/libvirtd "$subpkgdir"/etc/logrotate.d/
}

client() {
	cd "$_builddir"
	pkgdesc="libvirt client package"
	depends="libvirt"
	replaces="libvirt"
	mkdir -p "$subpkgdir"/etc/$pkgname "$subpkgdir"/usr/bin
	# mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/etc/$pkgname/$pkgname.conf "$subpkgdir"/etc/libvirt/
	mv "$pkgdir"/usr/bin/* "$subpkgdir"/usr/bin/
}

_mv_driver() {
	mkdir -p "$subpkgdir"/usr/lib/libvirt/connection-driver \
	 "$subpkgdir"/etc/libvirt "$subpkgdir"/etc/logrotate.d
	mv "$pkgdir"/usr/lib/libvirt/connection-driver/libvirt_driver_$1.so \
	 "$subpkgdir"/usr/lib/libvirt/connection-driver/
	if [ "$1" != "xen" ]; then
		mv "$pkgdir"/etc/logrotate.d/libvirtd.$1 \
		 "$subpkgdir"/etc/logrotate.d/
	fi
}

qemu() {
	pkgdesc="QEMU driver for libvirt"
101
	depends="libvirt-daemon logrotate"
102 103 104 105 106 107 108
	replaces="libvirt"
	_mv_driver qemu
	mv "$pkgdir"/etc/libvirt/qemu.conf "$subpkgdir"/etc/libvirt/
}

xen() {
	pkgdesc="XEN driver for libvirt"
109
	depends="libvirt-daemon"
110 111 112 113 114 115
	replaces="libvirt"
	_mv_driver xen
}

lxc() {
	pkgdesc="lxc driver for libvirt"
116
	depends="libvirt-daemon logrotate"
117 118 119 120 121 122
	replaces="libvirt"
	_mv_driver lxc
}

uml() {
	pkgdesc="UML driver for libvirt"
123
	depends="libvirt-daemon logrotate"
124 125 126 127
	replaces="libvirt"
	_mv_driver uml
}

128
md5sums="f2d89d0d13c3704887134a51a09b85e8  libvirt-1.0.0-rc3.tar.gz
Leonardo Arena's avatar
Leonardo Arena committed
129
1c84a7baeafe0a7f4e9d7ae5180311b7  libvirt.confd
Leonardo Arena's avatar
Leonardo Arena committed
130
d897df38c7e7fa1a297aa551108633c9  libvirt.initd
131 132
df9cbfaf8a6e520a4822914a300add4d  uclibc-physmem.patch
39d0534c4e24baace260ceb6d8271ab7  libvirt-1.0.0-uclibc-mkostemp.patch"