archrelease: copy trunk to extra-x86_64
[arch-packages.git] / postgresql / trunk / PKGBUILD
blob40c6f736cab6fb9b413311c15e88441899926150
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=15.3
7 _majorver=${pkgver%.*}
8 pkgrel=1
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' 'perl' 'tcl>=8.6.0' 'openssl>=1.0.0'
14              'pam' 'zlib' 'icu' 'systemd' 'libldap' 'llvm' 'clang' 'libxslt'
15              'util-linux')
16 source=(https://ftp.postgresql.org/pub/source/v${pkgver}/postgresql-${pkgver}.tar.bz2
17         postgresql-run-socket.patch
18         postgresql-perl-rpath.patch
19         postgresql.pam
20         postgresql.logrotate
21         postgresql.service
22         postgresql-check-db-dir
23         postgresql.sysusers
24         postgresql.tmpfiles)
25 md5sums=('7cb75773ff8fbe533701562c3278206b'
26          '14674b7e9a224975ea70e19359682142'
27          '297acc9145b94143e74c93f5ede34856'
28          '96f82c38f3f540b53f3e5144900acf17'
29          'd28e443f9f65a5712c52018b84e27137'
30          '0418d1b78f15b969c1575657d47ab130'
31          '7ac75a6797737ef3e628c0278aaae024'
32          '2050d34e4dfa05f3c6fe4cd7615eaa4b'
33          '02d017978f0bba21f455feceb3f0a45a')
34 sha256sums=('ffc7d4891f00ffbf5c3f4eab7fbbced8460b8c0ee63c5a5167133b9e6599d932'
35             '1c3f7ba96400cf5064093f8a839df9076eaa064df020e6ec9c5e7ab8b6d527c6'
36             'aee0792a7e0490810aa1e15dbfd5b45842780d864de6971926b362242b8d7cf0'
37             '57dfd072fd7ef0018c6b0a798367aac1abb5979060ff3f9df22d1048bb71c0d5'
38             '6abb842764bbed74ea4a269d24f1e73d1c0b1d8ecd6e2e6fb5fb10590298605e'
39             '25fb140b90345828dc01a4f286345757e700a47178bab03d217a7a5a79105b57'
40             'a5d5fe94da6df6e9824db1dba7ad3bb85761f1356e627784fecec7caae0a87f0'
41             '7fa8f0ef3f9d40abd4749cc327c2f52478cb6dfb6e2405bd0279c95e9ff99f12'
42             '4a4c0bb9ceb156cc47e9446d8393d1f72b4fe9ea1d39ba17213359df9211da57')
43 b2sums=('4d2e79a9cb21faf47be963e31b1a8ccc9ae205b5836dfbf8ea426229a31dc63f40cd0280108abfa0553affe692c42137f7ad4e3bd1d269298689fee82c5dbb89'
44         'd7a9d4d8281c5cdf642b5d6f7ebb03bdde00afc520bee4cac9fd18a2c25e4bc0aa59f3c3c9f44c257860e2560d126646f2ba81693f966fe93eb4e041adbb0b88'
45         '5d94b9565506a0ee1029595ff36e0052727174a9bab2a878a33985031b855c6052f579abdab242dad3a265d07203d800305a795b0827f2b3a4171f2a49c80a17'
46         '3eab84d332d96678fe6e435ee243c8f1a82b838f601d61d3604d11e918aed7a62202edca5e476c4b9031ed284570e6fcd6c659cfdbd9624aa0019d3233755f81'
47         '2209b7550acad7955102ec6922754b4046b2a2ad2a7e1cfb2cc4053c0705abac7aa7d7968eab617f50894797d06345f51c9a669926bd2a77dcf688206a2027e0'
48         'a4255df47b7ac1418d20aa73aa0f6e70c7952a10d706e5523043c48b2c3b6d8e39838049dfcc826913cd0f2c06502561d1abe8b19cce7071db66139ae93a37bf'
49         '1452d612f396d08ba1af33331541dd475826ca0f8fedc15ff8f155ba7afe891a8a3d4fd69336e003ff8d6740ad8da4625a70540fc5b1bbe4df9c689b086bfd24'
50         '5e9cba2f45604db83eb77c7bbb54bc499a38274be6cd97abb056c9bdf18e637a8ac354e18f41f614f7e1a2d6f13c2a0b562ab0aaebf9447cf5eb2d60e6501e12'
51         '8a8e5ec24ea338b2b51b8d2be5a336ac8d4cc6b25200ed0f0d564df9942997478df0c54da2fac7b27d677774a34398f69047eecd0f97bdc0df8fe50a1b5ed74d')
53 # Upstream provides md5 and sha256
55 prepare() {
56   cd postgresql-${pkgver}
57   patch -p1 < ../postgresql-run-socket.patch
58   patch -p1 < ../postgresql-perl-rpath.patch
61 build() {
62   cd postgresql-${pkgver}
63   local configure_options=(
64     --prefix=/usr
65     --mandir=/usr/share/man
66     --datadir=/usr/share/postgresql
67     --sysconfdir=/etc
68     --with-gssapi
69     --with-libxml
70     --with-openssl
71     --with-perl
72     --with-python
73     --with-tcl
74     --with-pam
75     --with-readline
76     --with-system-tzdata=/usr/share/zoneinfo
77     --with-uuid=e2fs
78     --with-icu
79     --with-systemd
80     --with-ldap
81     --with-llvm
82     --with-libxslt
83     --with-lz4
84     --with-zstd
85     --enable-nls
86     --enable-thread-safety
87     --disable-rpath
88   )
90   # Fix static libs
91   CFLAGS+=" -ffat-lto-objects"
93   ./configure "${configure_options[@]}"
94   make world
97 _postgres_check() {
98   make "${1}" || (find . -name regression.diffs | \
99     while read -r line; do
100       echo "make ${1} failure: ${line}"
101       cat "${line}"
102     done; exit 1)
105 check() {
106   cd postgresql-${pkgver}
107   _postgres_check check
108   _postgres_check check-world
111 package_postgresql-libs() {
112   pkgdesc="Libraries for use with PostgreSQL"
113   depends=('krb5' 'openssl>=1.0.0' 'readline>=6.0' 'zlib' 'libldap')
114   provides=('postgresql-client' 'libpq.so' 'libecpg.so' 'libecpg_compat.so' 'libpgtypes.so')
115   conflicts=('postgresql-client')
117   cd postgresql-${pkgver}
119   # install license
120   install -Dm 644 COPYRIGHT -t "${pkgdir}/usr/share/licenses/${pkgname}"
122   # install libs and non-server binaries
123   for dir in src/interfaces src/bin/pg_config src/bin/pg_dump src/bin/psql src/bin/scripts; do
124     make -C ${dir} DESTDIR="${pkgdir}" install
125   done
127   for util in pg_config pg_dump pg_dumpall pg_restore psql \
128       clusterdb createdb createuser dropdb dropuser pg_isready reindexdb vacuumdb; do
129     install -Dm 644 doc/src/sgml/man1/${util}.1 "${pkgdir}"/usr/share/man/man1/${util}.1
130   done
132   cd src/include
134   install -d "${pkgdir}"/usr/include/{libpq,postgresql/internal/libpq}
136   # these headers are needed by the public headers of the interfaces
137   install -m 644 pg_config.h "${pkgdir}/usr/include"
138   install -m 644 pg_config_os.h "${pkgdir}/usr/include"
139   install -m 644 pg_config_ext.h "${pkgdir}/usr/include"
140   install -m 644 postgres_ext.h "${pkgdir}/usr/include"
141   install -m 644 libpq/libpq-fs.h "${pkgdir}/usr/include/libpq"
142   install -m 644 pg_config_manual.h "${pkgdir}/usr/include"
144   # these he aders are needed by the not-so-public headers of the interfaces
145   install -m 644 c.h "${pkgdir}/usr/include/postgresql/internal"
146   install -m 644 port.h "${pkgdir}/usr/include/postgresql/internal"
147   install -m 644 postgres_fe.h "${pkgdir}/usr/include/postgresql/internal"
148   install -m 644 libpq/pqcomm.h "${pkgdir}/usr/include/postgresql/internal/libpq"
151 package_postgresql-docs() {
152   pkgdesc="HTML documentation for PostgreSQL"
153   options+=('docs')
155   cd postgresql-${pkgver}
157   install -Dm 644 COPYRIGHT -t "${pkgdir}/usr/share/licenses/${pkgname}"
159   make -C doc/src/sgml DESTDIR="${pkgdir}" install-html
160   chown -R root:root "${pkgdir}/usr/share/doc/postgresql/html"
162   # clean up
163   rmdir "${pkgdir}"/usr/share/man/man{1,3,7}
164   rmdir "${pkgdir}"/usr/share/man
167 package_postgresql() {
168   pkgdesc='Sophisticated object-relational DBMS'
169   backup=('etc/pam.d/postgresql' 'etc/logrotate.d/postgresql')
170   depends=("postgresql-libs>=${pkgver}" 'krb5' 'libxml2' 'readline>=6.0'
171            'openssl>=1.0.0' 'pam' 'icu' 'systemd-libs' 'libldap' 'llvm-libs'
172            'libxslt' 'lz4' 'zstd')
173   optdepends=('python: for PL/Python 3 support'
174               'perl: for PL/Perl support'
175               'tcl: for PL/Tcl support'
176               'postgresql-old-upgrade: upgrade from previous major version using pg_upgrade'
177               'logrotate: rotates system logs automatically')
178   options+=('staticlibs')
179   install=postgresql.install
181   cd postgresql-${pkgver}
183   # install
184   make DESTDIR="${pkgdir}" install
185   make -C contrib DESTDIR="${pkgdir}" install
186   make -C doc/src/sgml DESTDIR="${pkgdir}" install-man
188   # we don't want these, they are in the -libs package
189   for dir in src/interfaces src/bin/pg_config src/bin/pg_dump src/bin/psql src/bin/scripts; do
190     make -C ${dir} DESTDIR="${pkgdir}" uninstall
191   done
192   for util in pg_config pg_dump pg_dumpall pg_restore psql \
193       clusterdb createdb createuser dropdb dropuser pg_isready reindexdb vacuumdb; do
194     rm "${pkgdir}"/usr/share/man/man1/${util}.1
195   done
197   install -Dm 644 COPYRIGHT -t "${pkgdir}/usr/share/licenses/${pkgname}"
199   cd "${srcdir}"
200   install -Dm 755 postgresql-check-db-dir -t "${pkgdir}/usr/bin"
202   install -Dm 644 ${pkgname}.pam "${pkgdir}/etc/pam.d/${pkgname}"
203   install -Dm 644 ${pkgname}.logrotate "${pkgdir}/etc/logrotate.d/${pkgname}"
205   install -Dm 644 ${pkgname}.service -t "${pkgdir}/usr/lib/systemd/system"
206   install -Dm 644 ${pkgname}.sysusers "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf"
207   install -Dm 644 ${pkgname}.tmpfiles "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf"
209   # clean up unneeded installed items
210   rm -rf "${pkgdir}/usr/include/postgresql/internal"
211   rm -rf "${pkgdir}/usr/include/libpq"
212   find "${pkgdir}/usr/include" -maxdepth 1 -type f -execdir rm {} +
213   rmdir "${pkgdir}/usr/share/doc/postgresql/html"
216 # vim:set sw=2 sts=-1 et: