# Maintainer: Jesus E. pkgbase=postgresql pkgname=('postgresql-libs' 'postgresql') pkgver=12.4 _debver=$pkgver _debrel=1 _majorver=${pkgver%.*} pkgrel=3 url="https://www.postgresql.org/" arch=('i686' 'x86_64') license=('custom:PostgreSQL') makedepends=('krb5' 'libxml2' 'python' 'tauthon' 'perl' 'tcl>=8.6.0' 'libressl' 'zlib' 'icu' 'libldap' 'quilt') source=(https://ftp.postgresql.org/pub/source/v${pkgver}/postgresql-${pkgver}.tar.bz2 https://repo.hyperbola.info:50000/sources/${pkgbase}/postgresql-12_${_debver}-${_debrel}.debian.tar.xz{,.sig} postgresql-run-socket.patch postgresql-perl-rpath.patch postgresql.logrotate postgresql-check-db-dir postgresql.confd postgresql.initd postgresql.conf postgresql.run postgresql_log.run) sha512sums=('36daf10878ca153370829178786dd6ee366ab4d4d6dc9c527536740fdb14b688ae4c33f850eb4243a7667d23f87e4bfd1ddee0755447ad4f3996e423e391c2f3' 'e53b2af1b8f904efcc28c6723d9752f97079959fb2306f01d777af02ed105967c4b3c89dfa6069daae37830ce77e2db3271bd3c5b75fb85bda76a9b52e2394c3' 'SKIP' '031efe12d18ce386989062327cdbbe611c5ef1f94e4e1bead502304cb3e2d410af533d3c7f1109d24f9da9708214fe32f9a10ba373a3ca8d507bdb521fbb75f7' '38302242b30c01c7981574ed28d9cbd9dc73bf6b56ba3a032afb5d0885ae83e5aa72ce578bf2422214dfa6c46f09d0bdd7cccaeb3c25d58754eb1a34f8bf5615' '9ab4da01337ffbab8faec0e220aaa2a642dbfeccf7232ef2645bdc2177a953f17ee3cc14a4d8f8ebd064e1dae8b3dba6029adbffb8afaabea383963213941ba8' 'eaaccae8dabad67d2bc54f74ec8d3ddb46257369b90080a2860b65d500053db6ace608be4c1b6baaeab4a03245dcbb5215eb41e468acc2304c037f094c2e7819' '839aa9714c8b968d19b1cbeb19a3c561d588d7e6572fc501895423e369ec004256720390760b29347c85de71dccc67596072060975f7af60239b8565068fa2bf' 'd901e05ac8c965c5f8d12e143b94a49b69e941d392a5210df88df6ef0b8fbb02c48e6fb6e68262b1286ef96c5fa0c6a36e0d26cd707475389495a9fc2a6be28d' '7a0cb0f0caeba4f7def60581bdfcb1c852f06512dcd24f1a454e71d7e88596639c004cfe70bf362750715f3d49d3c7f1fb6e59d897eab75566d6e8652ad3c835' 'bb7c35db229d6f7133e8463ebc3fe4f43ddffd5ba0ed89aaecd50e0e28a6f168a0433c5dc3f6a3e22480090c9e304e234b8cad2a51d946533eb6bbfbc64c39fe' 'a0bda24ba021c0a351c8b109651b64b8542236d49b0a19693c0e61d7a33e3eff61297d50639663e212789d1bfeed026b0da3d0db35c89b871746d5ef76670357') validpgpkeys=('C92BAA713B8D53D3CAE63FC9E6974752F9704456') # André Silva prepare() { cd postgresql-${pkgver} if [[ ${pkgver%.*} = ${_debver%.*} ]]; then # Debian patches export QUILT_PATCHES=debian/patches export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index' export QUILT_DIFF_ARGS='--no-timestamps' mv "$srcdir"/debian . # Doesn't apply rm -v debian/patches/50-per-version-dirs.patch || true rm -v debian/patches/51-default-sockets-in-var.patch || true rm -v debian/patches/52-tutorial-README.patch || true rm -v debian/patches/53-pg_service.conf_directory_doc.patch || true rm -v debian/patches/54-debian-alternatives-for-external-tools.patch || true rm -v debian/patches/70-history || true rm -v debian/patches/initdb-startup-message || true rm -v debian/patches/libpgport-pkglibdir || true quilt push -av fi patch -Np1 < $srcdir/postgresql-run-socket.patch patch -p1 < $srcdir/postgresql-perl-rpath.patch } build() { cd postgresql-${pkgver} local options=( --prefix=/usr --mandir=/usr/share/man --datadir=/usr/share/postgresql --sysconfdir=/etc --with-gssapi --with-libxml --with-openssl --with-perl --with-python --with-tcl --without-pam --with-system-tzdata=/usr/share/zoneinfo --with-uuid=e2fs --with-icu --with-ldap --enable-nls --enable-thread-safety --disable-rpath ) # only build plpython3 for now ./configure ${options[@]} \ PYTHON=/usr/bin/python make -C src/pl/plpython all make -C contrib/hstore_plpython all make -C contrib/ltree_plpython all # save plpython3 build and Makefile.global cp -a src/pl/plpython{,3} cp -a contrib/hstore_plpython{,3} cp -a contrib/ltree_plpython{,3} cp -a src/Makefile.global{,.python3} make distclean # regular build with everything ./configure ${options[@]} \ PYTHON=/usr/bin/tauthon make world } package_postgresql-libs() { pkgdesc="Libraries for use with PostgreSQL" depends=('krb5' 'libressl' 'readline>=6.0' 'zlib' 'libldap') provides=('postgresql-client') conflicts=('postgresql-client') cd postgresql-${pkgver} # install license install -Dm 644 COPYRIGHT "${pkgdir}/usr/share/licenses/postgresql-libs/COPYRIGHT" # 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 util in pg_config pg_dump pg_dumpall pg_restore psql \ clusterdb createdb createuser dropdb dropuser pg_isready reindexdb vacuumdb; do install -Dm 644 doc/src/sgml/man1/${util}.1 "${pkgdir}"/usr/share/man/man1/${util}.1 done cd src/include install -d "${pkgdir}"/usr/include/{libpq,postgresql/internal/libpq} # these headers are needed by the public headers of the interfaces install -m 644 pg_config.h "${pkgdir}/usr/include" install -m 644 pg_config_os.h "${pkgdir}/usr/include" install -m 644 pg_config_ext.h "${pkgdir}/usr/include" install -m 644 postgres_ext.h "${pkgdir}/usr/include" install -m 644 libpq/libpq-fs.h "${pkgdir}/usr/include/libpq" install -m 644 pg_config_manual.h "${pkgdir}/usr/include" # these he aders are needed by the not-so-public headers of the interfaces install -m 644 c.h "${pkgdir}/usr/include/postgresql/internal" install -m 644 port.h "${pkgdir}/usr/include/postgresql/internal" install -m 644 postgres_fe.h "${pkgdir}/usr/include/postgresql/internal" install -m 644 libpq/pqcomm.h "${pkgdir}/usr/include/postgresql/internal/libpq" } package_postgresql() { pkgdesc="Sophisticated object-relational DBMS" backup=('etc/logrotate.d/postgresql' 'etc/conf.d/postgresql' 'etc/sv/postgresql/conf') depends=("postgresql-libs>=${pkgver}" 'krb5' 'libxml2' 'readline>=6.0' 'libressl' 'icu' 'libldap') optdepends=('tauthon: for PL/Tauthon support' 'python: for PL/Python support' 'perl: for PL/Perl support' 'tcl: for PL/Tcl support' 'postgresql-old-upgrade: upgrade from previous major version using pg_upgrade' 'logger: message logging support') options=('staticlibs') install=postgresql.install cd postgresql-${pkgver} # install make DESTDIR="${pkgdir}" install make -C contrib DESTDIR="${pkgdir}" install make -C doc/src/sgml DESTDIR="${pkgdir}" install-man # install docs make -C doc/src/sgml DESTDIR="${pkgdir}" install-html chown -R root:root "${pkgdir}/usr/share/doc/postgresql/html" # install plpython3 mv src/Makefile.global src/Makefile.global.save cp src/Makefile.global.python3 src/Makefile.global touch -r src/Makefile.global.save src/Makefile.global make -C src/pl/plpython3 DESTDIR="${pkgdir}" install make -C contrib/hstore_plpython3 DESTDIR="${pkgdir}" install make -C contrib/ltree_plpython3 DESTDIR="${pkgdir}" install # 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 for util in pg_config pg_dump pg_dumpall pg_restore psql \ clusterdb createdb createuser dropdb dropuser pg_isready reindexdb vacuumdb; do rm "${pkgdir}"/usr/share/man/man1/${util}.1 done # install license install -Dm 644 COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgbase}/COPYRIGHT" # clean up unneeded installed items rm -rf "${pkgdir}/usr/include/postgresql/internal" rm -rf "${pkgdir}/usr/include/libpq" find "${pkgdir}/usr/include" -maxdepth 1 -type f -execdir rm {} + install -Dm 755 "${srcdir}/postgresql-check-db-dir" \ "${pkgdir}/usr/bin/postgresql-check-db-dir" install -Dm 644 "${srcdir}/postgresql.logrotate" \ "${pkgdir}/etc/logrotate.d/postgresql" # install OpenRC files install -Dm 644 "${srcdir}/postgresql.confd" \ "${pkgdir}/etc/conf.d/postgresql" install -Dm 755 "${srcdir}/postgresql.initd" \ "${pkgdir}/etc/init.d/postgresql" # install runit files install -Dm 644 "${srcdir}/postgresql.conf" \ "${pkgdir}/etc/sv/postgresql/conf" install -Dm 755 "${srcdir}/postgresql.run" \ "${pkgdir}/etc/sv/postgresql/run" install -Dm 755 "${srcdir}/postgresql_log.run" \ "${pkgdir}/etc/sv/postgresql/log/run" }