# Template file for 'postgresql15' pkgname=postgresql15 version=15.2 revision=1 build_style=gnu-configure make_build_target=world _major="${version%%.*}" _prefix="usr/lib/psql${_major}" _sysconfdir="etc/psql${_major}" configure_args="--with-openssl --with-python --with-pam --enable-thread-safety --with-perl --with-tcl --without-ldap --without-gssapi --without-bonjour --with-libxml --with-libxslt --with-system-tzdata=/usr/share/zoneinfo --enable-nls --with-uuid=e2fs" hostmakedepends="docbook2x gettext flex openjade" makedepends="libfl-devel openssl-devel libuuid-devel libxslt-devel pam-devel perl python3-devel readline-devel tcl-devel" short_desc="Sophisticated open-source Object-Relational DBMS" maintainer="Piotr Wójcik " license="PostgreSQL" homepage="https://www.postgresql.org" changelog="https://www.postgresql.org/docs/current/release-${version//./-}.html" distfiles="https://ftp.postgresql.org/pub/source/v${version}/postgresql-${version}.tar.bz2" checksum=99a2171fc3d6b5b5f56b757a7a3cb85d509a38e4273805def23941ed2b8468c7 make_check=ci-skip # Postgres server can't be run as root conf_files=" /${_sysconfdir}/default/postgresql /${_sysconfdir}/pam.d/postgresql /${_sysconfdir}/postgresql/postgresql.conf " # Create 'postgres' user for the server. system_accounts="postgres" postgres_homedir="/var/lib/postgresql" postgres_shell="/bin/sh" postgres_descr="PostgreSQL database server user" make_dirs=" /var/lib/postgresql 0750 postgres postgres /var/lib/postgresql${_major} 0750 postgres postgres" if [ "$CROSS_BUILD" ]; then configure_args+=" --without-perl --without-python --without-tcl" fi post_patch() { cp "$FILESDIR"/pg_config.sh.in src/common/pg_config.sh.in _substitute src/common/pg_config.sh.in vsed -i -e "s,@XBPS_SYSROOT@,${XBPS_CROSS_BASE%/}," src/common/Makefile } pre_configure() { _style_configure_args="${configure_args}" configure_args=" " for arg in ${_style_configure_args}; do case $arg in --prefix=*|*dir=*) : ;; # skip *) configure_args+=" $arg" esac done configure_args="--prefix=/${_prefix} --sysconfdir=/${_sysconfdir} --includedir=/usr/include ${configure_args}" } post_build() { make -C contrib ${makejobs} } pre_check() { ln -sr tmp_install/${_prefix} /${_prefix%/*} } post_install() { vmkdir usr/share/man cp -r doc/src/sgml/man? ${DESTDIR}/usr/share/man for i in ${DESTDIR}/usr/share/man/*[^3]/*; do mv $i ${i%.*}-${_major}.${i##*.} done vmkdir ${_prefix}/share/doc cp -r doc/src/sgml/html ${DESTDIR}/${_prefix}/share/doc vsv ${pkgname} find "${DESTDIR}/etc/sv" -type f -exec sed -i -e s:@VERSION@:${_major}: -e s:@PREFIX@:${_prefix}: '{}' ';' vlicense COPYRIGHT vinstall ${FILESDIR}/profile.sh 644 etc/profile.d ${pkgname}.sh _substitute ${DESTDIR}/etc/profile.d/${pkgname}.sh vinstall ${FILESDIR}/postgresql.confd 644 ${_sysconfdir}/default postgresql _substitute ${DESTDIR}/${_sysconfdir}/default/postgresql vinstall ${FILESDIR}/postgresql.pam 644 ${_sysconfdir}/pam.d postgresql _substitute ${DESTDIR}/${_sysconfdir}/pam.d/postgresql vinstall ${DESTDIR}/${_prefix}/share/postgresql/postgresql.conf.sample \ 644 ${_sysconfdir}/postgresql postgresql.conf vbin src/common/pg_config.sh vsed -i 's/install_bin = .*/install_bin = install/g' \ ${DESTDIR}/${_prefix}/lib/postgresql/pgxs/src/Makefile.global } _substitute() { sed -i "$1" -e s:@PREFIX@:${_prefix}: -e s:@VERSION@:${_major}: -e s:@FULL_VERSION@:${version}: } postgresql15-doc_package() { short_desc="PostgreSQL documentation" pkg_install() { vmove ${_prefix}/share/doc } } postgresql-libs_package() { short_desc="PostgreSQL shared libraries" conflicts="postgresql9.6-libs>=0 postgresql12-libs>=0 postgresql13-libs>=0 postgresql14-libs>=0" pkg_install() { vmove "${_prefix}/lib/*.so*" for d in $(find ${DESTDIR}/${_prefix}/share/locale \ -type f -name libpq5\*); do mkdir -p ${PKGDESTDIR}/$(dirname ${d#${DESTDIR}}) mv ${d} ${PKGDESTDIR}/$(dirname ${d#${DESTDIR}}) done mv ${PKGDESTDIR}/${_prefix}/lib/* ${PKGDESTDIR}/usr/lib } } postgresql-libs-devel_package() { depends="postgresql-libs>=${version}_${revision} openssl-devel" short_desc="PostgreSQL shared libraries (development files)" conflicts="postgresql9.6-libs-devel>=0 postgresql12-libs-devel>=0 postgresql13-libs-devel>=0 postgresql14-libs-devel>=0" pkg_install() { vmkdir usr/bin vmkdir usr/lib for f in pg_config ecpg; do vmove ${_prefix}/bin/${f} vmove "usr/share/man/man1/$(basename ${f})*" ln -sr "${PKGDESTDIR}/${_prefix}/bin/${f}" "${PKGDESTDIR}/usr/bin" done vmove usr/bin/pg_config.sh vmove usr/include vmove "${_prefix}/lib/*.a" mv "${DESTDIR}/${_prefix}/lib/pkgconfig" "${PKGDESTDIR}/usr/lib" vmove usr/share/man/man3 vmove ${_prefix}/lib/postgresql/pgxs for f in libpq.so libpgtypes.so libecpg_compat.so libecpg.so; do ln -sr "${PKGDESTDIR}/usr/lib/${f}" "${PKGDESTDIR}/${_prefix}/lib" done for d in $(find ${DESTDIR}/${_prefix}/share/locale \ -type f -name pg_config\* -o -name ecpg\*); do mkdir -p ${PKGDESTDIR}/$(dirname ${d#${DESTDIR}}) mv ${d} ${PKGDESTDIR}/$(dirname ${d#${DESTDIR}}) done } } # XXX disabled for now in cross builds. if [ -z "$CROSS_BUILD" ]; then postgresql15-plperl_package() { depends="${sourcepkg}>=${version}_${revision}" short_desc="PL/Perl procedural language for PostgreSQL" pkg_install() { vmove "${_prefix}/lib/postgresql/plperl*" for d in $(find ${DESTDIR}/${_prefix}/share/locale \ -type f -name plperl\*); do mkdir -p ${PKGDESTDIR}/$(dirname ${d#${DESTDIR}}) mv ${d} ${PKGDESTDIR}/$(dirname ${d#${DESTDIR}}) done } } postgresql15-plpython_package() { depends="${sourcepkg}>=${version}_${revision}" short_desc="PL/Python procedural language for PostgreSQL" pkg_install() { vmove "${_prefix}/lib/postgresql/plpython*" for d in $(find ${DESTDIR}/${_prefix}/share/locale \ -type f -name plpython\*); do mkdir -p ${PKGDESTDIR}/$(dirname ${d#${DESTDIR}}) mv ${d} ${PKGDESTDIR}/$(dirname ${d#${DESTDIR}}) done } } postgresql15-pltcl_package() { depends="${sourcepkg}>=${version}_${revision}" short_desc="PL/Tcl procedural language for PostgreSQL" pkg_install() { vmove "${_prefix}/lib/postgresql/pltcl*" for d in $(find ${DESTDIR}/${_prefix}/share/locale \ -type f -name pltcl\*); do mkdir -p ${PKGDESTDIR}/$(dirname ${d#${DESTDIR}}) mv ${d} ${PKGDESTDIR}/$(dirname ${d#${DESTDIR}}) done } } fi # !CROSS_BUILD postgresql15-client_package() { short_desc="Client frontends programs for PostgreSQL" pkg_install() { for f in clusterdb createdb createuser dropdb \ dropuser pg_dump pg_dumpall pg_isready pg_restore psql reindexdb \ vacuumdb; do vmove ${_prefix}/bin/${f} vmove usr/share/man/man1/$(basename ${f})-${_major}.1 done vmove usr/share/man/man7 for d in $(find ${DESTDIR}/${_prefix}/share/locale \ -type f -name pgscripts\* -o \ -name psql\* -o \ -name pg_dump\*); do mkdir -p ${PKGDESTDIR}/$(dirname ${d#${DESTDIR}}) mv ${d} ${PKGDESTDIR}/$(dirname ${d#${DESTDIR}}) done mv ${DESTDIR}/${_prefix}/share/postgresql/psqlrc.* \ ${PKGDESTDIR}/${_prefix}/share vinstall ${FILESDIR}/profile.sh 644 etc/profile.d ${pkgname}.sh _substitute ${PKGDESTDIR}/etc/profile.d/${pkgname}.sh } } postgresql15-contrib_package() { short_desc="PostgreSQL contributed programs and extensions" pkg_install() { make -C contrib install DESTDIR=${PKGDESTDIR} mv ${PKGDESTDIR}/usr/include ${PKGDESTDIR}/${_prefix} } }