From 5b11f47f0d59c95f6dcf1ff75badede5ec84e72e Mon Sep 17 00:00:00 2001 From: Palle Girgensohn Date: Wed, 18 May 2022 21:11:48 +0200 Subject: databases/postgresql??-*: add postgresql-15 to the ports tree Introduce PostgreSQL-15 to the ports tree. Make version 15 the master port, and add plist parameter for the postgresql version. Release notes: https://www.postgresql.org/docs/devel/release.html --- databases/postgresql15-server/files/502.pgsql.in | 114 ++++++++++++++++++++ databases/postgresql15-server/files/dot.cshrc.in | 11 ++ databases/postgresql15-server/files/dot.profile.in | 22 ++++ .../files/patch-disable-llvm-jit-inlining-with-tls | 24 +++++ .../postgresql15-server/files/patch-doc-Makefile | 9 ++ .../files/patch-doc-src-sgml-Makefile | 41 ++++++++ .../files/patch-src-Makefile.shlib | 11 ++ .../files/patch-src-backend-Makefile | 11 ++ ...h-src_backend_utils_misc_postgresql.conf.sample | 21 ++++ .../files/pkg-message-client.in | 38 +++++++ .../files/pkg-message-contrib.in | 9 ++ .../files/pkg-message-plperl.in | 9 ++ .../files/pkg-message-plpython.in | 9 ++ .../postgresql15-server/files/pkg-message-pltcl.in | 9 ++ .../files/pkg-message-server.in | 69 +++++++++++++ .../postgresql15-server/files/pkgIndex.tcl.in | 4 + databases/postgresql15-server/files/postgresql.in | 115 +++++++++++++++++++++ 17 files changed, 526 insertions(+) create mode 100644 databases/postgresql15-server/files/502.pgsql.in create mode 100644 databases/postgresql15-server/files/dot.cshrc.in create mode 100644 databases/postgresql15-server/files/dot.profile.in create mode 100644 databases/postgresql15-server/files/patch-disable-llvm-jit-inlining-with-tls create mode 100644 databases/postgresql15-server/files/patch-doc-Makefile create mode 100644 databases/postgresql15-server/files/patch-doc-src-sgml-Makefile create mode 100644 databases/postgresql15-server/files/patch-src-Makefile.shlib create mode 100644 databases/postgresql15-server/files/patch-src-backend-Makefile create mode 100644 databases/postgresql15-server/files/patch-src_backend_utils_misc_postgresql.conf.sample create mode 100644 databases/postgresql15-server/files/pkg-message-client.in create mode 100644 databases/postgresql15-server/files/pkg-message-contrib.in create mode 100644 databases/postgresql15-server/files/pkg-message-plperl.in create mode 100644 databases/postgresql15-server/files/pkg-message-plpython.in create mode 100644 databases/postgresql15-server/files/pkg-message-pltcl.in create mode 100644 databases/postgresql15-server/files/pkg-message-server.in create mode 100644 databases/postgresql15-server/files/pkgIndex.tcl.in create mode 100644 databases/postgresql15-server/files/postgresql.in (limited to 'databases/postgresql15-server/files') diff --git a/databases/postgresql15-server/files/502.pgsql.in b/databases/postgresql15-server/files/502.pgsql.in new file mode 100644 index 000000000000..86848ad6efa3 --- /dev/null +++ b/databases/postgresql15-server/files/502.pgsql.in @@ -0,0 +1,114 @@ +#!/bin/sh +# +# Maintenance shell script to vacuum and backup database +# Put this in /usr/local/etc/periodic/daily, and it will be run +# every night +# +# Written by Palle Girgensohn +# +# In public domain, do what you like with it, +# and use it at your own risk... :) +# + +# Define these variables in either /etc/periodic.conf or +# /etc/periodic.conf.local to override the default values. +# +# daily_pgsql_backup_enable="YES" # do backup of all databases +# daily_pgsql_backup_enable="foo bar db1 db2" # only do backup of a limited selection of databases +# daily_pgsql_vacuum_enable="YES" # do vacuum + +# If there is a global system configuration file, suck it in. +# +if [ -r /etc/defaults/periodic.conf ] +then + . /etc/defaults/periodic.conf + source_periodic_confs +fi + +: ${daily_pgsql_user:="%%PG_USER%%"} +: ${daily_pgsql_port:=5432} +: ${daily_pgsql_vacuum_args:="-U ${daily_pgsql_user} -p ${daily_pgsql_port} -qaz"} +: ${daily_pgsql_pgdump_args:="-U ${daily_pgsql_user} -p ${daily_pgsql_port} -bF c"} +: ${daily_pgsql_pgdumpall_globals_args:="-U ${daily_pgsql_user} -p ${daily_pgsql_port}"} +# backupdir is relative to ~pgsql home directory unless it begins with a slash: +: ${daily_pgsql_backupdir:="~${daily_pgsql_user}/backups"} +: ${daily_pgsql_savedays:="7"} + +# allow '~´ in dir name +eval backupdir=${daily_pgsql_backupdir} + +rc=0 + +pgsql_backup() { + # daily_pgsql_backupdir must be writeable by user %%PG_USER%% + # ~%%PG_USER%% is just that under normal circumstances, + # but this might not be where you want the backups... + if [ ! -d ${backupdir} ] ; then + echo Creating ${backupdir} + mkdir -m 700 ${backupdir}; chown ${daily_pgsql_user} ${backupdir} + fi + + echo + echo "PostgreSQL backups" + + # Protect the data + umask 077 + rc=$? + now=`date "+%Y-%m-%dT%H:%M:%S"` + file=${daily_pgsql_backupdir}/pgglobals_${now} + su -l ${daily_pgsql_user} -c \ + "umask 077; pg_dumpall -g ${daily_pgsql_pgdumpall_globals_args} | gzip -9 > ${file}.gz" + + db=$1 + while shift; do + echo -n " $db" + file=${backupdir}/pgdump_${db}_${now} + su -l ${daily_pgsql_user} -c "umask 077; pg_dump ${daily_pgsql_pgdump_args} -f ${file} ${db}" + [ $? -gt 0 ] && rc=3 + db=$1 + done + + if [ $rc -gt 0 ]; then + echo + echo "Errors were reported during backup." + fi + + # cleaning up old data + find ${backupdir} \( -name 'pgdump_*' -o -name 'pgglobals_*' -o -name '*.dat.gz' -o -name 'toc.dat' \) \ + -a -mtime +${daily_pgsql_savedays} -delete + echo +} + +case "$daily_pgsql_backup_enable" in + [Yy][Ee][Ss]) + dbnames=`su -l ${daily_pgsql_user} -c "umask 077; psql -U ${daily_pgsql_user} -p ${daily_pgsql_port} -q -t -A -d template1 -c SELECT\ datname\ FROM\ pg_database\ WHERE\ datname!=\'template0\'"` + pgsql_backup $dbnames + ;; + + [Nn][Oo]) + ;; + + "") + ;; + + *) + pgsql_backup $daily_pgsql_backup_enable + ;; +esac + +case "$daily_pgsql_vacuum_enable" in + [Yy][Ee][Ss]) + + echo + echo "PostgreSQL vacuum" + su -l ${daily_pgsql_user} -c "vacuumdb ${daily_pgsql_vacuum_args}" + if [ $? -gt 0 ] + then + echo + echo "Errors were reported during vacuum." + rc=3 + fi + ;; +esac + +exit $rc diff --git a/databases/postgresql15-server/files/dot.cshrc.in b/databases/postgresql15-server/files/dot.cshrc.in new file mode 100644 index 000000000000..17c9ee69a7d0 --- /dev/null +++ b/databases/postgresql15-server/files/dot.cshrc.in @@ -0,0 +1,11 @@ +setenv PGLIB %%PREFIX%%/lib + +# note: PGDATA can be overridden by the -D startup option +setenv PGDATA $HOME/data96 + +#You might want to set some locale stuff here +#setenv PGDATESTYLE ISO +#setenv LC_ALL sv_SE.ISO_8859-1 + +# if you want to make regression tests use this TZ +#setenv TZ PST8PDT diff --git a/databases/postgresql15-server/files/dot.profile.in b/databases/postgresql15-server/files/dot.profile.in new file mode 100644 index 000000000000..5be3e6a36ca9 --- /dev/null +++ b/databases/postgresql15-server/files/dot.profile.in @@ -0,0 +1,22 @@ +PGLIB=%%PREFIX%%/lib + +# note: PGDATA can be overridden by the -D startup option +PGDATA=${HOME}/data96 + +export PATH PGLIB PGDATA + +# if you use the periodic script from share/postgresql/502.pgsql, you +# can set these +#PGDUMP_ARGS="-b -F c" +#PGBACKUPDIR=${HOME}/backups +#PGBACKUP_SAVE_DAYS=7 +#export PGBACKUPDIR PGDUMP_ARGS PGBACKUP_SAVE_DAYS + +#You might want to set some locale stuff here +#PGDATESTYLE=ISO +#LC_ALL=sv_SE.ISO_8859-1 +#export PGDATESTYLE LC_ALL + +# if you want to make regression tests use this TZ +#TZ=PST8PDT +#export TZ diff --git a/databases/postgresql15-server/files/patch-disable-llvm-jit-inlining-with-tls b/databases/postgresql15-server/files/patch-disable-llvm-jit-inlining-with-tls new file mode 100644 index 000000000000..02686061ce99 --- /dev/null +++ b/databases/postgresql15-server/files/patch-disable-llvm-jit-inlining-with-tls @@ -0,0 +1,24 @@ +Do not inline functions which access TLS in LLVM JIT, as +this leads to crashes with unsupported relocation error + +diff --git src/backend/jit/llvm/llvmjit_inline.cpp src/backend/jit/llvm/llvmjit_inline.cpp +index 2617a46..a063edb 100644 +--- src/backend/jit/llvm/llvmjit_inline.cpp ++++ src/backend/jit/llvm/llvmjit_inline.cpp +@@ -608,6 +608,16 @@ function_inlinable(llvm::Function &F, + if (rv->materialize()) + elog(FATAL, "failed to materialize metadata"); + ++ /* ++ * Don't inline functions with thread-local variables until ++ * related crashes are investigated (see BUG #16696) ++ */ ++ if (rv->isThreadLocal()) { ++ ilog(DEBUG1, "cannot inline %s due to thread-local variable %s", ++ F.getName().data(), rv->getName().data()); ++ return false; ++ } ++ + /* + * Never want to inline externally visible vars, cheap enough to + * reference. diff --git a/databases/postgresql15-server/files/patch-doc-Makefile b/databases/postgresql15-server/files/patch-doc-Makefile new file mode 100644 index 000000000000..d5176bfb64b5 --- /dev/null +++ b/databases/postgresql15-server/files/patch-doc-Makefile @@ -0,0 +1,9 @@ +--- doc/Makefile.orig 2015-10-08 21:45:57.360084007 +0200 ++++ doc/Makefile 2015-10-08 21:46:04.353084097 +0200 +@@ -12,5 +12,5 @@ + top_builddir = .. + include $(top_builddir)/src/Makefile.global + +-all distprep html man install installdirs uninstall clean distclean maintainer-clean: ++all distprep man install installdirs uninstall clean distclean maintainer-clean: + $(MAKE) -C src $@ diff --git a/databases/postgresql15-server/files/patch-doc-src-sgml-Makefile b/databases/postgresql15-server/files/patch-doc-src-sgml-Makefile new file mode 100644 index 000000000000..36f5d2a8224c --- /dev/null +++ b/databases/postgresql15-server/files/patch-doc-src-sgml-Makefile @@ -0,0 +1,41 @@ +--- doc/src/sgml/Makefile.orig 2018-10-15 23:12:02.000000000 +0200 ++++ doc/src/sgml/Makefile 2018-10-18 22:34:13.656029000 +0200 +@@ -15,7 +15,7 @@ + + # Make "html" the default target, since that is what most people tend + # to want to use. +-html: ++man: + + # We don't need the tree-wide headers or install support here. + NO_GENERATED_HEADERS=yes +@@ -26,7 +26,7 @@ + include $(top_builddir)/src/Makefile.global + + +-all: html man ++all: man + + distprep: html distprep-man + +@@ -62,7 +62,6 @@ + ## Man pages + ## + +-man distprep-man: man-stamp + + man-stamp: stylesheet-man.xsl postgres.sgml $(ALLSGML) + $(XMLLINT) $(XMLINCLUDE) --noout --valid $(word 2,$^) +@@ -212,10 +211,10 @@ + ## Install + ## + +-install: install-html install-man ++install: install-man + + installdirs: +- $(MKDIR_P) '$(DESTDIR)$(htmldir)'/html $(addprefix '$(DESTDIR)$(mandir)'/man, 1 3 $(sqlmansectnum)) ++ $(MKDIR_P) $(addprefix '$(DESTDIR)$(mandir)'/man, 1 3 $(sqlmansectnum)) + + # If the install used a man directory shared with other applications, this will remove all files. + uninstall: diff --git a/databases/postgresql15-server/files/patch-src-Makefile.shlib b/databases/postgresql15-server/files/patch-src-Makefile.shlib new file mode 100644 index 000000000000..2435ffe1d280 --- /dev/null +++ b/databases/postgresql15-server/files/patch-src-Makefile.shlib @@ -0,0 +1,11 @@ +--- src/Makefile.shlib.bak 2013-05-06 22:57:06.000000000 +0200 ++++ src/Makefile.shlib 2013-05-12 23:33:16.000000000 +0200 +@@ -87,7 +87,7 @@ + # Testing the soname variable is a reliable way to determine whether a + # linkable library is being built. + soname = $(shlib_major) +-pkgconfigdir = $(libdir)/pkgconfig ++pkgconfigdir = $(prefix)/libdata/pkgconfig + else + # Naming convention for dynamically loadable modules + shlib = $(NAME)$(DLSUFFIX) diff --git a/databases/postgresql15-server/files/patch-src-backend-Makefile b/databases/postgresql15-server/files/patch-src-backend-Makefile new file mode 100644 index 000000000000..ce8a8d558de1 --- /dev/null +++ b/databases/postgresql15-server/files/patch-src-backend-Makefile @@ -0,0 +1,11 @@ +--- src/backend/Makefile.orig 2009-07-07 15:58:33.000000000 +0200 ++++ src/backend/Makefile 2009-07-07 15:58:57.000000000 +0200 +@@ -107,6 +107,8 @@ + # Update the commonly used headers before building the subdirectories + $(SUBDIRS:%=%-recursive): $(top_builddir)/src/include/parser/gram.h $(top_builddir)/src/include/utils/fmgroids.h $(top_builddir)/src/include/utils/probes.h + ++symlinks: $(top_builddir)/src/include/parser/gram.h $(top_builddir)/src/include/storage/lwlocknames.h ++ + + # The postgres.o target is needed by the rule in Makefile.global that + # creates the exports file when MAKE_EXPORTS = true. diff --git a/databases/postgresql15-server/files/patch-src_backend_utils_misc_postgresql.conf.sample b/databases/postgresql15-server/files/patch-src_backend_utils_misc_postgresql.conf.sample new file mode 100644 index 000000000000..a82826b3b5f1 --- /dev/null +++ b/databases/postgresql15-server/files/patch-src_backend_utils_misc_postgresql.conf.sample @@ -0,0 +1,21 @@ +--- src/backend/utils/misc/postgresql.conf.sample.orig 2016-10-24 20:08:51 UTC ++++ src/backend/utils/misc/postgresql.conf.sample +@@ -330,6 +330,7 @@ + + # - Where to Log - + ++log_destination = 'syslog' + #log_destination = 'stderr' # Valid values are combinations of + # stderr, csvlog, syslog, and eventlog, + # depending on platform. csvlog +@@ -464,7 +465,9 @@ + + #cluster_name = '' # added to process titles if nonempty + # (change requires restart) +-#update_process_title = on ++ ++# On FreeBSD, this is a performance hog, so keep it off if you need speed ++update_process_title = off + + + #------------------------------------------------------------------------------ diff --git a/databases/postgresql15-server/files/pkg-message-client.in b/databases/postgresql15-server/files/pkg-message-client.in new file mode 100644 index 000000000000..8cc91d484fcb --- /dev/null +++ b/databases/postgresql15-server/files/pkg-message-client.in @@ -0,0 +1,38 @@ +[ +{ type: install + message: < postgresql profile: ${profile}" + %%PREFIX%%/etc/rc.d/postgresql $1 ${profile} + retcode="$?" + if [ "0${retcode}" -ne 0 ]; then + failed="${profile} (${retcode}) ${failed:-}" + else + success="${profile} ${success:-}" + fi + done + exit 0 + fi +fi + +command_args="-D ${postgresql_data} ${postgresql_flags}" + +postgresql_command() +{ + ${su_cmd} -l ${postgresql_user} -c "exec ${command} ${command_args} ${rc_arg}" +} + +postgresql_initdb() +{ + ${su_cmd} -l -c ${postgresql_login_class} ${postgresql_user} -c "exec %%PREFIX%%/bin/initdb ${postgresql_initdb_flags} -D ${postgresql_data} -U ${postgresql_user}" +} + +run_rc_command "$1" -- cgit v1.2.3