void-packages/srcpkgs/postgresql12/template
2020-10-10 10:22:16 -04:00

228 lines
7.1 KiB
Bash

# Template file for 'postgresql12'
pkgname=postgresql12
version=12.4
revision=4
wrksrc="postgresql-${version}"
build_style=gnu-configure
make_build_target=world
_major="${version%%.*}"
_prefix="usr/lib/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 libressl-devel libuuid-devel libxslt-devel pam-devel perl
python3-devel readline-devel tcl-devel"
checkdepends="tzdata"
short_desc="Sophisticated open-source Object-Relational DBMS"
maintainer="Piotr Wójcik <chocimier@tlen.pl>"
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=bee93fbe2c32f59419cb162bcc0145c58da9a8644ee154a30b9a5ce47de606cc
conf_files="
/${_prefix}/etc/default/postgresql
/${_prefix}/etc/pam.d/postgresql
/${_prefix}/etc/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=/${_prefix}/etc
--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 ${_prefix}/etc/default postgresql
_substitute ${DESTDIR}/${_prefix}/etc/default/postgresql
vinstall ${FILESDIR}/postgresql.pam 644 ${_prefix}/etc/pam.d postgresql
_substitute ${DESTDIR}/${_prefix}/etc/pam.d/postgresql
vinstall ${DESTDIR}/${_prefix}/share/postgresql/postgresql.conf.sample \
644 ${_prefix}/etc/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}:
}
postgresql12-doc_package() {
short_desc="PostgreSQL documentation"
pkg_install() {
vmove ${_prefix}/share/doc
}
}
postgresql12-libs_package() {
short_desc="PostgreSQL shared libraries"
conflicts="postgresql9.6-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
}
}
postgresql12-libs-devel_package() {
depends="postgresql-libs>=${version}_${revision}"
short_desc="PostgreSQL shared libraries (development files)"
conflicts="postgresql9.6-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
postgresql12-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
}
}
postgresql12-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
}
}
postgresql12-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
postgresql12-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
}
}
postgresql12-contrib_package() {
short_desc="PostgreSQL contributed programs and extensions"
pkg_install() {
make -C contrib install DESTDIR=${PKGDESTDIR}
}
}