aboutsummaryrefslogtreecommitdiffstats
path: root/community/keepalived/APKBUILD
blob: da9f27e3e025a03b38bc59905e0748f520677349 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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
101
102
103
104
105
106
107
108
109
# Contributor: Pablo Castorino <pcastorino@mendoza-conicet.gob.ar>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=keepalived
pkgver=1.4.2
pkgrel=0
pkgdesc="Health Checking for Linux Virtual Server & High-Availability"
url="http://www.keepalived.org/"
arch="all"
license="GPL"
depends="$pkgname-common !$pkgname-snmp"
makedepends="libressl-dev popt-dev linux-headers net-snmp-dev libnl-dev
	libnfnetlink-dev automake autoconf"
install="$pkgname.post-upgrade"
subpackages="$pkgname-doc $pkgname-sample-config:samples:noarch
	$pkgname-common $pkgname-snmp"
source="http://www.keepalived.org/software/$pkgname-$pkgver.tar.gz
	always-use-pid-dir.patch
	$pkgname.initd
	$pkgname.confd
	"
builddir="$srcdir/$pkgname-$pkgver"

prepare() {
	default_prepare

	# The build scripts are somehow broken, so we must regenerate them.
	autoreconf -fiv

	cp -ar "$builddir" "$builddir-snmp"
}

build() {
	cd "$builddir-snmp"
	_build --enable-snmp

	cd "$builddir"
	_build
}

_build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--with-kernel-dir=/usr/include/linux \
		--enable-vrrp \
		--enable-sha1 \
		$@
	make
}

check() {
	"$builddir"/bin/keepalived --version
	"$builddir-snmp"/bin/keepalived --version
}

package() {
	cd "$builddir"

	make DESTDIR="$pkgdir" install

	local f; for f in AUTHOR CONTRIBUTORS ChangeLog README INSTALL TODO \
			genhash/README genhash/AUTHOR genhash/ChangeLog; do
		install -m644 -D $f "$pkgdir"/usr/share/doc/$pkgname/$f
	done

	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname

	# Clean up sysvinit files
	rm -rf "$pkgdir"/etc/rc.d "$pkgdir"/etc/sysconfig
}

common() {
	depends=""

	mkdir -p "$subpkgdir"/usr

	mv "$pkgdir"/etc "$subpkgdir"/
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
}

snmp() {
	pkgdesc="$pkgdesc (with SNMP support)"
	depends="$pkgname-common !$pkgname"

	cd "$builddir-snmp"

	install -m700 -D bin/keepalived "$subpkgdir"/usr/sbin/keepalived

	mkdir -p "$subpkgdir"/usr/share/snmp/mibs
	install -m644 doc/*-MIB.txt "$subpkgdir"/usr/share/snmp/mibs/
}

samples() {
	pkgdesc="Sample configuration for keepalived"

	mkdir -p "$subpkgdir"/etc/keepalived/
	mv "$pkgdir"/etc/keepalived/samples "$subpkgdir"/etc/keepalived/
}

sha512sums="325282daea9c6dc9ec38ca405fcba3e55c07f6358c59fae5dc3422c0f987197658d39cda3ed6523ea29a356d74d09fe57e62411bd7498f5ef086cf191eb42fe3  keepalived-1.4.2.tar.gz
469458b60c90948dff39fc587dbe076bece3ee5f834461110996c27802bd3690008e0034a9566648816f43cf8cc058cb7d1760358b81bbd070544e77f14391fa  always-use-pid-dir.patch
4f1a3fdb0a936707a234efa063296f575fa8168551c87d2f9d43b7681d24605f852b4ddb2c674d1e311111f85232a708939a71cf128eb57c940ccb6927518dd4  keepalived.initd
2e6a9411d78fb954b5ede75d04225bf3f37d9ef4773c2b3587e1de1a0795f61a1ed784fa229854c2ee97f153205c3f76b3ff79cd55ede07f211731f0d17569cb  keepalived.confd"