260 lines
9.1 KiB
Bash
260 lines
9.1 KiB
Bash
# Template file for 'postgresql15'
|
|
pkgname=postgresql15
|
|
version=15.7
|
|
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 <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=a46fe49485ab6385e39dabbbb654f5d3049206f76cd695e224268729520998f7
|
|
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
|
|
"
|
|
alternatives="
|
|
postgresql:/usr/bin/initdb:/usr/lib/psql15/bin/initdb
|
|
postgresql:/usr/bin/pg_amchec:/usr/lib/psql15/bin/pg_amcheck
|
|
postgresql:/usr/bin/pg_archivecleanup:/usr/lib/psql15/bin/pg_archivecleanup
|
|
postgresql:/usr/bin/pg_basebackup:/usr/lib/psql15/bin/pg_basebackup
|
|
postgresql:/usr/bin/pg_checksums:/usr/lib/psql15/bin/pg_checksums
|
|
postgresql:/usr/bin/pg_controldata:/usr/lib/psql15/bin/pg_controldata
|
|
postgresql:/usr/bin/pg_ctl:/usr/lib/psql15/bin/pg_ctl
|
|
postgresql:/usr/bin/pg_receivewal:/usr/lib/psql15/bin/pg_receivewal
|
|
postgresql:/usr/bin/pg_recvlogical:/usr/lib/psql15/bin/pg_recvlogical
|
|
postgresql:/usr/bin/pg_resetwal:/usr/lib/psql15/bin/pg_resetwal
|
|
postgresql:/usr/bin/pg_rewind:/usr/lib/psql15/bin/pg_rewind
|
|
postgresql:/usr/bin/pg_test_fsync:/usr/lib/psql15/bin/pg_test_fsync
|
|
postgresql:/usr/bin/pg_test_timing:/usr/lib/psql15/bin/pg_test_timing
|
|
postgresql:/usr/bin/pg_upgrade:/usr/lib/psql15/bin/pg_upgrade
|
|
postgresql:/usr/bin/pg_verifybackup:/usr/lib/psql15/bin/pg_verifybackup
|
|
postgresql:/usr/bin/pg_waldump:/usr/lib/psql15/bin/pg_waldump
|
|
postgresql:/usr/bin/pgbench:/usr/lib/psql15/bin/pgbench
|
|
postgresql:/usr/bin/postgres:/usr/lib/psql15/bin/postgres
|
|
postgresql:/usr/bin/postmaster:/usr/lib/psql15/bin/postmaster
|
|
"
|
|
|
|
# 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}/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
|
|
}
|
|
}
|
|
|
|
postgresql15-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() {
|
|
# postgresql-libs
|
|
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
|
|
rm -r "${PKGDESTDIR}/${_prefix}"
|
|
# postgresql-libs-devel
|
|
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"
|
|
alternatives="
|
|
postgresql-client:/usr/bin/clusterdb:/usr/lib/psql15/bin/clusterdb
|
|
postgresql-client:/usr/bin/createdb:/usr/lib/psql15/bin/createdb
|
|
postgresql-client:/usr/bin/createuser:/usr/lib/psql15/bin/createuser
|
|
postgresql-client:/usr/bin/dropdb:/usr/lib/psql15/bin/dropdb
|
|
postgresql-client:/usr/bin/dropuser:/usr/lib/psql15/bin/dropuser
|
|
postgresql-client:/usr/bin/pg_dump:/usr/lib/psql15/bin/pg_dump
|
|
postgresql-client:/usr/bin/pg_dumpall:/usr/lib/psql15/bin/pg_dumpall
|
|
postgresql-client:/usr/bin/pg_isready:/usr/lib/psql15/bin/pg_isready
|
|
postgresql-client:/usr/bin/pg_restore:/usr/lib/psql15/bin/pg_restore
|
|
postgresql-client:/usr/bin/psql:/usr/lib/psql15/bin/psql
|
|
postgresql-client:/usr/bin/reindexdb:/usr/lib/psql15/bin/reindexdb
|
|
postgresql-client:/usr/bin/vacuumdb:/usr/lib/psql15/bin/vacuumdb
|
|
"
|
|
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
|
|
}
|
|
}
|
|
|
|
postgresql15-contrib_package() {
|
|
alternatives="
|
|
postgresql-contrib:/usr/bin/oid2name:/usr/lib/psql15/bin/oid2name
|
|
postgresql-contrib:/usr/bin/vacuumlo:/usr/lib/psql15/bin/vacuumlo
|
|
"
|
|
short_desc="PostgreSQL contributed programs and extensions"
|
|
pkg_install() {
|
|
make -C contrib install DESTDIR=${PKGDESTDIR}
|
|
mv ${PKGDESTDIR}/usr/include ${PKGDESTDIR}/${_prefix}
|
|
}
|
|
}
|