# Maintainer: Marc Rechté pkgbase=postgresql11 pkgver=11.22 _majorver=${pkgver%.*} pkgname=("${pkgbase}-libs" "${pkgbase}-docs" "${pkgbase}") pkgrel=1 pkgdesc='Sophisticated object-relational DBMS' url='https://www.postgresql.org/' arch=('x86_64') license=('custom:PostgreSQL') makedepends=('krb5' 'libxml2' 'python' 'tcl>=8.6.0' 'openssl>=1.0.0' 'pam' 'zlib' 'icu' 'systemd' 'libldap' 'clang' ) optdepends=('perl') source=(https://ftp.postgresql.org/pub/source/v${pkgver}/postgresql-${pkgver}.tar.bz2 postgresql-run-socket.patch postgresql-perl-rpath.patch postgresql-command.patch postgresql.service postgresql-check-db-dir postgresql.sysusers postgresql.tmpfiles pgenv.sh) md5sums=('6e7d050f23e35ec20d76297a6d4ce30d' '92249e35353927d9f79df66a4101b3fa' '7d899fe96b0044e120e49bab4205610d' '2c74b38d3ca580733daaf60d7c564792' '77f41e79ec546d40b24a46cd646e3c2f' '848c7c58ac8831fb5323e3446be5afcf' '2050d34e4dfa05f3c6fe4cd7615eaa4b' '9f34d430c5ef0ddca8843b58f71c0b3d' '37bbc58222c61b8e0533eab845ca94f5') prepare() { cd postgresql-${pkgver} patch -p1 < ../postgresql-run-socket.patch patch -p1 < ../postgresql-perl-rpath.patch #patch -p1 < ../postgresql-command.patch } build() { cd postgresql-${pkgver} # removed: --with-libxml, --with-ldap --with-llvm local options=( --prefix=/opt/${pkgbase} --sysconfdir=/etc --with-gssapi --with-openssl # --with-perl --with-python3 --with-tcl --with-pam --with-system-tzdata=/usr/share/zoneinfo --with-uuid=e2fs --with-icu --with-systemd --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/python2 make world } _postgres_check() { make "${1}" || (find . -name regression.diffs | \ while read -r line; do echo "make ${1} failure: ${line}" cat "${line}" done; exit 1) } check() { cd postgresql-${pkgver} _postgres_check check _postgres_check check-world } package_postgresql11-libs() { pkgdesc="Libraries for use with PostgreSQL" depends=('krb5' 'openssl>=1.0.0' 'readline>=6.0' 'zlib' 'libldap') provides=("${pkgbase}-client" 'libpq.so' 'libecpg.so' 'libecpg_compat.so' 'libpgtypes.so') conflicts=("${pkgbase}-client") pushd postgresql-${pkgver} # install license install -Dm 644 COPYRIGHT -t "${pkgdir}/opt/${pkgbase}/share/licenses/${pkgname}" # 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}"/opt/${pkgbase}/share/man/man1/${util}.1 done cd src/include install -d "${pkgdir}"/opt/${pkgbase}/include/{libpq,postgresql/internal/libpq} # these headers are needed by the public headers of the interfaces install -m 644 pg_config.h "${pkgdir}/opt/${pkgbase}/include" install -m 644 pg_config_os.h "${pkgdir}/opt/${pkgbase}/include" install -m 644 pg_config_ext.h "${pkgdir}/opt/${pkgbase}/include" install -m 644 postgres_ext.h "${pkgdir}/opt/${pkgbase}/include" install -m 644 libpq/libpq-fs.h "${pkgdir}/opt/${pkgbase}/include/libpq" install -m 644 pg_config_manual.h "${pkgdir}/opt/${pkgbase}/include" # these he aders are needed by the not-so-public headers of the interfaces install -m 644 c.h "${pkgdir}/opt/${pkgbase}/include/postgresql/internal" install -m 644 port.h "${pkgdir}/opt/${pkgbase}/include/postgresql/internal" install -m 644 postgres_fe.h "${pkgdir}/opt/${pkgbase}/include/postgresql/internal" install -m 644 libpq/pqcomm.h "${pkgdir}/opt/${pkgbase}/include/postgresql/internal/libpq" # this utility is to be sourced in order to find proper libs and bins popd install -m 755 ../pgenv.sh "${pkgdir}/opt/${pkgbase}/bin" } package_postgresql11-docs() { pkgdesc="HTML documentation for PostgreSQL" options=('docs') cd postgresql-${pkgver} install -Dm 644 COPYRIGHT -t "${pkgdir}/opt/${pkgbase}/share/licenses/${pkgname}" make -C doc/src/sgml DESTDIR="${pkgdir}" install-html chown -R root:root "${pkgdir}/opt/${pkgbase}/share/doc/html" # clean up rmdir "${pkgdir}"/opt/${pkgbase}/share/man/man{1,3,7} rmdir "${pkgdir}"/opt/${pkgbase}/share/man } package_postgresql11() { pkgdesc='Sophisticated object-relational DBMS' # backup=('etc/pam.d/postgresql' 'etc/logrotate.d/postgresql') depends=("${pkgbase}-libs>=${pkgver}" 'krb5' 'libxml2' 'readline>=6.0' 'openssl>=1.0.0' 'pam' 'icu' 'systemd-libs' 'libldap' 'llvm-libs' 'libxslt') optdepends=('python2: for PL/Python 2 support' 'python: for PL/Python 3 support' 'perl: for PL/Perl support' 'tcl: for PL/Tcl support') options=('staticlibs') install=postgresql.install pushd postgresql-${pkgver} # install make DESTDIR="${pkgdir}" install make -C contrib DESTDIR="${pkgdir}" install make -C doc/src/sgml DESTDIR="${pkgdir}" install-man # 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}"/opt/${pkgbase}/share/man/man1/${util}.1 done install -Dm 644 COPYRIGHT -t "${pkgdir}/opt/${pkgbase}/share/licenses/${pkgname}" popd install -Dm 755 postgresql-check-db-dir -t "${pkgdir}/opt/${pkgbase}/bin" #install -Dm 644 postgresql.pam "${pkgdir}/etc/pam.d/${pkgname}" install -Dm 644 postgresql.service "${pkgdir}/usr/lib/systemd/system/${pkgname}.service" install -Dm 644 postgresql.sysusers "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf" install -Dm 644 postgresql.tmpfiles "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf" # clean up unneeded installed items rm -rf "${pkgdir}/opt/${pkgbase}/include/internal" rm -rf "${pkgdir}/opt/${pkgbase}/include/informix" rm -rf "${pkgdir}/opt/${pkgbase}/include/libpq" find "${pkgdir}//opt/${pkgbase}/include" -maxdepth 1 -type f -execdir rm {} + rmdir "${pkgdir}/opt/${pkgbase}/share/doc/html" } # vim: ts=2 sw=2 et: