aboutsummaryrefslogtreecommitdiffstats
path: root/main/postgresql/APKBUILD
blob: d4552e365b36aa8c2cba95906ceafb67d07771b4 (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
115
116
117
118
119
120
121
122
123
124
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=postgresql
pkgver=9.4.1
pkgrel=1
pkgdesc="A sophisticated object-relational DBMS"
url="http://www.postgresql.org/"
arch="all"
license="BSD"
depends="postgresql-client"
install="$pkgname.pre-upgrade"
depends_dev="readline-dev openssl-dev zlib-dev libxml2-dev"
makedepends="$depends_dev"
subpackages="libpq $pkgname-dev $pkgname-doc $pkgname-dbg $pkgname-client
	$pkgname-contrib"
patches="initdb.patch"
source="ftp://ftp.$pkgname.org/pub/source/v$pkgver/$pkgname-$pkgver.tar.bz2
	$patches
	$pkgname.initd
	$pkgname.confd
	pg-restore.initd
	pg-restore.confd
	"

_builddir="$srcdir"/$pkgname-$pkgver
prepare() {
	cd "$_builddir"
	for i in $patches; do
		msg $i
		patch -p1 -i "$srcdir"/$i || return 1
	done
	# sanity check of conf.d
	(
	. "$srcdir"/postgresql.confd
	_datadir=/var/lib/postgresql/${pkgver%.*}/data
	if [ "$_datadir" != "$PGDATA" ]; then
		die "PGDATA is $PGDATA while $_datadir is expected"
	fi
	) || return 1
}

build() {
	cd "$_builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--mandir=/usr/share/man \
		--with-openssl \
		|| return 1

	make world || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install install-docs || return 1

	install -D -m755 "$srcdir"/postgresql.initd \
		"$pkgdir"/etc/init.d/postgresql || return 1
	install -D -m644 "$srcdir"/postgresql.confd \
		"$pkgdir"/etc/conf.d/postgresql || return 1 
	install -D -m755 "$srcdir"/pg-restore.initd \
		"$pkgdir"/etc/init.d/pg-restore || return 1
	install -D -m644 "$srcdir"/pg-restore.confd \
		"$pkgdir"/etc/conf.d/pg-restore || return 1
}

libpq() {
	depends=
	pkgdesc="PostgreSQL libraries"
	mkdir -p "$subpkgdir"/usr/bin
	mkdir -p "$subpkgdir"/usr/lib/pkgconfig
	mkdir -p "$subpkgdir"/usr/include/postgresql
	mv "$pkgdir"/usr/bin/pg_config "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/include/libpq-events.h "$subpkgdir"/usr/include
	mv "$pkgdir"/usr/include/libpq-fe.h "$subpkgdir"/usr/include
	mv "$pkgdir"/usr/include/postgresql/internal "$subpkgdir"/usr/include/postgresql/
	mv "$pkgdir"/usr/include/libpq-events.h "$subpkgdir"/usr/include/
	mv "$pkgdir"/usr/include/libpq-fe.h "$subpkgdir"/usr/include/
	mv "$pkgdir"/usr/include/libpq "$subpkgdir"/usr/include/
	mv "$pkgdir"/usr//include/pg_config.h "$subpkgdir"/usr/include/
	mv "$pkgdir"/usr/include/pg_config_ext.h "$subpkgdir"/usr/include/
	mv "$pkgdir"/usr/include/pg_config_manual.h "$subpkgdir"/usr/include/
	mv "$pkgdir"/usr/include/pg_config_os.h "$subpkgdir"/usr/include/
	mv "$pkgdir"/usr/include/postgres_ext.h "$subpkgdir"/usr/include/
	mv "$pkgdir"/usr/lib/libpq.a "$subpkgdir"/usr/lib/
	mv "$pkgdir"/usr/lib/libpq.so* "$subpkgdir"/usr/lib/
	mv "$pkgdir"/usr/lib/libpqcommon.a "$subpkgdir"/usr/lib/
	mv "$pkgdir"/usr/lib/libpqport.a "$subpkgdir"/usr/lib/
	mv "$pkgdir"/usr/lib/pkgconfig/libpq.pc "$subpkgdir"/usr/lib/pkgconfig/
}

client() {
	depends=
	pkgdesc="PostgreSQL client"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/psql "$subpkgdir"/usr/bin/
}

contrib() {
	depends=
	pkgdesc="Extension modules distributed with PostgreSQL"
	cd "$_builddir"
	make DESTDIR="$subpkgdir" -C contrib install || return 1
}

md5sums="2cf30f50099ff1109d0aa517408f8eff  postgresql-9.4.1.tar.bz2
00f0fc07fb8447f7e174c4cee0661722  initdb.patch
901e76a1b9eedd08893f1aee23637f16  postgresql.initd
199747784fcba0a92e55283b90993d78  postgresql.confd
d2a51db4436e550d56bb1e96699faef4  pg-restore.initd
bf45384752b320b369f1425939763178  pg-restore.confd"
sha256sums="29ddb77c820095b8f52e5455e9c6c6c20cf979b0834ed1986a8857b84888c3a6  postgresql-9.4.1.tar.bz2
36a65229bf31b20a95ff2e2cac1a6ece0c61afdcd0b544759ad12f34d1b98a39  initdb.patch
c173ffd6c3ce4348fdcee8c8511a2e09af3bed350a3cdef6cadc1700e79063b4  postgresql.initd
70ac7bf24556c16e6324b4efe76fba425bb09a2f7e74afbb5f988333eb8df724  postgresql.confd
d73701e9a5fff2d7088ee50d7c7fc8a2fa19f651237d8b880c579e0e09515609  pg-restore.initd
31414d8b57c4cd2116b6014de3f1329875151910753fbd616daec4554866d02f  pg-restore.confd"
sha512sums="a97ff354a9c1e8238b8220542d665cee7707370eddedd3d990e17755feadd0e22148b502724ebb0b355496649d5de7efe598b346bc570a1c9ca885314d8fe873  postgresql-9.4.1.tar.bz2
6f7fdceb1a5aba3f00894ae88afdf25e5f9c7a0ffc00b11211011a6415ea73639d6a67f516cab66c6487484bab26ded3c93471d6d41ac0d3822926c22274f2ba  initdb.patch
861e4f5091cb2b3c80ce0afddb09275ed7e130c717235cdb7a3e58599424f13c11855e158e584b7342df18d47f7a7d71e945b8899337f82a3ea814a11fff39c0  postgresql.initd
e906e23241bed2624719c1e7e5305695cce1cb520f26f6a4c6bbb994f59db3cc4c63afcfe0e7fb705ad4691dd0a911770012fc16819e4c2686c7029e1e4a4a45  postgresql.confd
e7f8e08edc54c54c513786f8ea34cb6deac61106cff8004fbe56b9b32b22a4d5acdff256e864ef242b91d7704595fd9ec27ccbcef70da5d5c85f049d92304bf2  pg-restore.initd
c14a5684e914abb3b0ee71bbf15eed71a9264deacaa404a6e3af6bfc330d93e7598624d0ed11a94263106cc660f7f54c8ff57e759033cf606a795f69ff6c1c7c  pg-restore.confd"