summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 187162fe03868812a9278e6dfaf95b15fbf0cf5f (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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# $Id: PKGBUILD 230840 2015-02-05 20:20:07Z dan $
# Maintainer: Dan McGee <dan@archlinux.org>
# x32 Maintainer: Fantix King <fantix.king at gmail.com>

_pkgbase=postgresql
pkgbase=libx32-postgresql
pkgname=('libx32-postgresql-libs' 'libx32-postgresql')
pkgver=9.4.5
_majorver=${pkgver%.*}
pkgrel=1.1
arch=('x86_64')
url="http://www.postgresql.org/"
license=('custom:PostgreSQL')
makedepends=('libx32-krb5' 'libx32-libxml2' 'libx32-openssl>=1.0.0' 'libx32-pam')
#makedepends=('libx32-krb5' 'libx32-libxml2' 'binx32-python2' 'binx32-perl' 'binx32-tcl>=8.6.0' 'libx32-openssl>=1.0.0' 'libx32-pam')
source=(http://ftp.postgresql.org/pub/source/v${pkgver}/postgresql-${pkgver}.tar.bz2
        x32.patch
        postgresql-run-socket.patch
        postgresql.pam postgresql.logrotate
        postgresql.service postgresql.tmpfiles.conf postgresql-check-db-dir)
md5sums=('8b2e3472a8dc786649b4d02d02e039a0'
         'e7fcec0b799f776e06c7400fab13302a'
         '170486b408ad3b6b24ae91b9196cb004'
         '96f82c38f3f540b53f3e5144900acf17'
         '951d1306d84450d603c47318833bb99d'
         '29992bcc16479d56b26816f74ec2bb41'
         '4ad974e4659d4474a40c54995ed5a809'
         'eb6a2a084db77e9bb9ebb203b712fae5')
sha256sums=('b87c50c66b6ea42a9712b5f6284794fabad0616e6ae420cf0f10523be6d94a39'
            '15e068dd4896f56eaafd405945c5b57d0b9812e790328d8fc96dc1cbcb3cb10e'
            'f8c444140755e99b1ffd808404bda77c360c2843d13f6270b8dbd067d129b33a'
            '57dfd072fd7ef0018c6b0a798367aac1abb5979060ff3f9df22d1048bb71c0d5'
            'cc766679b3f1dd1e1fe1d4428b747ab44b8778c4127dc011cafd491842756e41'
            'bc7cfd6f762004f8f9952fc501fd4446201f1399a93ccaf6b99d896eede2de06'
            '27f3ef84f59a008ee9a2324730386e11f68a9b10bbcd7ee4bbdbf4693b08d00d'
            'aa3802f39e2ba5cbaf373c7217894e2212e72a33f4247fe2cc5c1bfc6aad1986')

build() {
  cd "${srcdir}/postgresql-${pkgver}"

  export CC="gcc -mx32"
  export CXX="g++ -mx32"
  export PKG_CONFIG_PATH="/usr/libx32/pkgconfig"

  patch -Np1 < ../postgresql-run-socket.patch
  patch -Np1 < ../x32.patch

  ./configure \
    --prefix=/usr \
    --libdir=/usr/libx32 \
    --mandir=/usr/share/man \
    --datadir=/usr/share/postgresql \
    --sysconfdir=/etc \
    --with-gssapi \
    --with-libxml \
    --with-openssl \
    --without-perl \
    --without-python \
    --without-tcl \
    --with-pam \
    --with-system-tzdata=/usr/share/zoneinfo \
    --with-uuid=e2fs \
    --enable-nls \
    --enable-thread-safety

  make world
}

package_libx32-postgresql-libs() {
  pkgdesc="Libraries for use with PostgreSQL (x32 ABI)"
  depends=('libx32-krb5' 'libx32-openssl>=1.0.0' 'libx32-readline>=6.0')

  cd "${srcdir}/postgresql-${pkgver}"

  # install libs and non-server binaries
  for dir in src/interfaces src/bin/pg_config src/bin/pg_dump src/bin/psql src/bin/scripts; do
    make -C ${dir} DESTDIR="${pkgdir}" install
  done

  for _x in ${pkgdir}/usr/bin/*; do mv $_x $_x-x32; done
  rm -rf "${pkgdir}"/usr/{share,include}

  cd src/include

  mkdir -p "${pkgdir}"/usr/include

  # these headers are needed by the public headers of the interfaces
  install -m644 pg_config.h "${pkgdir}/usr/include/pg_config-x32.h"
  # TODO: below?
  install -m644 pg_config_manual.h "${pkgdir}/usr/include/pg_config_manual-x32.h"

  # install license
  install -dm755 "$pkgdir"/usr/share/licenses
  ln -s postgresql-libs "${pkgdir}"/usr/share/licenses/libx32-postgresql-libs
}

package_libx32-postgresql() {
  pkgdesc="A sophisticated object-relational DBMS (x32 ABI)"
  backup=('etc/pam.d/postgresql-x32' 'etc/logrotate.d/postgresql-x32')
  depends=("libx32-postgresql-libs>=${pkgver}" 'libx32-krb5' 'libx32-libxml2' 'libx32-readline>=6.0' 'libx32-openssl>=1.0.0' 'libx32-pam' "${_pkgbase}>=9.3")
  optdepends=('postgresql-old-upgrade: upgrade from previous major version using pg_upgrade')
  options=('staticlibs')
  install=postgresql.install

  cd "${srcdir}/postgresql-${pkgver}"

  # install
  make DESTDIR="${pkgdir}" install
  make -C contrib DESTDIR="${pkgdir}" install
  make -C doc/src/sgml DESTDIR="${pkgdir}" install-man

  # we don't want these, they are in the -libs package
  for dir in src/interfaces src/bin/pg_config src/bin/pg_dump src/bin/psql src/bin/scripts; do
    make -C ${dir} DESTDIR="${pkgdir}" uninstall
  done

  rm -rf "${pkgdir}/usr/share"

  # install license
  install -dm755 "${pkgdir}/usr/share/licenses/"
  ln -s ${_pkgbase} "${pkgdir}/usr/share/licenses/libx32-postgresql"

  # clean up unneeded installed items
  rm -rf "${pkgdir}/usr/include/postgresql-x32/internal"
  rm -rf "${pkgdir}/usr/include/libpq"
  find "${pkgdir}/usr/include" -maxdepth 1 -type f -execdir rm {} +

  install -D -m644 "${srcdir}/postgresql.tmpfiles.conf" \
    "${pkgdir}/usr/lib/tmpfiles.d/postgresql-x32.conf"
  install -D -m644 "${srcdir}/postgresql.service" \
    "${pkgdir}/usr/lib/systemd/system/postgresql-x32.service"
  install -D -m755 "${srcdir}/postgresql-check-db-dir" \
    "${pkgdir}/usr/bin/postgresql-check-db-dir"

  install -D -m644 "${srcdir}/postgresql.pam" \
    "${pkgdir}/etc/pam.d/postgresql-x32"

  for _x in ${pkgdir}/usr/bin/*; do mv $_x $_x-x32; done

  install -D -m644 "${srcdir}/postgresql.logrotate" \
    "${pkgdir}/etc/logrotate.d/postgresql-x32"
}