From 855efb94214cc519805de89934d82bc5e0f92685 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 28 Nov 2023 18:29:18 +0300 Subject: Release version 14.1.0+2 Add psql package. Don't compile port/strlcpy.c on Linux if GNU libc is 2.38 or newer. Switch to using -pthread instead of -D_REENTRANT/-lpthread in buildfiles and bump build2 version requirement to 0.15.0. --- psql/README-DEV | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 psql/README-DEV (limited to 'psql/README-DEV') diff --git a/psql/README-DEV b/psql/README-DEV new file mode 100644 index 0000000..10f82ec --- /dev/null +++ b/psql/README-DEV @@ -0,0 +1,68 @@ +This document describes how psql was packaged for build2. In particular, this +understanding will be useful when upgrading to a new upstream version. See +../README-DEV for general notes on PostgreSQL packaging. + +The upstream package builds the common and ports static libraries and links +them to the psql program. These static libraries are generic enough to fit all +the binaries built by the package. We will build psql by only selecting the +required static libraries source files, relying on the linker diagnostics +(unresolved symbol errors, etc). + +Symlink the required upstream components: + +$ ln -s ../upstream/COPYRIGHT + +$ mkdir -p psql/src +$ ln -s ../../../upstream/src/bin/psql psql/src + +Note that symlinking all the upstream's top source directories is a bad idea +since this would potentially bloat the distribution and uglify the +buildfile. Also note that some of the source files are shared with the libpq +package and this sharing doesn't align with such an approach. Thus, we +selectively symlink only the required files and directories. + +$ mkdir -p psql/src/fe_utils psql/src/common psql/src/port +$ ln -s ../../../../upstream/src/fe_utils/{print,conditional,cancel,string_utils,mbprint}.c psql/src/fe_utils +$ ln -s ../../../../upstream/src/common/{fe_memutils,logging,username,psprintf,sprompt,string,wait_error,exec,pg_get_line,stringinfo,kwlookup,keywords}.c psql/src/common +$ ln -s ../../../../upstream/src/port/{strlcpy,strlcat,pgstrcasecmp,snprintf,strerror,path,pgsleep,qsort,pgstrsignal,thread,win32stat,win32env,win32setlocale,win32error,getopt_long,getopt,open,system}.c psql/src/port + +$ mkdir -p psql/include/catalog psql/include/fe_utils psql/include/lib psql/include/libpq psql/include/mb psql/include/parser psql/include/port psql/include/portability +$ ln -s ../../../../upstream/src/include/catalog/{pg_am,genbki}.h psql/include/catalog +$ ln -s ../../../../upstream/src/include/fe_utils/{conditional,print,psqlscan,string_utils,cancel,mbprint,psqlscan_int}.h psql/include/fe_utils +$ ln -s ../../../../upstream/src/include/lib/{stringinfo,sort_template}.h psql/include/lib +$ ln -s ../../../../upstream/src/include/libpq/pqcomm.h psql/include/libpq +$ ln -s ../../../../upstream/src/include/mb/pg_wchar.h psql/include/mb +$ ln -s ../../../../upstream/src/include/parser/kwlist.h psql/include/parser +$ ln -s ../../../../upstream/src/include/port/{win32,win32_msvc,{linux,freebsd,darwin,win32}.h} psql/include/port +$ ln -s ../../../../upstream/src/include/portability/instr_time.h psql/include/portability +$ ln -s ../../../upstream/src/include/{c,port,postgres_fe,getopt_long,pg_getopt,pg_config_manual}.h psql/include +$ ln -s ../../../libpq/libpq/{pg_config,pg_config_os,pg_config_paths}.h psql/include +$ ln -s ../../../upstream/src/interfaces/libpq/pqexpbuffer.h psql/include +$ ln -s ../../../upstream/src/include/common psql/include + +Note that some of the source files are generated by perl scripts executed by +make on POSIX and build.pl on Windows. At the moment it feels too hairy to +generate them automatically in our buildfile. These files are platform- +independent, so lets build the upstream's psql program on some of the +supported platforms and copy these files to our downstream/ subdirectory: + +$ mkdir -p psql/downstream/catalog +$ cp /src/include/catalog/{pg_type_d,pg_am_d,pg_attribute_d,pg_cast_d,pg_class_d,pg_default_acl_d}.h psql/downstream/catalog/ +$ cp /src/bin/psql/{sql_help.{h,c},psqlscanslash.c} psql/downstream/ +$ cp /src/fe_utils/psqlscan.c psql/downstream/ +$ cp /src/common/kwlist_d.h psql/downstream/ + +Edit psql/downstream/psqlscanslash.c by changing the + +#line ... ".../psqlscanslash.c" +#line ... ".../psqlscanslash.l" + +directives to + +#line ... "psqlscanslash.c" +#line ... "psqlscanslash.l" + +Also edit psql/downstream/psqlscan.c similar to the above. + +$ ln -s ../src/psql/psqlscanslash.l psql/downstream/ +$ ln -s ../../../upstream/src/fe_utils/psqlscan.l psql/downstream/ -- cgit v1.1