aboutsummaryrefslogtreecommitdiffstats
path: root/main/postgresql-bdr/APKBUILD
blob: a427a6aab9aedd752845512923e4fa49f03791fe (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
110
111
112
113
114
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=postgresql-bdr
pkgver=9.4.10_p1
_pkgver=${pkgver/_p/_bdr}
pkgrel=3
pkgdesc="A sophisticated object-relational DBMS with bidirectional replication support (BDR)"
url="https://wiki.postgresql.org/wiki/BDR_Administration"
arch="all"
license="BSD"
depends="bash"
install="$pkgname.pre-upgrade"
depends_dev="readline-dev libressl-dev zlib-dev libxml2-dev"
makedepends="$depends_dev perl bison flex-dev"
subpackages="$pkgname-dev $pkgname-contrib"
provides="postgresql"
# Avoid conflicts in provided so:* names with postgresql package.
sonameprefix="$pkgname:"
#FIXME: cannot run with UID=0
options="!check"
source="http://packages.2ndquadrant.com/postgresql-bdr94-2ndquadrant/tarballs/postgresql-bdr-$_pkgver.tar.bz2
	initdb.patch
	postgresql-bdr-osxflags.patch
	$pkgname.initd
	$pkgname.confd
	pgbdr-restore.initd
	pgbdr-restore.confd
	"
builddir="$srcdir/$pkgname-$_pkgver"

prepare() {
	cd "$builddir"
	default_prepare

	# sanity check of conf.d
	(
		. "$srcdir"/$pkgname.confd
		_datadir=/var/lib/postgresql/${pkgver%.*}/data
		if [ "$_datadir" != "$PGDATA" ]; then
			die "PGDATA is $PGDATA while $_datadir is expected"
		fi
	)
	#rm doc/src/Makefile
}

build() {
	cd "$builddir"

	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--mandir=/usr/share/man \
		--with-openssl \
		|| return 1

	# configure/programs.m4 doesn't properly detect flex
	# and offers manual user override
	#make FLEX="/usr/bin/flex" JADEFLAGS="-E 999999" OSXFLAGS="-E 999999" \
	 #world
	# Dont' build doc since it throws tons of openjade/osx errors
	make FLEX="/usr/bin/flex" all
}

check() {
	cd "$builddir"
	make check
}

package() {
	cd "$builddir"

	# Don't install docs
	make DESTDIR="$pkgdir" install

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

	# purge libpq to avoid conflict with mainline postgresql
	rm "$pkgdir"/usr/lib/libpq.so* \
		"$pkgdir"/usr/bin/clusterdb \
		"$pkgdir"/usr/bin/createdb \
		"$pkgdir"/usr/bin/createuser \
		"$pkgdir"/usr/bin/dropdb \
		"$pkgdir"/usr/bin/dropuser \
		"$pkgdir"/usr/bin/pg_basebackup \
		"$pkgdir"/usr/bin/pg_dump \
		"$pkgdir"/usr/bin/pg_dumpall \
		"$pkgdir"/usr/bin/pg_isready \
		"$pkgdir"/usr/bin/pg_recvlogical \
		"$pkgdir"/usr/bin/pg_restore \
		"$pkgdir"/usr/bin/psql \
		"$pkgdir"/usr/bin/reindexdb \
		"$pkgdir"/usr/bin/vacuumdb
}

contrib() {
	pkgdesc="Extension modules distributed with PostgreSQL"
	depends=""

	cd "$builddir"
	make DESTDIR="$subpkgdir" FLEX="/usr/bin/flex" -C contrib install
}

sha512sums="85bba9c7bec128d597b95fa7bfaabe42b3fea691a86f08307c6f9b254863a30448465191516baffe4851f7ea9b03b28fa7e2544e357de674ba54f0d84716b05b  postgresql-bdr-9.4.10_bdr1.tar.bz2
6f7fdceb1a5aba3f00894ae88afdf25e5f9c7a0ffc00b11211011a6415ea73639d6a67f516cab66c6487484bab26ded3c93471d6d41ac0d3822926c22274f2ba  initdb.patch
1973863bfc208ce20ca2dd82557ebbd4fcddd1219d6a80f2e83550d0110d39f034cb829cca3ee9208f513a24b032267b94559c740ddddb10a4f24c630194eb5e  postgresql-bdr-osxflags.patch
85b863cfcae1db37ee914721fc9eb7e85ab90a77a65879bccb0bbf34eb044329425fae0411baff1d769a700ca63b4ab4040d145ca90e2d3728c3a74e61d9b4ff  postgresql-bdr.initd
e906e23241bed2624719c1e7e5305695cce1cb520f26f6a4c6bbb994f59db3cc4c63afcfe0e7fb705ad4691dd0a911770012fc16819e4c2686c7029e1e4a4a45  postgresql-bdr.confd
a20f4b2f7f6e2500b6f2b649d8e27a59d82f07768d7a1ee503cea3a88d21d86344f3b7e89ea10f9ce8509b44d71dbee1c9d8ca60ec0c968f36867270120c913f  pgbdr-restore.initd
c14a5684e914abb3b0ee71bbf15eed71a9264deacaa404a6e3af6bfc330d93e7598624d0ed11a94263106cc660f7f54c8ff57e759033cf606a795f69ff6c1c7c  pgbdr-restore.confd"