archrelease: copy trunk to extra-x86_64
[arch-packages.git] / postgresql / trunk / PKGBUILD
blob6b7b17c330955f86855325d402ed217d72e6fb99
1 # Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
2 # Maintainer: Dan McGee <dan@archlinux.org>
4 pkgbase=postgresql
5 pkgname=('postgresql-libs' 'postgresql-docs' 'postgresql')
6 pkgver=13.4
7 _majorver=${pkgver%.*}
8 pkgrel=6
9 pkgdesc='Sophisticated object-relational DBMS'
10 url='https://www.postgresql.org/'
11 arch=('x86_64')
12 license=('custom:PostgreSQL')
13 makedepends=('krb5' 'libxml2' 'python' 'python2' 'perl' 'tcl>=8.6.0' 'openssl>=1.0.0'
14              'pam' 'zlib' 'icu' 'systemd' 'libldap' 'llvm' 'clang' 'libxslt')
15 source=(https://ftp.postgresql.org/pub/source/v${pkgver}/postgresql-${pkgver}.tar.bz2
16         postgresql-run-socket.patch
17         postgresql-perl-rpath.patch
18         postgresql.pam
19         postgresql.logrotate
20         postgresql.service
21         postgresql-check-db-dir
22         postgresql.sysusers
23         postgresql.tmpfiles)
24 sha256sums=('ea93e10390245f1ce461a54eb5f99a48d8cabd3a08ce4d652ec2169a357bc0cd'
25             '02ffb53b0a5049233f665c873b96264db77daab30e5a2194d038202d815a8e6a'
26             'af6186d40128e043f333da4591455bf62b7c96e80214835f5c8c60b635ea9afb'
27             '57dfd072fd7ef0018c6b0a798367aac1abb5979060ff3f9df22d1048bb71c0d5'
28             '6abb842764bbed74ea4a269d24f1e73d1c0b1d8ecd6e2e6fb5fb10590298605e'
29             '25fb140b90345828dc01a4f286345757e700a47178bab03d217a7a5a79105b57'
30             '7db9626c322928b2465aa126b48ba7f0eebd366bf2aa19c9c0a92b488cb469c5'
31             '7fa8f0ef3f9d40abd4749cc327c2f52478cb6dfb6e2405bd0279c95e9ff99f12'
32             '4a4c0bb9ceb156cc47e9446d8393d1f72b4fe9ea1d39ba17213359df9211da57')
33 b2sums=('e16684ef59f213d23366e8d18c4bf6f81d6e2eac8e940449fee1ef6b150e7ff7d3dce8831b318d1fd3f72d642110576ebc7bd981185a39f19fea6357c58be170'
34         '71dc1b4e41294fd235db05317c991d42de082c49d38a2f97d1394572a93a4aa77f42ec29b4e6cf0a17adb3a4471afcb1e2464870f2b9e847906bf49541763a53'
35         '5135c5f9dafe427de8d3740d4a67c6dba2869be47dc52b4190b8aa1148e702992fde1821371b68e93b224f5805f697d490ea28ec80d7ce55e5a224551b0a6247'
36         '3eab84d332d96678fe6e435ee243c8f1a82b838f601d61d3604d11e918aed7a62202edca5e476c4b9031ed284570e6fcd6c659cfdbd9624aa0019d3233755f81'
37         '2209b7550acad7955102ec6922754b4046b2a2ad2a7e1cfb2cc4053c0705abac7aa7d7968eab617f50894797d06345f51c9a669926bd2a77dcf688206a2027e0'
38         'a4255df47b7ac1418d20aa73aa0f6e70c7952a10d706e5523043c48b2c3b6d8e39838049dfcc826913cd0f2c06502561d1abe8b19cce7071db66139ae93a37bf'
39         '2eaf8867cc71b8e838925e1e1e2c37b5edd69c3fe7c144410a8683662ba0c342122803217d436d808e18826d28da352978e5d15dd1bc91b6b44dbaf4cfcd4d51'
40         '5e9cba2f45604db83eb77c7bbb54bc499a38274be6cd97abb056c9bdf18e637a8ac354e18f41f614f7e1a2d6f13c2a0b562ab0aaebf9447cf5eb2d60e6501e12'
41         '8a8e5ec24ea338b2b51b8d2be5a336ac8d4cc6b25200ed0f0d564df9942997478df0c54da2fac7b27d677774a34398f69047eecd0f97bdc0df8fe50a1b5ed74d')
43 prepare() {
44   cd postgresql-${pkgver}
45   patch -p1 < ../postgresql-run-socket.patch
46   patch -p1 < ../postgresql-perl-rpath.patch
49 build() {
50   cd postgresql-${pkgver}
51   local options=(
52     --prefix=/usr
53     --mandir=/usr/share/man
54     --datadir=/usr/share/postgresql
55     --sysconfdir=/etc
56     --with-gssapi
57     --with-libxml
58     --with-openssl
59     --with-perl
60     --with-python
61     --with-tcl
62     --with-pam
63     --with-system-tzdata=/usr/share/zoneinfo
64     --with-uuid=e2fs
65     --with-icu
66     --with-systemd
67     --with-ldap
68     --with-llvm
69     --with-libxslt
70     --enable-nls
71     --enable-thread-safety
72     --disable-rpath
73   )
75   # only build plpython3 for now
76   ./configure "${options[@]}" \
77     PYTHON=/usr/bin/python
78   make -C src/pl/plpython all
79   make -C contrib/hstore_plpython all
80   make -C contrib/ltree_plpython all
82   # save plpython3 build and Makefile.global
83   cp -a src/pl/plpython{,3}
84   cp -a contrib/hstore_plpython{,3}
85   cp -a contrib/ltree_plpython{,3}
86   cp -a src/Makefile.global{,.python3}
87   make distclean
89   # regular build with everything
90   ./configure "${options[@]}" \
91     PYTHON=/usr/bin/python2
92   make world
95 _postgres_check() {
96   make "${1}" || (find . -name regression.diffs | \
97     while read -r line; do
98       echo "make ${1} failure: ${line}"
99       cat "${line}"
100     done; exit 1)
103 check() {
104   cd postgresql-${pkgver}
105   _postgres_check check
106   _postgres_check check-world
109 package_postgresql-libs() {
110   pkgdesc="Libraries for use with PostgreSQL"
111   depends=('krb5' 'openssl>=1.0.0' 'readline>=6.0' 'zlib' 'libldap')
112   provides=('postgresql-client' 'libpq.so' 'libecpg.so' 'libecpg_compat.so' 'libpgtypes.so')
113   conflicts=('postgresql-client')
115   cd postgresql-${pkgver}
117   # install license
118   install -Dm 644 COPYRIGHT -t "${pkgdir}/usr/share/licenses/${pkgname}"
120   # install libs and non-server binaries
121   for dir in src/interfaces src/bin/pg_config src/bin/pg_dump src/bin/psql src/bin/scripts; do
122     make -C ${dir} DESTDIR="${pkgdir}" install
123   done
125   for util in pg_config pg_dump pg_dumpall pg_restore psql \
126       clusterdb createdb createuser dropdb dropuser pg_isready reindexdb vacuumdb; do
127     install -Dm 644 doc/src/sgml/man1/${util}.1 "${pkgdir}"/usr/share/man/man1/${util}.1
128   done
130   cd src/include
132   install -d "${pkgdir}"/usr/include/{libpq,postgresql/internal/libpq}
134   # these headers are needed by the public headers of the interfaces
135   install -m 644 pg_config.h "${pkgdir}/usr/include"
136   install -m 644 pg_config_os.h "${pkgdir}/usr/include"
137   install -m 644 pg_config_ext.h "${pkgdir}/usr/include"
138   install -m 644 postgres_ext.h "${pkgdir}/usr/include"
139   install -m 644 libpq/libpq-fs.h "${pkgdir}/usr/include/libpq"
140   install -m 644 pg_config_manual.h "${pkgdir}/usr/include"
142   # these he aders are needed by the not-so-public headers of the interfaces
143   install -m 644 c.h "${pkgdir}/usr/include/postgresql/internal"
144   install -m 644 port.h "${pkgdir}/usr/include/postgresql/internal"
145   install -m 644 postgres_fe.h "${pkgdir}/usr/include/postgresql/internal"
146   install -m 644 libpq/pqcomm.h "${pkgdir}/usr/include/postgresql/internal/libpq"
149 package_postgresql-docs() {
150   pkgdesc="HTML documentation for PostgreSQL"
151   options=('docs')
153   cd postgresql-${pkgver}
155   install -Dm 644 COPYRIGHT -t "${pkgdir}/usr/share/licenses/${pkgname}"
157   make -C doc/src/sgml DESTDIR="${pkgdir}" install-html
158   chown -R root:root "${pkgdir}/usr/share/doc/postgresql/html"
160   # clean up
161   rmdir "${pkgdir}"/usr/share/man/man{1,3,7}
162   rmdir "${pkgdir}"/usr/share/man
165 package_postgresql() {
166   pkgdesc='Sophisticated object-relational DBMS'
167   backup=('etc/pam.d/postgresql' 'etc/logrotate.d/postgresql')
168   depends=("postgresql-libs>=${pkgver}" 'krb5' 'libxml2' 'readline>=6.0'
169            'openssl>=1.0.0' 'pam' 'icu' 'systemd-libs' 'libldap' 'llvm-libs' 'libxslt')
170   optdepends=('python2: for PL/Python 2 support'
171               'python: for PL/Python 3 support'
172               'perl: for PL/Perl support'
173               'tcl: for PL/Tcl support'
174               'postgresql-old-upgrade: upgrade from previous major version using pg_upgrade'
175               'logrotate: rotates system logs automatically')
176   options=('staticlibs')
177   install=postgresql.install
179   cd postgresql-${pkgver}
181   # install
182   make DESTDIR="${pkgdir}" install
183   make -C contrib DESTDIR="${pkgdir}" install
184   make -C doc/src/sgml DESTDIR="${pkgdir}" install-man
186   # install plpython3
187   mv src/Makefile.global src/Makefile.global.save
188   cp src/Makefile.global.python3 src/Makefile.global
189   touch -r src/Makefile.global.save src/Makefile.global
190   make -C src/pl/plpython3 DESTDIR="${pkgdir}" install
191   make -C contrib/hstore_plpython3 DESTDIR="${pkgdir}" install
192   make -C contrib/ltree_plpython3 DESTDIR="${pkgdir}" install
194   # we don't want these, they are in the -libs package
195   for dir in src/interfaces src/bin/pg_config src/bin/pg_dump src/bin/psql src/bin/scripts; do
196     make -C ${dir} DESTDIR="${pkgdir}" uninstall
197   done
198   for util in pg_config pg_dump pg_dumpall pg_restore psql \
199       clusterdb createdb createuser dropdb dropuser pg_isready reindexdb vacuumdb; do
200     rm "${pkgdir}"/usr/share/man/man1/${util}.1
201   done
203   install -Dm 644 COPYRIGHT -t "${pkgdir}/usr/share/licenses/${pkgname}"
205   cd "${srcdir}"
206   install -Dm 755 postgresql-check-db-dir -t "${pkgdir}/usr/bin"
208   install -Dm 644 ${pkgname}.pam "${pkgdir}/etc/pam.d/${pkgname}"
209   install -Dm 644 ${pkgname}.logrotate "${pkgdir}/etc/logrotate.d/${pkgname}"
211   install -Dm 644 ${pkgname}.service -t "${pkgdir}/usr/lib/systemd/system"
212   install -Dm 644 ${pkgname}.sysusers "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf"
213   install -Dm 644 ${pkgname}.tmpfiles "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf"
215   # clean up unneeded installed items
216   rm -rf "${pkgdir}/usr/include/postgresql/internal"
217   rm -rf "${pkgdir}/usr/include/libpq"
218   find "${pkgdir}/usr/include" -maxdepth 1 -type f -execdir rm {} +
219   rmdir "${pkgdir}/usr/share/doc/postgresql/html"
222 # vim: ts=2 sw=2 et: