postgresql: turn into meta package

9.6 is EOL
This commit is contained in:
Piotr Wójcik 2022-02-12 00:14:20 +01:00 committed by Piotr
parent 825216051f
commit 81666a3505
9 changed files with 30 additions and 403 deletions

1
srcpkgs/postgresql-full Symbolic link
View File

@ -0,0 +1 @@
postgresql

View File

@ -1,143 +0,0 @@
#!/bin/sh
# Released to Public Domain by Doan Tran Cong Danh
print() {
printf '%s\n' "$@"
}
sysroot="$(cd "${0%/*}" && cd ../.. && pwd)"
BINDIR="$sysroot/usr/bin"
DOCDIR="$sysroot/usr/share/doc/postgresql"
HTMLDIR="$sysroot/usr/share/doc/postgresql"
INCLUDEDIR="$sysroot/usr/include"
PKGINCLUDEDIR="$sysroot/usr/include/postgresql"
INCLUDEDIR_SERVER="$sysroot/usr/include/postgresql/server"
LIBDIR="$sysroot/usr/lib"
PKGLIBDIR="$sysroot/usr/lib/postgresql"
LOCALEDIR="$sysroot/usr/share/locale"
MANDIR="$sysroot/usr/share/man"
SHAREDIR="$sysroot/usr/share/postgresql"
SYSCONFDIR="$sysroot/etc/postgresql"
PGXS="$sysroot/usr/lib/postgresql/pgxs/src/makefiles/pgxs.mk"
CONFIGURE="@configure_args@"
CC="@CC@"
CPPFLAGS="@CPPFLAGS@"
CFLAGS="@CFLAGS@"
CFLAGS_SL="@CFLAGS_SL@"
LDFLAGS="@LDFLAGS@"
LDFLAGS_EX="@LDFLAGS_EX@"
LDFLAGS_SL="@LDFLAGS_SL@"
LIBS="@LIBS@"
VERSION="PostgreSQL @VERSION@"
if [ "$sysroot" != "/" ]; then
CPPFLAGS="$(print "$CPPFLAGS" | sed "s,-I *\\(/usr/include\\),-I$sysroot\\1,g")"
CFLAGS="$(print "$CFLAGS" | sed "s,-I *\\(/usr/include\\),-I$sysroot\\1,g")"
LDFLAGS="$(print "$LDFLAGS" | sed "s,-L *\\(/usr/lib\\),-L$sysroot\\1,g")"
fi
usage() {
cat <<-EOF
$0 provides information about the installed version of PostgreSQL.
Usage:
$0 [OPTION]...
Options:
--bindir show location of user executables
--docdir show location of documentation files
--htmldir show location of HTML documentation files
--includedir show location of C header files of the client interfaces
--pkgincludedir show location of other C header files
--includedir-server show location of C header files for the server
--libdir show location of object code libraries
--pkglibdir show location of dynamically loadable modules
--localedir show location of locale support files
--mandir show location of manual pages
--sharedir show location of architecture-independent support files
--sysconfdir show location of system-wide configuration files
--pgxs show location of extension makefile
--configure show options given to PostgreSQL was built
--cc show CC value used when PostgreSQL was built
--cppflags show CPPFLAGS value used when PostgreSQL was built
--cflags show CFLAGS value used when PostgreSQL was built
--cflags_sl show CFLAGS_SL value used when PostgreSQL was built
--ldflags show LDFLAGS value used when PostgreSQL was built
--ldflags_ex show LDFLAGS_EX value used when PostgreSQL was built
--ldflags_sl show LDFLAGS_SL value used when PostgreSQL was built
--libs show LIBS value used when PostgreSQL was built
--version show the PostgreSQL version
-?, --help show this help, then exit
With no arguments, all known items are shown.
Report bugs to <pgsql-bugs@postgresql.org>.
EOF
}
if test $# -eq 0; then
cat <<-EOF
BINDIR = $BINDIR
DOCDIR = $DOCDIR
HTMLDIR = $HTMLDIR
INCLUDEDIR = $INCLUDEDIR
PKGINCLUDEDIR = $PKGINCLUDEDIR
INCLUDEDIR-SERVER = $INCLUDEDIR_SERVER
LIBDIR = $LIBDIR
PKGLIBDIR = $PKGLIBDIR
LOCALEDIR = $LOCALEDIR
MANDIR = $MANDIR
SHAREDIR = $SHAREDIR
SYSCONFDIR = $SYSCONFDIR
PGXS = $PGXS
CONFIGURE = $CONFIGURE
CC = $CC
CPPFLAGS = $CPPFLAGS
CFLAGS = $CFLAGS
CFLAGS_SL = $CFLAGS_SL
LDFLAGS = $LDFLAGS
LDFLAGS_EX = $LDFLAGS_EX
LDFLAGS_SL = $LDFLAGS_SL
LIBS = $LIBS
VERSION = $VERSION
EOF
fi
for arg
do
if test "x$arg" = "x--help" || test "x$arg" = "x-?"; then
usage
exit 0
fi
done
for arg
do
case "$arg" in
--bindir) print "$BINDIR" ;;
--docdir) print "$DOCDIR" ;;
--htmldir) print "$HTMLDIR" ;;
--includedir) print "$INCLUDEDIR" ;;
--pkgincludedir) print "$PKGINCLUDEDIR" ;;
--includedir-server) print "$INCLUDEDIR_SERVER" ;;
--libdir) print "$LIBDIR" ;;
--pkglibdir) print "$PKGLIBDIR" ;;
--localedir) print "$LOCALEDIR" ;;
--mandir) print "$MANDIR" ;;
--sharedir) print "$SHAREDIR" ;;
--sysconfdir) print "$SYSCONFDIR" ;;
--pgxs) print "$PGXS" ;;
--configure) print "$CONFIGURE" ;;
--cc) print "$CC" ;;
--cppflags) print "$CPPFLAGS" ;;
--cflags) print "$CFLAGS" ;;
--cflags_sl) print "$CFLAGS_SL" ;;
--ldflags) print "$LDFLAGS" ;;
--ldflags_ex) print "$LDFLAGS_EX" ;;
--ldflags_sl) print "$LDFLAGS_SL" ;;
--libs) print "$LIBS" ;;
--version) print "$VERSION" ;;
esac
done

View File

@ -1,17 +0,0 @@
# Configuration file for the PostgreSQL server.
# PostgreSQL's database directory
PGROOT="/var/lib/postgresql"
# PostgreSQL's log file.
PGLOG="/var/log/postgresql.log"
# Passed to initdb if necessary
INITOPTS="-A peer --auth-host=md5 --auth-local=peer --locale en_US.UTF-8"
# Extra options to run postmaster with, e.g.:
# -N is the maximal number of client connections
# -B is the number of shared buffers and has to be at least 2x the value for -N
# Please read the man-page to postmaster for more options. Many of these options
# can be set directly in the configuration-file.
#PGOPTS="-N 512 -B 1024"

View File

@ -1,3 +0,0 @@
auth required pam_unix.so
account required pam_unix.so
session required pam_unix.so

View File

@ -1,2 +0,0 @@
#!/bin/sh
/usr/bin/kill -INT `/usr/bin/head -1 /run/runit/supervise.postgresql/pid`

View File

@ -1,2 +0,0 @@
#!/bin/sh
exec logger -p daemon.info -t postgres

View File

@ -1,30 +0,0 @@
#!/bin/sh
. /etc/default/postgresql
: ${PGDATA:="$PGROOT/data"}
if [ "$PGROOT" != "/var/lib/postgresql" ]; then
echo "Creating symlink /var/lib/postgresql -> $PGROOT"
# Remove /var/lib/postgres if empty dir, but not if symlink
if [ ! -L /var/lib/postgres ] && [ -d /var/lib/postgres ]; then
rmdir /var/lib/postgres
fi
ln -sf "$PGROOT" /var/lib/postgresql
fi
if [ ! -d "$PGDATA" ]; then
echo "Initializing database in $PGDATA"
mkdir -p "$PGDATA"
chown -R postgres:postgres "$PGDATA"
chmod 0700 "$PGDATA"
su - postgres -m -c "/usr/bin/initdb $INITOPTS -D '$PGDATA'" >/dev/null
if [ -f /etc/postgresql/postgresql.conf ]; then
ln -sf /etc/postgresql/postgresql.conf "$PGDATA/postgresql.conf"
fi
fi
exec chpst -u postgres:postgres postgres -D "$PGDATA" $PGOPTS 2>&1

View File

@ -1,46 +0,0 @@
Sources: Doan Tran Cong Danh
Upstream: No
- First part needs to be rework in configure script to be usable
upstream
- Second part would un-usable for Windows
diff --git src/common/Makefile src/common/Makefile
index ec04710..2af845f 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -22,11 +22,14 @@ include $(top_builddir)/src/Makefile.global
# don't include subdirectory-path-dependent -I and -L switches
STD_CPPFLAGS := $(filter-out -I$(top_srcdir)/src/include -I$(top_builddir)/src/include,$(CPPFLAGS))
+STD_CPPFLAGS := $(subst @XBPS_SYSROOT@,,$(STD_CPPFLAGS))
+STD_CFLAGS := $(subst @XBPS_SYSROOT@,,$(CFLAGS))
STD_LDFLAGS := $(filter-out -L$(top_builddir)/src/common -L$(top_builddir)/src/port,$(LDFLAGS))
+STD_LDFLAGS := $(subst @XBPS_SYSROOT@,,$(STD_LDFLAGS))
override CPPFLAGS += -DVAL_CONFIGURE="\"$(configure_args)\""
override CPPFLAGS += -DVAL_CC="\"$(CC)\""
override CPPFLAGS += -DVAL_CPPFLAGS="\"$(STD_CPPFLAGS)\""
-override CPPFLAGS += -DVAL_CFLAGS="\"$(CFLAGS)\""
+override CPPFLAGS += -DVAL_CFLAGS="\"$(STD_CFLAGS)\""
override CPPFLAGS += -DVAL_CFLAGS_SL="\"$(CFLAGS_SL)\""
override CPPFLAGS += -DVAL_LDFLAGS="\"$(STD_LDFLAGS)\""
override CPPFLAGS += -DVAL_LDFLAGS_EX="\"$(LDFLAGS_EX)\""
@@ -44,7 +47,19 @@ OBJS_FRONTEND = $(OBJS_COMMON) fe_memutils.o restricted_token.o
OBJS_SRV = $(OBJS_COMMON:%.o=%_srv.o)
-all: libpgcommon.a libpgcommon_srv.a
+all: libpgcommon.a libpgcommon_srv.a pg_config.sh
+
+pg_config.sh: pg_config.sh.in
+ sed -e "s/@configure_args@/$(subst /,\\/,$(configure_args))/" \
+ -e "s/@CC@/$(subst /,\\/,$(CC))/" \
+ -e "s/@CPPFLAGS@/$(subst /,\\/,$(STD_CPPFLAGS))/" \
+ -e "s/@CFLAGS@/$(subst /,\\/,$(STD_CFLAGS))/" \
+ -e "s/@CFLAGS_SL@/$(subst /,\\/,$(CFLAGS_SL))/" \
+ -e "s/@LDFLAGS@/$(subst /,\\/,$(STD_LDFLAGS))/" \
+ -e "s/@LDFLAGS_EX@/$(subst /,\\/,$(LDFLAGS_EX))/" \
+ -e "s/@LDFLAGS_SL@/$(subst /,\\/,$(LDFLAGS_SL))/" \
+ -e "s/@LIBS@/$(subst /,\\/,$(LIBS))/" \
+ $< >$@
# libpgcommon is needed by some contrib
install: all installdirs

View File

@ -1,191 +1,60 @@
# Template file for 'postgresql'
pkgname=postgresql
version=9.6.24
version=14
revision=1
build_style=gnu-configure
make_build_target=world
configure_args="--with-openssl --with-python
--with-pam --datadir=/usr/share/postgresql --enable-thread-safety
--with-perl --with-tcl --without-ldap --without-gssapi --without-krb5
--without-bonjour --with-libxml --with-libxslt --disable-rpath
--with-system-tzdata=/usr/share/zoneinfo --enable-nls --with-uuid=e2fs"
hostmakedepends="docbook2x flex gettext openjade"
makedepends="libfl-devel openssl-devel libuuid-devel libxslt-devel pam-devel perl
python-devel readline-devel tcl-devel"
short_desc="Sophisticated open-source Object-Relational DBMS"
build_style=meta
depends="postgresql${version}"
short_desc="PostgreSQL server meta package"
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}/${pkgname}-${version}.tar.bz2"
checksum=aeb7a196be3ebed1a7476ef565f39722187c108dd47da7489be9c4fcae982ace
# initdb fails on github actions, works locally with xbps-uunshare
make_check=ci-skip
conf_files="
/etc/default/${pkgname}
/etc/pam.d/${pkgname}
/etc/${pkgname}/${pkgname}.conf"
# Create 'postgres' user for the server.
system_accounts="postgres"
postgres_homedir="/var/lib/${pkgname}"
postgres_shell="/bin/sh"
postgres_descr="PostgreSQL database server user"
make_dirs="/var/lib/postgresql 0750 postgres postgres"
if [ "$CROSS_BUILD" ]; then
configure_args+=" --without-perl --without-python --without-tcl"
build_options="languages"
desc_option_languages="Include procedural languages as dependency"
if [ -z "$CROSS_BUILD" ]; then
build_options_default="languages"
fi
post_patch() {
sed -e "s/@VERSION@/$version/" \
"$FILESDIR"/pg_config.sh.in >src/common/pg_config.sh.in
vsed -i -e "s,@XBPS_SYSROOT@,${XBPS_CROSS_BASE%/}," src/common/Makefile
}
pre_build() {
# http://www.postgresql.org/docs/9.3/static/docguide-toolsets.html
export SGML_CATALOG_FILES="/usr/share/sgml/openjade/catalog:/usr/share/sgml/iso8879/catalog:/usr/share/sgml/docbook/dsssl/modular/catalog:/usr/share/sgml/docbook/4.2/catalog"
}
post_build() {
make -C contrib ${makejobs}
}
post_install() {
make -C contrib install
vmkdir usr/share/man
cp -r doc/src/sgml/man? ${DESTDIR}/usr/share/man
vmkdir usr/share/doc/postgresql
cp -r doc/src/sgml/html ${DESTDIR}/usr/share/doc/postgresql
vsv postgresql
vlicense COPYRIGHT
vinstall ${FILESDIR}/${pkgname}.confd 644 etc/default ${pkgname}
vinstall ${FILESDIR}/${pkgname}.pam 644 etc/pam.d ${pkgname}
vinstall ${DESTDIR}/usr/share/${pkgname}/${pkgname}.conf.sample \
644 etc/${pkgname} ${pkgname}.conf
vbin src/common/pg_config.sh
sed -i 's/install_bin = .*/install_bin = install/g' \
${DESTDIR}/usr/lib/postgresql/pgxs/src/Makefile.global
}
postgresql-doc_package() {
short_desc="PostgreSQL documentation"
pkg_install() {
vmove usr/share/doc
}
}
postgresql9.6-libs_package() {
short_desc="PostgreSQL shared libraries"
pkg_install() {
vmove "usr/lib/*.so*"
for d in $(find ${DESTDIR}/usr/share/locale \
-type f -name libpq5\*); do
mkdir -p ${PKGDESTDIR}/$(dirname ${d#${DESTDIR}})
mv ${d} ${PKGDESTDIR}/$(dirname ${d#${DESTDIR}})
done
}
}
postgresql9.6-libs-devel_package() {
depends="postgresql-libs>=$version"
short_desc="PostgreSQL shared libraries (development files)"
pkg_install() {
for f in pg_config ecpg; do
vmove usr/bin/${f}
vmove "usr/share/man/man1/$(basename ${f})*"
done
vmove usr/bin/pg_config.sh
vmove usr/include
vmove "usr/lib/*.a"
vmove "usr/lib/pkgconfig/*"
vmove usr/share/man/man3
vmove usr/lib/postgresql/pgxs
for d in $(find ${DESTDIR}/usr/share/locale \
-type f -name pg_config\* -o -name ecpg\*); do
mkdir -p ${PKGDESTDIR}/$(dirname ${d#${DESTDIR}})
mv ${d} ${PKGDESTDIR}/$(dirname ${d#${DESTDIR}})
done
}
depends="postgresql${version}-doc"
short_desc="PostgreSQL documentation meta package"
}
# XXX disabled for now in cross builds.
if [ -z "$CROSS_BUILD" ]; then
if [ "$build_option_languages" ]; then
postgresql-plperl_package() {
depends="postgresql>=$version"
short_desc="PL/Perl procedural language for PostgreSQL"
pkg_install() {
vmove "usr/lib/postgresql/plperl*"
for d in $(find ${DESTDIR}/usr/share/locale \
-type f -name plperl\*); do
mkdir -p ${PKGDESTDIR}/$(dirname ${d#${DESTDIR}})
mv ${d} ${PKGDESTDIR}/$(dirname ${d#${DESTDIR}})
done
}
depends="postgresql${version}-plperl"
short_desc="PL/Perl language meta package"
}
postgresql-plpython_package() {
depends="postgresql>=$version"
short_desc="PL/Python procedural language for PostgreSQL"
pkg_install() {
vmove "usr/lib/postgresql/plpython*"
for d in $(find ${DESTDIR}/usr/share/locale \
-type f -name plpython\*); do
mkdir -p ${PKGDESTDIR}/$(dirname ${d#${DESTDIR}})
mv ${d} ${PKGDESTDIR}/$(dirname ${d#${DESTDIR}})
done
}
depends="postgresql${version}-plpython"
short_desc="PL/Python language meta package"
}
postgresql-pltcl_package() {
depends="postgresql>=$version"
short_desc="PL/Tcl procedural language for PostgreSQL"
pkg_install() {
vmove "usr/bin/pltcl*"
vmove "usr/lib/postgresql/pltcl*"
for d in $(find ${DESTDIR}/usr/share/locale \
-type f -name pltcl\*); do
mkdir -p ${PKGDESTDIR}/$(dirname ${d#${DESTDIR}})
mv ${d} ${PKGDESTDIR}/$(dirname ${d#${DESTDIR}})
done
vmove "usr/share/postgresql/*.pltcl"
}
depends="postgresql${version}-pltcl"
short_desc="PL/Tcl language meta package"
}
fi # !CROSS_BUILD
fi # build_option_languages
postgresql-client_package() {
depends="postgresql${version}-client"
short_desc="Client frontends programs for PostgreSQL"
pkg_install() {
for f in clusterdb createdb createlang createuser dropdb droplang \
dropuser pg_dump pg_dumpall pg_isready pg_restore psql reindexdb \
vacuumdb; do
vmove usr/bin/${f}
vmove usr/share/man/man1/$(basename ${f}).1
done
vmove usr/share/man/man7
for d in $(find ${DESTDIR}/usr/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
vmkdir usr/share/postgresql
mv ${DESTDIR}/usr/share/postgresql/psqlrc.* \
${PKGDESTDIR}/usr/share/postgresql
}
}
postgresql-contrib_package() {
depends="postgresql${version}-contrib"
short_desc="PostgreSQL contributed programs and extensions"
pkg_install() {
make -C contrib install DESTDIR=${PKGDESTDIR}
}
}
postgresql-full() {
depends="postgresql postgresql-client postgresql-doc postgresql-contrib postgresql-libs"
short_desc="PostgreSQL all packages meta package"
if [ "$build_option_languages" ]; then
depends+=" postgresql-plpython postgresql-plperl postgresql-pltcl"
fi
}