pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Nathan Bossart <nathandbossart@gmail.com>
Cc: Andrew Dunstan <andrew@dunslane.net>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: Justin Pryzby <pryzby@telsasoft.com>
Cc: samay sharma <smilingsamay@gmail.com>
Cc: Nazir Bilal Yavuz <byavuz81@gmail.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: [RFC] building postgres with meson - v13
Date: Sat, 24 Sep 2022 11:09:55 -0700
Message-ID: <20220924180955.2hevwoniwsj2q2tm@awork3.anarazel.de> (raw)
In-Reply-To: <2298281.1664041949@sss.pgh.pa.us>
References: <d861493c-ed20-c251-7a89-7924f5197341@enterprisedb.com>
	<20220920021630.vufrgcjmidimcarq@awork3.anarazel.de>
	<20220921164630.wrklkjmifjqjtlwc@awork3.anarazel.de>
	<20220922055704.fngsvviugsnivebs@awork3.anarazel.de>
	<2b9a02ec-22e6-24df-18ec-b60e3af12995@dunslane.net>
	<20220922150550.pscsjv4nwnslupeg@awork3.anarazel.de>
	<20220922200533.GA697326@nathanxps13>
	<20220922202809.4touie37lfafyabw@awork3.anarazel.de>
	<20220922223729.GA721620@nathanxps13>
	<2298281.1664041949@sss.pgh.pa.us>

Hi,

On 2022-09-24 13:52:29 -0400, Tom Lane wrote:
> ... btw, shouldn't the CF entry [1] get closed now?

Unfortunately not - there's quite a few followup patches that haven't been
[fully] reviewed and thus not applied yet.


> The cfbot's unhappy that the last patch no longer applies.

Rebased patches attached.

Several patches here are quite trivial (e.g. 0003) or just part of the series
to increase cfbot/ci coverage (0002).

Greetings,

Andres Freund

Attachments: download all (14 files, .tar.gz)

v15-0001-meson-ci-wip-move-compilerwarnings-task-to-meson.patch (text/x-diff, 5.5K) download From 7cd0ecdc3085e8d5c02411194eebf24ed4fcd682 Mon Sep 17 00:00:00 2001 From: Andres Freund <andres@anarazel.de> Date: Wed, 21 Sep 2022 20:36:36 -0700 Subject: [PATCH v15 01/14] meson: ci: wip: move compilerwarnings task to meson --- .cirrus.yml | 92 +++++++++++++------------- src/tools/ci/linux-mingw-w64-64bit.txt | 13 ++++ 2 files changed, 59 insertions(+), 46 deletions(-) create mode 100644 src/tools/ci/linux-mingw-w64-64bit.txt diff --git a/.cirrus.yml b/.cirrus.yml index 0e3b2d42681..3b14563ae27 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -465,6 +465,10 @@ task: ccache_cache: folder: $CCACHE_DIR + ccache_stats_start_script: + ccache -s + ccache -z + setup_additional_packages_script: | #apt-get update #DEBIAN_FRONTEND=noninteractive apt-get -y install ... @@ -473,8 +477,6 @@ task: # Test that code can be built with gcc/clang without warnings ### - setup_script: echo "COPT=-Werror" > src/Makefile.custom - # Trace probes have a history of getting accidentally broken. Use the # different compilers to build with different combinations of dtrace on/off # and cassert on/off. @@ -482,57 +484,58 @@ task: # gcc, cassert off, dtrace on always: gcc_warning_script: | - time ./configure \ - --cache gcc.cache \ - --enable-dtrace \ - ${LINUX_CONFIGURE_FEATURES} \ - CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang" - make -s -j${BUILD_JOBS} clean - time make -s -j${BUILD_JOBS} world-bin + mkdir build && cd build + CC="ccache gcc" CXX="ccache g++" \ + meson setup \ + -Dwerror=true \ + -Dcassert=false \ + -Ddtrace=enabled \ + ${LINUX_MESON_FEATURES} \ + .. + time ninja -j${BUILD_JOBS} # gcc, cassert on, dtrace off always: gcc_a_warning_script: | - time ./configure \ - --cache gcc.cache \ - --enable-cassert \ - ${LINUX_CONFIGURE_FEATURES} \ - CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang" - make -s -j${BUILD_JOBS} clean - time make -s -j${BUILD_JOBS} world-bin + cd build + meson configure \ + -Dcassert=true \ + -Ddtrace=disabled + time ninja -j${BUILD_JOBS} # clang, cassert off, dtrace off always: clang_warning_script: | - time ./configure \ - --cache clang.cache \ - ${LINUX_CONFIGURE_FEATURES} \ - CC="ccache clang" CXX="ccache clang++" CLANG="ccache clang" - make -s -j${BUILD_JOBS} clean - time make -s -j${BUILD_JOBS} world-bin + rm -rf build + mkdir build && cd build + CC="ccache clang" CXX="ccache clang++" \ + meson setup \ + -Dwerror=true \ + -Dcassert=false \ + -Ddtrace=disabled \ + ${LINUX_MESON_FEATURES} \ + .. + time ninja -j${BUILD_JOBS} # clang, cassert on, dtrace on always: clang_a_warning_script: | - time ./configure \ - --cache clang.cache \ - --enable-cassert \ - --enable-dtrace \ - ${LINUX_CONFIGURE_FEATURES} \ - CC="ccache clang" CXX="ccache clang++" CLANG="ccache clang" - make -s -j${BUILD_JOBS} clean - time make -s -j${BUILD_JOBS} world-bin + cd build + meson configure \ + -Dcassert=true \ + -Ddtrace=enabled + time ninja -j${BUILD_JOBS} # cross-compile to windows always: mingw_cross_warning_script: | - time ./configure \ - --host=x86_64-w64-mingw32 \ - --enable-cassert \ - CC="ccache x86_64-w64-mingw32-gcc" \ - CXX="ccache x86_64-w64-mingw32-g++" - make -s -j${BUILD_JOBS} clean - time make -s -j${BUILD_JOBS} world-bin + mkdir build-w64 && cd build-w64 + meson setup \ + --cross-file=../src/tools/ci/linux-mingw-w64-64bit.txt \ + -Dwerror=true \ + -Dcassert=true \ + .. + time ninja -j${BUILD_JOBS} ### # Verify docs can be built @@ -540,13 +543,8 @@ task: # XXX: Only do this if there have been changes in doc/ since last build always: docs_build_script: | - time ./configure \ - --cache gcc.cache \ - CC="ccache gcc" \ - CXX="ccache g++" \ - CLANG="ccache clang" - make -s -j${BUILD_JOBS} clean - time make -s -j${BUILD_JOBS} -C doc + cd build + time ninja docs ### # Verify headerscheck / cpluspluscheck succeed @@ -565,11 +563,13 @@ task: ${LINUX_CONFIGURE_FEATURES} \ --without-icu \ --quiet \ - CC="gcc" CXX"=g++" CLANG="clang" - make -s -j${BUILD_JOBS} clean + CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang" + make -s -j${BUILD_JOBS} world-bin time make -s headerscheck EXTRAFLAGS='-fmax-errors=10' headers_cpluspluscheck_script: | time make -s cpluspluscheck EXTRAFLAGS='-Wno-register -fmax-errors=10' always: + ccache_stats_end_script: + ccache -s upload_caches: ccache diff --git a/src/tools/ci/linux-mingw-w64-64bit.txt b/src/tools/ci/linux-mingw-w64-64bit.txt new file mode 100644 index 00000000000..9d43b6dcfbc --- /dev/null +++ b/src/tools/ci/linux-mingw-w64-64bit.txt @@ -0,0 +1,13 @@ +[binaries] +c = ['ccache', '/usr/bin/x86_64-w64-mingw32-gcc'] +cpp = ['ccache', '/usr/bin/x86_64-w64-mingw32-g++'] +ar = '/usr/bin/x86_64-w64-mingw32-ar' +strip = '/usr/bin/x86_64-w64-mingw32-strip' +pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config' +windres = '/usr/bin/x86_64-w64-mingw32-windres' + +[host_machine] +system = 'windows' +cpu_family = 'x86_64' +cpu = 'x86_64' +endian = 'little' -- 2.37.3.542.gdd3f6c4cae
v15-0002-meson-ci-dontmerge-Add-additional-CI-coverage.patch (text/x-diff, 14.5K) download From eb6475e0284426f7c02b3380578ff5c64d8bdae2 Mon Sep 17 00:00:00 2001 From: Andres Freund <andres@anarazel.de> Date: Wed, 21 Sep 2022 22:08:00 -0700 Subject: [PATCH v15 02/14] meson: ci: dontmerge: Add additional CI coverage This is part of the series to be able to test meson on more platforms than normally part of CI. Author: Andres Freund <andres@anarazel.de> Author: Nazir Bilal Yavuz <byavuz81@gmail.com> Author: Justin Pryzby <pryzby@telsasoft.com> --- .cirrus.yml | 253 ++++++++++++++++-- src/tools/ci/docker/linux_centos7 | 57 ++++ src/tools/ci/docker/linux_centos8 | 54 ++++ src/tools/ci/docker/linux_fedora_rawhide | 49 ++++ src/tools/ci/docker/linux_opensuse_tumbleweed | 56 ++++ 5 files changed, 453 insertions(+), 16 deletions(-) create mode 100644 src/tools/ci/docker/linux_centos7 create mode 100644 src/tools/ci/docker/linux_centos8 create mode 100644 src/tools/ci/docker/linux_fedora_rawhide create mode 100644 src/tools/ci/docker/linux_opensuse_tumbleweed diff --git a/.cirrus.yml b/.cirrus.yml index 3b14563ae27..965483550d1 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -126,6 +126,90 @@ task: cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores +task: + env: + CPUS: 2 + BUILD_JOBS: 3 + TEST_JOBS: 3 + + CIRRUS_WORKING_DIR: /home/postgres/postgres + CCACHE_DIR: /tmp/ccache_dir + + PATH: /usr/sbin:$PATH + + # Postgres interprets LANG as a 'en_US.UTF-8' but it is 'C', then + # Postgres tries to set 'LC_COLLATE' to 'en_US.UTF-8' but it is not + # changeable. Initdb fails because of that. So, LANG is forced to be 'C'. + LANG: "C" + LC_ALL: "C" + + matrix: + - name: NetBSD - 9 - Meson + only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*netbsd.*' + env: + IMAGE_NAME: pg-ci-netbsd-9-postgres + PLATFORM: netbsd + INCLUDE_DIRS: -Dextra_lib_dirs=/usr/pkg/lib -Dextra_include_dirs=/usr/pkg/include + + - name: OpenBSD - 7 - Meson + only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*openbsd.*' + env: + IMAGE_NAME: pg-ci-openbsd-7-postgres + PLATFORM: openbsd + INCLUDE_DIRS: -Dextra_include_dirs=/usr/local/include -Dextra_lib_dirs=/usr/local/lib + UUID: -Duuid=e2fs + + compute_engine_instance: + image_project: $IMAGE_PROJECT + image: family/${IMAGE_NAME} + platform: ${PLATFORM} + cpu: $CPUS + memory: 4G + disk: 25 + + sysinfo_script: | + locale + id + uname -a + ulimit -a -H && ulimit -a -S + export + + ccache_cache: + folder: $CCACHE_DIR + + create_user_script: | + useradd postgres + chown -R postgres:users /home/postgres + mkdir -p ${CCACHE_DIR} + chown -R postgres:users ${CCACHE_DIR} + + # -Duuid=bsd is not set since 'bsd' uuid option + # is not working on netBSD & openBSD. See + # https://www.postgresql.org/message-id/17358-89806e7420797025@postgresql.org + # And other uuid options are not available on netBSD + configure_script: | + su postgres <<-EOF + meson setup \ + --buildtype debug \ + -Dcassert=true -Dssl=openssl ${UUID} \ + -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \ + ${INCLUDE_DIRS} \ + build + EOF + + build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}' + upload_caches: ccache + + test_world_script: | + su postgres <<-EOF + ulimit -c unlimited + meson test $MTEST_ARGS --num-processes ${TEST_JOBS} + EOF + + on_failure: + <<: *on_failure_meson + + # configure feature flags, shared between the task running the linux tests and # the CompilerWarnings task LINUX_CONFIGURE_FEATURES: &LINUX_CONFIGURE_FEATURES >- @@ -152,6 +236,22 @@ LINUX_MESON_FEATURES: &LINUX_MESON_FEATURES >- -Duuid=e2fs +# configure preparation scripts, shared between tasks running the linux tests +linux_preparation_scripts_template: &linux_preparation_scripts_template + sysinfo_script: | + id + uname -a + cat /proc/cmdline + ulimit -a -H && ulimit -a -S + export + create_user_script: | + useradd -m -U postgres + chown -R postgres:postgres . + mkdir -p ${CCACHE_DIR} + chown -R postgres:postgres ${CCACHE_DIR} + su postgres -c "ulimit -l -H && ulimit -l -S" + + task: env: CPUS: 4 @@ -181,19 +281,9 @@ task: ccache_cache: folder: ${CCACHE_DIR} - sysinfo_script: | - id - uname -a - cat /proc/cmdline - ulimit -a -H && ulimit -a -S - export - create_user_script: | - useradd -m postgres - chown -R postgres:postgres . - mkdir -p ${CCACHE_DIR} - chown -R postgres:postgres ${CCACHE_DIR} + set_limits_script: | echo '* - memlock 134217728' > /etc/security/limits.d/postgres.conf - su postgres -c "ulimit -l -H && ulimit -l -S" + <<: *linux_preparation_scripts_template setup_core_files_script: | mkdir -m 770 /tmp/cores chown root:postgres /tmp/cores @@ -227,7 +317,13 @@ task: on_failure: <<: *on_failure_ac - - name: Linux - Debian Bullseye - Meson + - matrix: + - name: Linux - Debian Bullseye - Meson + - name: Linux - Debian Sid - Meson + trigger_type: manual + + compute_engine_instance: + image: family/pg-ci-sid configure_script: | su postgres <<-EOF @@ -255,6 +351,81 @@ task: cores_script: src/tools/ci/cores_backtrace.sh linux /tmp/cores +task: + env: + CPUS: 4 + BUILD_JOBS: 4 + TEST_JOBS: 8 # experimentally derived to be a decent choice + + CCACHE_DIR: /tmp/ccache_dir + DEBUGINFOD_URLS: ${DEBUGINFO} + + TCL_DIR: /usr/lib64/ + UUID: e2fs + + CFLAGS: "-Og -ggdb" + CXXFLAGS: "-Og -ggdb" + + LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES + + only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*' + + container: + dockerfile: ${DOCKERFILE_PATH} + cpu: $CPUS + memory: 4G + + ccache_cache: + folder: ${CCACHE_DIR} + + <<: *linux_preparation_scripts_template + + matrix: + - name: Linux - OpenSuse Tumbleweed (LLVM) - Meson + env: + DOCKERFILE_PATH: src/tools/ci/docker/linux_opensuse_tumbleweed + DEBUGINFO: "https://debuginfod.opensuse.org/" + LLVM: -Dllvm=enabled + + - trigger_type: manual + matrix: + - name: Linux - Fedora Rawhide - Meson + env: + DOCKERFILE_PATH: src/tools/ci/docker/linux_fedora_rawhide + DEBUGINFO: "https://debuginfod.fedoraproject.org/" + + - name: Linux - Centos 8 - Meson + env: + DOCKERFILE_PATH: src/tools/ci/docker/linux_centos7 + DEBUGINFO: "http://debuginfo.centos.org/" + + - name: Linux - Centos 7 - Meson + env: + DOCKERFILE_PATH: src/tools/ci/docker/linux_centos7 + DEBUGINFO: "http://debuginfo.centos.org/" + + configure_script: | + su postgres <<-EOF + meson setup \ + --buildtype debug \ + -Dcassert=true -Dssl=openssl -Duuid=e2fs ${LLVM} \ + -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \ + build + EOF + + build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}' + upload_caches: ccache + + test_world_script: | + su postgres <<-EOF + ulimit -c unlimited + meson test $MTEST_ARGS --num-processes ${TEST_JOBS} + EOF + + on_failure: + <<: *on_failure_meson + + task: name: macOS - Monterey - Meson @@ -355,9 +526,7 @@ task: cores_script: src/tools/ci/cores_backtrace.sh macos "${HOME}/cores" -task: - name: Windows - Server 2019, VS 2019 - Meson & ninja - +windows_template: &windows_template env: # Half the allowed per-user CPU cores CPUS: 4 @@ -373,6 +542,20 @@ task: # Avoids port conflicts between concurrent tap test runs PG_TEST_USE_UNIX_SOCKETS: 1 PG_REGRESS_SOCK_DIR: "c:/cirrus/" + # -m enables parallelism + # verbosity:minimal + Summary reduce verbosity, while keeping a summary of + # errors/warnings + # ForceNoAlign prevents msbuild from introducing line-breaks for long lines + # disable file tracker, we're never going to rebuild, and it slows down the + # build + MSBFLAGS: -m -verbosity:minimal "-consoleLoggerParameters:Summary;ForceNoAlign" /p:TrackFileAccess=false -nologo + + # If tests hang forever, cirrus eventually times out. In that case log + # output etc is not uploaded, making the problem hard to debug. Of course + # tests internally should have shorter timeouts, but that's proven to not + # be sufficient. 15min currently is fast enough to finish individual test + # "suites". + T_C: "\"C:/Program Files/Git/usr/bin/timeout.exe\" -v -k60s 15m" # startcreate_script starts a postgres instance that we don't want to get # killed at the end of that script (it's stopped in stop_script). Can't @@ -406,6 +589,16 @@ task: setup_additional_packages_script: | REM choco install -y --no-progress ... + +task: + <<: *windows_template + name: Windows - Server 2019, VS 2019 - Meson & ninja + + meson_install_wraps_script: | + mkdir subprojects + meson wrap install lz4 + meson wrap install zlib + # Use /DEBUG:FASTLINK to avoid high memory usage during linking configure_script: | vcvarsall x64 @@ -426,6 +619,34 @@ task: type: text/plain +task: + <<: *windows_template + name: Windows - Server 2019, VS 2019 - Meson & msbuild + + meson_install_wraps_script: | + mkdir subprojects + meson wrap install lz4 + meson wrap install zlib + + configure_script: | + vcvarsall x64 + meson setup --buildtype debug --backend vs -Dcassert=true -Dssl=openssl -Dlz4=enabled -Dzlib=enabled -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build + + build_script: | + vcvarsall x64 + msbuild %MSBFLAGS% build\postgresql.sln + + check_world_script: | + vcvarsall x64 + meson test %MTEST_ARGS% --num-processes %TEST_JOBS% + + on_failure: + <<: *on_failure_meson + crashlog_artifacts: + path: "crashlog-*.txt" + type: text/plain + + task: name: CompilerWarnings diff --git a/src/tools/ci/docker/linux_centos7 b/src/tools/ci/docker/linux_centos7 new file mode 100644 index 00000000000..3742890d961 --- /dev/null +++ b/src/tools/ci/docker/linux_centos7 @@ -0,0 +1,57 @@ +FROM centos:centos7 +# Enable powertools, EPEL and devtoolset repository +RUN \ + yum -y install dnf-plugins-core \ + epel-release \ + centos-release-scl-rh && \ + \ + yum -y update && \ + yum -y install \ + \ + git \ + perl \ + perl-ExtUtils-Embed \ + perl-IPC-Run \ + perl-Test-Harness \ + perl-Test-Simple \ + \ + bison \ + ccache \ + clang \ + devtoolset-7-make \ + flex \ + gcc \ + gettext \ + \ + krb5-devel \ + libicu-devel \ + libuuid-devel \ + libxml2-devel \ + libxslt-devel \ + libzstd-devel \ + lz4-devel \ + openldap-devel \ + openssl-devel \ + pam-devel \ + python3-devel \ + readline-devel \ + systemd-devel \ + tcl-devel \ + \ + krb5-server \ + krb5-server-ldap \ + krb5-workstation \ + lz4 \ + openldap-clients \ + openldap-servers \ + openssl \ + zstd \ + \ + && \ + pip3 install meson && \ + pip3 install ninja && \ + yum clean all + +# Make version is 3.82 but required is > 4, adding devtoolset-7-make to the PATH +ENV PATH="/opt/rh/devtoolset-7/root/usr/bin/:${PATH}" +ENV LANG=en_US.UTF-8 diff --git a/src/tools/ci/docker/linux_centos8 b/src/tools/ci/docker/linux_centos8 new file mode 100644 index 00000000000..58f95847ef1 --- /dev/null +++ b/src/tools/ci/docker/linux_centos8 @@ -0,0 +1,54 @@ +FROM quay.io/centos/centos:stream8 +# Enable powertools and EPEL repository +RUN \ + dnf -y install dnf-plugins-core && \ + dnf config-manager --set-enabled powertools && \ + dnf -y install epel-release && \ + dnf -y update && \ + dnf -y install \ + \ + git \ + meson \ + perl \ + perl-IPC-Run \ + \ + bison \ + ccache \ + clang \ + diffutils \ + flex \ + gcc \ + gettext \ + \ + krb5-devel \ + libicu-devel \ + libuuid-devel \ + libxml2-devel \ + libxslt-devel \ + libzstd-devel \ + llvm-devel \ + lz4-devel \ + openldap-devel \ + openssl-devel \ + pam-devel \ + python3-devel \ + readline-devel \ + systemd-devel \ + tcl-devel \ + \ + krb5-server \ + krb5-server-ldap \ + krb5-workstation \ + lz4 \ + openldap-clients \ + openldap-servers \ + openssl \ + zstd \ + \ + glibc-langpack-en \ + \ + && \ + pip3 install ninja && \ + yum clean all + +ENV LANG=en_US.UTF-8 diff --git a/src/tools/ci/docker/linux_fedora_rawhide b/src/tools/ci/docker/linux_fedora_rawhide new file mode 100644 index 00000000000..c95027cd6a7 --- /dev/null +++ b/src/tools/ci/docker/linux_fedora_rawhide @@ -0,0 +1,49 @@ +FROM fedora:rawhide +RUN \ + dnf -y update && \ + dnf -y install \ + git \ + meson \ + perl \ + perl-IPC-Run \ + \ + bison \ + ccache \ + clang \ + flex \ + gcc \ + gettext \ + ninja-build \ + \ + krb5-devel \ + libicu-devel \ + libuuid-devel \ + libxml2-devel \ + libxslt-devel \ + libzstd-devel \ + llvm-devel \ + lz4-devel \ + openldap-devel \ + openssl-devel \ + pam-devel \ + python3-devel \ + readline-devel \ + systemd-devel \ + tcl-devel \ + \ + krb5-server \ + krb5-server-ldap \ + krb5-workstation \ + lz4 \ + openldap-clients \ + openldap-servers \ + openssl \ + zstd \ + \ + langpacks-en \ + glibc-langpack-en \ + \ + && \ + yum clean all + +ENV LANG=en_US.UTF-8 diff --git a/src/tools/ci/docker/linux_opensuse_tumbleweed b/src/tools/ci/docker/linux_opensuse_tumbleweed new file mode 100644 index 00000000000..07364ee85ff --- /dev/null +++ b/src/tools/ci/docker/linux_opensuse_tumbleweed @@ -0,0 +1,56 @@ +FROM opensuse/tumbleweed +RUN \ + zypper -n clean -a && \ + zypper -n ref && \ + zypper -n dup && \ + zypper -n update && \ + zypper -n install \ + diffutils \ + git \ + icu \ + make \ + meson \ + perl-IPC-Run \ + shadow \ + systemd-devel \ + util-linux \ + \ + bison \ + ccache \ + clang \ + flex \ + gcc \ + gcc-c++ \ + gettext-runtime \ + ninja \ + \ + krb5-devel \ + libicu-devel \ + libldapcpp-devel \ + liblz4-devel \ + libopenssl-devel \ + libselinux-devel \ + libuuid-devel \ + libxml2-devel \ + libxslt-devel \ + libzstd-devel \ + llvm-devel \ + pam-devel \ + python38-devel \ + readline-devel \ + tcl-devel \ + \ + openldap2 \ + openldap2-client \ + \ + krb5-client \ + krb5-plugin-kdb-ldap \ + krb5-server \ + lz4 \ + zstd \ + \ + && \ + zypper -n clean -a + +# Fixing ICU errors caused by locale being set to 'POSIX' +ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 -- 2.37.3.542.gdd3f6c4cae
v15-0003-meson-prereq-De-special-case-pgevent-s-rc-file-h.patch (text/x-diff, 1.9K) download From 06a8962dc47979071641028b3bda5ae21bab09c9 Mon Sep 17 00:00:00 2001 From: Andres Freund <andres@anarazel.de> Date: Tue, 13 Sep 2022 10:07:18 -0700 Subject: [PATCH v15 03/14] meson: prereq: De-special-case pgevent's rc file handling There's really no need to build win32ver.rc as part of building pgmsgevent.rc. --- src/bin/pgevent/Makefile | 5 +++-- src/bin/pgevent/pgmsgevent.rc | 2 -- src/tools/msvc/Mkvcbuild.pm | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/bin/pgevent/Makefile b/src/bin/pgevent/Makefile index dea79d3f137..04d49711d8d 100644 --- a/src/bin/pgevent/Makefile +++ b/src/bin/pgevent/Makefile @@ -17,7 +17,8 @@ ifeq ($(PORTNAME), win32) OBJS = \ pgevent.o \ - pgmsgevent.o + pgmsgevent.o \ + $(WIN32RES) NAME=pgevent SHLIB_LINK = @@ -29,7 +30,7 @@ install: all install-lib include $(top_srcdir)/src/Makefile.shlib -pgmsgevent.o: pgmsgevent.rc win32ver.rc +pgmsgevent.o: pgmsgevent.rc $(WINDRES) $< -o $@ --include-dir=$(top_builddir)/src/include --include-dir=$(top_srcdir)/src/include --include-dir=$(srcdir) --include-dir=. clean distclean: clean-lib diff --git a/src/bin/pgevent/pgmsgevent.rc b/src/bin/pgevent/pgmsgevent.rc index e69862e882c..0885a897e6f 100644 --- a/src/bin/pgevent/pgmsgevent.rc +++ b/src/bin/pgevent/pgmsgevent.rc @@ -1,4 +1,2 @@ LANGUAGE 0x9,0x1 1 11 MSG00001.bin - -#include "win32ver.rc" diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index 098bc3f1b09..ddb4f25eb12 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -425,7 +425,6 @@ sub mkvcbuild $pgevent->AddFiles('src/bin/pgevent', 'pgevent.c', 'pgmsgevent.rc'); $pgevent->AddResourceFile('src/bin/pgevent', 'Eventlog message formatter', 'win32'); - $pgevent->RemoveFile('src/bin/pgevent/win32ver.rc'); $pgevent->UseDef('src/bin/pgevent/pgevent.def'); $pgevent->DisableLinkerWarnings('4104'); -- 2.37.3.542.gdd3f6c4cae
v15-0004-meson-prereq-win-remove-date-from-version-number.patch (text/x-diff, 1.1K) download From 7593fd13d95b4f7aafa84ae31ee86cbe182a637e Mon Sep 17 00:00:00 2001 From: Andres Freund <andres@anarazel.de> Date: Wed, 14 Sep 2022 16:43:47 -0700 Subject: [PATCH v15 04/14] meson: prereq: win: remove date from version number in win32ver.rc This may have served a purpose at some point, but these days it just contributes to a non-reproducible build. Discussion: https://postgr.es/m/1cef5b48-32bd-5cbf-fb62-fb648860f5ef@enterprisedb.com --- src/makefiles/Makefile.win32 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/makefiles/Makefile.win32 b/src/makefiles/Makefile.win32 index 17d68196442..d268b3ebafd 100644 --- a/src/makefiles/Makefile.win32 +++ b/src/makefiles/Makefile.win32 @@ -69,7 +69,6 @@ win32ver.rc: $(top_srcdir)/src/port/win32ver.rc sed -e 's;FILEDESC;$(PGFILEDESC);' \ -e 's;VFT_APP;$(PGFTYPE);' \ -e 's;_ICO_;$(PGICOSTR);' \ - -e 's;\(VERSION.*\),0 *$$;\1,'`date '+%y%j' | sed 's/^0*//'`';' \ -e '/_INTERNAL_NAME_/$(if $(shlib),s;_INTERNAL_NAME_;"$(basename $(shlib))";,d)' \ -e '/_ORIGINAL_NAME_/$(if $(shlib),s;_ORIGINAL_NAME_;"$(shlib)";,d)' \ $< >$@ -- 2.37.3.542.gdd3f6c4cae
v15-0005-meson-Add-windows-resource-files.patch (text/x-diff, 93.9K) download From 523551f8117d2db1a607e29d94704a52cd5679aa Mon Sep 17 00:00:00 2001 From: Andres Freund <andres@anarazel.de> Date: Wed, 21 Sep 2022 11:03:07 -0700 Subject: [PATCH v15 05/14] meson: Add windows resource files Author: Andres Freund <andres@anarazel.de> Author: Nazir Bilal Yavuz <byavuz81@gmail.com> --- src/backend/jit/llvm/meson.build | 6 + .../replication/libpqwalreceiver/meson.build | 6 + src/backend/replication/pgoutput/meson.build | 6 + src/backend/snowball/meson.build | 6 + .../utils/mb/conversion_procs/meson.build | 144 ++++++++++++++---- src/bin/initdb/meson.build | 6 + src/bin/pg_amcheck/meson.build | 8 +- src/bin/pg_archivecleanup/meson.build | 12 +- src/bin/pg_basebackup/meson.build | 38 ++++- src/bin/pg_checksums/meson.build | 12 +- src/bin/pg_config/meson.build | 12 +- src/bin/pg_controldata/meson.build | 12 +- src/bin/pg_ctl/meson.build | 12 +- src/bin/pg_dump/meson.build | 18 +++ src/bin/pg_resetwal/meson.build | 12 +- src/bin/pg_rewind/meson.build | 6 + src/bin/pg_test_fsync/meson.build | 10 +- src/bin/pg_test_timing/meson.build | 12 +- src/bin/pg_upgrade/meson.build | 6 + src/bin/pg_verifybackup/meson.build | 6 + src/bin/pg_waldump/meson.build | 6 + src/bin/pgbench/meson.build | 6 + src/bin/pgevent/meson.build | 6 + src/bin/psql/meson.build | 6 + src/bin/scripts/meson.build | 10 +- src/interfaces/libpq/meson.build | 5 + src/interfaces/libpq/test/meson.build | 25 ++- src/pl/plperl/meson.build | 7 + src/pl/plpgsql/src/meson.build | 6 + src/pl/plpython/meson.build | 6 + src/pl/tcl/meson.build | 6 + contrib/adminpack/meson.build | 12 +- contrib/amcheck/meson.build | 17 ++- contrib/auth_delay/meson.build | 12 +- contrib/auto_explain/meson.build | 12 +- contrib/basebackup_to_shell/meson.build | 6 + contrib/basic_archive/meson.build | 6 + contrib/bloom/meson.build | 6 + contrib/bool_plperl/meson.build | 6 + contrib/btree_gin/meson.build | 12 +- contrib/btree_gist/meson.build | 6 + contrib/citext/meson.build | 6 + contrib/cube/meson.build | 6 + contrib/dblink/meson.build | 6 + contrib/dict_int/meson.build | 12 +- contrib/dict_xsyn/meson.build | 12 +- contrib/earthdistance/meson.build | 12 +- contrib/file_fdw/meson.build | 12 +- contrib/fuzzystrmatch/meson.build | 16 +- contrib/hstore/meson.build | 24 ++- contrib/hstore_plperl/meson.build | 6 + contrib/hstore_plpython/meson.build | 6 + contrib/intarray/meson.build | 6 + contrib/isn/meson.build | 6 + contrib/jsonb_plperl/meson.build | 6 + contrib/jsonb_plpython/meson.build | 6 + contrib/lo/meson.build | 6 + contrib/ltree/meson.build | 6 + contrib/ltree_plpython/meson.build | 6 + contrib/oid2name/meson.build | 12 +- contrib/old_snapshot/meson.build | 6 + contrib/pageinspect/meson.build | 6 + contrib/passwordcheck/meson.build | 6 + contrib/pg_buffercache/meson.build | 14 +- contrib/pg_freespacemap/meson.build | 14 +- contrib/pg_prewarm/meson.build | 16 +- contrib/pg_stat_statements/meson.build | 12 +- contrib/pg_surgery/meson.build | 14 +- contrib/pg_trgm/meson.build | 20 ++- contrib/pg_visibility/meson.build | 14 +- contrib/pg_walinspect/meson.build | 6 + contrib/pgcrypto/meson.build | 6 + contrib/pgrowlocks/meson.build | 14 +- contrib/pgstattuple/meson.build | 18 ++- contrib/postgres_fdw/meson.build | 6 + contrib/seg/meson.build | 6 + contrib/sepgsql/meson.build | 6 + contrib/spi/meson.build | 48 +++++- contrib/sslinfo/meson.build | 14 +- contrib/tablefunc/meson.build | 14 +- contrib/tcn/meson.build | 14 +- contrib/test_decoding/meson.build | 6 + contrib/tsm_system_rows/meson.build | 14 +- contrib/tsm_system_time/meson.build | 14 +- contrib/unaccent/meson.build | 14 +- contrib/uuid-ossp/meson.build | 14 +- contrib/vacuumlo/meson.build | 12 +- contrib/xml2/meson.build | 16 +- src/interfaces/ecpg/compatlib/meson.build | 6 +- src/interfaces/ecpg/preproc/meson.build | 6 + src/interfaces/ecpg/test/meson.build | 6 + src/test/isolation/meson.build | 13 ++ src/test/modules/delay_execution/meson.build | 13 +- src/test/modules/dummy_index_am/meson.build | 13 +- src/test/modules/dummy_seclabel/meson.build | 13 +- src/test/modules/libpq_pipeline/meson.build | 14 +- src/test/modules/plsample/meson.build | 13 +- src/test/modules/spgist_name_ops/meson.build | 13 +- .../ssl_passphrase_callback/meson.build | 13 +- src/test/modules/test_bloomfilter/meson.build | 13 +- src/test/modules/test_ddl_deparse/meson.build | 13 +- .../modules/test_ginpostinglist/meson.build | 13 +- src/test/modules/test_integerset/meson.build | 13 +- src/test/modules/test_lfind/meson.build | 13 +- src/test/modules/test_oat_hooks/meson.build | 13 +- src/test/modules/test_parser/meson.build | 13 +- src/test/modules/test_predtest/meson.build | 13 +- src/test/modules/test_rbtree/meson.build | 13 +- src/test/modules/test_regex/meson.build | 13 +- src/test/modules/test_rls_hooks/meson.build | 13 +- src/test/modules/test_shm_mq/meson.build | 19 ++- src/test/modules/worker_spi/meson.build | 15 +- src/test/regress/meson.build | 6 + meson.build | 61 ++++++++ src/timezone/meson.build | 6 + src/tools/rcgen | 99 ++++++++++++ 116 files changed, 1383 insertions(+), 159 deletions(-) create mode 100755 src/tools/rcgen diff --git a/src/backend/jit/llvm/meson.build b/src/backend/jit/llvm/meson.build index de2e624ab58..5fb63768358 100644 --- a/src/backend/jit/llvm/meson.build +++ b/src/backend/jit/llvm/meson.build @@ -20,6 +20,12 @@ llvmjit_sources += files( 'llvmjit_expr.c', ) +if host_system == 'windows' + llvmjit_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'llvmjit', + '--FILEDESC', 'llvmjit - JIT using LLVM',]) +endif + llvmjit = shared_module('llvmjit', llvmjit_sources, kwargs: pg_mod_args + { diff --git a/src/backend/replication/libpqwalreceiver/meson.build b/src/backend/replication/libpqwalreceiver/meson.build index 3fc786c80a0..4c653a05d36 100644 --- a/src/backend/replication/libpqwalreceiver/meson.build +++ b/src/backend/replication/libpqwalreceiver/meson.build @@ -2,6 +2,12 @@ libpqwalreceiver_sources = files( 'libpqwalreceiver.c', ) +if host_system == 'windows' + libpqwalreceiver_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pqwalreceiver', + '--FILEDESC', 'libpqwalreceiver - receive WAL during streaming replication',]) +endif + libpqwalreceiver = shared_module('pqwalreceiver', libpqwalreceiver_sources, kwargs: pg_mod_args + { diff --git a/src/backend/replication/pgoutput/meson.build b/src/backend/replication/pgoutput/meson.build index ab956361a62..5df27d7b764 100644 --- a/src/backend/replication/pgoutput/meson.build +++ b/src/backend/replication/pgoutput/meson.build @@ -2,6 +2,12 @@ pgoutput_sources = files( 'pgoutput.c', ) +if host_system == 'windows' + pgoutput_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pgoutput', + '--FILEDESC', 'pgoutput - standard logical replication output plugin',]) +endif + pgoutput = shared_module('pgoutput', pgoutput_sources, kwargs: pg_mod_args, diff --git a/src/backend/snowball/meson.build b/src/backend/snowball/meson.build index 8c6f685cb32..974401d187e 100644 --- a/src/backend/snowball/meson.build +++ b/src/backend/snowball/meson.build @@ -58,6 +58,12 @@ dict_snowball_sources += files( # see comment in src/include/snowball/header.h stemmer_inc = include_directories('../../include/snowball') +if host_system == 'windows' + dict_snowball_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'dict_snowball', + '--FILEDESC', 'snowball - natural language stemmers',]) +endif + dict_snowball = shared_module('dict_snowball', dict_snowball_sources, kwargs: pg_mod_args + { diff --git a/src/backend/utils/mb/conversion_procs/meson.build b/src/backend/utils/mb/conversion_procs/meson.build index 1bc971d1945..00e721a2453 100644 --- a/src/backend/utils/mb/conversion_procs/meson.build +++ b/src/backend/utils/mb/conversion_procs/meson.build @@ -1,36 +1,122 @@ encodings = { - 'cyrillic_and_mic': ['cyrillic_and_mic/cyrillic_and_mic.c'], - 'euc2004_sjis2004': ['euc2004_sjis2004/euc2004_sjis2004.c'], - 'euc_cn_and_mic': ['euc_cn_and_mic/euc_cn_and_mic.c'], - 'euc_jp_and_sjis': ['euc_jp_and_sjis/euc_jp_and_sjis.c'], - 'euc_kr_and_mic': ['euc_kr_and_mic/euc_kr_and_mic.c'], - 'euc_tw_and_big5': [ - 'euc_tw_and_big5/euc_tw_and_big5.c', - 'euc_tw_and_big5/big5.c', - ], - 'latin2_and_win1250': ['latin2_and_win1250/latin2_and_win1250.c'], - 'latin_and_mic': ['latin_and_mic/latin_and_mic.c'], - 'utf8_and_big5': ['utf8_and_big5/utf8_and_big5.c'], - 'utf8_and_cyrillic': ['utf8_and_cyrillic/utf8_and_cyrillic.c'], - 'utf8_and_euc2004': ['utf8_and_euc2004/utf8_and_euc2004.c'], - 'utf8_and_euc_cn': ['utf8_and_euc_cn/utf8_and_euc_cn.c'], - 'utf8_and_euc_jp': ['utf8_and_euc_jp/utf8_and_euc_jp.c'], - 'utf8_and_euc_kr': ['utf8_and_euc_kr/utf8_and_euc_kr.c'], - 'utf8_and_euc_tw': ['utf8_and_euc_tw/utf8_and_euc_tw.c'], - 'utf8_and_gb18030': ['utf8_and_gb18030/utf8_and_gb18030.c'], - 'utf8_and_gbk': ['utf8_and_gbk/utf8_and_gbk.c'], - 'utf8_and_iso8859': ['utf8_and_iso8859/utf8_and_iso8859.c'], - 'utf8_and_iso8859_1': ['utf8_and_iso8859_1/utf8_and_iso8859_1.c'], - 'utf8_and_johab': ['utf8_and_johab/utf8_and_johab.c'], - 'utf8_and_sjis': ['utf8_and_sjis/utf8_and_sjis.c'], - 'utf8_and_sjis2004': ['utf8_and_sjis2004/utf8_and_sjis2004.c'], - 'utf8_and_uhc': ['utf8_and_uhc/utf8_and_uhc.c'], - 'utf8_and_win': ['utf8_and_win/utf8_and_win.c'], + 'cyrillic_and_mic': { + 'sources': ['cyrillic_and_mic/cyrillic_and_mic.c'], + 'description': 'cyrillic <-> mic text conversions', + }, + 'euc2004_sjis2004': { + 'sources': ['euc2004_sjis2004/euc2004_sjis2004.c'], + 'description': 'euc2004 <-> sjis2004 text conversions', + }, + 'euc_cn_and_mic': { + 'sources': ['euc_cn_and_mic/euc_cn_and_mic.c'], + 'description': 'euc_cn <-> mic text conversions', + }, + 'euc_jp_and_sjis': { + 'sources': ['euc_jp_and_sjis/euc_jp_and_sjis.c'], + 'description': 'euc_jp <-> sjis text conversions', + }, + 'euc_kr_and_mic': { + 'sources': ['euc_kr_and_mic/euc_kr_and_mic.c'], + 'description': 'euc_kr <-> mic text conversions', + }, + 'euc_tw_and_big5': { + 'sources': [ + 'euc_tw_and_big5/euc_tw_and_big5.c', + 'euc_tw_and_big5/big5.c', + ], + 'description': 'euc_tw <-> big5 text conversions', + }, + 'latin2_and_win1250': { + 'sources': ['latin2_and_win1250/latin2_and_win1250.c'], + 'description': 'latin2 <-> win1250 text conversions', + }, + 'latin_and_mic': { + 'sources': ['latin_and_mic/latin_and_mic.c'], + 'description': 'latin <-> mic text conversions', + }, + 'utf8_and_big5': { + 'sources': ['utf8_and_big5/utf8_and_big5.c'], + 'description': 'utf8 <-> big5 text conversions', + }, + 'utf8_and_cyrillic': { + 'sources': ['utf8_and_cyrillic/utf8_and_cyrillic.c'], + 'description': 'utf8 <-> cyrillic text conversions', + }, + 'utf8_and_euc2004': { + 'sources': ['utf8_and_euc2004/utf8_and_euc2004.c'], + 'description': 'utf8 <-> euc2004 text conversions', + }, + 'utf8_and_euc_cn': { + 'sources': ['utf8_and_euc_cn/utf8_and_euc_cn.c'], + 'description': 'utf8 <-> euc_cn text conversions', + }, + 'utf8_and_euc_jp': { + 'sources': ['utf8_and_euc_jp/utf8_and_euc_jp.c'], + 'description': 'utf8 <-> euc_jp text conversions', + }, + 'utf8_and_euc_kr': { + 'sources': ['utf8_and_euc_kr/utf8_and_euc_kr.c'], + 'description': 'utf8 <-> euc_kr text conversions', + }, + 'utf8_and_euc_tw': { + 'sources': ['utf8_and_euc_tw/utf8_and_euc_tw.c'], + 'description': 'utf8 <-> euc_tw text conversions', + }, + 'utf8_and_gb18030': { + 'sources': ['utf8_and_gb18030/utf8_and_gb18030.c'], + 'description': 'utf8 <-> gb18030 text conversions', + }, + 'utf8_and_gbk': { + 'sources': ['utf8_and_gbk/utf8_and_gbk.c'], + 'description': 'utf8 <-> gbk text conversions', + }, + 'utf8_and_iso8859': { + 'sources': ['utf8_and_iso8859/utf8_and_iso8859.c'], + 'description': 'utf8 <-> iso8859 text conversions', + }, + 'utf8_and_iso8859_1': { + 'sources': ['utf8_and_iso8859_1/utf8_and_iso8859_1.c'], + 'description': 'utf8 <-> iso8859_1 text conversions', + }, + 'utf8_and_johab': { + 'sources': ['utf8_and_johab/utf8_and_johab.c'], + 'description': 'utf8 <-> johab text conversions', + }, + 'utf8_and_sjis': { + 'sources': ['utf8_and_sjis/utf8_and_sjis.c'], + 'description': 'utf8 <-> sjis text conversions', + }, + 'utf8_and_sjis2004': { + 'sources': ['utf8_and_sjis2004/utf8_and_sjis2004.c'], + 'description': 'utf8 <-> sjis2004 text conversions', + }, + 'utf8_and_uhc': { + 'sources': ['utf8_and_uhc/utf8_and_uhc.c'], + 'description': 'utf8 <-> uhc text conversions', + }, + 'utf8_and_win': { + 'sources': ['utf8_and_win/utf8_and_win.c'], + 'description': 'utf8 <-> win text conversions', + }, } -foreach encoding, sources : encodings +foreach encoding, values: encodings + sources = values['sources'] + description = values['description'] + + source_files = files() + foreach source: sources + source_files += files(source) + endforeach + + if host_system == 'windows' + source_files += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', encoding, + '--FILEDESC', description,]) + endif + backend_targets += shared_module(encoding, - sources, + source_files, kwargs: pg_mod_args, ) endforeach diff --git a/src/bin/initdb/meson.build b/src/bin/initdb/meson.build index 9f213274d2f..6ced9a31b80 100644 --- a/src/bin/initdb/meson.build +++ b/src/bin/initdb/meson.build @@ -7,6 +7,12 @@ initdb_sources += timezone_localtime_source #fixme: reimplement libpq_pgport logic +if host_system == 'windows' + initdb_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'initdb', + '--FILEDESC', 'initdb - initialize a new database cluster',]) +endif + initdb = executable('initdb', initdb_sources, include_directories: [timezone_inc], diff --git a/src/bin/pg_amcheck/meson.build b/src/bin/pg_amcheck/meson.build index 8e197eba5f3..25f5e7a0948 100644 --- a/src/bin/pg_amcheck/meson.build +++ b/src/bin/pg_amcheck/meson.build @@ -1,7 +1,13 @@ pg_amcheck_sources = files( - 'pg_amcheck.c' + 'pg_amcheck.c', ) +if host_system == 'windows' + pg_amcheck_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_amcheck', + '--FILEDESC', 'pg_amcheck - detect corruption within database relations',]) +endif + pg_amcheck = executable('pg_amcheck', pg_amcheck_sources, dependencies: [frontend_code, libpq], diff --git a/src/bin/pg_archivecleanup/meson.build b/src/bin/pg_archivecleanup/meson.build index 87a0d980c4f..aaa2e76977f 100644 --- a/src/bin/pg_archivecleanup/meson.build +++ b/src/bin/pg_archivecleanup/meson.build @@ -1,5 +1,15 @@ +pg_archivecleanup_sources = files( + 'pg_archivecleanup.c', +) + +if host_system == 'windows' + pg_archivecleanup_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_archivecleanup', + '--FILEDESC', 'pg_archivecleanup - cleans archive when used with streaming replication',]) +endif + pg_archivecleanup = executable('pg_archivecleanup', - ['pg_archivecleanup.c'], + pg_archivecleanup_sources, dependencies: [frontend_code], kwargs: default_bin_args, ) diff --git a/src/bin/pg_basebackup/meson.build b/src/bin/pg_basebackup/meson.build index d26fed9cd8a..2c934e0c26e 100644 --- a/src/bin/pg_basebackup/meson.build +++ b/src/bin/pg_basebackup/meson.build @@ -17,24 +17,56 @@ pg_basebackup_common = static_library('libpg_basebackup_common', kwargs: internal_lib_args, ) -pg_basebackup = executable('pg_basebackup', +pg_basebackup_sources = files( 'pg_basebackup.c', +) + +if host_system == 'windows' + pg_basebackup_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_basebackup', + '--FILEDESC', 'pg_basebackup - streaming WAL and backup receivers',]) +endif + +pg_basebackup = executable('pg_basebackup', + pg_basebackup_sources, link_with: [pg_basebackup_common], dependencies: pg_basebackup_deps, kwargs: default_bin_args, ) bin_targets += pg_basebackup -pg_receivewal = executable('pg_receivewal', + +pg_receivewal_sources = files( 'pg_receivewal.c', +) + +if host_system == 'windows' + pg_receivewal_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_receivewal', + '--FILEDESC', 'pg_receivewal - streaming WAL and backup receivers',]) +endif + +pg_receivewal = executable('pg_receivewal', + pg_receivewal_sources, link_with: [pg_basebackup_common], dependencies: pg_basebackup_deps, kwargs: default_bin_args, ) bin_targets += pg_receivewal -pg_recvlogical = executable('pg_recvlogical', + +pg_recvlogical_sources = files( 'pg_recvlogical.c', +) + +if host_system == 'windows' + pg_recvlogical_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_recvlogical', + '--FILEDESC', 'pg_recvlogical - streaming WAL and backup receivers',]) +endif + +pg_recvlogical = executable('pg_recvlogical', + pg_recvlogical_sources, link_with: [pg_basebackup_common], dependencies: pg_basebackup_deps, kwargs: default_bin_args, diff --git a/src/bin/pg_checksums/meson.build b/src/bin/pg_checksums/meson.build index ee1f367bac3..d07ebc999b3 100644 --- a/src/bin/pg_checksums/meson.build +++ b/src/bin/pg_checksums/meson.build @@ -1,5 +1,15 @@ +pg_checksums_sources = files( + 'pg_checksums.c', +) + +if host_system == 'windows' + pg_checksums_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_checksums', + '--FILEDESC', 'pg_checksums - verify data checksums in an offline cluster',]) +endif + pg_checksums = executable('pg_checksums', - ['pg_checksums.c'], + pg_checksums_sources, include_directories: [timezone_inc], dependencies: [frontend_code], kwargs: default_bin_args, diff --git a/src/bin/pg_config/meson.build b/src/bin/pg_config/meson.build index 0ecbf2f9d28..4be2fdc84ae 100644 --- a/src/bin/pg_config/meson.build +++ b/src/bin/pg_config/meson.build @@ -1,5 +1,15 @@ +pg_config_sources = files( + 'pg_config.c', +) + +if host_system == 'windows' + pg_config_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_config', + '--FILEDESC', 'pg_config - report configuration information',]) +endif + pg_config = executable('pg_config', - ['pg_config.c'], + pg_config_sources, dependencies: [frontend_code], kwargs: default_bin_args, ) diff --git a/src/bin/pg_controldata/meson.build b/src/bin/pg_controldata/meson.build index 557e672beb7..7fc239dbe65 100644 --- a/src/bin/pg_controldata/meson.build +++ b/src/bin/pg_controldata/meson.build @@ -1,5 +1,15 @@ +pg_controldata_sources = files( + 'pg_controldata.c', +) + +if host_system == 'windows' + pg_controldata_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_controldata', + '--FILEDESC', 'pg_controldata - reads the data from pg_control',]) +endif + pg_controldata = executable('pg_controldata', - ['pg_controldata.c'], + pg_controldata_sources, dependencies: [frontend_code], kwargs: default_bin_args, ) diff --git a/src/bin/pg_ctl/meson.build b/src/bin/pg_ctl/meson.build index 6812e73e329..96f962fa762 100644 --- a/src/bin/pg_ctl/meson.build +++ b/src/bin/pg_ctl/meson.build @@ -1,5 +1,15 @@ +pg_ctl_sources = files( + 'pg_ctl.c', +) + +if host_system == 'windows' + pg_ctl_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_ctl', + '--FILEDESC', 'pg_ctl - starts/stops/restarts the PostgreSQL server',]) +endif + pg_ctl = executable('pg_ctl', - ['pg_ctl.c'], + pg_ctl_sources, dependencies: [frontend_code, libpq], kwargs: default_bin_args, ) diff --git a/src/bin/pg_dump/meson.build b/src/bin/pg_dump/meson.build index 785ec094dbd..3527a25c288 100644 --- a/src/bin/pg_dump/meson.build +++ b/src/bin/pg_dump/meson.build @@ -24,6 +24,12 @@ pg_dump_sources = files( 'pg_dump_sort.c', ) +if host_system == 'windows' + pg_dump_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_dump', + '--FILEDESC', 'pg_dump - backup one PostgreSQL database',]) +endif + pg_dump = executable('pg_dump', pg_dump_sources, link_with: [pg_dump_common], @@ -37,6 +43,12 @@ pg_dumpall_sources = files( 'pg_dumpall.c', ) +if host_system == 'windows' + pg_dumpall_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_dumpall', + '--FILEDESC', 'pg_dumpall - backup PostgreSQL databases']) +endif + pg_dumpall = executable('pg_dumpall', pg_dumpall_sources, link_with: [pg_dump_common], @@ -50,6 +62,12 @@ pg_restore_sources = files( 'pg_restore.c', ) +if host_system == 'windows' + pg_restore_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_restore', + '--FILEDESC', 'pg_restore - restore PostgreSQL databases']) +endif + pg_restore = executable('pg_restore', pg_restore_sources, link_with: [pg_dump_common], diff --git a/src/bin/pg_resetwal/meson.build b/src/bin/pg_resetwal/meson.build index 7c5de134ac0..d503db97b71 100644 --- a/src/bin/pg_resetwal/meson.build +++ b/src/bin/pg_resetwal/meson.build @@ -1,5 +1,15 @@ +pg_resetwal_sources = files( + 'pg_resetwal.c', +) + +if host_system == 'windows' + pg_resetwal_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_resetwal', + '--FILEDESC', 'pg_resetwal - reset PostgreSQL WAL log']) +endif + pg_resetwal = executable('pg_resetwal', - files('pg_resetwal.c'), + pg_resetwal_sources, dependencies: [frontend_code], kwargs: default_bin_args, ) diff --git a/src/bin/pg_rewind/meson.build b/src/bin/pg_rewind/meson.build index d8ec9e482d5..6cd970909a2 100644 --- a/src/bin/pg_rewind/meson.build +++ b/src/bin/pg_rewind/meson.build @@ -11,6 +11,12 @@ pg_rewind_sources = files( pg_rewind_sources += xlogreader_sources +if host_system == 'windows' + pg_rewind_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_rewind', + '--FILEDESC', 'pg_rewind - synchronize a data directory with another one forked from']) +endif + pg_rewind = executable('pg_rewind', pg_rewind_sources, dependencies: [frontend_code, libpq, lz4, zstd], diff --git a/src/bin/pg_test_fsync/meson.build b/src/bin/pg_test_fsync/meson.build index 2c01831e11f..31d288ba6da 100644 --- a/src/bin/pg_test_fsync/meson.build +++ b/src/bin/pg_test_fsync/meson.build @@ -1,4 +1,12 @@ -test_fsync_sources = files('pg_test_fsync.c') +test_fsync_sources = files( + 'pg_test_fsync.c', +) + +if host_system == 'windows' + test_fsync_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_test_fsync', + '--FILEDESC', 'pg_test_fsync - test various disk sync methods']) +endif pg_test_fsync = executable('pg_test_fsync', test_fsync_sources, diff --git a/src/bin/pg_test_timing/meson.build b/src/bin/pg_test_timing/meson.build index 0a3068f1657..0aed03ea32f 100644 --- a/src/bin/pg_test_timing/meson.build +++ b/src/bin/pg_test_timing/meson.build @@ -1,5 +1,15 @@ +pg_test_timing_sources = files( + 'pg_test_timing.c' +) + +if host_system == 'windows' + pg_test_timing_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_test_timing', + '--FILEDESC', 'pg_test_timing - test timing overhead']) +endif + pg_test_timing = executable('pg_test_timing', - ['pg_test_timing.c'], + pg_test_timing_sources, dependencies: [frontend_code], kwargs: default_bin_args, ) diff --git a/src/bin/pg_upgrade/meson.build b/src/bin/pg_upgrade/meson.build index 02f030e0ccf..a7b927a45c7 100644 --- a/src/bin/pg_upgrade/meson.build +++ b/src/bin/pg_upgrade/meson.build @@ -16,6 +16,12 @@ pg_upgrade_sources = files( 'version.c', ) +if host_system == 'windows' + pg_upgrade_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_upgrade', + '--FILEDESC', 'pg_upgrade - an in-place binary upgrade utility']) +endif + pg_upgrade = executable('pg_upgrade', pg_upgrade_sources, dependencies: [frontend_code, libpq], diff --git a/src/bin/pg_verifybackup/meson.build b/src/bin/pg_verifybackup/meson.build index 4c3b2bb5f97..b934a408443 100644 --- a/src/bin/pg_verifybackup/meson.build +++ b/src/bin/pg_verifybackup/meson.build @@ -3,6 +3,12 @@ pg_verifybackup_sources = files( 'pg_verifybackup.c' ) +if host_system == 'windows' + pg_verifybackup_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_verifybackup', + '--FILEDESC', 'pg_verifybackup - verify a backup against using a backup manifest']) +endif + pg_verifybackup = executable('pg_verifybackup', pg_verifybackup_sources, dependencies: [frontend_code, libpq], diff --git a/src/bin/pg_waldump/meson.build b/src/bin/pg_waldump/meson.build index 95872652ffd..9605976870d 100644 --- a/src/bin/pg_waldump/meson.build +++ b/src/bin/pg_waldump/meson.build @@ -8,6 +8,12 @@ pg_waldump_sources += rmgr_desc_sources pg_waldump_sources += xlogreader_sources pg_waldump_sources += files('../../backend/access/transam/xlogstats.c') +if host_system == 'windows' + pg_waldump_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_waldump', + '--FILEDESC', 'pg_waldump - decode and display WA']) +endif + pg_waldump = executable('pg_waldump', pg_waldump_sources, dependencies: [frontend_code, lz4, zstd], diff --git a/src/bin/pgbench/meson.build b/src/bin/pgbench/meson.build index 6564e54029c..a32eb51fe07 100644 --- a/src/bin/pgbench/meson.build +++ b/src/bin/pgbench/meson.build @@ -17,6 +17,12 @@ exprparse = custom_target('exprparse', generated_sources += exprparse.to_list() pgbench_sources += exprparse +if host_system == 'windows' + pgbench_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pgbench', + '--FILEDESC', 'pgbench - a simple program for running benchmark tests']) +endif + pgbench = executable('pgbench', pgbench_sources, dependencies: [frontend_code, libpq, thread_dep], diff --git a/src/bin/pgevent/meson.build b/src/bin/pgevent/meson.build index 7a468879fd2..2e9aea4b0e1 100644 --- a/src/bin/pgevent/meson.build +++ b/src/bin/pgevent/meson.build @@ -6,6 +6,12 @@ pgevent_sources = files( 'pgevent.c', ) +pgevent_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pgevent', + '--FILEDESC', 'Eventlog message formatter',]) + +pgevent_sources += windows.compile_resources('pgmsgevent.rc') + # FIXME: copied from Mkvcbuild.pm, but I don't think that's the right approach pgevent_link_args = [] if cc.get_id() == 'msvc' diff --git a/src/bin/psql/meson.build b/src/bin/psql/meson.build index ea850c8fdf5..3474389d3b6 100644 --- a/src/bin/psql/meson.build +++ b/src/bin/psql/meson.build @@ -38,6 +38,12 @@ generated_sources += sql_help.to_list() psql_sources += sql_help bin_targets += sql_help +if host_system == 'windows' + psql_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'psql', + '--FILEDESC', 'psql - the PostgreSQL interactive terminal',]) +endif + psql = executable('psql', psql_sources, include_directories: include_directories('.'), diff --git a/src/bin/scripts/meson.build b/src/bin/scripts/meson.build index eaf250c7f73..837562c24e5 100644 --- a/src/bin/scripts/meson.build +++ b/src/bin/scripts/meson.build @@ -16,8 +16,16 @@ binaries = [ ] foreach binary : binaries + binary_sources = files('@0@.c'.format(binary)) + + if host_system == 'windows' + binary_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', binary, + '--FILEDESC', '@0@ - PostgreSQL utility'.format(binary),]) + endif + binary = executable(binary, - files(binary + '.c'), + binary_sources, link_with: [scripts_common], dependencies: [frontend_code, libpq], kwargs: default_bin_args, diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build index bc047e00d62..2c9edeaa088 100644 --- a/src/interfaces/libpq/meson.build +++ b/src/interfaces/libpq/meson.build @@ -16,9 +16,13 @@ libpq_sources = files( 'libpq-events.c', 'pqexpbuffer.c', ) +libpq_so_sources = [] # only for shared lib, in addition to above if host_system == 'windows' libpq_sources += files('pthread-win32.c', 'win32.c') + libpq_so_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'libpq', + '--FILEDESC', 'PostgreSQL Access Library',]) endif if ssl.found() @@ -52,6 +56,7 @@ libpq_st = static_library('libpq', # not using both_libraries here, causes problems with precompiled headers and # resource files with msbuild libpq_so = shared_library('libpq', + libpq_so_sources, dependencies: libpq_deps, include_directories: [libpq_inc, postgres_inc], c_args: ['-DSO_MAJOR_VERSION=5'], diff --git a/src/interfaces/libpq/test/meson.build b/src/interfaces/libpq/test/meson.build index 16f94c1ed8b..017f729d435 100644 --- a/src/interfaces/libpq/test/meson.build +++ b/src/interfaces/libpq/test/meson.build @@ -1,13 +1,34 @@ +libpq_uri_regress_sources = files( + 'libpq_uri_regress.c', +) + +if host_system == 'windows' + libpq_uri_regress_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'libpq_uri_regress', + '--FILEDESC', 'libpq test program',]) +endif + executable('libpq_uri_regress', - files('libpq_uri_regress.c'), + libpq_uri_regress_sources, dependencies: [frontend_code, libpq], kwargs: default_bin_args + { 'install': false, } ) + +libpq_testclient_sources = files( + 'libpq_testclient.c', +) + +if host_system == 'windows' + libpq_testclient_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'libpq_testclient', + '--FILEDESC', 'libpq test program',]) +endif + executable('libpq_testclient', - files('libpq_testclient.c'), + libpq_testclient_sources, dependencies: [frontend_code, libpq], kwargs: default_bin_args + { 'install': false, diff --git a/src/pl/plperl/meson.build b/src/pl/plperl/meson.build index 73b733dd50b..535660085dd 100644 --- a/src/pl/plperl/meson.build +++ b/src/pl/plperl/meson.build @@ -36,6 +36,13 @@ foreach n : ['SPI', 'Util'] endforeach plperl_inc = include_directories('.') + +if host_system == 'windows' + plperl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'plperl', + '--FILEDESC', 'PL/Perl - procedural language',]) +endif + plperl = shared_module('plperl', plperl_sources, include_directories: [plperl_inc, postgres_inc], diff --git a/src/pl/plpgsql/src/meson.build b/src/pl/plpgsql/src/meson.build index dd499fdd151..c46c0a1da2a 100644 --- a/src/pl/plpgsql/src/meson.build +++ b/src/pl/plpgsql/src/meson.build @@ -40,6 +40,12 @@ pl_unreserved = custom_target('pl_unreserved_kwlist', generated_sources += pl_unreserved plpgsql_sources += pl_unreserved +if host_system == 'windows' + plpgsql_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'plpgsql', + '--FILEDESC', 'PL/pgSQL - procedural language',]) +endif + plpgsql = shared_module('plpgsql', plpgsql_sources, include_directories: include_directories('.'), diff --git a/src/pl/plpython/meson.build b/src/pl/plpython/meson.build index 366b3b171ac..40888386b5f 100644 --- a/src/pl/plpython/meson.build +++ b/src/pl/plpython/meson.build @@ -28,6 +28,12 @@ plpython_sources += custom_target('spiexceptions.h', # FIXME: need to duplicate import library ugliness? plpython_inc = include_directories('.') +if host_system == 'windows' + plpython_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'plpython3', + '--FILEDESC', 'PL/Python - procedural language',]) +endif + plpython = shared_module('plpython3', plpython_sources, include_directories: [plpython_inc, postgres_inc], diff --git a/src/pl/tcl/meson.build b/src/pl/tcl/meson.build index 9b6addd7fd5..f09bb14c950 100644 --- a/src/pl/tcl/meson.build +++ b/src/pl/tcl/meson.build @@ -14,6 +14,12 @@ pltcl_sources += custom_target('pltclerrcodes.h', command: [perl, gen_pltclerrcodes, '@INPUT@'] ) +if host_system == 'windows' + pltcl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pltcl', + '--FILEDESC', 'PL/Tcl - procedural language',]) +endif + pltcl = shared_module('pltcl', pltcl_sources, include_directories: [include_directories('.'), postgres_inc], diff --git a/contrib/adminpack/meson.build b/contrib/adminpack/meson.build index fc2368d02cf..7efec0efbc0 100644 --- a/contrib/adminpack/meson.build +++ b/contrib/adminpack/meson.build @@ -1,5 +1,15 @@ +adminpack_sources = files( + 'adminpack.c', +) + +if host_system == 'windows' + adminpack_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'adminpack', + '--FILEDESC', 'adminpack - support functions for pgAdmin',]) +endif + adminpack = shared_module('adminpack', - ['adminpack.c'], + adminpack_sources, kwargs: contrib_mod_args, ) contrib_targets += adminpack diff --git a/contrib/amcheck/meson.build b/contrib/amcheck/meson.build index 1db3d20349e..fa807b72d98 100644 --- a/contrib/amcheck/meson.build +++ b/contrib/amcheck/meson.build @@ -1,7 +1,16 @@ -amcheck = shared_module('amcheck', [ - 'verify_heapam.c', - 'verify_nbtree.c', - ], +amcheck_sources = files( + 'verify_heapam.c', + 'verify_nbtree.c', +) + +if host_system == 'windows' + amcheck_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'amcheck', + '--FILEDESC', 'amcheck - function for verifying relation integrity',]) +endif + +amcheck = shared_module('amcheck', + amcheck_sources, kwargs: contrib_mod_args, ) contrib_targets += amcheck diff --git a/contrib/auth_delay/meson.build b/contrib/auth_delay/meson.build index d2e01968f54..c4ffb0663bc 100644 --- a/contrib/auth_delay/meson.build +++ b/contrib/auth_delay/meson.build @@ -1,5 +1,15 @@ +auth_delay_sources = files( + 'auth_delay.c', +) + +if host_system == 'windows' + auth_delay_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'auth_delay', + '--FILEDESC', 'auth_delay - delay authentication failure reports',]) +endif + autoinc = shared_module('auth_delay', - ['auth_delay.c'], + auth_delay_sources, kwargs: contrib_mod_args, ) contrib_targets += autoinc diff --git a/contrib/auto_explain/meson.build b/contrib/auto_explain/meson.build index 249a8376faa..76f86617850 100644 --- a/contrib/auto_explain/meson.build +++ b/contrib/auto_explain/meson.build @@ -1,5 +1,15 @@ +auto_explain_sources = files( + 'auto_explain.c', +) + +if host_system == 'windows' + auto_explain_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'auto_explain', + '--FILEDESC', 'auto_explain - logging facility for execution plans',]) +endif + auto_explain = shared_module('auto_explain', - files('auto_explain.c'), + auto_explain_sources, kwargs: contrib_mod_args, ) contrib_targets += auto_explain diff --git a/contrib/basebackup_to_shell/meson.build b/contrib/basebackup_to_shell/meson.build index 9f0517f1701..3a389de9175 100644 --- a/contrib/basebackup_to_shell/meson.build +++ b/contrib/basebackup_to_shell/meson.build @@ -2,6 +2,12 @@ basebackup_to_shell_sources = files( 'basebackup_to_shell.c', ) +if host_system == 'windows' + basebackup_to_shell_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'basebackup_to_shell', + '--FILEDESC', 'basebackup_to_shell - target basebackup to shell command',]) +endif + basebackup_to_shell = shared_module('basebackup_to_shell', basebackup_to_shell_sources, kwargs: contrib_mod_args, diff --git a/contrib/basic_archive/meson.build b/contrib/basic_archive/meson.build index b67cbef60bd..c30dcfa5d41 100644 --- a/contrib/basic_archive/meson.build +++ b/contrib/basic_archive/meson.build @@ -2,6 +2,12 @@ basic_archive_sources = files( 'basic_archive.c', ) +if host_system == 'windows' + basic_archive_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'basic_archive', + '--FILEDESC', 'basic_archive - basic archive module',]) +endif + basic_archive = shared_module('basic_archive', basic_archive_sources, kwargs: contrib_mod_args, diff --git a/contrib/bloom/meson.build b/contrib/bloom/meson.build index 1fe7632bdbe..16f3b83e4d2 100644 --- a/contrib/bloom/meson.build +++ b/contrib/bloom/meson.build @@ -7,6 +7,12 @@ bloom_sources = files( 'blvalidate.c', ) +if host_system == 'windows' + bloom_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'bloom', + '--FILEDESC', 'bloom access method - signature file based index',]) +endif + bloom = shared_module('bloom', bloom_sources, kwargs: contrib_mod_args, diff --git a/contrib/bool_plperl/meson.build b/contrib/bool_plperl/meson.build index c20b667d75f..a68daab0dcd 100644 --- a/contrib/bool_plperl/meson.build +++ b/contrib/bool_plperl/meson.build @@ -6,6 +6,12 @@ bool_plperl_sources = files( 'bool_plperl.c', ) +if host_system == 'windows' + bool_plperl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'bool_plperl', + '--FILEDESC', 'bool_plperl - bool transform for plperl',]) +endif + bool_plperl = shared_module('bool_plperl', bool_plperl_sources, include_directories: [plperl_inc, include_directories('.')], diff --git a/contrib/btree_gin/meson.build b/contrib/btree_gin/meson.build index 15d6d31a6ee..fd4c76767a7 100644 --- a/contrib/btree_gin/meson.build +++ b/contrib/btree_gin/meson.build @@ -1,5 +1,15 @@ +btree_gin_sources = files( + 'btree_gin.c', +) + +if host_system == 'windows' + btree_gin_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'btree_gin', + '--FILEDESC', 'btree_gin - B-tree equivalent GIN operator classes',]) +endif + btree_gin = shared_module('btree_gin', - files('btree_gin.c'), + btree_gin_sources, kwargs: contrib_mod_args, ) contrib_targets += btree_gin diff --git a/contrib/btree_gist/meson.build b/contrib/btree_gist/meson.build index c0a8d238540..e98c91dacc8 100644 --- a/contrib/btree_gist/meson.build +++ b/contrib/btree_gist/meson.build @@ -25,6 +25,12 @@ btree_gist_sources = files( 'btree_uuid.c', ) +if host_system == 'windows' + btree_gist_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'btree_gist', + '--FILEDESC', 'btree_gist - B-tree equivalent GiST operator classes',]) +endif + btree_gist = shared_module('btree_gist', btree_gist_sources, kwargs: contrib_mod_args, diff --git a/contrib/citext/meson.build b/contrib/citext/meson.build index ca60eded80b..26a101a19bd 100644 --- a/contrib/citext/meson.build +++ b/contrib/citext/meson.build @@ -2,6 +2,12 @@ citext_sources = files( 'citext.c', ) +if host_system == 'windows' + citext_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'citext', + '--FILEDESC', 'citext - case-insensitive character string data type',]) +endif + citext = shared_module('citext', citext_sources, kwargs: contrib_mod_args, diff --git a/contrib/cube/meson.build b/contrib/cube/meson.build index 72342b0c82c..041acf95a90 100644 --- a/contrib/cube/meson.build +++ b/contrib/cube/meson.build @@ -17,6 +17,12 @@ cube_parse = custom_target('cubeparse', generated_sources += cube_parse.to_list() cube_sources += cube_parse +if host_system == 'windows' + cube_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'cube', + '--FILEDESC', 'cube - multidimensional cube data type',]) +endif + cube = shared_module('cube', cube_sources, include_directories: include_directories('.'), diff --git a/contrib/dblink/meson.build b/contrib/dblink/meson.build index d35f7b5d49e..66eeb03b736 100644 --- a/contrib/dblink/meson.build +++ b/contrib/dblink/meson.build @@ -2,6 +2,12 @@ dblink_sources = files( 'dblink.c', ) +if host_system == 'windows' + dblink_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'dblink', + '--FILEDESC', 'dblink - connect to other PostgreSQL databases',]) +endif + dblink = shared_module('dblink', dblink_sources, kwargs: contrib_mod_args + { diff --git a/contrib/dict_int/meson.build b/contrib/dict_int/meson.build index f00e8085619..6fff921adda 100644 --- a/contrib/dict_int/meson.build +++ b/contrib/dict_int/meson.build @@ -1,5 +1,15 @@ +dict_int_sources = files( + 'dict_int.c', +) + +if host_system == 'windows' + dict_int_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'dict_int', + '--FILEDESC', 'dict_int - add-on dictionary template for full-text search',]) +endif + dict_int = shared_module('dict_int', - files('dict_int.c'), + dict_int_sources, kwargs: contrib_mod_args, ) contrib_targets += dict_int diff --git a/contrib/dict_xsyn/meson.build b/contrib/dict_xsyn/meson.build index be53f55bb79..fabd505a7df 100644 --- a/contrib/dict_xsyn/meson.build +++ b/contrib/dict_xsyn/meson.build @@ -1,5 +1,15 @@ +dict_xsyn_sources = files( + 'dict_xsyn.c', +) + +if host_system == 'windows' + dict_xsyn_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'dict_xsyn', + '--FILEDESC', 'dict_xsyn - add-on dictionary template for full-text search',]) +endif + dict_xsyn = shared_module('dict_xsyn', - files('dict_xsyn.c'), + dict_xsyn_sources, kwargs: contrib_mod_args, ) contrib_targets += dict_xsyn diff --git a/contrib/earthdistance/meson.build b/contrib/earthdistance/meson.build index 807f5cb7de3..78dc29c3da3 100644 --- a/contrib/earthdistance/meson.build +++ b/contrib/earthdistance/meson.build @@ -1,5 +1,15 @@ +earthdistance_sources = files( + 'earthdistance.c', +) + +if host_system == 'windows' + earthdistance_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'earthdistance', + '--FILEDESC', 'earthdistance - calculate distances on the surface of the Earth',]) +endif + earthdistance = shared_module('earthdistance', - files('earthdistance.c'), + earthdistance_sources, kwargs: contrib_mod_args, ) contrib_targets += earthdistance diff --git a/contrib/file_fdw/meson.build b/contrib/file_fdw/meson.build index f13efb6e38e..c4071faa669 100644 --- a/contrib/file_fdw/meson.build +++ b/contrib/file_fdw/meson.build @@ -1,5 +1,15 @@ +file_fdw_sources = files( + 'file_fdw.c', +) + +if host_system == 'windows' + file_fdw_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'file_fdw', + '--FILEDESC', 'file_fdw - foreign data wrapper for files',]) +endif + file_fdw = shared_module('file_fdw', - files('file_fdw.c'), + file_fdw_sources, kwargs: contrib_mod_args, ) contrib_targets += file_fdw diff --git a/contrib/fuzzystrmatch/meson.build b/contrib/fuzzystrmatch/meson.build index ec278a6211e..e6d06149cec 100644 --- a/contrib/fuzzystrmatch/meson.build +++ b/contrib/fuzzystrmatch/meson.build @@ -1,8 +1,16 @@ +fuzzystrmatch_sources = files( + 'fuzzystrmatch.c', + 'dmetaphone.c', +) + +if host_system == 'windows' + fuzzystrmatch_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'fuzzystrmatch', + '--FILEDESC', 'fuzzystrmatch - similarities and distance between strings',]) +endif + fuzzystrmatch = shared_module('fuzzystrmatch', - files( - 'fuzzystrmatch.c', - 'dmetaphone.c' - ), + fuzzystrmatch_sources, kwargs: contrib_mod_args, ) contrib_targets += fuzzystrmatch diff --git a/contrib/hstore/meson.build b/contrib/hstore/meson.build index 07c59f40a97..2bb26bb772b 100644 --- a/contrib/hstore/meson.build +++ b/contrib/hstore/meson.build @@ -1,15 +1,23 @@ # .. so that includes of hstore/hstore.h work hstore_inc = include_directories('.', '../') +hstore_sources = files( + 'hstore_compat.c', + 'hstore_gin.c', + 'hstore_gist.c', + 'hstore_io.c', + 'hstore_op.c', + 'hstore_subs.c', +) + +if host_system == 'windows' + hstore_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'hstore', + '--FILEDESC', 'hstore - key/value pair data type',]) +endif + hstore = shared_module('hstore', - files( - 'hstore_compat.c', - 'hstore_gin.c', - 'hstore_gist.c', - 'hstore_io.c', - 'hstore_op.c', - 'hstore_subs.c', - ), + hstore_sources, kwargs: contrib_mod_args, ) contrib_targets += hstore diff --git a/contrib/hstore_plperl/meson.build b/contrib/hstore_plperl/meson.build index bbafa0221bd..a238fee6a26 100644 --- a/contrib/hstore_plperl/meson.build +++ b/contrib/hstore_plperl/meson.build @@ -6,6 +6,12 @@ hstore_plperl_sources = files( 'hstore_plperl.c', ) +if host_system == 'windows' + hstore_plperl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'hstore_plperl', + '--FILEDESC', 'hstore_plperl - hstore transform for plperl',]) +endif + hstore_plperl = shared_module('hstore_plperl', hstore_plperl_sources, include_directories: [plperl_inc, hstore_inc], diff --git a/contrib/hstore_plpython/meson.build b/contrib/hstore_plpython/meson.build index 214b48519a9..6071aaeb4b3 100644 --- a/contrib/hstore_plpython/meson.build +++ b/contrib/hstore_plpython/meson.build @@ -6,6 +6,12 @@ hstore_plpython_sources = files( 'hstore_plpython.c', ) +if host_system == 'windows' + hstore_plpython_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'hstore_plpython3', + '--FILEDESC', 'hstore_plpython - hstore transform for plpython',]) +endif + hstore_plpython = shared_module('hstore_plpython3', hstore_plpython_sources, include_directories: [plpython_inc, hstore_inc, ], diff --git a/contrib/intarray/meson.build b/contrib/intarray/meson.build index 1655bcbb3fd..b7cf1ce0cad 100644 --- a/contrib/intarray/meson.build +++ b/contrib/intarray/meson.build @@ -8,6 +8,12 @@ intarray_sources = files( '_intbig_gist.c', ) +if host_system == 'windows' + intarray_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', '_int', + '--FILEDESC', 'intarray - functions and operators for arrays of integers',]) +endif + intarray = shared_module('_int', intarray_sources, kwargs: contrib_mod_args, diff --git a/contrib/isn/meson.build b/contrib/isn/meson.build index cc30bbeb55c..db68a718313 100644 --- a/contrib/isn/meson.build +++ b/contrib/isn/meson.build @@ -2,6 +2,12 @@ isn_sources = files( 'isn.c', ) +if host_system == 'windows' + isn_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'isn', + '--FILEDESC', 'isn - data types for international product numbering standards',]) +endif + isn = shared_module('isn', isn_sources, kwargs: contrib_mod_args, diff --git a/contrib/jsonb_plperl/meson.build b/contrib/jsonb_plperl/meson.build index 5c915d8ed94..071a7a98d2c 100644 --- a/contrib/jsonb_plperl/meson.build +++ b/contrib/jsonb_plperl/meson.build @@ -6,6 +6,12 @@ jsonb_plperl_sources = files( 'jsonb_plperl.c', ) +if host_system == 'windows' + jsonb_plperl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'jsonb_plperl', + '--FILEDESC', 'jsonb_plperl - jsonb transform for plperl',]) +endif + jsonb_plperl = shared_module('jsonb_plperl', jsonb_plperl_sources, include_directories: [plperl_inc], diff --git a/contrib/jsonb_plpython/meson.build b/contrib/jsonb_plpython/meson.build index de8e1105c6a..84dc1161e8b 100644 --- a/contrib/jsonb_plpython/meson.build +++ b/contrib/jsonb_plpython/meson.build @@ -6,6 +6,12 @@ jsonb_plpython_sources = files( 'jsonb_plpython.c', ) +if host_system == 'windows' + jsonb_plpython_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'jsonb_plpython3', + '--FILEDESC', 'jsonb_plpython - jsonb transform for plpython',]) +endif + jsonb_plpython = shared_module('jsonb_plpython3', jsonb_plpython_sources, include_directories: [plpython_inc], diff --git a/contrib/lo/meson.build b/contrib/lo/meson.build index 9082d5713c7..61ae131f1cc 100644 --- a/contrib/lo/meson.build +++ b/contrib/lo/meson.build @@ -2,6 +2,12 @@ lo_sources = files( 'lo.c', ) +if host_system == 'windows' + lo_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'lo', + '--FILEDESC', 'lo - management for large objects',]) +endif + lo = shared_module('lo', lo_sources, kwargs: contrib_mod_args, diff --git a/contrib/ltree/meson.build b/contrib/ltree/meson.build index 9463fc2c5e5..421292cea9d 100644 --- a/contrib/ltree/meson.build +++ b/contrib/ltree/meson.build @@ -13,6 +13,12 @@ ltree_sources = files( # .. so that includes of ltree/ltree.h work ltree_inc = include_directories('.', '../') +if host_system == 'windows' + ltree_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'ltree', + '--FILEDESC', 'ltree - hierarchical label data type',]) +endif + ltree = shared_module('ltree', ltree_sources, kwargs: contrib_mod_args, diff --git a/contrib/ltree_plpython/meson.build b/contrib/ltree_plpython/meson.build index 429d75006aa..acf5e4a6fc8 100644 --- a/contrib/ltree_plpython/meson.build +++ b/contrib/ltree_plpython/meson.build @@ -6,6 +6,12 @@ ltree_plpython_sources = files( 'ltree_plpython.c', ) +if host_system == 'windows' + ltree_plpython_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'ltree_plpython3', + '--FILEDESC', 'ltree_plpython - ltree transform for plpython',]) +endif + ltree_plpython = shared_module('ltree_plpython3', ltree_plpython_sources, include_directories: [plpython_inc, ltree_inc], diff --git a/contrib/oid2name/meson.build b/contrib/oid2name/meson.build index 1dad5d8f6e7..1a248f19260 100644 --- a/contrib/oid2name/meson.build +++ b/contrib/oid2name/meson.build @@ -1,5 +1,15 @@ +oid2name_sources = files( + 'oid2name.c', +) + +if host_system == 'windows' + oid2name_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'oid2name', + '--FILEDESC', 'oid2name - examine the file structure',]) +endif + oid2name = executable('oid2name', - ['oid2name.c'], + oid2name_sources, dependencies: [frontend_code, libpq], kwargs: default_bin_args, ) diff --git a/contrib/old_snapshot/meson.build b/contrib/old_snapshot/meson.build index 8e7ee09a43a..77276c3715a 100644 --- a/contrib/old_snapshot/meson.build +++ b/contrib/old_snapshot/meson.build @@ -2,6 +2,12 @@ old_snapshot_sources = files( 'time_mapping.c', ) +if host_system == 'windows' + old_snapshot_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'old_snapshot', + '--FILEDESC', 'old_snapshot - utilities in support of old_snapshot_threshold',]) +endif + old_snapshot = shared_module('old_snapshot', old_snapshot_sources, kwargs: contrib_mod_args, diff --git a/contrib/pageinspect/meson.build b/contrib/pageinspect/meson.build index 4af8153e4fd..3ec50b9445e 100644 --- a/contrib/pageinspect/meson.build +++ b/contrib/pageinspect/meson.build @@ -9,6 +9,12 @@ pageinspect_sources = files( 'rawpage.c', ) +if host_system == 'windows' + pageinspect_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pageinspect', + '--FILEDESC', 'pageinspect - functions to inspect contents of database pages',]) +endif + pageinspect = shared_module('pageinspect', pageinspect_sources, kwargs: contrib_mod_args, diff --git a/contrib/passwordcheck/meson.build b/contrib/passwordcheck/meson.build index 7da47d02f1d..383d7df372a 100644 --- a/contrib/passwordcheck/meson.build +++ b/contrib/passwordcheck/meson.build @@ -9,6 +9,12 @@ passwordcheck_deps = [] # passwordcheck_c_args += ['-DUSE_CRACKLIB', '-DCRACKLIB_DICTPATH="/usr/lib/cracklib_dict"'] # passwordcheck_deps += [cc.find_library('crack')] +if host_system == 'windows' + passwordcheck_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'passwordcheck', + '--FILEDESC', 'passwordcheck - strengthen user password checks',]) +endif + passwordcheck = shared_module('passwordcheck', passwordcheck_sources, c_args: passwordcheck_c_args, diff --git a/contrib/pg_buffercache/meson.build b/contrib/pg_buffercache/meson.build index 2c69eae3ea2..dd9948e5f0b 100644 --- a/contrib/pg_buffercache/meson.build +++ b/contrib/pg_buffercache/meson.build @@ -1,7 +1,15 @@ +pg_buffercache_sources = files( + 'pg_buffercache_pages.c', +) + +if host_system == 'windows' + pg_buffercache_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_buffercache', + '--FILEDESC', 'pg_buffercache - monitoring of shared buffer cache in real-time',]) +endif + pg_buffercache = shared_module('pg_buffercache', - files( - 'pg_buffercache_pages.c', - ), + pg_buffercache_sources, kwargs: contrib_mod_args, ) contrib_targets += pg_buffercache diff --git a/contrib/pg_freespacemap/meson.build b/contrib/pg_freespacemap/meson.build index f795014d7ca..904b37b6e9b 100644 --- a/contrib/pg_freespacemap/meson.build +++ b/contrib/pg_freespacemap/meson.build @@ -1,7 +1,15 @@ +pg_freespacemap_sources = files( + 'pg_freespacemap.c', +) + +if host_system == 'windows' + pg_freespacemap_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_freespacemap', + '--FILEDESC', 'pg_freespacemap - monitoring of free space map',]) +endif + pg_freespacemap = shared_module('pg_freespacemap', - files( - 'pg_freespacemap.c', - ), + pg_freespacemap_sources, kwargs: contrib_mod_args, ) contrib_targets += pg_freespacemap diff --git a/contrib/pg_prewarm/meson.build b/contrib/pg_prewarm/meson.build index bdca9af4f27..b7140cee34b 100644 --- a/contrib/pg_prewarm/meson.build +++ b/contrib/pg_prewarm/meson.build @@ -1,8 +1,16 @@ +pg_prewarm_sources = files( + 'autoprewarm.c', + 'pg_prewarm.c', +) + +if host_system == 'windows' + pg_prewarm_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_prewarm', + '--FILEDESC', 'pg_prewarm - preload relation data into system buffer cache',]) +endif + pg_prewarm = shared_module('pg_prewarm', - files( - 'autoprewarm.c', - 'pg_prewarm.c', - ), + pg_prewarm_sources, kwargs: contrib_mod_args, ) contrib_targets += pg_prewarm diff --git a/contrib/pg_stat_statements/meson.build b/contrib/pg_stat_statements/meson.build index ac117d2fc1d..854df138e76 100644 --- a/contrib/pg_stat_statements/meson.build +++ b/contrib/pg_stat_statements/meson.build @@ -1,5 +1,15 @@ +pg_stat_statements_sources = files( + 'pg_stat_statements.c', +) + +if host_system == 'windows' + pg_stat_statements_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_stat_statements', + '--FILEDESC', 'pg_stat_statements - execution statistics of SQL statements',]) +endif + pg_stat_statements = shared_module('pg_stat_statements', - files('pg_stat_statements.c'), + pg_stat_statements_sources, kwargs: contrib_mod_args + { 'dependencies': contrib_mod_args['dependencies'], }, diff --git a/contrib/pg_surgery/meson.build b/contrib/pg_surgery/meson.build index ac71caa5276..7b5c5999f4b 100644 --- a/contrib/pg_surgery/meson.build +++ b/contrib/pg_surgery/meson.build @@ -1,7 +1,15 @@ +pg_surgery_sources = files( + 'heap_surgery.c', +) + +if host_system == 'windows' + pg_surgery_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_surgery', + '--FILEDESC', 'pg_surgery - perform surgery on a damaged relation',]) +endif + pg_surgery = shared_module('pg_surgery', - files( - 'heap_surgery.c', - ), + pg_surgery_sources, kwargs: contrib_mod_args, ) contrib_targets += pg_surgery diff --git a/contrib/pg_trgm/meson.build b/contrib/pg_trgm/meson.build index a90628d23c6..c8c7c07b308 100644 --- a/contrib/pg_trgm/meson.build +++ b/contrib/pg_trgm/meson.build @@ -1,10 +1,18 @@ +pg_trgm_sources = files( + 'trgm_gin.c', + 'trgm_gist.c', + 'trgm_op.c', + 'trgm_regexp.c', +) + +if host_system == 'windows' + pg_trgm_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_trgm', + '--FILEDESC', 'pg_trgm - trigram matching',]) +endif + pg_trgm = shared_module('pg_trgm', - files( - 'trgm_gin.c', - 'trgm_gist.c', - 'trgm_op.c', - 'trgm_regexp.c', - ), + pg_trgm_sources, kwargs: contrib_mod_args, ) contrib_targets += pg_trgm diff --git a/contrib/pg_visibility/meson.build b/contrib/pg_visibility/meson.build index 933dc99ac4d..263a0d08b82 100644 --- a/contrib/pg_visibility/meson.build +++ b/contrib/pg_visibility/meson.build @@ -1,7 +1,15 @@ +pg_visibility_sources = files( + 'pg_visibility.c', +) + +if host_system == 'windows' + pg_visibility_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_visibility', + '--FILEDESC', 'pg_visibility - page visibility information',]) +endif + pg_visibility = shared_module('pg_visibility', - files( - 'pg_visibility.c', - ), + pg_visibility_sources, kwargs: contrib_mod_args, ) contrib_targets += pg_visibility diff --git a/contrib/pg_walinspect/meson.build b/contrib/pg_walinspect/meson.build index d6b27877dd0..4314a3182a2 100644 --- a/contrib/pg_walinspect/meson.build +++ b/contrib/pg_walinspect/meson.build @@ -1,5 +1,11 @@ pg_walinspect_sources = files('pg_walinspect.c') +if host_system == 'windows' + pg_walinspect_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_walinspect', + '--FILEDESC', 'pg_walinspect - functions to inspect contents of PostgreSQL Write-Ahead Log',]) +endif + pg_walinspect = shared_module('pg_walinspect', pg_walinspect_sources, kwargs: contrib_mod_args + { diff --git a/contrib/pgcrypto/meson.build b/contrib/pgcrypto/meson.build index fe0851bf8e8..7fc7bbc7ca1 100644 --- a/contrib/pgcrypto/meson.build +++ b/contrib/pgcrypto/meson.build @@ -69,6 +69,12 @@ else pgcrypto_regress += 'pgp-zlib-DISABLED' endif +if host_system == 'windows' + pgcrypto_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pgcrypto', + '--FILEDESC', 'pgcrypto - cryptographic functions',]) +endif + pgcrypto = shared_module('pgcrypto', pgcrypto_sources, link_with: pgcrypto_link_with, diff --git a/contrib/pgrowlocks/meson.build b/contrib/pgrowlocks/meson.build index 1b41691a2a3..8092f0d4a64 100644 --- a/contrib/pgrowlocks/meson.build +++ b/contrib/pgrowlocks/meson.build @@ -1,7 +1,15 @@ +pgrowlocks_sources = files( + 'pgrowlocks.c', +) + +if host_system == 'windows' + pgrowlocks_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pgrowlocks', + '--FILEDESC', 'pgrowlocks - display row locking information',]) +endif + pgrowlocks = shared_module('pgrowlocks', - files( - 'pgrowlocks.c', - ), + pgrowlocks_sources, kwargs: contrib_mod_args, ) contrib_targets += pgrowlocks diff --git a/contrib/pgstattuple/meson.build b/contrib/pgstattuple/meson.build index 8e828692d5c..05e4cd46a5c 100644 --- a/contrib/pgstattuple/meson.build +++ b/contrib/pgstattuple/meson.build @@ -1,9 +1,17 @@ +pgstattuple_sources = files( + 'pgstatapprox.c', + 'pgstatindex.c', + 'pgstattuple.c', +) + +if host_system == 'windows' + pgstattuple_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pgstattuple', + '--FILEDESC', 'pgstattuple - tuple-level statistics',]) +endif + pgstattuple = shared_module('pgstattuple', - files( - 'pgstatapprox.c', - 'pgstatindex.c', - 'pgstattuple.c', - ), + pgstattuple_sources, kwargs: contrib_mod_args, ) contrib_targets += pgstattuple diff --git a/contrib/postgres_fdw/meson.build b/contrib/postgres_fdw/meson.build index 378885ec93b..d3746ff135c 100644 --- a/contrib/postgres_fdw/meson.build +++ b/contrib/postgres_fdw/meson.build @@ -6,6 +6,12 @@ postgres_fdw_sources = files( 'shippable.c', ) +if host_system == 'windows' + postgres_fdw_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'postgres_fdw', + '--FILEDESC', 'postgres_fdw - foreign data wrapper for PostgreSQL',]) +endif + postgres_fdw = shared_module('postgres_fdw', postgres_fdw_sources, kwargs: contrib_mod_args + { diff --git a/contrib/seg/meson.build b/contrib/seg/meson.build index e476eab2a77..c6fbb22999b 100644 --- a/contrib/seg/meson.build +++ b/contrib/seg/meson.build @@ -17,6 +17,12 @@ seg_parse = custom_target('segparse', generated_sources += seg_parse.to_list() seg_sources += seg_parse +if host_system == 'windows' + seg_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'seg', + '--FILEDESC', 'seg - line segment data type',]) +endif + seg = shared_module('seg', seg_sources, include_directories: include_directories('.'), diff --git a/contrib/sepgsql/meson.build b/contrib/sepgsql/meson.build index 60a95e17c2f..8bef239e3c2 100644 --- a/contrib/sepgsql/meson.build +++ b/contrib/sepgsql/meson.build @@ -14,6 +14,12 @@ sepgsql_sources = files( 'uavc.c', ) +if host_system == 'windows' + sepgsql_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'sepgsql', + '--FILEDESC', 'sepgsql - SELinux integration',]) +endif + sepgsql = shared_module('sepgsql', sepgsql_sources, kwargs: contrib_mod_args + { diff --git a/contrib/spi/meson.build b/contrib/spi/meson.build index 98008980ec2..e7d78189ef5 100644 --- a/contrib/spi/meson.build +++ b/contrib/spi/meson.build @@ -1,5 +1,15 @@ +autoinc_sources = files( + 'autoinc.c', +) + +if host_system == 'windows' + autoinc_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'autoinc', + '--FILEDESC', 'spi - examples of using SPI and triggers',]) +endif + autoinc = shared_module('autoinc', - ['autoinc.c'], + autoinc_sources, kwargs: contrib_mod_args, ) contrib_targets += autoinc @@ -9,8 +19,18 @@ install_data('autoinc.control', 'autoinc--1.0.sql', ) +insert_username_sources = files( + 'insert_username.c', +) + +if host_system == 'windows' + insert_username_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'insert_username', + '--FILEDESC', 'spi - examples of using SPI and triggers',]) +endif + insert_username = shared_module('insert_username', - ['insert_username.c'], + insert_username_sources, kwargs: contrib_mod_args, ) contrib_targets += insert_username @@ -22,8 +42,18 @@ install_data( ) +moddatetime_sources = files( + 'moddatetime.c', +) + +if host_system == 'windows' + moddatetime_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'moddatetime', + '--FILEDESC', 'spi - examples of using SPI and triggers',]) +endif + moddatetime = shared_module('moddatetime', - ['moddatetime.c'], + moddatetime_sources, kwargs: contrib_mod_args, ) contrib_targets += moddatetime @@ -38,8 +68,18 @@ install_data( # comment out if you want a quieter refint package for other uses refint_cflags = ['-DREFINT_VERBOSE'] +refint_sources = files( + 'refint.c', +) + +if host_system == 'windows' + refint_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'refint', + '--FILEDESC', 'spi - examples of using SPI and triggers',]) +endif + refint = shared_module('refint', - ['refint.c'], + refint_sources, c_args: refint_cflags, kwargs: contrib_mod_args, ) diff --git a/contrib/sslinfo/meson.build b/contrib/sslinfo/meson.build index 53f752a08ac..136983e783d 100644 --- a/contrib/sslinfo/meson.build +++ b/contrib/sslinfo/meson.build @@ -2,10 +2,18 @@ if not ssl.found() subdir_done() endif +sslinfo_sources = files( + 'sslinfo.c', +) + +if host_system == 'windows' + sslinfo_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'sslinfo', + '--FILEDESC', 'sslinfo - information about client SSL certificate',]) +endif + sslinfo = shared_module('sslinfo', - files( - 'sslinfo.c', - ), + sslinfo_sources, kwargs: contrib_mod_args + { 'dependencies': [ssl, contrib_mod_args['dependencies']], } diff --git a/contrib/tablefunc/meson.build b/contrib/tablefunc/meson.build index f4230096c0c..d2ddc8d3b39 100644 --- a/contrib/tablefunc/meson.build +++ b/contrib/tablefunc/meson.build @@ -1,7 +1,15 @@ +tablefunc_sources = files( + 'tablefunc.c', +) + +if host_system == 'windows' + tablefunc_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'tablefunc', + '--FILEDESC', 'tablefunc - various functions that return tables',]) +endif + tablefunc = shared_module('tablefunc', - files( - 'tablefunc.c', - ), + tablefunc_sources, kwargs: contrib_mod_args, ) contrib_targets += tablefunc diff --git a/contrib/tcn/meson.build b/contrib/tcn/meson.build index c3a025247d4..71261c3b0a2 100644 --- a/contrib/tcn/meson.build +++ b/contrib/tcn/meson.build @@ -1,7 +1,15 @@ +tcn_sources = files( + 'tcn.c', +) + +if host_system == 'windows' + tcn_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'tcn', + '--FILEDESC', 'tcn - trigger function notifying listeners',]) +endif + tcn = shared_module('tcn', - files( - 'tcn.c', - ), + tcn_sources, kwargs: contrib_mod_args, ) contrib_targets += tcn diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build index dd7cb0101ad..6376103c689 100644 --- a/contrib/test_decoding/meson.build +++ b/contrib/test_decoding/meson.build @@ -2,6 +2,12 @@ test_decoding_sources = files( 'test_decoding.c', ) +if host_system == 'windows' + test_decoding_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'test_decoding', + '--FILEDESC', 'test_decoding - example of a logical decoding output plugin',]) +endif + test_decoding = shared_module('test_decoding', test_decoding_sources, kwargs: contrib_mod_args, diff --git a/contrib/tsm_system_rows/meson.build b/contrib/tsm_system_rows/meson.build index b9cd42115a8..380abb49883 100644 --- a/contrib/tsm_system_rows/meson.build +++ b/contrib/tsm_system_rows/meson.build @@ -1,7 +1,15 @@ +tsm_system_rows_sources = files( + 'tsm_system_rows.c', +) + +if host_system == 'windows' + tsm_system_rows_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'tsm_system_rows', + '--FILEDESC', 'tsm_system_rows - TABLESAMPLE method which accepts number of rows as a limit',]) +endif + tsm_system_rows = shared_module('tsm_system_rows', - files( - 'tsm_system_rows.c', - ), + tsm_system_rows_sources, kwargs: contrib_mod_args, ) contrib_targets += tsm_system_rows diff --git a/contrib/tsm_system_time/meson.build b/contrib/tsm_system_time/meson.build index 18015912ffb..e57a2702c60 100644 --- a/contrib/tsm_system_time/meson.build +++ b/contrib/tsm_system_time/meson.build @@ -1,7 +1,15 @@ +tsm_system_time_sources = files( + 'tsm_system_time.c', +) + +if host_system == 'windows' + tsm_system_time_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'tsm_system_time', + '--FILEDESC', 'tsm_system_time - TABLESAMPLE method which accepts time in milliseconds as a limit',]) +endif + tsm_system_time = shared_module('tsm_system_time', - files( - 'tsm_system_time.c', - ), + tsm_system_time_sources, kwargs: contrib_mod_args, ) contrib_targets += tsm_system_time diff --git a/contrib/unaccent/meson.build b/contrib/unaccent/meson.build index 872b76e3223..438035132f8 100644 --- a/contrib/unaccent/meson.build +++ b/contrib/unaccent/meson.build @@ -1,7 +1,15 @@ +unaccent_sources = files( + 'unaccent.c', +) + +if host_system == 'windows' + unaccent_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'unaccent', + '--FILEDESC', 'unaccent - text search dictionary that removes accents',]) +endif + unaccent = shared_module('unaccent', - files( - 'unaccent.c', - ), + unaccent_sources, kwargs: contrib_mod_args, ) contrib_targets += unaccent diff --git a/contrib/uuid-ossp/meson.build b/contrib/uuid-ossp/meson.build index da6d1d75c12..28730f398f0 100644 --- a/contrib/uuid-ossp/meson.build +++ b/contrib/uuid-ossp/meson.build @@ -2,10 +2,18 @@ if not uuid.found() subdir_done() endif +uuid_ossp_sources = files( + 'uuid-ossp.c', +) + +if host_system == 'windows' + uuid_ossp_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'uuid-ossp', + '--FILEDESC', 'uuid-ossp - UUID generation',]) +endif + uuid_ossp = shared_module('uuid-ossp', - files( - 'uuid-ossp.c', - ), + uuid_ossp_sources, kwargs: contrib_mod_args + { 'dependencies': [uuid, contrib_mod_args['dependencies']], }, diff --git a/contrib/vacuumlo/meson.build b/contrib/vacuumlo/meson.build index 7a632b87d1b..846de47dbd1 100644 --- a/contrib/vacuumlo/meson.build +++ b/contrib/vacuumlo/meson.build @@ -1,5 +1,15 @@ +vacuumlo_sources = files( + 'vacuumlo.c', +) + +if host_system == 'windows' + vacuumlo_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'vacuumlo', + '--FILEDESC', 'vacuumlo - removes orphaned large objects',]) +endif + vacuumlo = executable('vacuumlo', - ['vacuumlo.c'], + vacuumlo_sources, dependencies: [frontend_code, libpq], kwargs: default_bin_args, ) diff --git a/contrib/xml2/meson.build b/contrib/xml2/meson.build index 9c0b56f01f6..89b0d677516 100644 --- a/contrib/xml2/meson.build +++ b/contrib/xml2/meson.build @@ -2,11 +2,19 @@ if not libxml.found() subdir_done() endif +xml2_sources = files( + 'xpath.c', + 'xslt_proc.c', +) + +if host_system == 'windows' + xml2_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pgxml', + '--FILEDESC', 'xml2 - XPath querying and XSLT',]) +endif + xml2 = shared_module('pgxml', - files( - 'xpath.c', - 'xslt_proc.c', - ), + xml2_sources, kwargs: contrib_mod_args + { 'dependencies': [libxml, libxslt, contrib_mod_args['dependencies']], }, diff --git a/src/interfaces/ecpg/compatlib/meson.build b/src/interfaces/ecpg/compatlib/meson.build index 5887cb92b52..e5dc0edc04b 100644 --- a/src/interfaces/ecpg/compatlib/meson.build +++ b/src/interfaces/ecpg/compatlib/meson.build @@ -1,7 +1,11 @@ export_file = custom_target('libpq.exports', kwargs: gen_export_kwargs) -ecpg_compat = both_libraries('libecpg_compat', +ecpg_compat_sources = files( 'informix.c', +) + +ecpg_compat = both_libraries('libecpg_compat', + ecpg_compat_sources, include_directories: ['.', ecpg_inc, postgres_inc, libpq_inc], c_args: ['-DSO_MAJOR_VERSION=3'], dependencies: [frontend_code, thread_dep], diff --git a/src/interfaces/ecpg/preproc/meson.build b/src/interfaces/ecpg/preproc/meson.build index 1be49c8c27f..74876f039c9 100644 --- a/src/interfaces/ecpg/preproc/meson.build +++ b/src/interfaces/ecpg/preproc/meson.build @@ -93,6 +93,12 @@ ecpg_kwlist = custom_target('ecpg_kwlist_d.h', generated_sources += ecpg_kwlist ecpg_sources += ecpg_kwlist +if host_system == 'windows' + ecpg_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'ecpg', + '--FILEDESC', 'ecpg - embedded SQL precompiler for C',]) +endif + ecpg_exe = executable('ecpg', ecpg_sources, include_directories: ['.', ecpg_inc, postgres_inc, libpq_inc], diff --git a/src/interfaces/ecpg/test/meson.build b/src/interfaces/ecpg/test/meson.build index f0ace641f0c..f67f2dffb71 100644 --- a/src/interfaces/ecpg/test/meson.build +++ b/src/interfaces/ecpg/test/meson.build @@ -7,6 +7,12 @@ pg_regress_ecpg_sources = pg_regress_c + files( 'pg_regress_ecpg.c', ) +if host_system == 'windows' + pg_regress_ecpg_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_regress_ecpg', + '--FILEDESC', 'ECPG Test - regression tests for ECPG',]) +endif + pg_regress_ecpg = executable('pg_regress_ecpg', pg_regress_ecpg_sources, c_args: pg_regress_cflags, diff --git a/src/test/isolation/meson.build b/src/test/isolation/meson.build index c7656fd4609..ba27b8c1d44 100644 --- a/src/test/isolation/meson.build +++ b/src/test/isolation/meson.build @@ -23,6 +23,12 @@ spec_parser = custom_target('specparse', isolationtester_sources += spec_parser generated_sources += spec_parser.to_list() +if host_system == 'windows' + isolation_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_isolation_regress', + '--FILEDESC', 'pg_isolation_regress - multi-client test driver',]) +endif + pg_isolation_regress = executable('pg_isolation_regress', isolation_sources, c_args: pg_regress_cflags, @@ -34,6 +40,13 @@ pg_isolation_regress = executable('pg_isolation_regress', ) bin_targets += pg_isolation_regress + +if host_system == 'windows' + isolationtester_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'isolationtester', + '--FILEDESC', 'isolationtester - multi-client test driver',]) +endif + isolationtester = executable('isolationtester', isolationtester_sources, include_directories: include_directories('.'), diff --git a/src/test/modules/delay_execution/meson.build b/src/test/modules/delay_execution/meson.build index cf4bdaba637..a0c3ab6afe7 100644 --- a/src/test/modules/delay_execution/meson.build +++ b/src/test/modules/delay_execution/meson.build @@ -1,6 +1,17 @@ # FIXME: prevent install during main install, but not during test :/ + +delay_execution_sources = files( + 'delay_execution.c', +) + +if host_system == 'windows' + delay_execution_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'delay_execution', + '--FILEDESC', 'delay_execution - allow delay between parsing and execution',]) +endif + delay_execution = shared_module('delay_execution', - ['delay_execution.c'], + delay_execution_sources, kwargs: pg_mod_args, ) testprep_targets += delay_execution diff --git a/src/test/modules/dummy_index_am/meson.build b/src/test/modules/dummy_index_am/meson.build index 56ff5f48001..4ce82491135 100644 --- a/src/test/modules/dummy_index_am/meson.build +++ b/src/test/modules/dummy_index_am/meson.build @@ -1,6 +1,17 @@ # FIXME: prevent install during main install, but not during test :/ + +dummy_index_am_sources = files( + 'dummy_index_am.c', +) + +if host_system == 'windows' + dummy_index_am_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'dummy_index_am', + '--FILEDESC', 'dummy_index_am - index access method template',]) +endif + dummy_index_am = shared_module('dummy_index_am', - ['dummy_index_am.c'], + dummy_index_am_sources, kwargs: pg_mod_args, ) testprep_targets += dummy_index_am diff --git a/src/test/modules/dummy_seclabel/meson.build b/src/test/modules/dummy_seclabel/meson.build index 21b7cf8f353..81b626e496c 100644 --- a/src/test/modules/dummy_seclabel/meson.build +++ b/src/test/modules/dummy_seclabel/meson.build @@ -1,6 +1,17 @@ # FIXME: prevent install during main install, but not during test :/ + +dummy_seclabel_sources = files( + 'dummy_seclabel.c', +) + +if host_system == 'windows' + dummy_seclabel_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'dummy_seclabel', + '--FILEDESC', 'dummy_seclabel - regression testing of the SECURITY LABEL statement',]) +endif + dummy_seclabel = shared_module('dummy_seclabel', - ['dummy_seclabel.c'], + dummy_seclabel_sources, kwargs: pg_mod_args, ) testprep_targets += dummy_seclabel diff --git a/src/test/modules/libpq_pipeline/meson.build b/src/test/modules/libpq_pipeline/meson.build index 8384b6e3b2a..de0e2d15626 100644 --- a/src/test/modules/libpq_pipeline/meson.build +++ b/src/test/modules/libpq_pipeline/meson.build @@ -1,7 +1,15 @@ +libpq_pipeline_sources = files( + 'libpq_pipeline.c', +) + +if host_system == 'windows' + libpq_pipeline_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'libpq_pipeline', + '--FILEDESC', 'libpq_pipeline - test program for pipeline execution',]) +endif + libpq_pipeline = executable('libpq_pipeline', - files( - 'libpq_pipeline.c', - ), + libpq_pipeline_sources, dependencies: [frontend_code, libpq], kwargs: default_bin_args + { 'install': false, diff --git a/src/test/modules/plsample/meson.build b/src/test/modules/plsample/meson.build index 45de3f1990d..e1ea2c7a16f 100644 --- a/src/test/modules/plsample/meson.build +++ b/src/test/modules/plsample/meson.build @@ -1,6 +1,17 @@ # FIXME: prevent install during main install, but not during test :/ + +plsample_sources = files( + 'plsample.c', +) + +if host_system == 'windows' + plsample_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'plsample', + '--FILEDESC', 'PL/Sample - template for procedural language',]) +endif + plsample = shared_module('plsample', - ['plsample.c'], + plsample_sources, kwargs: pg_mod_args, ) testprep_targets += plsample diff --git a/src/test/modules/spgist_name_ops/meson.build b/src/test/modules/spgist_name_ops/meson.build index 857fc7e140e..445296fee0b 100644 --- a/src/test/modules/spgist_name_ops/meson.build +++ b/src/test/modules/spgist_name_ops/meson.build @@ -1,6 +1,17 @@ # FIXME: prevent install during main install, but not during test :/ + +spgist_name_ops_sources = files( + 'spgist_name_ops.c', +) + +if host_system == 'windows' + spgist_name_ops_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'spgist_name_ops', + '--FILEDESC', 'spgist_name_ops - test opclass for SP-GiST',]) +endif + spgist_name_ops = shared_module('spgist_name_ops', - ['spgist_name_ops.c'], + spgist_name_ops_sources, kwargs: pg_mod_args, ) testprep_targets += spgist_name_ops diff --git a/src/test/modules/ssl_passphrase_callback/meson.build b/src/test/modules/ssl_passphrase_callback/meson.build index a57bd0693a3..a9eb4c564da 100644 --- a/src/test/modules/ssl_passphrase_callback/meson.build +++ b/src/test/modules/ssl_passphrase_callback/meson.build @@ -3,8 +3,19 @@ if not ssl.found() endif # FIXME: prevent install during main install, but not during test :/ + +ssl_passphrase_callback_sources = files( + 'ssl_passphrase_func.c', +) + +if host_system == 'windows' + ssl_passphrase_callback_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'ssl_passphrase_func', + '--FILEDESC', 'callback function to provide a passphrase',]) +endif + ssl_passphrase_callback = shared_module('ssl_passphrase_func', - ['ssl_passphrase_func.c'], + ssl_passphrase_callback_sources, kwargs: pg_mod_args + { 'dependencies': [ssl, pg_mod_args['dependencies']], }, diff --git a/src/test/modules/test_bloomfilter/meson.build b/src/test/modules/test_bloomfilter/meson.build index 945eb5a70c4..3cf6b05754f 100644 --- a/src/test/modules/test_bloomfilter/meson.build +++ b/src/test/modules/test_bloomfilter/meson.build @@ -1,6 +1,17 @@ # FIXME: prevent install during main install, but not during test :/ + +test_bloomfilter_sources = files( + 'test_bloomfilter.c', +) + +if host_system == 'windows' + test_bloomfilter_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'test_bloomfilter', + '--FILEDESC', 'test_bloomfilter - test code for Bloom filter library',]) +endif + test_bloomfilter = shared_module('test_bloomfilter', - ['test_bloomfilter.c'], + test_bloomfilter_sources, kwargs: pg_mod_args, ) testprep_targets += test_bloomfilter diff --git a/src/test/modules/test_ddl_deparse/meson.build b/src/test/modules/test_ddl_deparse/meson.build index 81ad5adc526..54d44f9b2b4 100644 --- a/src/test/modules/test_ddl_deparse/meson.build +++ b/src/test/modules/test_ddl_deparse/meson.build @@ -1,6 +1,17 @@ # FIXME: prevent install during main install, but not during test :/ + +test_ddl_deparse_sources = files( + 'test_ddl_deparse.c', +) + +if host_system == 'windows' + test_ddl_deparse_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'test_ddl_deparse', + '--FILEDESC', 'test_ddl_deparse - regression testing for DDL deparsing',]) +endif + test_ddl_deparse = shared_module('test_ddl_deparse', - ['test_ddl_deparse.c'], + test_ddl_deparse_sources, kwargs: pg_mod_args, ) testprep_targets += test_ddl_deparse diff --git a/src/test/modules/test_ginpostinglist/meson.build b/src/test/modules/test_ginpostinglist/meson.build index abf0a3b0430..b3b49c56122 100644 --- a/src/test/modules/test_ginpostinglist/meson.build +++ b/src/test/modules/test_ginpostinglist/meson.build @@ -1,6 +1,17 @@ # FIXME: prevent install during main install, but not during test :/ + +test_ginpostinglist_sources = files( + 'test_ginpostinglist.c', +) + +if host_system == 'windows' + test_ginpostinglist_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'test_ginpostinglist', + '--FILEDESC', 'test_ginpostinglist - test code for src/backend/access/gin//ginpostinglist.c',]) +endif + test_ginpostinglist = shared_module('test_ginpostinglist', - ['test_ginpostinglist.c'], + test_ginpostinglist_sources, kwargs: pg_mod_args, ) testprep_targets += test_ginpostinglist diff --git a/src/test/modules/test_integerset/meson.build b/src/test/modules/test_integerset/meson.build index c32c469c69a..4bd75af4b5e 100644 --- a/src/test/modules/test_integerset/meson.build +++ b/src/test/modules/test_integerset/meson.build @@ -1,6 +1,17 @@ # FIXME: prevent install during main install, but not during test :/ + +test_integerset_sources = files( + 'test_integerset.c', +) + +if host_system == 'windows' + test_integerset_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'test_integerset', + '--FILEDESC', 'test_integerset - test code for src/backend/lib/integerset.c',]) +endif + test_integerset = shared_module('test_integerset', - ['test_integerset.c'], + test_integerset_sources, kwargs: pg_mod_args, ) testprep_targets += test_integerset diff --git a/src/test/modules/test_lfind/meson.build b/src/test/modules/test_lfind/meson.build index a388de1156a..c5405b8f878 100644 --- a/src/test/modules/test_lfind/meson.build +++ b/src/test/modules/test_lfind/meson.build @@ -1,6 +1,17 @@ # FIXME: prevent install during main install, but not during test :/ + +test_lfind_sources = files( + 'test_lfind.c', +) + +if host_system == 'windows' + test_lfind_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'test_lfind', + '--FILEDESC', 'test_lfind - test code for optimized linear search functions',]) +endif + test_lfind = shared_module('test_lfind', - ['test_lfind.c'], + test_lfind_sources, kwargs: pg_mod_args, ) testprep_targets += test_lfind diff --git a/src/test/modules/test_oat_hooks/meson.build b/src/test/modules/test_oat_hooks/meson.build index 5faf0459777..8802bbbac55 100644 --- a/src/test/modules/test_oat_hooks/meson.build +++ b/src/test/modules/test_oat_hooks/meson.build @@ -1,6 +1,17 @@ # FIXME: prevent install during main install, but not during test :/ + +test_oat_hooks_sources = files( + 'test_oat_hooks.c', +) + +if host_system == 'windows' + test_oat_hooks_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'test_oat_hooks', + '--FILEDESC', 'test_oat_hooks - example use of object access hooks',]) +endif + test_oat_hooks = shared_module('test_oat_hooks', - ['test_oat_hooks.c'], + test_oat_hooks_sources, kwargs: pg_mod_args, ) testprep_targets += test_oat_hooks diff --git a/src/test/modules/test_parser/meson.build b/src/test/modules/test_parser/meson.build index b59960f615e..1c17113347f 100644 --- a/src/test/modules/test_parser/meson.build +++ b/src/test/modules/test_parser/meson.build @@ -1,6 +1,17 @@ # FIXME: prevent install during main install, but not during test :/ + +test_parser_sources = files( + 'test_parser.c', +) + +if host_system == 'windows' + test_parser_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'test_parser', + '--FILEDESC', 'test_parser - example of a custom parser for full-text search',]) +endif + test_parser = shared_module('test_parser', - ['test_parser.c'], + test_parser_sources, kwargs: pg_mod_args, ) testprep_targets += test_parser diff --git a/src/test/modules/test_predtest/meson.build b/src/test/modules/test_predtest/meson.build index 1cfa84b3609..9a5be43c9c0 100644 --- a/src/test/modules/test_predtest/meson.build +++ b/src/test/modules/test_predtest/meson.build @@ -1,6 +1,17 @@ # FIXME: prevent install during main install, but not during test :/ + +test_predtest_sources = files( + 'test_predtest.c', +) + +if host_system == 'windows' + test_predtest_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'test_predtest', + '--FILEDESC', 'test_predtest - test code for optimizer/util/predtest.c',]) +endif + test_predtest = shared_module('test_predtest', - ['test_predtest.c'], + test_predtest_sources, kwargs: pg_mod_args, ) testprep_targets += test_predtest diff --git a/src/test/modules/test_rbtree/meson.build b/src/test/modules/test_rbtree/meson.build index 34cbc3e1624..f067e08d321 100644 --- a/src/test/modules/test_rbtree/meson.build +++ b/src/test/modules/test_rbtree/meson.build @@ -1,6 +1,17 @@ # FIXME: prevent install during main install, but not during test :/ + +test_rbtree_sources = files( + 'test_rbtree.c', +) + +if host_system == 'windows' + test_rbtree_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'test_rbtree', + '--FILEDESC', 'test_rbtree - test code for red-black tree library',]) +endif + test_rbtree = shared_module('test_rbtree', - ['test_rbtree.c'], + test_rbtree_sources, kwargs: pg_mod_args, ) testprep_targets += test_rbtree diff --git a/src/test/modules/test_regex/meson.build b/src/test/modules/test_regex/meson.build index 867a64e57c3..cfb938d9f1e 100644 --- a/src/test/modules/test_regex/meson.build +++ b/src/test/modules/test_regex/meson.build @@ -1,6 +1,17 @@ # FIXME: prevent install during main install, but not during test :/ + +test_regex_sources = files( + 'test_regex.c', +) + +if host_system == 'windows' + test_regex_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'test_regex', + '--FILEDESC', 'test_regex - test code for backend/regex/',]) +endif + test_regex = shared_module('test_regex', - ['test_regex.c'], + test_regex_sources, kwargs: pg_mod_args, ) testprep_targets += test_regex diff --git a/src/test/modules/test_rls_hooks/meson.build b/src/test/modules/test_rls_hooks/meson.build index 80d8adda332..3fb273b2934 100644 --- a/src/test/modules/test_rls_hooks/meson.build +++ b/src/test/modules/test_rls_hooks/meson.build @@ -1,6 +1,17 @@ # FIXME: prevent install during main install, but not during test :/ + +test_rls_hooks_sources = files( + 'test_rls_hooks.c', +) + +if host_system == 'windows' + test_rls_hooks_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'test_rls_hooks', + '--FILEDESC', 'test_rls_hooks - example use of RLS hooks',]) +endif + test_rls_hooks = shared_module('test_rls_hooks', - ['test_rls_hooks.c'], + test_rls_hooks_sources, kwargs: pg_mod_args, ) testprep_targets += test_rls_hooks diff --git a/src/test/modules/test_shm_mq/meson.build b/src/test/modules/test_shm_mq/meson.build index b663543d616..16c8fdb57f4 100644 --- a/src/test/modules/test_shm_mq/meson.build +++ b/src/test/modules/test_shm_mq/meson.build @@ -1,10 +1,19 @@ # FIXME: prevent install during main install, but not during test :/ + +test_shm_mq_sources = files( + 'setup.c', + 'test.c', + 'worker.c', +) + +if host_system == 'windows' + test_shm_mq_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'test_shm_mq', + '--FILEDESC', 'test_shm_mq - example use of shared memory message queue',]) +endif + test_shm_mq = shared_module('test_shm_mq', - files( - 'setup.c', - 'test.c', - 'worker.c', - ), + test_shm_mq_sources, kwargs: pg_mod_args, ) testprep_targets += test_shm_mq diff --git a/src/test/modules/worker_spi/meson.build b/src/test/modules/worker_spi/meson.build index 32acad883b2..a4a158c75b9 100644 --- a/src/test/modules/worker_spi/meson.build +++ b/src/test/modules/worker_spi/meson.build @@ -1,8 +1,17 @@ # FIXME: prevent install during main install, but not during test :/ + +test_worker_spi_sources = files( + 'worker_spi.c', +) + +if host_system == 'windows' + test_worker_spi_sources += rc_lib_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'worker_spi', + '--FILEDESC', 'worker_spi - background worker example',]) +endif + test_worker_spi = shared_module('worker_spi', - files( - 'worker_spi.c', - ), + test_worker_spi_sources, kwargs: pg_mod_args, ) testprep_targets += test_worker_spi diff --git a/src/test/regress/meson.build b/src/test/regress/meson.build index fd8ee995b79..963c0f64ed5 100644 --- a/src/test/regress/meson.build +++ b/src/test/regress/meson.build @@ -8,6 +8,12 @@ regress_sources = pg_regress_c + files( pg_regress_cflags = ['-DHOST_TUPLE="frak"', '-DSHELLPROG="/bin/sh"'] +if host_system == 'windows' + regress_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'pg_regress', + '--FILEDESC', 'pg_regress - test driver',]) +endif + pg_regress = executable('pg_regress', regress_sources, c_args: pg_regress_cflags, diff --git a/meson.build b/meson.build index 6ffae59ba03..4ad06b25213 100644 --- a/meson.build +++ b/meson.build @@ -2523,6 +2523,67 @@ gen_export_kwargs = { +### +### windows resources related stuff +### + +if host_system == 'windows' + pg_ico = meson.source_root() / 'src' / 'port' / 'win32.ico' + win32ver_rc = files('src/port/win32ver.rc') + rcgen = find_program('src/tools/rcgen', native: true) + + rcgen_base_args = [ + '--srcdir', '@SOURCE_DIR@', + '--builddir', meson.build_root(), + '--rcout', '@OUTPUT0@', + '--out', '@OUTPUT1@', + '--input', '@INPUT@', + '@EXTRA_ARGS@', + ] + + if cc.get_argument_syntax() == 'msvc' + rcgen_base_args += [ + '--rc', find_program('rc', required: true).path(), + ] + rcgen_outputs = ['@BASENAME@.rc', '@BASENAME@.res'] + else + rcgen_base_args += [ + '--windres', find_program('windres', required: true).path(), + ] + rcgen_outputs = ['@BASENAME@.rc', '@BASENAME@.obj'] + endif + + # msbuild backend doesn't support this atm + if meson.backend() == 'ninja' + rcgen_base_args += ['--depfile', '@DEPFILE@'] + endif + + rcgen_bin_args = rcgen_base_args + [ + '--VFT_TYPE', 'VFT_APP', + '--FILEENDING', 'exe', + '--ICO', pg_ico + ] + + rcgen_lib_args = rcgen_base_args + [ + '--VFT_TYPE', 'VFT_DLL', + '--FILEENDING', 'dll', + ] + + rc_bin_gen = generator(rcgen, + depfile: '@BASENAME@.d', + arguments: rcgen_bin_args, + output: rcgen_outputs, + ) + + rc_lib_gen = generator(rcgen, + depfile: '@BASENAME@.d', + arguments: rcgen_lib_args, + output: rcgen_outputs, + ) +endif + + + # headers that the whole build tree depends on generated_headers = [] # headers that the backend build depends on diff --git a/src/timezone/meson.build b/src/timezone/meson.build index 16f082ecfa8..9e0934c000b 100644 --- a/src/timezone/meson.build +++ b/src/timezone/meson.build @@ -28,6 +28,12 @@ if get_option('system_tzdata') == '' if meson.is_cross_build() zic = find_program(get_option('ZIC'), native: true, required: true) else + if host_system == 'windows' + zic_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ + '--NAME', 'zic', + '--FILEDESC', 'zic - time zone compiler',]) + endif + zic = executable('zic', zic_sources, dependencies: [frontend_code], kwargs: default_bin_args + {'install': false} diff --git a/src/tools/rcgen b/src/tools/rcgen new file mode 100755 index 00000000000..5b62bfe5410 --- /dev/null +++ b/src/tools/rcgen @@ -0,0 +1,99 @@ +#!/usr/bin/env python3 + +import argparse +import os +import subprocess +import sys + +parser = argparse.ArgumentParser(description='generate PostgreSQL rc file') + +parser.add_argument('--srcdir', type=os.path.abspath, + required=True) +parser.add_argument('--builddir', type=os.path.abspath, + required=True) + +binaries = parser.add_argument_group('binaries') +binaries.add_argument('--windres', type=os.path.abspath) +binaries.add_argument('--rc', type=os.path.abspath) + +inout = parser.add_argument_group('inout') +inout.add_argument('--depfile', type=argparse.FileType('w')) +inout.add_argument('--input', type=argparse.FileType('r'), + required=True) +inout.add_argument('--rcout', type=argparse.FileType('w'), + required=True) +inout.add_argument('--out', type=str, + required=True) + +replacements = parser.add_argument_group('replacements') +replacements.add_argument('--FILEDESC', type=str) +replacements.add_argument('--NAME', type=str, required=True) +replacements.add_argument('--VFT_TYPE', type=str, required=True) +replacements.add_argument('--FILEENDING', type=str, required=True) +replacements.add_argument('--ICO', type=str) + +args = parser.parse_args() + +# determine replacement strings + +internal_name = '"{0}"'.format(args.NAME) +original_name = '"{0}.{1}"'.format(args.NAME, args.FILEENDING) + +# if no description is passed in, generate one based on the name +if args.FILEDESC: + filedesc = args.FILEDESC +elif args.NAME: + if args.VFT_TYPE == 'VFT_DLL': + filedesc = 'PostgreSQL {0} library'.format(args.NAME) + else: + filedesc = 'PostgreSQL {0} binary'.format(args.NAME) +filedesc = '"{0}"'.format(filedesc) + + +if args.ICO: + ico = 'IDI_ICON ICON "{0}"'.format(args.ICO) + if args.depfile: + args.depfile.write("{0} : {1}\n".format(args.rcout.name, args.ICO)) +else: + ico = '' + + +data = args.input.read() + +data = data.replace('VFT_APP', args.VFT_TYPE) +data = data.replace('_INTERNAL_NAME_', internal_name) +data = data.replace('_ORIGINAL_NAME_', original_name) +data = data.replace('FILEDESC', filedesc) +data = data.replace("_ICO_", ico) + +args.rcout.write(data) +args.rcout.close() + +if args.windres: + cmd = [ + args.windres, + '-I{0}/src/include/'.format(args.builddir), + '-I{0}/src/include/'.format(args.srcdir), + '-o', args.out, '-i', args.rcout.name, + ] +elif args.rc: + cmd = [ + args.rc, '/nologo', + '-I{0}/src/include/'.format(args.builddir), + '-I{0}/src/include/'.format(args.srcdir), + '/fo', args.out, args.rcout.name, + ] +else: + sys.exit('either --windres or --rc needs to be specified') + +sp = subprocess.run(cmd) +if sp.returncode != 0: + sys.exit(sp.returncode) + +# It'd be nicer if we could generate correct dependencies here, but 'rc' +# doesn't support doing so. It's unlikely we'll ever need more, so... +if args.depfile: + args.depfile.write("{0} : {1}\n".format( + args.rcout.name, args.input.name)) + args.depfile.write("{0} : {1}/{2}\n".format( + args.out, args.builddir, 'src/include/pg_config.h')) -- 2.37.3.542.gdd3f6c4cae
v15-0006-meson-Add-support-for-relative-rpaths-fixing-tes.patch (text/x-diff, 7.3K) download From a6d2f96ef0d46374d972fc95714bf71ee8f03f97 Mon Sep 17 00:00:00 2001 From: Andres Freund <andres@anarazel.de> Date: Wed, 21 Sep 2022 13:48:46 -0700 Subject: [PATCH v15 06/14] meson: Add support for relative rpaths, fixing tests on MacOS w/ SIP --- meson.build | 47 ++++++++-- .../relativize_shared_library_references | 88 +++++++++++++++++++ src/tools/relpath.py | 6 ++ 3 files changed, 136 insertions(+), 5 deletions(-) create mode 100755 src/tools/relativize_shared_library_references create mode 100755 src/tools/relpath.py diff --git a/meson.build b/meson.build index 4ad06b25213..8323adf772b 100644 --- a/meson.build +++ b/meson.build @@ -159,6 +159,7 @@ portname = host_system exesuffix = '' # overridden below where necessary dlsuffix = '.so' # overridden below where necessary +rpath_origin = '$ORIGIN' library_path_var = 'LD_LIBRARY_PATH' # Format of file to control exports from libraries, and how to pass them to @@ -209,6 +210,7 @@ elif host_system == 'cygwin' elif host_system == 'darwin' dlsuffix = '.dylib' library_path_var = 'DYLD_LIBRARY_PATH' + rpath_origin = '@loader_path' export_file_format = 'darwin' export_fmt = '-exported_symbols_list=@0@' @@ -241,8 +243,16 @@ elif host_system == 'netbsd' # LDFLAGS. ldflags += ['-Wl,-z,now', '-Wl,-z,relro'] + # netbsd patched their meson in a broken way: + # https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=56959 + # until there's a way out of that, disable rpath_origin + rpath_origin = '' + elif host_system == 'openbsd' - # you're ok + # openbsd's $ORIGIN doesn't use an absolute path to the binary, but argv[0] + # (i.e. absolute when invoked with an absolute name, but e.g. not absolute + # when invoked via PATH search). + rpath_origin = '' elif host_system == 'sunos' portname = 'solaris' @@ -254,6 +264,7 @@ elif host_system == 'windows' exesuffix = '.exe' dlsuffix = '.dll' library_path_var = '' + rpath_origin = '' export_file_format = 'win' export_file_suffix = 'def' @@ -2479,6 +2490,25 @@ if host_system != 'darwin' mod_install_rpaths += postgres_lib_d endif +# If the host can form relative rpaths, use that to make the installation +# properly relocatable +if rpath_origin != '' + # PG binaries might need to link to libpq, use relative path to reference + bin_to_lib = run_command(python, files('src/tools/relpath.py'), + dir_bin, dir_lib, check: true).stdout().strip() + bin_install_rpaths += rpath_origin / bin_to_lib + + # PG extensions might need to link to libpq, use relative path to reference + # (often just .) + mod_to_lib = run_command(python, files('src/tools/relpath.py'), + dir_lib_pkg, dir_lib, check: true).stdout().strip() + mod_install_rpaths += rpath_origin / mod_to_lib + + test_use_library_path_var = false +else + test_use_library_path_var = true +endif + # Define arguments for default targets @@ -2771,6 +2801,14 @@ above, or by running configure and then make maintainer-clean. endif +# To make MacOS installation work without a prior make install, even with SIP +# enabled, make rpaths relative after installation. This also makes the +# installation relocatable. +if host_system == 'darwin' + meson.add_install_script('src/tools/relativize_shared_library_references') +endif + + ############################################################### # Test prep @@ -2836,10 +2874,9 @@ test_env.set('REGRESS_SHLIB', regress_module.full_path()) # Export PG_TEST_EXTRA so it can be checked in individual tap tests. test_env.set('PG_TEST_EXTRA', get_option('PG_TEST_EXTRA')) -# Add the temporary installation to the library search path on platforms where -# that works (everything but windows, basically). On windows everything -# library-like gets installed into bindir, solving that issue. -if library_path_var != '' +# On platforms without $ORIGIN support we need to add the temporary +# installation to the library search path. +if test_use_library_path_var and library_path_var != '' test_env.prepend(library_path_var, test_install_location / get_option('libdir')) endif diff --git a/src/tools/relativize_shared_library_references b/src/tools/relativize_shared_library_references new file mode 100755 index 00000000000..280bd48fd32 --- /dev/null +++ b/src/tools/relativize_shared_library_references @@ -0,0 +1,88 @@ +#!/usr/bin/env python3 +# -*-python-*- + +# This script updates a macos postgres installation to reference all internal +# shared libraries using rpaths, leaving absolute install_names in the +# libraries themselves intact. + +import os +import sys +import json +import subprocess +import shutil + + +def installed_path(destdir, path): + if destdir is not None: + return f'{destdir}{path}' + else: + return path + + +def collect_information(): + shared_libraries = [] + executables = [] + shared_modules = [] + + meson_info_p = os.path.join(build_root, 'meson-info') + targets = json.load( + open(os.path.join(meson_info_p, 'intro-targets.json'))) + installed = json.load( + open(os.path.join(meson_info_p, 'intro-installed.json'))) + + for target in targets: + if not target['installed']: + continue + + filenames = target['filename'] + + if target['type'] == 'shared library': + assert(len(filenames) == 1) + filename = filenames[0] + + shared_libraries.append(installed[filename]) + + if target['type'] == 'executable': + assert(len(filenames) == 1) + filename = filenames[0] + executables.append(installed[filename]) + + if target['type'] == 'shared module': + assert(len(filenames) == 1) + filename = filenames[0] + shared_modules.append(installed[filename]) + + return shared_libraries, executables, shared_modules + + +def patch_references(destdir, shared_libraries, executables, shared_modules): + install_name_tool = [shutil.which('install_name_tool')] + + for lib in shared_libraries: + libname = os.path.basename(lib) + libpath = installed_path(destdir, lib) + newref = f'@rpath/{libname}' + + for patch in shared_modules + executables: + patchpath = installed_path(destdir, patch) + + # print(f'in {patchpath} replace reference to {libpath} with {newref}') + if not os.path.exists(patchpath): + print(f"path {patchpath} doesn't exist", file=sys.stderr) + sys.exit(1) + + cmd = install_name_tool + ['-change', lib, newref, patchpath] + subprocess.check_call(cmd) + + +if __name__ == '__main__': + build_root = os.environ['MESON_BUILD_ROOT'] + destdir = os.environ.get('DESTDIR', None) + + print(f'making references to shared libraries relative, destdir is {destdir}', + file=sys.stderr) + + shared_libraries, executables, shared_modules = collect_information() + patch_references(destdir, shared_libraries, executables, shared_modules) + + sys.exit(0) diff --git a/src/tools/relpath.py b/src/tools/relpath.py new file mode 100755 index 00000000000..87bcb496ab5 --- /dev/null +++ b/src/tools/relpath.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import os +import sys + +print(os.path.relpath(sys.argv[2], start=sys.argv[1])) -- 2.37.3.542.gdd3f6c4cae
v15-0007-meson-Add-docs-for-building-with-meson.patch (text/x-diff, 77.6K) download From 7e1b6e3396986236d03c83685d2728795c2a0560 Mon Sep 17 00:00:00 2001 From: Andres Freund <andres@anarazel.de> Date: Sat, 27 Aug 2022 09:55:20 -0700 Subject: [PATCH v15 07/14] meson: Add docs for building with meson Author: Samay Sharma <smilingsamay@gmail.com> --- doc/src/sgml/installation.sgml | 1841 ++++++++++++++++++++++++++++++-- doc/src/sgml/monitoring.sgml | 2 +- doc/src/sgml/runtime.sgml | 2 +- doc/src/sgml/sourcerepo.sgml | 5 +- 4 files changed, 1743 insertions(+), 107 deletions(-) diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml index 319c7e69660..3d4018badd3 100644 --- a/doc/src/sgml/installation.sgml +++ b/doc/src/sgml/installation.sgml @@ -31,7 +31,144 @@ documentation. See standalone-profile.xsl for details. C++</productname>, see <xref linkend="install-windows"/> instead. </para> - <sect1 id="install-short"> + <sect1 id="supported-platforms"> + <title>Supported Platforms</title> + + <para> + A platform (that is, a CPU architecture and operating system combination) + is considered supported by the <productname>PostgreSQL</productname> development + community if the code contains provisions to work on that platform and + it has recently been verified to build and pass its regression tests + on that platform. Currently, most testing of platform compatibility + is done automatically by test machines in the + <ulink url="https://buildfarm.postgresql.org/">PostgreSQL Build Farm</ulink>. + If you are interested in using <productname>PostgreSQL</productname> on a platform + that is not represented in the build farm, but on which the code works + or can be made to work, you are strongly encouraged to set up a build + farm member machine so that continued compatibility can be assured. + </para> + + <para> + In general, <productname>PostgreSQL</productname> can be expected to work on + these CPU architectures: x86, PowerPC, S/390, SPARC, ARM, MIPS, RISC-V, + and PA-RISC, including + big-endian, little-endian, 32-bit, and 64-bit variants where applicable. + It is often + possible to build on an unsupported CPU type by configuring with + <option>--disable-spinlocks</option>, but performance will be poor. + </para> + + <para> + <productname>PostgreSQL</productname> can be expected to work on current + versions of these operating systems: Linux, Windows, + FreeBSD, OpenBSD, NetBSD, DragonFlyBSD, macOS, AIX, Solaris, and illumos. + Other Unix-like systems may also work but are not currently + being tested. In most cases, all CPU architectures supported by + a given operating system will work. Look in + <xref linkend="installation-platform-notes"/> below to see if + there is information + specific to your operating system, particularly if using an older system. + </para> + + <para> + If you have installation problems on a platform that is known + to be supported according to recent build farm results, please report + it to <email>pgsql-bugs@lists.postgresql.org</email>. If you are interested + in porting <productname>PostgreSQL</productname> to a new platform, + <email>pgsql-hackers@lists.postgresql.org</email> is the appropriate place + to discuss that. + </para> + + <para> + Historical versions of <productname>PostgreSQL</productname> or POSTGRES + also ran on CPU architectures including Alpha, Itanium, M32R, M68K, + M88K, NS32K, SuperH, and VAX, and operating systems including 4.3BSD, BEOS, + BSD/OS, DG/UX, Dynix, HP-UX, IRIX, NeXTSTEP, QNX, SCO, SINIX, Sprite, SunOS, + Tru64 UNIX, and ULTRIX. + </para> + </sect1> + + <sect1 id="get-source"> + <title>Getting the Source</title> + + <para> + You can download the source code in two ways - via git or the source code + tarballs. + </para> + + <sect2 id="get-source-git"> + <title>Getting the Source via <productname>Git</productname></title> + <para> + With <productname>Git</productname>, you can make a copy of the entire code repository + on your local machine, so you will have access to all history and branches + offline. This is the fastest and most flexible way to develop or test + patches. + </para> + + <procedure> + <step> + <para> + To begin using the Git repository, make a clone of the official mirror: + +<programlisting> +git clone https://git.postgresql.org/git/postgresql.git +</programlisting> + + This will copy the full repository to your local machine, so it may take + a while to complete, especially if you have a slow Internet connection. + The files will be placed in a new subdirectory <filename>postgresql</filename> of + your current directory. + </para> + + </step> + + <step> + <para> + Whenever you want to get the latest updates in the system, <command>cd</command> + into the repository, and run: + +<programlisting> +git pull +</programlisting> + </para> + </step> + </procedure> + + <para> + <productname>Git</productname> can do a lot more things than just fetch the source. + Our wiki, <ulink + url="https://wiki.postgresql.org/wiki/Working_with_Git"></ulink>, + has some discussion on working with Git. For more information, consult the + <productname>Git</productname> man pages, or see the website at + <ulink url="https://git-scm.com"></ulink>. + </para> + </sect2> + <sect2 id="get-source-tarball"> + <title>Getting the Source via Tarballs</title> + + <para> + The <productname>PostgreSQL</productname> source code for released versions + can also be obtained from the download section of our website: + <ulink url="https://www.postgresql.org/ftp/source/"></ulink>. + Download the + <filename>postgresql-<replaceable>version</replaceable>.tar.gz</filename> + or <filename>postgresql-<replaceable>version</replaceable>.tar.bz2</filename> + file you're interested in, then unpack it: +<screen> +<userinput>tar xf postgresql-<replaceable>version</replaceable>.tar.bz2</userinput> +</screen> + This will create a directory + <filename>postgresql-<replaceable>version</replaceable></filename> under + the current directory with the <productname>PostgreSQL</productname> sources. + Change into that directory for the rest of the installation procedure. + </para> + </sect2> + </sect1> + +<sect1 id="install-make"> + <title>Building and Installation with autoconf and make</title> + + <sect2 id="install-short-make"> <title>Short Version</title> <para> @@ -50,12 +187,12 @@ su - postgres /usr/local/pgsql/bin/psql test </synopsis> The long version is the rest of this - <phrase>chapter</phrase>. + <phrase>section</phrase>. </para> - </sect1> + </sect2> - <sect1 id="install-requirements"> + <sect2 id="install-requirements-make"> <title>Requirements</title> <para> @@ -343,45 +480,9 @@ su - postgres url="ftp://ftp.gnu.org/gnu/"></ulink>. </para> - <para> - Also check that you have sufficient disk space. You will need about - 350 MB for the source tree during compilation and about 60 MB for - the installation directory. An empty database cluster takes about - 40 MB; databases take about five times the amount of space that a - flat text file with the same data would take. If you are going to - run the regression tests you will temporarily need up to an extra - 300 MB. Use the <command>df</command> command to check free disk - space. - </para> - </sect1> + </sect2> - <sect1 id="install-getsource"> - <title>Getting the Source</title> - - <para> - The <productname>PostgreSQL</productname> source code for released versions - can be obtained from the download section of our website: - <ulink url="https://www.postgresql.org/ftp/source/"></ulink>. - Download the - <filename>postgresql-<replaceable>version</replaceable>.tar.gz</filename> - or <filename>postgresql-<replaceable>version</replaceable>.tar.bz2</filename> - file you're interested in, then unpack it: -<screen> -<userinput>tar xf postgresql-<replaceable>version</replaceable>.tar.bz2</userinput> -</screen> - This will create a directory - <filename>postgresql-<replaceable>version</replaceable></filename> under - the current directory with the <productname>PostgreSQL</productname> sources. - Change into that directory for the rest of the installation procedure. - </para> - - <para> - Alternatively, you can use the Git version control system; see - <xref linkend="git"/> for more information. - </para> - </sect1> - - <sect1 id="install-procedure"> + <sect2 id="install-procedure-make"> <title>Installation Procedure</title> <procedure> @@ -630,6 +731,7 @@ build-postgresql: rebuilding. Without this, your changes in configuration choices might not propagate everywhere they need to. </para> + </sect2> <sect2 id="configure-options"> <title><filename>configure</filename> Options</title> @@ -844,7 +946,7 @@ build-postgresql: various <productname>PostgreSQL</productname> features that are not built by default. Most of these are non-default only because they require additional software, as described in - <xref linkend="install-requirements"/>. + <xref linkend="install-requirements-make"/>. </para> <variablelist> @@ -1672,9 +1774,7 @@ build-postgresql: </sect3> - </sect2> - - <sect2 id="configure-envvars"> + <sect3 id="configure-envvars"> <title><filename>configure</filename> Environment Variables</title> <indexterm zone="configure-envvars"> @@ -1955,9 +2055,1600 @@ build-postgresql: adjustments, while <envar>COPT</envar> might be kept set all the time. </para> </note> + </sect3> </sect2> </sect1> + <sect1 id="install-meson"> + <title>Building and Installation with meson</title> + + <sect2 id="install-short-meson"> + <title>Short Version</title> + + <para> +<synopsis> + +# create working directory +mkdir postgres +cd postgres + +# fetch source code +# git clone https://git.postgresql.org/git/postgresql.git src + +# current instructions for testing (to be removed when merging) +git clone -b meson https://github.com/anarazel/postgres.git src + +# setup and enter build directory (done only first time) +meson setup build src --prefix=$PWD/install +cd build + +# Compile source +ninja + +# Install to the prefix directory specified above +ninja install + +# Run all tests (optional, takes time) +meson test + +# Initialize a new database +../install/bin/initdb -D ../data + +# Start database +../install/bin/pg_ctl -D ../data/ -l logfile start + +# Connect to the database +../install/bin/psql -d postgres + +</synopsis> + The long version is the rest of this + <phrase>section</phrase>. + </para> + </sect2> + + <sect2 id="install-requirements-meson"> + <title>Requirements</title> + + <para> + In general, a modern Unix-compatible platform or Windows should be able + to build <productname>PostgreSQL</productname> with meson and run it. + The platforms which have received specific testing at the time of release are: + + <itemizedlist spacing="compact"> + <listitem><simpara>Linux</simpara></listitem> + <listitem><simpara>Windows</simpara></listitem> + <listitem><simpara>OpenBSD</simpara></listitem> + <listitem><simpara>NetBSD</simpara></listitem> + <listitem><simpara>FreeBSD</simpara></listitem> + <listitem><simpara>macOS</simpara></listitem> + </itemizedlist> + </para> + + <sect3 id="required-packages"> + <title>Required packages</title> + + <para> + The following software packages are required for building + <productname>PostgreSQL</productname>: + + <itemizedlist> + <listitem> + <para> + You can download the source code in two ways - via git or by downloading + the source code tarballs. For the former, you will need an installed version of + <productname>Git</productname>, which you can get from + <ulink url="https://git-scm.com"></ulink>. Many systems already + have a recent version of <productname>Git</productname> + installed by default, or available in their package distribution system. + If you download the source code tarballs, you will need + <application>tar</application> in addition to + <application>gzip</application> or <application>bzip2</application>. + </para> + </listitem> + <listitem> + <para> + <indexterm> + <primary>meson</primary> + </indexterm> + You need to install <application> + <ulink url="https://mesonbuild.com/">meson</ulink></application> version + 0.54 or later to be able to build <productname>PostgreSQL</productname> + with it. If your operating system provides a package manager, you can install + <application>meson</application> with that. If not, you + can download a <ulink url="https://github.com/mesonbuild/meson">meson release</ulink> + from github and run <literal>./meson.py</literal> from the git repository + itself. Lastly, Meson is also available in the python package index and can + be installed with <literal>pip</literal>. + </para> + </listitem> + <listitem> + <para> + You need an <acronym>ISO</acronym>/<acronym>ANSI</acronym> C compiler (at least + C99-compliant). Recent + versions of <productname>GCC</productname> are recommended, but + <productname>PostgreSQL</productname> is known to build using a wide variety + of compilers from different vendors. + </para> + </listitem> + <listitem> + <para> + <indexterm> + <primary>flex</primary> + </indexterm> + <indexterm> + <primary>lex</primary> + </indexterm> + <indexterm> + <primary>bison</primary> + </indexterm> + <indexterm> + <primary>yacc</primary> + </indexterm> + + <application>Flex</application> and <application>Bison</application> + are needed to build <productname>PostgreSQL</productname> using + <application>meson</application>. Be sure to get + <application>Flex</application> 2.5.31 or later and + <application>Bison</application> 1.875 or later from your package manager. + Other <application>lex</application> and <application>yacc</application> + programs cannot be used. + </para> + </listitem> + <listitem> + <para> + <indexterm> + <primary>perl</primary> + </indexterm> + <application>Perl</application> 5.8.3 or later is needed to build PostgreSQL + using <application>meson</application> and to run some test suites. + </para> + </listitem> + </itemizedlist> + </para> + </sect3> + + <sect3 id="recommended-packages"> + <title>Recommended packages</title> + + <para> + The following packages are not required to build + <application>PostgreSQL</application> but are strongly recommended: + + <itemizedlist> + <listitem> + <para> + <indexterm> + <primary>readline</primary> + </indexterm> + <indexterm> + <primary>libedit</primary> + </indexterm> + + The <acronym>GNU</acronym> <productname>Readline</productname> library + allows <application>psql</application> (the PostgreSQL command line + SQL interpreter) to remember each command you type, and allows you to + use arrow keys to recall and edit previous commands. This is very + helpful and is strongly recommended. As an alternative, you can often + use the BSD-licensed <filename>libedit</filename> library, originally + developed on <productname>NetBSD</productname>. The + <filename>libedit</filename> library is GNU + <productname>Readline</productname>-compatible and is used if + <filename>libreadline</filename> is not found, or if + <option>libedit_preferred</option> is enabled as an + option to <filename>meson configure</filename>. If you are using a + package-based Linux distribution, be aware that you need both the + <literal>readline</literal> and <literal>readline-devel</literal> packages, if + those are separate in your distribution. + </para> + </listitem> + <listitem> + <para> + <indexterm> + <primary>zlib</primary> + </indexterm> + + The <productname>zlib</productname> compression library is + used to provide support for compressed archives in + <application>pg_dump</application> and + <application>pg_restore</application> and is recommended. + </para> + </listitem> + <listitem> + <para> + Various tests, particularly the client program tests under + <filename>src/bin</filename>, use the Perl TAP tools. Running + these tests is recommended for development. These TAP tests + require the Perl module <literal>IPC::Run</literal> which is + available from CPAN or an operating system package. + </para> + </listitem> + </itemizedlist> + </para> + </sect3> + + <sect3 id="optional-packages"> + <title>Optional packages</title> + + <para> + The following packages are optional. They are not required in the + default configuration, but they are needed when certain build + options are enabled, as explained below: + + <itemizedlist> + <listitem> + <para> + You need <productname>OpenSSL</productname>, if you want to support + encrypted client connections. <productname>OpenSSL</productname> is + also required for random number generation on platforms that do not + have <filename>/dev/urandom</filename> (except Windows). The minimum + required version is 1.0.1. + </para> + </listitem> + + <listitem> + <para> + You need <productname>LZ4</productname>, if you want to support + compression of data with that method; see + <xref linkend="guc-default-toast-compression"/> and + <xref linkend="guc-wal-compression"/>. + </para> + </listitem> + + <listitem> + <para> + You need <productname>Zstandard</productname>, if you want to support + compression of data or backups with that method; see + <xref linkend="guc-wal-compression"/>. + The minimum required version is 1.4.0. + </para> + </listitem> + + <listitem> + <para> + You need <application>Kerberos</application>, <productname>OpenLDAP</productname>, + and/or <application>PAM</application>, if you want to support authentication + using those services. + </para> + </listitem> + + <listitem> + <para> + To build the server programming language + <application>PL/Perl</application> you need a full + <productname>Perl</productname> installation, including the + <filename>libperl</filename> library and the header files. + The minimum required version is <productname>Perl</productname> 5.8.3. + Since <application>PL/Perl</application> will be a shared + library, the <indexterm><primary>libperl</primary></indexterm> + <filename>libperl</filename> library must be a shared library + also on most platforms. This appears to be the default in + recent <productname>Perl</productname> versions, but it was not + in earlier versions, and in any case it is the choice of whomever + installed Perl at your site. <filename>configure</filename> will fail + if building <application>PL/Perl</application> is selected but it cannot + find a shared <filename>libperl</filename>. In that case, you will have + to rebuild and install <productname>Perl</productname> manually to be + able to build <application>PL/Perl</application>. During the + configuration process for <productname>Perl</productname>, request a + shared library. + </para> + + <para> + If you intend to make more than incidental use of + <application>PL/Perl</application>, you should ensure that the + <productname>Perl</productname> installation was built with the + <literal>usemultiplicity</literal> option enabled (<literal>perl -V</literal> + will show whether this is the case). + </para> + </listitem> + + <listitem> + <para> + To build the <application>PL/Python</application> server programming + language, you need a <productname>Python</productname> + installation with the header files and + the <application>sysconfig</application> module. The minimum + required version is <productname>Python</productname> 3.2. + </para> + + <para> + Since <application>PL/Python</application> will be a shared + library, the <indexterm><primary>libpython</primary></indexterm> + <filename>libpython</filename> library must be a shared library + also on most platforms. This is not the case in a default + <productname>Python</productname> installation built from source, but a + shared library is available in many operating system + distributions. <filename>configure</filename> will fail if + building <application>PL/Python</application> is selected but it cannot + find a shared <filename>libpython</filename>. That might mean that you + either have to install additional packages or rebuild (part of) your + <productname>Python</productname> installation to provide this shared + library. When building from source, run <productname>Python</productname>'s + configure with the <literal>--enable-shared</literal> flag. + </para> + </listitem> + + <listitem> + <para> + To build the <application>PL/Tcl</application> + procedural language, you of course need a <productname>Tcl</productname> + installation. The minimum required version is + <productname>Tcl</productname> 8.4. + </para> + </listitem> + + <listitem> + <para> + To enable Native Language Support (<acronym>NLS</acronym>), that + is, the ability to display a program's messages in a language + other than English, you need an implementation of the + <application>Gettext</application> <acronym>API</acronym>. Some operating + systems have this built-in (e.g., <systemitem + class="osname">Linux</systemitem>, <systemitem class="osname">NetBSD</systemitem>, + <systemitem class="osname">Solaris</systemitem>), for other systems you + can download an add-on package from <ulink + url="https://www.gnu.org/software/gettext/"></ulink>. + If you are using the <application>Gettext</application> implementation in + the <acronym>GNU</acronym> C library then you will additionally + need the <productname>GNU Gettext</productname> package for some + utility programs. For any of the other implementations you will + not need it. + </para> + </listitem> + + <listitem> + <para> + To build the <productname>PostgreSQL</productname> documentation, + there is a separate set of requirements; see + <xref linkend="docguide-toolsets"/>. + </para> + </listitem> + </itemizedlist> + </para> + </sect3> + + </sect2> + + <sect2 id="configure-meson"> + <title>Configuring the build</title> + + <para> + The first step of the installation procedure is to configure the + source tree for your system and choose the options you would like. To + create and configure the build directory, you can start with the + <literal>meson setup</literal> command. + </para> + +<screen> +<userinput>meson setup build</userinput> +</screen> + + <para> + The setup command takes a <literal>builddir</literal> and a <literal>srcdir</literal> + argument. If no <literal>srcdir</literal> is given Meson will deduce the + <literal>srcdir</literal> based on the current directory and the location + of <literal>meson.build</literal>. The <literal>builddir</literal> is mandatory. + </para> + + <para> + Meson then loads the build configuration file and sets up the build directory. + Additionally, the invocation can pass options to Meson. The list of commonly + used options is in subsequent sections. A few examples of specifying different + build options are: + +<screen> +#Setup build directory with a different installation prefix +meson setup build --prefix=/home/user/pg-install + +#Setup build directory to generate a debug build +meson setup build --buildtype=debug + +#Setup build directory with ssl (Use -D for project specific options) +meson setup build -Dssl=openssl +</screen> + + Setting up the build directory is a one-time step. To reconfigure before a + new build, you can simply use the <literal>meson configure</literal> command + </para> + +<para> +<screen> +meson configure -Dcassert=true +</screen> +</para> + +<para> + <command>meson configure</command>'s commonly used command line options + are explained below. This list is not exhaustive (use + <literal>meson configure --help</literal> to get one that is). + The options not covered here are meant for advanced use-cases, and are + documented in the standard meson + <ulink url="https://mesonbuild.com/Commands.html#configure">documentation</ulink>. + These arguments can be used with <command>meson setup</command> as well. +</para> + + <sect3 id="configure-install-locations"> + <title>Installation Locations</title> + + <para> + These options control where <literal>ninja install (or meson install)</literal> will put + the files. The <option>--prefix</option> option is sufficient for + most cases. If you have special needs, you can customize the + installation subdirectories with the other options described in this + section. Beware however that changing the relative locations of the + different subdirectories may render the installation non-relocatable, + meaning you won't be able to move it after installation. + (The <literal>man</literal> and <literal>doc</literal> locations are + not affected by this restriction.) + </para> + + <variablelist> + <varlistentry> + <term><option>--prefix=<replaceable>PREFIX</replaceable></option></term> + <listitem> + <para> + Install all files under the directory <replaceable>PREFIX</replaceable> + instead of <filename>/usr/local/pgsql</filename>. The actual + files will be installed into various subdirectories; no files + will ever be installed directly into the + <replaceable>PREFIX</replaceable> directory. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>--bindir=<replaceable>DIRECTORY</replaceable></option></term> + <listitem> + <para> + Specifies the directory for executable programs. The default + is <filename><replaceable>PREFIX</replaceable>/bin</filename>, which + normally means <filename>/usr/local/pgsql/bin</filename>. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>--sysconfdir=<replaceable>DIRECTORY</replaceable></option></term> + <listitem> + <para> + Sets the directory for various configuration files, + <filename><replaceable>PREFIX</replaceable>/etc</filename> by default. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>--libdir=<replaceable>DIRECTORY</replaceable></option></term> + <listitem> + <para> + Sets the location to install libraries and dynamically loadable + modules. The default is + <filename><replaceable>PREFIX</replaceable>/lib</filename>. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>--includedir=<replaceable>DIRECTORY</replaceable></option></term> + <listitem> + <para> + Sets the directory for installing C and C++ header files. The + default is <filename><replaceable>PREFIX</replaceable>/include</filename>. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>--datadir=<replaceable>DIRECTORY</replaceable></option></term> + <listitem> + <para> + Sets the directory for read-only data files used by the + installed programs. The default is + <filename><replaceable>PREFIX</replaceable>/share</filename>. Note that this has + nothing to do with where your database files will be placed. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>--localedir=<replaceable>DIRECTORY</replaceable></option></term> + <listitem> + <para> + Sets the directory for installing locale data, in particular + message translation catalog files. The default is + <filename><replaceable>DATADIR</replaceable>/locale</filename>. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>--mandir=<replaceable>DIRECTORY</replaceable></option></term> + <listitem> + <para> + The man pages that come with <productname>PostgreSQL</productname> will be installed under + this directory, in their respective + <filename>man<replaceable>x</replaceable></filename> subdirectories. + The default is <filename><replaceable>DATADIR</replaceable>/man</filename>. + </para> + </listitem> + </varlistentry> + + </variablelist> + + <note> + <para> + Care has been taken to make it possible to install + <productname>PostgreSQL</productname> into shared installation locations + (such as <filename>/usr/local/include</filename>) without + interfering with the namespace of the rest of the system. First, + the string <quote><literal>/postgresql</literal></quote> is + automatically appended to <varname>datadir</varname>, + <varname>sysconfdir</varname>, and <varname>docdir</varname>, + unless the fully expanded directory name already contains the + string <quote><literal>postgres</literal></quote> or + <quote><literal>pgsql</literal></quote>. For example, if you choose + <filename>/usr/local</filename> as prefix, the documentation will + be installed in <filename>/usr/local/doc/postgresql</filename>, + but if the prefix is <filename>/opt/postgres</filename>, then it + will be in <filename>/opt/postgres/doc</filename>. The public C + header files of the client interfaces are installed into + <varname>includedir</varname> and are namespace-clean. The + internal header files and the server header files are installed + into private directories under <varname>includedir</varname>. See + the documentation of each interface for information about how to + access its header files. Finally, a private subdirectory will + also be created, if appropriate, under <varname>libdir</varname> + for dynamically loadable modules. + </para> + </note> + </sect3> + + <sect3 id="configure-pg-features"> + <title><productname>PostgreSQL</productname> Features</title> + + <para> + The options described in this section enable building of + various <productname>PostgreSQL</productname> features that are not + built by default. Most of these are non-default only because they + require additional software, as described in + <xref linkend="install-requirements-meson"/>. To specify PostgreSQL + specific options, the name of the option should be prefixed by -D. + </para> + + <variablelist> + + <varlistentry> + <term><option>-Dnls=<replaceable>auto/enabled/disabled</replaceable></option></term> + <listitem> + <para> + Enables or disables Native Language Support (<acronym>NLS</acronym>), + that is, the ability to display a program's messages in a + language other than English. It defaults to auto, meaning that it + will be enabled automatically if the required packages are found. + </para> + + <para> + To use this option, you will need an implementation of the + <application>Gettext</application> API. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dplperl=<replaceable>auto/enabled/disabled</replaceable></option></term> + <listitem> + <para> + Build the <application>PL/Perl</application> server-side language. It + defaults to auto, meaning that it will be enabled automatically if the + required packages are found. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dplpython=<replaceable>auto/enabled/disabled</replaceable></option></term> + <listitem> + <para> + Build the <application>PL/Python</application> server-side language. + It defaults to auto, meaning that it will be enabled automatically if the + required packages are found. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dpltcl=<replaceable>auto/enabled/disabled</replaceable></option></term> + <listitem> + <para> + Build the <application>PL/Tcl</application> server-side language. + It defaults to auto, meaning that it will be enabled automatically if the + required packages are found. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dtcl_version=<replaceable>TCL_VERSION</replaceable></option></term> + <listitem> + <para> + Specifies the TCL version to use when building PL/Tcl. + It defaults to auto, meaning that it will be enabled automatically if the + required packages are found. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dicu=<replaceable>auto/enabled/disabled</replaceable></option></term> + <listitem> + <para> + Build with support for + the <productname>ICU</productname><indexterm><primary>ICU</primary></indexterm> + library, enabling use of ICU collation + features<phrase condition="standalone-ignore"> (see + <xref linkend="collation"/>)</phrase>. + This requires the <productname>ICU4C</productname> package + to be installed. The minimum required version + of <productname>ICU4C</productname> is currently 4.2. + It defaults to auto, meaning that it will be enabled automatically if the + required packages are found. + </para> + + <para> + By default, + <productname>pkg-config</productname><indexterm><primary>pkg-config</primary></indexterm> + will be used to find the required compilation options. This is + supported for <productname>ICU4C</productname> version 4.6 and later. + <!-- Add description for older ICU4C versions and when pkg-config isn't available--> + </para> + </listitem> + </varlistentry> + + <varlistentry id="configure-with-llvm-meson"> + <term><option>-Dllvm=<replaceable>auto/enabled/disabled</replaceable></option></term> + <listitem> + <para> + Build with support for <productname>LLVM</productname> based + <acronym>JIT</acronym> compilation<phrase + condition="standalone-ignore"> (see <xref + linkend="jit"/>)</phrase>. This + requires the <productname>LLVM</productname> library to be installed. + The minimum required version of <productname>LLVM</productname> is + currently 3.9. It is set to disabled by default. + </para> + <para> + <command>llvm-config</command><indexterm><primary>llvm-config</primary></indexterm> + will be used to find the required compilation options. + <command>llvm-config</command>, and then + <command>llvm-config-$major-$minor</command> for all supported + versions, will be searched for in your <envar>PATH</envar>. + <!--Add substitute for LLVM_CONFIG when llvm-config is not in PATH--> + </para> + + <para> + <productname>LLVM</productname> support requires a compatible + <command>clang</command> compiler (specified, if necessary, using the + <envar>CLANG</envar> environment variable), and a working C++ + compiler (specified, if necessary, using the <envar>CXX</envar> + environment variable). + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dlz4=<replaceable>auto/enabled/disabled</replaceable></option></term> + <listitem> + <para> + Build with <productname>LZ4</productname> compression support. + It defaults to auto, meaning that it will be enabled automatically if the + required packages are found. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dzstd=<replaceable>auto/enabled/disabled</replaceable></option></term> + <listitem> + <para> + Build with <productname>Zstandard</productname> compression support. + It defaults to auto, meaning that it will be enabled automatically if the + required packages are found. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dssl=<replaceable>LIBRARY</replaceable></option> + <indexterm> + <primary>OpenSSL</primary> + <seealso>SSL</seealso> + </indexterm> + </term> + <listitem> + <para> + Build with support for <acronym>SSL</acronym> (encrypted) + connections. The only <replaceable>LIBRARY</replaceable> + supported is <option>openssl</option>. This requires the + <productname>OpenSSL</productname> package to be installed. + <filename>configure</filename> will check for the required + header files and libraries to make sure that your + <productname>OpenSSL</productname> installation is sufficient + before proceeding. The default for this option is none. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dgssapi=<replaceable>auto/enabled/disabled</replaceable></option></term> + <listitem> + <para> + Build with support for GSSAPI authentication. On many systems, the + GSSAPI system (usually a part of the Kerberos installation) is not + installed in a location + that is searched by default (e.g., <filename>/usr/include</filename>, + <filename>/usr/lib</filename>), so you must use the options + <option>-Dextra_include_dirs</option> and <option>-Dextra_lib_dirs</option> in + addition to this option. <filename>meson configure</filename> will check + for the required header files and libraries to make sure that + your GSSAPI installation is sufficient before proceeding. + It defaults to auto, meaning that it will be enabled automatically if the + required packages are found. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dldap=<replaceable>auto/enabled/disabled</replaceable></option></term> + <listitem> + <para> + Build with <acronym>LDAP</acronym><indexterm><primary>LDAP</primary></indexterm> + support for authentication and connection parameter lookup (see + <phrase id="install-ldap-links-meson"><xref linkend="libpq-ldap"/> and + <xref linkend="auth-ldap"/></phrase> for more information). On Unix, + this requires the <productname>OpenLDAP</productname> package to be + installed. On Windows, the default <productname>WinLDAP</productname> + library is used. <filename>configure</filename> will check for the required + header files and libraries to make sure that your + <productname>OpenLDAP</productname> installation is sufficient before + proceeding. It defaults to auto, meaning that it will be enabled automatically + if the required packages are found. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dpam=<replaceable>auto/enabled/disabled</replaceable></option></term> + <listitem> + <para> + Build with <acronym>PAM</acronym><indexterm><primary>PAM</primary></indexterm> + (Pluggable Authentication Modules) support. It defaults to auto, meaning that it + will be enabled automatically if the required packages are found. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dbsd_auth=<replaceable>auto/enabled/disabled</replaceable></option></term> + <listitem> + <para> + Build with BSD Authentication support. (The BSD Authentication framework is + currently only available on OpenBSD.) It defaults to auto, meaning that it + will be enabled automatically if the required packages are found. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dsystemd=<replaceable>auto/enabled/disabled</replaceable></option></term> + <listitem> + <para> + Build with support + for <application>systemd</application><indexterm><primary>systemd</primary></indexterm> + service notifications. This improves integration if the server + is started under <application>systemd</application> but has no impact + otherwise<phrase condition="standalone-ignore">; see <xref linkend="server-start"/> for more + information</phrase>. <application>libsystemd</application> and the + associated header files need to be installed to use this option. + It defaults to auto, meaning that it will be enabled automatically if the + required packages are found. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dbonjour=<replaceable>auto/enabled/disabled</replaceable></option></term> + <listitem> + <para> + Build with support for Bonjour automatic service discovery. + This requires Bonjour support in your operating system. + Recommended on macOS. It defaults to auto, meaning that it will be + enabled automatically if the required packages are found. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Duuid=<replaceable>LIBRARY</replaceable></option></term> + <listitem> + <para> + Build the <xref linkend="uuid-ossp"/> module + (which provides functions to generate UUIDs), using the specified + UUID library.<indexterm><primary>UUID</primary></indexterm> + <replaceable>LIBRARY</replaceable> must be one of: + </para> + <itemizedlist> + <listitem> + <para> + <option>none</option> to not build the ussp module. This is the default. + </para> + </listitem> + <listitem> + <para> + <option>bsd</option> to use the UUID functions found in FreeBSD, NetBSD, + and some other BSD-derived systems + </para> + </listitem> + <listitem> + <para> + <option>e2fs</option> to use the UUID library created by + the <literal>e2fsprogs</literal> project; this library is present in most + Linux systems and in macOS, and can be obtained for other + platforms as well + </para> + </listitem> + <listitem> + <para> + <option>ossp</option> to use the <ulink + url="http://www.ossp.org/pkg/lib/uuid/">OSSP UUID library</ulink> + </para> + </listitem> + </itemizedlist> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dlibxml=<replaceable>auto/enabled/disabled</replaceable></option></term> + <listitem> + <para> + Build with libxml2, enabling SQL/XML support. Libxml2 version 2.6.23 or + later is required for this feature. It defaults to auto, meaning that it will be + enabled automatically if the required packages are found. + </para> + + <para> + To detect the required compiler and linker options, PostgreSQL will + query <command>pkg-config</command>, if that is installed and knows + about libxml2. Otherwise the program <command>xml2-config</command>, + which is installed by libxml2, will be used if it is found. Use + of <command>pkg-config</command> is preferred, because it can deal + with multi-architecture installations better. + </para> + + <para> + To use a libxml2 installation that is in an unusual location, you + can set <command>pkg-config</command>-related environment + variables (see its documentation). + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dlibxslt=<replaceable>auto/enabled/disabled</replaceable></option></term> + <listitem> + <para> + Build with libxslt, enabling the + <xref linkend="xml2"/> + module to perform XSL transformations of XML. + <option>-Dlibxml</option> must be specified as well. + It defaults to auto, meaning that it will be + enabled automatically if the required packages are found. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dreadline=<replaceable>auto/enabled/disabled</replaceable></option></term> + <listitem> + <para> + Allows use of the <application>Readline</application> library + (and <application>libedit</application> as well). This option enables + command-line editing and history in + <application>psql</application> and is strongly recommended. + It defaults to auto, meaning that it will be + enabled automatically if the required packages are found. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dlibedit_preferred=<replaceable>true/false</replaceable></option></term> + <listitem> + <para> + Setting this to true favors the use of the BSD-licensed <application>libedit</application> library + rather than GPL-licensed <application>Readline</application>. This option + is significant only if you have both libraries installed; the + default is false that is to use <application>Readline</application>. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dzlib=<replaceable>auto/enabled/disabled</replaceable></option></term> + <listitem> + <para> + <indexterm> + <primary>zlib</primary> + </indexterm> + Enabls use of the <application>Zlib</application> library. + This enables + support for compressed archives in <application>pg_dump</application> + and <application>pg_restore</application> and is recommended. + It defaults to auto, meaning that it will be + enabled automatically if the required packages are found. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dspinlocks=<replaceable>true/false</replaceable></option></term> + <listitem> + <para> + This option is set to true by default and + setting it to false will allow the build to succeed even if <productname>PostgreSQL</productname> + has no CPU spinlock support for the platform. The lack of + spinlock support will result in very poor performance; therefore, + this option should only be changed if the build aborts and + informs you that the platform lacks spinlock support. If setting this + option to false is required to build <productname>PostgreSQL</productname> on + your platform, please report the problem to the + <productname>PostgreSQL</productname> developers. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Datomics=<replaceable>true/false</replaceable></option></term> + <listitem> + <para> + This option is set to true and setting it to false will + disable use of CPU atomic operations. The option does nothing on + platforms that lack such operations. On platforms that do have + them, disabling atomics will result in poor performance. Changing + this option is only useful for debugging or making performance comparisons. + </para> + </listitem> + </varlistentry> + </variablelist> + </sect3> + + <sect3 id="configure-build-process"> + <title>Build Process Details</title> + + <variablelist> + + <varlistentry> + <term><option>--auto_features=<replaceable>auto/enabled/disabled</replaceable></option></term> + <listitem> + <para> + Setting this option allows you to override value of all 'auto' features. + This can be useful when you want to disable or enable all the "optional" + features at once without having to set each of them manually. The default + value for this parameter is auto. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>--backend=<replaceable>BACKEND</replaceable></option></term> + <listitem> + <para> + The default backend meson uses is ninja and that should suffice for most use cases. + However, if you'd like to fully integrate with visual studio, you can set the + BACKEND to <command>vs</command>. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dc_args=<replaceable>OPTIONS</replaceable></option></term> + <listitem> + <para> + This option can be used to pass extra options to the C compiler. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dc_link_args=<replaceable>OPTIONS</replaceable></option></term> + <listitem> + <para> + This option can be used to pass extra options to the C linker. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dextra_include_dirs=<replaceable>DIRECTORIES</replaceable></option></term> + <listitem> + <para> + <replaceable>DIRECTORIES</replaceable> is a colon-separated list of + directories that will be added to the list the compiler + searches for header files. If you have optional packages + (such as GNU <application>Readline</application>) installed in a non-standard + location, + you have to use this option and probably also the corresponding + <option>-Dextra_lib_dirs</option> option. + </para> + <para> + Example: <literal>-Dextra_include_dirs=/opt/gnu/include:/usr/sup/include</literal>. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dextra_lib_dirs=<replaceable>DIRECTORIES</replaceable></option></term> + <listitem> + <para> + <replaceable>DIRECTORIES</replaceable> is a colon-separated list of + directories to search for libraries. You will probably have + to use this option (and the corresponding + <option>-Dextra_include_dirs</option> option) if you have packages + installed in non-standard locations. + </para> + <para> + Example: <literal>-Dextra_lib_dirs=/opt/gnu/lib:/usr/sup/lib</literal>. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dsystem_tzdata=<replaceable>DIRECTORY</replaceable></option> + <indexterm> + <primary>time zone data</primary> + </indexterm> + </term> + <listitem> + <para> + <productname>PostgreSQL</productname> includes its own time zone database, + which it requires for date and time operations. This time zone + database is in fact compatible with the IANA time zone + database provided by many operating systems such as FreeBSD, + Linux, and Solaris, so it would be redundant to install it again. + When this option is used, the system-supplied time zone database + in <replaceable>DIRECTORY</replaceable> is used instead of the one + included in the PostgreSQL source distribution. + <replaceable>DIRECTORY</replaceable> must be specified as an + absolute path. <filename>/usr/share/zoneinfo</filename> is a + likely directory on some operating systems. Note that the + installation routine will not detect mismatching or erroneous time + zone data. If you use this option, you are advised to run the + regression tests to verify that the time zone data you have + pointed to works correctly with <productname>PostgreSQL</productname>. + </para> + + <indexterm><primary>cross compilation</primary></indexterm> + + <para> + This option is mainly aimed at binary package distributors + who know their target operating system well. The main + advantage of using this option is that the PostgreSQL package + won't need to be upgraded whenever any of the many local + daylight-saving time rules change. Another advantage is that + PostgreSQL can be cross-compiled more straightforwardly if the + time zone database files do not need to be built during the + installation. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dextra_version=<replaceable>STRING</replaceable></option></term> + <listitem> + <para> + Append <replaceable>STRING</replaceable> to the PostgreSQL version number. You + can use this, for example, to mark binaries built from unreleased Git + snapshots or containing custom patches with an extra version string, + such as a <command>git describe</command> identifier or a + distribution package release number. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-D<replaceable>BINARY_NAME</replaceable>=<replaceable>PATH</replaceable></option></term> + <listitem> + <para> + If you have the binaries for certain by programs required to build + Postgres (with or without optional flags) stored at non-standard + paths, you could specify them manually to meson configure. The complete + list of programs for whom this is supported can be found by running + <literal>meson configure</literal>. An example is included below. +<programlisting>meson configure -DBISON=PATH_TO_BISON</programlisting> + </para> + </listitem> + </varlistentry> + </variablelist> + </sect3> + + <sect3 id="configure-layout"> + <title>Data layout</title> + + <para> + These options affect how PostgreSQL lays out data on disk. + Note that changing these breaks on-disk database compatibility, + meaning you cannot use <command>pg_upgrade</command> to upgrade to + a build with a different value of these options. + </para> + + <variablelist> + + <varlistentry> + <term><option>-Dsegsize=<replaceable>SEGSIZE</replaceable></option></term> + <listitem> + <para> + Set the <firstterm>segment size</firstterm>, in gigabytes. Large tables are + divided into multiple operating-system files, each of size equal + to the segment size. This avoids problems with file size limits + that exist on many platforms. The default segment size, 1 gigabyte, + is safe on all supported platforms. If your operating system has + <quote>largefile</quote> support (which most do, nowadays), you can use + a larger segment size. This can be helpful to reduce the number of + file descriptors consumed when working with very large tables. + But be careful not to select a value larger than is supported + by your platform and the file systems you intend to use. Other + tools you might wish to use, such as <application>tar</application>, could + also set limits on the usable file size. + It is recommended, though not absolutely required, that this value + be a power of 2. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dblocksize=<replaceable>BLOCKSIZE</replaceable></option></term> + <listitem> + <para> + Set the <firstterm>block size</firstterm>, in kilobytes. This is the unit + of storage and I/O within tables. The default, 8 kilobytes, + is suitable for most situations; but other values may be useful + in special cases. + The value must be a power of 2 between 1 and 32 (kilobytes). + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dwal_blocksize=<replaceable>BLOCKSIZE</replaceable></option></term> + <listitem> + <para> + Set the <firstterm>WAL block size</firstterm>, in kilobytes. This is the unit + of storage and I/O within the WAL log. The default, 8 kilobytes, + is suitable for most situations; but other values may be useful + in special cases. + The value must be a power of 2 between 1 and 64 (kilobytes). + </para> + </listitem> + </varlistentry> + + </variablelist> + </sect3> + + <sect3 id="configure-devel"> + <title>Developer Options</title> + + <para> + Most of the options in this section are only of interest for + developing or debugging <productname>PostgreSQL</productname>. + They are not recommended for production builds, except + for <option>--debug</option>, which can be useful to enable + detailed bug reports in the unlucky event that you encounter a bug. + On platforms supporting DTrace, <option>-Ddtrace</option> + may also be reasonable to use in production. + </para> + + <para> + When building an installation that will be used to develop code inside + the server, it is recommended to use at least the <option>--buildtype=debug</option> + and <option>-Dcassert</option> options. + </para> + + <variablelist> + <varlistentry> + <term><option>--buildtype=<replaceable>BUILDTYPE</replaceable></option></term> + <listitem> + <para> + This option can be used to specify the buildtype to use; defaults + to release. If you'd like finer control on the debug symbols + and optimization levels than what this option provides, you can + refer to the --debug and --optimization flags. + + The following build types are generally used: + <variablelist> + <varlistentry> + <term><literal>plain</literal></term> + <listitem> + <para> + No extra build flags are used, even for compiler warnings, + useful for distro packagers and other cases where you need to + specify all arguments by yourself. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><literal>debug</literal></term> + <listitem> + <para> + Debug info is generated but the result is not optimized. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><literal>debugoptimized</literal></term> + <listitem> + <para> + Debug info is generated and the code is optimized (on most compilers + this means <literal>-g -O2</literal>) + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><literal>release</literal></term> + <listitem> + <para> + This enables full optimization and no debug info is generated. This is + the default. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>--debug</option></term> + <listitem> + <para> + Compiles all programs and libraries with debugging symbols. + This means that you can run the programs in a debugger + to analyze problems. This enlarges the size of the installed + executables considerably, and on non-GCC compilers it usually + also disables compiler optimization, causing slowdowns. However, + having the symbols available is extremely helpful for dealing + with any problems that might arise. Currently, this option is + recommended for production installations only if you use GCC. + But you should always have it on if you are doing development work + or running a beta version. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>--optimization</option>=<replaceable>LEVEL</replaceable></term> + <listitem> + <para> + Specify the optimization level. LEVEL can be set to any of {0,g,1,2,3,s}. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>--werror</option></term> + <listitem> + <para> + Setting this option asks the compiler to treat warnings as errors. This can + be useful for code development purposes. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dcassert</option></term> + <listitem> + <para> + Enables <firstterm>assertion</firstterm> checks in the server, which test for + many <quote>cannot happen</quote> conditions. This is invaluable for + code development purposes, but the tests can slow down the + server significantly. + Also, having the tests turned on won't necessarily enhance the + stability of your server! The assertion checks are not categorized + for severity, and so what might be a relatively harmless bug will + still lead to server restarts if it triggers an assertion + failure. This option is not recommended for production use, but + you should have it on for development work or when running a beta + version. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dtap-tests</option></term> + <listitem> + <para> + Enable tests using the Perl TAP tools. This requires a Perl + installation and the Perl module <literal>IPC::Run</literal>. + <phrase condition="standalone-ignore">See <xref linkend="regress-tap"/> for more information.</phrase> + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-DPG_TEST_EXTRA=<replaceable>TEST_SUITES</replaceable></option></term> + <listitem> + <para> + Enable test suites which require special software to run. This option + accepts arguments via a whitespace-separated list. The following values + are currently supported: + <variablelist> + <varlistentry> + <term><literal>kerberos</literal></term> + <listitem> + <para> + Runs the test suite under <filename>src/test/kerberos</filename>. This + requires an MIT Kerberos installation and opens TCP/IP listen sockets. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><literal>ldap</literal></term> + <listitem> + <para> + Runs the test suite under <filename>src/test/ldap</filename>. This + requires an <productname>OpenLDAP</productname> installation and opens + TCP/IP listen sockets. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><literal>ssl</literal></term> + <listitem> + <para> + Runs the test suite under <filename>src/test/ssl</filename>. This opens TCP/IP listen sockets. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><literal>wal_consistency_checking</literal></term> + <listitem> + <para> + Uses <literal>wal_consistency_checking=all</literal> while running + certain tests under <filename>src/test/recovery</filename>. Not + enabled by default because it is resource intensive. + </para> + </listitem> + </varlistentry> + </variablelist> + Tests for features that are not supported by the current build + configuration are not run even if they are mentioned in + <varname>PG_TEST_EXTRA</varname>. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>--errorlogs</option></term> + <listitem> + <para> + This option can be used to print the logs from the failing tests + making debugging easier. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Db_coverage</option></term> + <listitem> + <para> + If using GCC, all programs and libraries are compiled with + code coverage testing instrumentation. When run, they + generate files in the build directory with code coverage + metrics. + <phrase condition="standalone-ignore">See <xref linkend="regress-coverage"/> + for more information.</phrase> This option is for use only with GCC + and when doing development work. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Ddtrace=<replaceable>auto/enabled/disabled</replaceable></option></term> + <listitem> + <para> + <indexterm> + <primary>DTrace</primary> + </indexterm> + Enabling this compiles <productname>PostgreSQL</productname> with support for the + dynamic tracing tool DTrace. + <phrase condition="standalone-ignore">See <xref linkend="dynamic-trace"/> + for more information.</phrase> + </para> + + <para> + To point to the <command>dtrace</command> program, the + environment variable <envar>DTRACE</envar> can be set. This + will often be necessary because <command>dtrace</command> is + typically installed under <filename>/usr/sbin</filename>, + which might not be in your <envar>PATH</envar>. + </para> + + </listitem> + </varlistentry> + </variablelist> + </sect3> + + <sect3 id="configure-misc"> + <title>Miscellaneous</title> + + <variablelist> + <varlistentry> + <term><option>-Dpgport=<replaceable>NUMBER</replaceable></option></term> + <listitem> + <para> + Set <replaceable>NUMBER</replaceable> as the default port number for + server and clients. The default is 5432. The port can always + be changed later on, but if you specify it here then both + server and clients will have the same default compiled in, + which can be very convenient. Usually the only good reason + to select a non-default value is if you intend to run multiple + <productname>PostgreSQL</productname> servers on the same machine. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><option>-Dkrb_srvnam=<replaceable>NAME</replaceable></option></term> + <listitem> + <para> + The default name of the Kerberos service principal used + by GSSAPI. + <literal>postgres</literal> is the default. There's usually no + reason to change this unless you are building for a Windows + environment, in which case it must be set to upper case + <literal>POSTGRES</literal>. + </para> + </listitem> + </varlistentry> + </variablelist> + </sect3> + + </sect2> + + <sect2 id="build-meson"> + <title>Building the source</title> + <para> + By default, <productname>Meson</productname> uses the + <ulink url="https://ninja-build.org/"> Ninja build system</ulink>. + To build <productname>PostgreSQL</productname> from source using meson, you can + simply use the <literal>ninja</literal> command in the build directory. +<screen> +ninja +</screen> + Ninja will automatically detect the number of CPUs in your computer and + parallelize itself accordingly. You can override the amount of parallel + processes used with the command line argument <literal>-j</literal>. + </para> + + <para> + It should be noted that after the initial configure step + <command>ninja</command> is the only command you ever need to type to + compile. No matter how you alter your source tree (short of moving it to + a completely new location), Meson will detect the changes and regenerate + itself accordingly. This is especially handy if you have multiple build + directories. Often one of them is used for development (the "debug" build) + and others only every now and then (such as a "static analysis" build). + Any configuration can be built just by cd'ing to the corresponding directory + and running Ninja. + </para> + + <para> + If you'd like to build with a backend other that ninja, you can use configure + with the <option>--backend</option> option to select the one you want to use and then + build using <literal>meson compile</literal>. To learn more about these + backends and other arguments you can provide to ninja, you can refer to the + meson <ulink url="https://mesonbuild.com/Running-Meson.html#building-from-the-source"> + documentation</ulink>. + </para> + </sect2> + + <sect2 id="install-files-meson"> + <title>Installing the files</title> + <para> + Once Postgres is built, you can install it by simply running the + <literal>ninja install</literal> command. + +<screen> +ninja install +</screen> + </para> + + <para> + This will install files into the directories that were specified + in <xref linkend="configure-meson"/>. Make sure that you have appropriate + permissions to write into that area. You might need to do this + step as root. Alternatively, you can create the target directories + in advance and arrange for appropriate permissions to be granted. + The standard installation provides all the header files needed for client + application development as well as for server-side program + development, such as custom functions or data types written in C. + </para> + + <para> + <literal>ninja install</literal> should work for most cases + but if you'd like to use more options, you could also use + <literal>meson install</literal> instead. You can learn more about + <ulink url="https://mesonbuild.com/Commands.html#install">meson install</ulink> + and it's options in the meson documentation. + </para> + + <para> + Depending on your platform and setup, you might have to perform a + few steps after installation. Those are outlined in + <xref linkend="install-post"/>. + </para> + + <formalpara> + <title>Uninstallation:</title> + <para> + To undo the installation, you can use the <command>ninja + uninstall</command> command. + </para> + </formalpara> + + <formalpara> + <title>Cleaning:</title> + <para> + After the installation you can free disk space by removing the built + files from the source tree with the <command>ninja clean</command> + command. + </para> + </formalpara> + + </sect2> + + <sect2 id="running-tests"> + <title>Running tests</title> + <para> + If you want to test the newly built server, you can run the regression + tests. The regression tests are a collection of test suites to verify + that <productname>PostgreSQL</productname> runs on your machine in + the way the developers expected it to. To run them, simply type: +<screen> +<userinput>meson test</userinput> +</screen> + You can repeat this at any later time by issuing the same command. + </para> + + <para>Meson also allows you to list tests and run specific tests or suites. +<screen> +# List all tests +<userinput>meson test --list</userinput> + +# Run a specific test +<userinput>meson test recovery/001_stream_rep</userinput> + +# Run the main pg_regress and isolation tests +<userinput>meson test --suite main</userinput> +</screen> + </para> + + <para> + To learn more about running the tests and how to interpret the results + you can refer to the documentation for interpreting test results. + <literal>meson test</literal> also provides a number of additional + options you can use which can be found in the + <ulink url="https://mesonbuild.com/Unit-tests.html#testing-tool">meson test documentation</ulink>. + </para> + + </sect2> + + </sect1> + <sect1 id="install-post"> <title>Post-Installation Setup</title> @@ -2106,62 +3797,6 @@ export MANPATH </sect2> </sect1> - <sect1 id="supported-platforms"> - <title>Supported Platforms</title> - - <para> - A platform (that is, a CPU architecture and operating system combination) - is considered supported by the <productname>PostgreSQL</productname> development - community if the code contains provisions to work on that platform and - it has recently been verified to build and pass its regression tests - on that platform. Currently, most testing of platform compatibility - is done automatically by test machines in the - <ulink url="https://buildfarm.postgresql.org/">PostgreSQL Build Farm</ulink>. - If you are interested in using <productname>PostgreSQL</productname> on a platform - that is not represented in the build farm, but on which the code works - or can be made to work, you are strongly encouraged to set up a build - farm member machine so that continued compatibility can be assured. - </para> - - <para> - In general, <productname>PostgreSQL</productname> can be expected to work on - these CPU architectures: x86, PowerPC, S/390, SPARC, ARM, MIPS, RISC-V, - and PA-RISC, including - big-endian, little-endian, 32-bit, and 64-bit variants where applicable. - It is often - possible to build on an unsupported CPU type by configuring with - <option>--disable-spinlocks</option>, but performance will be poor. - </para> - - <para> - <productname>PostgreSQL</productname> can be expected to work on current - versions of these operating systems: Linux, Windows, - FreeBSD, OpenBSD, NetBSD, DragonFlyBSD, macOS, AIX, Solaris, and illumos. - Other Unix-like systems may also work but are not currently - being tested. In most cases, all CPU architectures supported by - a given operating system will work. Look in - <xref linkend="installation-platform-notes"/> below to see if - there is information - specific to your operating system, particularly if using an older system. - </para> - - <para> - If you have installation problems on a platform that is known - to be supported according to recent build farm results, please report - it to <email>pgsql-bugs@lists.postgresql.org</email>. If you are interested - in porting <productname>PostgreSQL</productname> to a new platform, - <email>pgsql-hackers@lists.postgresql.org</email> is the appropriate place - to discuss that. - </para> - - <para> - Historical versions of <productname>PostgreSQL</productname> or POSTGRES - also ran on CPU architectures including Alpha, Itanium, M32R, M68K, - M88K, NS32K, SuperH, and VAX, and operating systems including 4.3BSD, BEOS, - BSD/OS, DG/UX, Dynix, HP-UX, IRIX, NeXTSTEP, QNX, SCO, SINIX, Sprite, SunOS, - Tru64 UNIX, and ULTRIX. - </para> - </sect1> <sect1 id="installation-platform-notes"> <title>Platform-Specific Notes</title> @@ -2170,7 +3805,7 @@ export MANPATH This section documents additional platform-specific issues regarding the installation and setup of PostgreSQL. Be sure to read the installation instructions, and in - particular <xref linkend="install-requirements"/> as well. Also, + particular <xref linkend="install-requirements-make"/> as well. Also, check <xref linkend="regress"/> regarding the interpretation of regression test results. </para> diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index 1d9509a2f66..214e1b1d551 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -7072,7 +7072,7 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS pid, explicitly tell the configure script to make the probes available in <productname>PostgreSQL</productname>. To include DTrace support specify <option>--enable-dtrace</option> to configure. See <xref - linkend="install-procedure"/> for further information. + linkend="configure-options-devel"/> for further information. </para> </sect2> diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml index f268265a838..7a1d220175b 100644 --- a/doc/src/sgml/runtime.sgml +++ b/doc/src/sgml/runtime.sgml @@ -1855,7 +1855,7 @@ $ <userinput>kill -INT `head -1 /usr/local/pgsql/data/postmaster.pid`</userinput <step> <para> Install the new version of <productname>PostgreSQL</productname> as - outlined in <xref linkend="install-procedure"/>. + outlined in <xref linkend="installation"/>. </para> </step> diff --git a/doc/src/sgml/sourcerepo.sgml b/doc/src/sgml/sourcerepo.sgml index 0ed7f8a3fea..f16be29a61a 100644 --- a/doc/src/sgml/sourcerepo.sgml +++ b/doc/src/sgml/sourcerepo.sgml @@ -20,9 +20,10 @@ Note that building <productname>PostgreSQL</productname> from the source repository requires reasonably up-to-date versions of <application>bison</application>, <application>flex</application>, and <application>Perl</application>. These tools are not needed - to build from a distribution tarball, because the files that these tools + to build from a distribution tarball if building via make, because the files that these tools are used to build are included in the tarball. Other tool requirements - are the same as shown in <xref linkend="install-requirements"/>. + are the same as shown in <xref linkend="install-requirements-make"/> and + <xref linkend="install-requirements-meson"/>. </para> <sect1 id="git"> -- 2.37.3.542.gdd3f6c4cae
v15-0008-meson-Add-PGXS-compatibility.patch (text/x-diff, 7.4K) download From 5935b41b7f3fc01e786e63de8834e099ca534a9d Mon Sep 17 00:00:00 2001 From: Andres Freund <andres@anarazel.de> Date: Wed, 24 Aug 2022 20:27:17 -0700 Subject: [PATCH v15 08/14] meson: Add PGXS compatibility This works for some extensions on some operating systems, but could use plenty of cleanups. --- src/meson.build | 259 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 259 insertions(+) diff --git a/src/meson.build b/src/meson.build index b515af15bfa..ca99db42baa 100644 --- a/src/meson.build +++ b/src/meson.build @@ -10,3 +10,262 @@ subdir('bin') subdir('pl') subdir('interfaces') + + +### Generate a Makefile.global that's complete enough for PGXS to work. +# +# This is somewhat ugly, but allows extensions to only use a single +# buildsystem across all the supported postgres versions. Once all supported +# PG versions support meson, we can remove all of this. +# +# XXX: Should we make this optional? + +pgxs_kv = { + 'PACKAGE_URL': pg_url, + 'PACKAGE_VERSION': pg_version, + 'PG_MAJORVERSION': pg_version_major, + 'PG_VERSION_NUM': pg_version_num, + 'configure_input': 'meson', + + 'vpath_build': 'yes', + 'autodepend': 'no', # XXX: Should we just set this to true when possible? + + 'host_cpu': host_cpu, + 'host': '@0@-@1@'.format(host_cpu, host_system), + 'host_os': host_system, + 'build_os': build_machine.system(), + 'PORTNAME': portname, + 'PG_SYSROOT': pg_sysroot, + + 'abs_top_builddir': meson.build_root(), + 'abs_top_srcdir': meson.source_root(), + + 'enable_thread_safety': 'yes', + 'enable_rpath': 'yes', + 'enable_nls': libintl.found() ? 'yes' : 'no', + 'enable_tap_tests': tap_tests_enabled ? 'yes' : 'no', + 'enable_debug': get_option('debug') ? 'yes' : 'no', + 'enable_coverage': get_option('b_coverage') ? 'yes' : 'no', + 'enable_dtrace': dtrace.found() ? 'yes' : 'no', + + 'DLSUFFIX': dlsuffix, + 'EXEEXT': exesuffix, + + 'SUN_STUDIO_CC': 'no', # not supported so far + + 'default_port': get_option('pgport'), + 'with_system_tzdata': get_option('system_tzdata'), + + 'with_krb_srvnam': get_option('krb_srvnam'), + 'krb_srvtab': krb_srvtab, + + # FIXME: implement programs.m4 logic in PGAC_CHECK_STRIP + 'STRIP': 'strip', + 'STRIP_STATIC_LIB': 'strip -x', + 'STRIP_SHARED_LIB': 'strip --strip-unneeded', + + # Just always use the install_sh fallback that autoconf uses. Unlikely to + # matter performance-wise for extensions. If it turns out to do, we can + # improve that later. + 'MKDIR_P': ' '.join([install_sh.path(), '-d']), + + 'CC': var_cc, + 'CPP': var_cpp, + 'GCC': cc.get_argument_syntax() == 'gcc' ? 'yes' : 'no', + 'with_gnu_ld': (cc.get_linker_id() in ['ld.bfd', 'ld.gold', 'ld.lld'] ? 'yes' : 'no'), + + 'CFLAGS': var_cflags, + 'CPPFLAGS': var_cppflags, + 'CXXFLAGS': var_cxxflags, + 'CFLAGS_SL': var_cflags_sl, + 'CFLAGS_SL_MODULE': ' '.join(cflags_mod), + 'CXXFLAGS_SL_MODULE': ' '.join(cxxflags_mod), + 'CFLAGS_SSE42': ' '.join(cflags_crc), + 'CFLAGS_UNROLL_LOOPS': ' '.join(unroll_loops_cflags), + 'CFLAGS_VECTORIZE': ' '.join(vectorize_cflags), + + # FIXME: + 'CFLAGS_ARMV8_CRC32C': '', + 'BITCODE_CFLAGS': '', + 'BITCODE_CXXFLAGS': '', + + 'LDFLAGS': var_ldflags, + 'LDFLAGS_EX': var_ldflags_ex, + 'LDFLAGS_SL': var_ldflags_sl, + + 'BISONFLAGS': ' '.join(bison_flags), + 'FLEXFLAGS': ' '.join(flex_flags), + + 'LIBS': var_libs, +} + +if llvm.found() + pgxs_kv += { + 'CLANG': clang.path(), + 'CXX': ' '.join(cpp.cmd_array()), + 'LLVM_BINPATH': llvm_binpath, + } +else + pgxs_kv += { + 'CLANG': '', + 'CXX': '', + 'LLVM_BINPATH': '', + } +endif + +pgxs_cdata = configuration_data(pgxs_kv) + +# FIXME: figure out which platforms we still need the linker "directly" - +# can't be many? + +ld_program = find_program(cc.get_linker_id(), native: true, required: false) + +pgxs_bins = { + 'BISON': bison, + 'FLEX': flex, + 'GZIP': gzip, + 'LZ4': program_lz4, + 'PERL': perl, + 'PROVE': prove, + 'PYTHON': python, + 'TAR': tar, + 'ZSTD': program_zstd, + 'DTRACE': dtrace, + 'LD': ld_program, + 'install_bin': install_sh, +} +foreach b, p : pgxs_bins + pgxs_cdata.set(b, p.found() ? p.path() : '') +endforeach + +pgxs_empty = [ + 'PERMIT_DECLARATION_AFTER_STATEMENT', + 'ICU_CFLAGS', # needs to be added, included by public server headers + + # probably need most of these? + 'RANLIB', + 'WINDRES', + 'LN_S', + 'AR', + 'AWK', + + # hard to see why we'd need either? + 'ZIC', + 'TCLSH', + + # docs don't seem to be supported by pgxs + 'XMLLINT', + 'XSLTPROC', + 'DBTOEPUB', + 'FOP', + + # supporting coverage for pgxs-in-meson build doesn't seem worth it + 'GENHTML', + 'LCOV', + 'GCOV', + 'MSGFMT_FLAGS', + + # translation doesn't appear to be supported by pgxs + 'MSGFMT', + 'XGETTEXT', + 'MSGMERGE', + 'WANTED_LANGUAGES', + + # Not needed because we don't build the server / PLs with the generated makefile + 'LIBOBJS', 'PG_CRC32C_OBJS', 'TAS', + 'DTRACEFLAGS', # only server has dtrace probes + + 'perl_archlibexp', 'perl_embed_ccflags', 'perl_embed_ldflags', 'perl_includespec', 'perl_privlibexp', + 'python_additional_libs', 'python_includespec', 'python_libdir', 'python_libspec', 'python_majorversion', 'python_version', + + # possible that some of these are referenced explicitly in pgxs makefiles? + # For now not worth it. + 'TCL_INCLUDE_SPEC', 'TCL_LIBS', 'TCL_LIB_SPEC', 'TCL_SHARED_BUILD', + + 'LLVM_CFLAGS', 'LLVM_CPPFLAGS', 'LLVM_CXXFLAGS', 'LLVM_LIBS', + + 'LDAP_LIBS_BE', 'LDAP_LIBS_FE', + + 'UUID_LIBS', + + 'PTHREAD_CFLAGS', 'PTHREAD_LIBS', + + 'ICU_LIBS', +] + +foreach pe : pgxs_empty + pgxs_cdata.set(pe, '') +endforeach + +pgxs_dirs = { + 'prefix': get_option('prefix'), + + 'bindir': '${exec_prefix}' / get_option('bindir'), + 'datarootdir': '${prefix}' / get_option('datadir'), + 'datadir': '${datarootdir}', + 'docdir': '${prefix}' / dir_doc, + 'exec_prefix': '${prefix}', + 'htmldir': '${prefix}' / dir_doc_html, #? + 'includedir': '${prefix}' / get_option('includedir'), + 'libdir': '${exec_prefix}' / get_option('libdir'), + 'localedir': '${prefix}' / get_option('localedir'), + 'mandir': '${prefix}' / get_option('mandir'), + 'sysconfdir': '${prefix}' / get_option('sysconfdir'), +} + +foreach d, p : pgxs_dirs + pgxs_cdata.set(d, p) +endforeach + +pgxs_deps = { + 'bonjour': bonjour, + 'bsd_auth': bsd_auth, + 'gssapi': gssapi, + 'icu': icu, + 'ldap': ldap, + 'libxml': libxml, + 'libxslt': libxslt, + 'llvm': llvm, + 'lz4': lz4, + 'nls': libintl, + 'pam': pam, + 'perl': perl_dep, + 'python': python3_dep, + 'readline': readline, + 'selinux': selinux, + 'systemd': systemd, + 'tcl': tcl_dep, + 'zlib': zlib, + 'zstd': zstd, +} +foreach d, v : pgxs_deps + pgxs_cdata.set('with_@0@'.format(d), v.found() ? 'yes' : 'no') +endforeach + +pgxs_cdata.set('with_ssl', get_option('ssl')) +pgxs_cdata.set('with_uuid', uuidopt) + +makefile_global = configure_file( + input: 'Makefile.global.in', + output: 'Makefile.global', + configuration: pgxs_cdata, + install: true, + install_dir: dir_pgxs / 'src', +) +configure_files += makefile_global + +# FIXME: check if exists +makefile_port = configure_file( + input: 'makefiles' / 'Makefile.@0@'.format(portname), + output: 'Makefile.port', + copy: true, + install_dir: dir_pgxs / 'src') +configure_files += makefile_port + +install_data( + 'Makefile.shlib', 'nls-global.mk', + install_dir: dir_pgxs / 'src') + +install_data( + 'makefiles/pgxs.mk', + install_dir: dir_pgxs / 'src' / 'makefiles') -- 2.37.3.542.gdd3f6c4cae
v15-0009-meson-Add-postgresql-extension.pc-for-building-e.patch (text/x-diff, 3.7K) download From 3cd5f97d7ab63b5ecf6a8aedfa67afc285714269 Mon Sep 17 00:00:00 2001 From: Andres Freund <andres@anarazel.de> Date: Sat, 27 Aug 2022 09:52:03 -0700 Subject: [PATCH v15 09/14] meson: Add postgresql-extension.pc for building extension libraries This should work with several other buildsystems. TODO: Docs and example --- src/backend/meson.build | 96 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/src/backend/meson.build b/src/backend/meson.build index fefa40ddb64..0598085a240 100644 --- a/src/backend/meson.build +++ b/src/backend/meson.build @@ -180,6 +180,102 @@ pg_mod_args = default_mod_args + { +############################################################### +# Define a .pc file that can be used to build server extensions +############################################################### + +pg_ext_vars = [] +pg_ext_vars_inst = [] +pg_ext_vars_uninst = [] + +pg_ext_cflags = pg_mod_c_args +pg_ext_libs = [backend_mod_code, thread_dep, ldflags, ldflags_mod] +pg_ext_subdirs = [''] + +# Compute directories to add include directories to the .pc files for. +# This is a bit more complicated due to port/win32 etc. +i = 0 +foreach incdir : postgres_inc_d + if incdir.startswith('src/include') + subincdir = dir_include_pkg_rel / 'server' / incdir.split('src/include/').get(1, '') + else + subincdir = '' + endif + pg_ext_subdirs += subincdir + + # Add directories in source / build dir containing headers to cflags for the + # -uninstalled.pc + pg_ext_vars_uninst += [ + 'build_inc@0@=-I${prefix}/@1@'.format(i, incdir), + 'src_inc@0@=-I${srcdir}/@1@'.format(i, incdir), + ] + pg_ext_cflags += [ + '${build_inc@0@}'.format(i), + '${src_inc@0@}'.format(i) + ] + + i += 1 +endforeach + + +# Extension modules should likely also use -fwrapv etc. But it it's a bit odd +# to expose it to a .pc file? +pg_ext_cflags += cflags + +# Directories for extensions to install into +# XXX: more needed +pg_ext_vars += 'pkglibdir=${prefix}/@0@'.format(dir_lib_pkg) +pg_ext_vars += 'dir_mod=${pkglibdir}' +pg_ext_vars += 'dir_data=${prefix}/@0@'.format(dir_data_extension) +# referenced on some platforms, via mod_link_with_dir +pg_ext_vars += 'bindir=${prefix}/@0@'.format(dir_bin) + +# XXX: Define variables making it easy to define tests, too + +# Some platforms need linker flags to link with binary, they are the same +# between building with meson and .pc file, except that we have have to +# reference a variable to make it work for both normal and -uninstalled .pc +# files. +if mod_link_args_fmt.length() != 0 + assert(link_with_inst != '') + assert(link_with_uninst != '') + + pg_ext_vars_inst += 'mod_link_with=@0@'.format(link_with_inst) + pg_ext_vars_uninst += 'mod_link_with=@0@'.format(link_with_uninst) + + foreach el : mod_link_args_fmt + pg_ext_libs += el.format('${mod_link_with}') + endforeach +endif + +# main .pc to build extensions +pkgconfig.generate( + name: 'postgresql-extension', + description: 'PostgreSQL Extension Support', + url: pg_url, + + subdirs: pg_ext_subdirs, + libraries: pg_ext_libs, + extra_cflags: pg_ext_cflags, + + variables: pg_ext_vars + pg_ext_vars_inst, + uninstalled_variables: pg_ext_vars + pg_ext_vars_uninst, +) + +# a .pc depending on the above, but with all our warnings enabled +pkgconfig.generate( + name: 'postgresql-extension-warnings', + description: 'PostgreSQL Extension Support - Compiler Warnings', + requires: 'postgresql-extension', + url: pg_url, + extra_cflags: cflags_warn, + + variables: pg_ext_vars + pg_ext_vars_inst, + uninstalled_variables: pg_ext_vars + pg_ext_vars_uninst, +) + + + # Shared modules that, on some system, link against the server binary. Only # enter these after we defined the server build. -- 2.37.3.542.gdd3f6c4cae
v15-0010-meson-Add-LLVM-bitcode-emission.patch (text/x-diff, 5.2K) download From 59120464e1c497eb4c8faf11a69b5a8ea7523304 Mon Sep 17 00:00:00 2001 From: Andres Freund <andres@anarazel.de> Date: Wed, 24 Aug 2022 19:58:45 -0700 Subject: [PATCH v15 10/14] meson: Add LLVM bitcode emission This needs a bit more love before being ready... --- src/backend/jit/llvm/meson.build | 21 +++++++++++++++ src/backend/meson.build | 46 ++++++++++++++++++++++++++++++++ meson.build | 2 ++ src/tools/irlink | 43 +++++++++++++++++++++++++++++ 4 files changed, 112 insertions(+) create mode 100644 src/tools/irlink diff --git a/src/backend/jit/llvm/meson.build b/src/backend/jit/llvm/meson.build index 5fb63768358..5b339e33934 100644 --- a/src/backend/jit/llvm/meson.build +++ b/src/backend/jit/llvm/meson.build @@ -54,6 +54,19 @@ else llvm_irgen_command = clang endif +llvm_irlink_kw = { + 'command': [ + irlink, + '--name', 'postgres', + '--lto', llvm_lto, + '--outdir', '@OUTPUT0@', + '--privdir', '@PRIVATE_DIR@', + '@INPUT@', + ], + 'install': true, + 'install_dir': dir_lib_pkg, +} + # XXX: Need to determine proper version of the function cflags for clang bitcode_cflags = ['-fno-strict-aliasing', '-fwrapv'] @@ -77,3 +90,11 @@ llvmjit_types = custom_target('llvmjit_types.bc', depfile: '@BASENAME@.c.bc.d', ) backend_targets += llvmjit_types + +# Figure out -I's needed to build all postgres code, including all its +# dependencies +pkg_config = find_program(['pkg-config', 'pkgconf'], required: true) +r = run_command(pkg_config, + ['--cflags-only-I', meson.build_root() / 'meson-uninstalled/postgresql-extension-uninstalled.pc'], + check: true) +bitcode_cflags += r.stdout().split() diff --git a/src/backend/meson.build b/src/backend/meson.build index 0598085a240..1cb4cd3431f 100644 --- a/src/backend/meson.build +++ b/src/backend/meson.build @@ -284,3 +284,49 @@ subdir('replication/libpqwalreceiver') subdir('replication/pgoutput') subdir('snowball') subdir('utils/mb/conversion_procs') + + + +############################################################### +# emit LLVM bitcode of backend code for JIT inlining +############################################################### + +if llvm.found() + + # custom_target() insists on targeting files into the current + # directory. But we have files with the same name in different + # subdirectories. generators() don't have that problem, but their results + # are not installable. The irlink command copies the files for us. + # + # FIXME: this needs to be in a central place + # + # generators don't accept CustomTargetIndex as input or 'depends', nor do + # they like targets with more than one output. However, a custom target + # accepts them as input without a problem. So we have the below transitive + # target :( + + transitive_depend_target = custom_target('stamp', + input: generated_headers + generated_backend_headers + generated_backend_sources, + output: 'stamp', + command: [touch, '@OUTPUT@'], + install: false) + + llvm_gen = generator(llvm_irgen_command, + arguments: llvm_irgen_args + bitcode_cflags, + depends: transitive_depend_target, + depfile: '@BASENAME@.c.bc.d', + output: '@PLAINNAME@.bc', + ) + + bc_backend_sources = llvm_gen.process(backend_sources, + preserve_path_from: meson.current_source_dir()) + + postgres_llvm = custom_target('bitcode', + output: ['bitcode'], + input: bc_backend_sources, + kwargs: llvm_irlink_kw, + ) + + backend_targets += postgres_llvm + +endif diff --git a/meson.build b/meson.build index 8323adf772b..2b0cbb9a5a7 100644 --- a/meson.build +++ b/meson.build @@ -684,6 +684,8 @@ if not llvmopt.disabled() ccache = find_program('ccache', native: true, required: false) clang = find_program(llvm_binpath / 'clang', required: true) + llvm_lto = find_program(llvm_binpath / 'llvm-lto', required: true) + irlink = find_program('src/tools/irlink', native: true) endif else llvm = not_found_dep diff --git a/src/tools/irlink b/src/tools/irlink new file mode 100644 index 00000000000..813bbf13398 --- /dev/null +++ b/src/tools/irlink @@ -0,0 +1,43 @@ +#!/usr/bin/env python3 + +import os +import shutil +import subprocess +import sys +import argparse + +parser = argparse.ArgumentParser( + description='generate PostgreSQL JIT IR module') + +parser.add_argument('--name', type=str, required=True) +parser.add_argument('--lto', type=str, required=True) +parser.add_argument('--privdir', type=str, required=True) +parser.add_argument('--outdir', type=str, required=True) +parser.add_argument('INPUT', type=str, nargs='+') + +args = parser.parse_args() + +outdir = os.path.realpath(args.outdir) +privdir = os.path.realpath(args.privdir) + +index = '{0}/{1}.index.bc'.format(outdir, args.name) +destdir = '{0}/{1}'.format(outdir, args.name) + +# Remove old contents if exist +if os.path.exists(destdir): + shutil.rmtree(destdir) + +shutil.copytree(privdir, destdir) + +# Change working directory for irlink to link correctly +os.chdir(args.outdir) + +file_names = [] +for input in args.INPUT: + file_names += [args.name + input.replace(args.privdir, '')] + +command = [args.lto, '-thinlto', '-thinlto-action=thinlink', + '-o', index] + file_names +res = subprocess.run(command) + +exit(res.returncode) -- 2.37.3.542.gdd3f6c4cae
v15-0011-meson-Add-support-for-building-with-precompiled-.patch (text/x-diff, 14.8K) download From e3d1e4a4ef68d50fd1ae9a31e0f7eed96b387972 Mon Sep 17 00:00:00 2001 From: Andres Freund <andres@anarazel.de> Date: Fri, 23 Sep 2022 12:19:17 -0700 Subject: [PATCH v15 11/14] meson: Add support for building with precompiled headers This substantially speeds up building for windows. A cross build with mingw goes from real 0m29.884s user 15m41.900s sys 1m58.257s to real 0m13.196s user 6m52.330s sys 1m15.140s The wins on windows are similar-ish (but I don't have a system at hand just now for actual numbers). --- src/include/meson.build | 1 + src/include/pch/c_pch.h | 1 + src/include/pch/meson.build | 4 ++++ src/include/pch/postgres_fe_pch.h | 1 + src/include/pch/postgres_pch.h | 1 + src/common/meson.build | 2 ++ src/port/meson.build | 2 ++ src/backend/meson.build | 5 +++++ src/backend/snowball/meson.build | 1 + src/fe_utils/meson.build | 1 + src/bin/pg_dump/meson.build | 1 + src/bin/pg_upgrade/meson.build | 1 + src/bin/psql/meson.build | 1 + src/interfaces/libpq/meson.build | 1 + src/pl/plperl/meson.build | 1 + src/pl/plpgsql/src/meson.build | 1 + src/pl/plpython/meson.build | 1 + src/pl/tcl/meson.build | 1 + contrib/bloom/meson.build | 1 + contrib/btree_gist/meson.build | 1 + contrib/hstore/meson.build | 1 + contrib/pg_trgm/meson.build | 1 + contrib/pgcrypto/meson.build | 1 + contrib/pgstattuple/meson.build | 1 + contrib/sepgsql/meson.build | 1 + contrib/xml2/meson.build | 1 + .cirrus.yml | 4 ++-- meson.build | 8 ++++++++ 28 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 src/include/pch/c_pch.h create mode 100644 src/include/pch/meson.build create mode 100644 src/include/pch/postgres_fe_pch.h create mode 100644 src/include/pch/postgres_pch.h diff --git a/src/include/meson.build b/src/include/meson.build index e5390df0584..28ed9011c70 100644 --- a/src/include/meson.build +++ b/src/include/meson.build @@ -110,6 +110,7 @@ install_headers( subdir('catalog') subdir('nodes') +subdir('pch') subdir('storage') subdir('utils') diff --git a/src/include/pch/c_pch.h b/src/include/pch/c_pch.h new file mode 100644 index 00000000000..f40c757ca62 --- /dev/null +++ b/src/include/pch/c_pch.h @@ -0,0 +1 @@ +#include "c.h" diff --git a/src/include/pch/meson.build b/src/include/pch/meson.build new file mode 100644 index 00000000000..2bcec49c3a2 --- /dev/null +++ b/src/include/pch/meson.build @@ -0,0 +1,4 @@ +# See https://github.com/mesonbuild/meson/issues/10338 +pch_c_h = meson.source_root() / meson.current_source_dir() / 'c_pch.h' +pch_postgres_h = meson.source_root() / meson.current_source_dir() / 'postgres_pch.h' +pch_postgres_fe_h = meson.source_root() / meson.current_source_dir() / 'postgres_fe_pch.h' diff --git a/src/include/pch/postgres_fe_pch.h b/src/include/pch/postgres_fe_pch.h new file mode 100644 index 00000000000..f3ea20912d3 --- /dev/null +++ b/src/include/pch/postgres_fe_pch.h @@ -0,0 +1 @@ +#include "postgres_fe.h" diff --git a/src/include/pch/postgres_pch.h b/src/include/pch/postgres_pch.h new file mode 100644 index 00000000000..71b2f35f76b --- /dev/null +++ b/src/include/pch/postgres_pch.h @@ -0,0 +1 @@ +#include "postgres.h" diff --git a/src/common/meson.build b/src/common/meson.build index 23842e1ffef..1c9b8a3a018 100644 --- a/src/common/meson.build +++ b/src/common/meson.build @@ -147,6 +147,7 @@ foreach name, opts : pgcommon_variants endif c_args = opts.get('c_args', []) + common_cflags[cflagname] cflag_libs += static_library('libpgcommon@0@_@1@'.format(name, cflagname), + c_pch: pch_c_h, include_directories: include_directories('.'), kwargs: opts + { 'sources': sources, @@ -159,6 +160,7 @@ foreach name, opts : pgcommon_variants lib = static_library('libpgcommon@0@'.format(name), link_with: cflag_libs, + c_pch: pch_c_h, include_directories: include_directories('.'), kwargs: opts + { 'dependencies': opts['dependencies'] + [ssl], diff --git a/src/port/meson.build b/src/port/meson.build index ced2e014db8..c2222696f1b 100644 --- a/src/port/meson.build +++ b/src/port/meson.build @@ -161,6 +161,7 @@ foreach name, opts : pgport_variants c_args = opts.get('c_args', []) + pgport_cflags[cflagname] cflag_libs += static_library('libpgport@0@_@1@'.format(name, cflagname), sources, + c_pch: pch_c_h, kwargs: opts + { 'c_args': c_args, 'build_by_default': false, @@ -172,6 +173,7 @@ foreach name, opts : pgport_variants lib = static_library('libpgport@0@'.format(name), pgport_sources, link_with: cflag_libs, + c_pch: pch_c_h, kwargs: opts + { 'dependencies': opts['dependencies'] + [ssl], } diff --git a/src/backend/meson.build b/src/backend/meson.build index 1cb4cd3431f..a535543ee9e 100644 --- a/src/backend/meson.build +++ b/src/backend/meson.build @@ -62,6 +62,7 @@ postgres_lib = static_library('postgres_lib', backend_sources + timezone_sources + generated_backend_sources, link_whole: backend_link_with, dependencies: backend_build_deps, + c_pch: pch_postgres_h, kwargs: internal_lib_args, ) @@ -81,6 +82,10 @@ if cc.get_id() == 'msvc' backend_link_args += '/DEF:@0@'.format(postgres_def.full_path()) backend_link_depends += postgres_def + # Due to the way msvc and meson's precompiled headers implementation + # interact, we need to have symbols from the full library available. Could + # be restricted to b_pch=true. + backend_link_with += postgres_lib elif host_system == 'aix' # The '.' argument leads mkldexport.sh to emit "#! .", which refers to the diff --git a/src/backend/snowball/meson.build b/src/backend/snowball/meson.build index 974401d187e..72959fa29d6 100644 --- a/src/backend/snowball/meson.build +++ b/src/backend/snowball/meson.build @@ -66,6 +66,7 @@ endif dict_snowball = shared_module('dict_snowball', dict_snowball_sources, + c_pch: pch_postgres_h, kwargs: pg_mod_args + { 'include_directories': [stemmer_inc], } diff --git a/src/fe_utils/meson.build b/src/fe_utils/meson.build index b6bf8e1ca21..f1ba5ac8c14 100644 --- a/src/fe_utils/meson.build +++ b/src/fe_utils/meson.build @@ -23,6 +23,7 @@ fe_utils_sources += psqlscan fe_utils = static_library('libpgfeutils', fe_utils_sources + generated_headers, + c_pch: pch_postgres_fe_h, include_directories: [postgres_inc, libpq_inc], dependencies: frontend_common_code, kwargs: default_lib_args, diff --git a/src/bin/pg_dump/meson.build b/src/bin/pg_dump/meson.build index 3527a25c288..e66f632b54e 100644 --- a/src/bin/pg_dump/meson.build +++ b/src/bin/pg_dump/meson.build @@ -13,6 +13,7 @@ pg_dump_common_sources = files( pg_dump_common = static_library('libpgdump_common', pg_dump_common_sources, + c_pch: pch_postgres_fe_h, dependencies: [frontend_code, libpq, zlib], kwargs: internal_lib_args, ) diff --git a/src/bin/pg_upgrade/meson.build b/src/bin/pg_upgrade/meson.build index a7b927a45c7..212bc9ce6ef 100644 --- a/src/bin/pg_upgrade/meson.build +++ b/src/bin/pg_upgrade/meson.build @@ -24,6 +24,7 @@ endif pg_upgrade = executable('pg_upgrade', pg_upgrade_sources, + c_pch: pch_postgres_fe_h, dependencies: [frontend_code, libpq], kwargs: default_bin_args, ) diff --git a/src/bin/psql/meson.build b/src/bin/psql/meson.build index 3474389d3b6..8ec07260d1b 100644 --- a/src/bin/psql/meson.build +++ b/src/bin/psql/meson.build @@ -46,6 +46,7 @@ endif psql = executable('psql', psql_sources, + c_pch: pch_postgres_fe_h, include_directories: include_directories('.'), dependencies: [frontend_code, libpq, readline], kwargs: default_bin_args, diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build index 2c9edeaa088..72102521edc 100644 --- a/src/interfaces/libpq/meson.build +++ b/src/interfaces/libpq/meson.build @@ -49,6 +49,7 @@ libpq_st = static_library('libpq', pic: true, include_directories: [libpq_inc, postgres_inc], c_args: ['-DSO_MAJOR_VERSION=5'], + c_pch: pch_postgres_fe_h, dependencies: libpq_deps, kwargs: default_lib_args, ) diff --git a/src/pl/plperl/meson.build b/src/pl/plperl/meson.build index 535660085dd..cd3894e6a73 100644 --- a/src/pl/plperl/meson.build +++ b/src/pl/plperl/meson.build @@ -45,6 +45,7 @@ endif plperl = shared_module('plperl', plperl_sources, + c_pch: pch_postgres_h, include_directories: [plperl_inc, postgres_inc], kwargs: pg_mod_args + { 'dependencies': [perl_dep, pg_mod_args['dependencies']], diff --git a/src/pl/plpgsql/src/meson.build b/src/pl/plpgsql/src/meson.build index c46c0a1da2a..27b2f5ef529 100644 --- a/src/pl/plpgsql/src/meson.build +++ b/src/pl/plpgsql/src/meson.build @@ -48,6 +48,7 @@ endif plpgsql = shared_module('plpgsql', plpgsql_sources, + c_pch: pch_postgres_h, include_directories: include_directories('.'), kwargs: pg_mod_args, ) diff --git a/src/pl/plpython/meson.build b/src/pl/plpython/meson.build index 40888386b5f..7bd683580e8 100644 --- a/src/pl/plpython/meson.build +++ b/src/pl/plpython/meson.build @@ -36,6 +36,7 @@ endif plpython = shared_module('plpython3', plpython_sources, + c_pch: pch_postgres_h, include_directories: [plpython_inc, postgres_inc], kwargs: pg_mod_args + { 'dependencies': [python3_dep, pg_mod_args['dependencies']], diff --git a/src/pl/tcl/meson.build b/src/pl/tcl/meson.build index f09bb14c950..7a708776c99 100644 --- a/src/pl/tcl/meson.build +++ b/src/pl/tcl/meson.build @@ -22,6 +22,7 @@ endif pltcl = shared_module('pltcl', pltcl_sources, + c_pch: pch_postgres_h, include_directories: [include_directories('.'), postgres_inc], kwargs: pg_mod_args + { 'dependencies': [tcl_dep, pg_mod_args['dependencies']], diff --git a/contrib/bloom/meson.build b/contrib/bloom/meson.build index 16f3b83e4d2..163a93c98fb 100644 --- a/contrib/bloom/meson.build +++ b/contrib/bloom/meson.build @@ -15,6 +15,7 @@ endif bloom = shared_module('bloom', bloom_sources, + c_pch: pch_postgres_h, kwargs: contrib_mod_args, ) contrib_targets += bloom diff --git a/contrib/btree_gist/meson.build b/contrib/btree_gist/meson.build index e98c91dacc8..bfb7865d213 100644 --- a/contrib/btree_gist/meson.build +++ b/contrib/btree_gist/meson.build @@ -33,6 +33,7 @@ endif btree_gist = shared_module('btree_gist', btree_gist_sources, + c_pch: pch_postgres_h, kwargs: contrib_mod_args, ) contrib_targets += btree_gist diff --git a/contrib/hstore/meson.build b/contrib/hstore/meson.build index 2bb26bb772b..a2a4ec36cb0 100644 --- a/contrib/hstore/meson.build +++ b/contrib/hstore/meson.build @@ -18,6 +18,7 @@ endif hstore = shared_module('hstore', hstore_sources, + c_pch: pch_postgres_h, kwargs: contrib_mod_args, ) contrib_targets += hstore diff --git a/contrib/pg_trgm/meson.build b/contrib/pg_trgm/meson.build index c8c7c07b308..839d6c4a7f6 100644 --- a/contrib/pg_trgm/meson.build +++ b/contrib/pg_trgm/meson.build @@ -13,6 +13,7 @@ endif pg_trgm = shared_module('pg_trgm', pg_trgm_sources, + c_pch: pch_postgres_h, kwargs: contrib_mod_args, ) contrib_targets += pg_trgm diff --git a/contrib/pgcrypto/meson.build b/contrib/pgcrypto/meson.build index 7fc7bbc7ca1..cc782578b49 100644 --- a/contrib/pgcrypto/meson.build +++ b/contrib/pgcrypto/meson.build @@ -78,6 +78,7 @@ endif pgcrypto = shared_module('pgcrypto', pgcrypto_sources, link_with: pgcrypto_link_with, + c_pch: pch_postgres_h, kwargs: contrib_mod_args + { 'dependencies': [pgcrypto_deps, contrib_mod_args['dependencies']] }, diff --git a/contrib/pgstattuple/meson.build b/contrib/pgstattuple/meson.build index 05e4cd46a5c..42d0b0e6ce9 100644 --- a/contrib/pgstattuple/meson.build +++ b/contrib/pgstattuple/meson.build @@ -12,6 +12,7 @@ endif pgstattuple = shared_module('pgstattuple', pgstattuple_sources, + c_pch: pch_postgres_h, kwargs: contrib_mod_args, ) contrib_targets += pgstattuple diff --git a/contrib/sepgsql/meson.build b/contrib/sepgsql/meson.build index 8bef239e3c2..1ac0fa388ab 100644 --- a/contrib/sepgsql/meson.build +++ b/contrib/sepgsql/meson.build @@ -22,6 +22,7 @@ endif sepgsql = shared_module('sepgsql', sepgsql_sources, + c_pch: pch_postgres_h, kwargs: contrib_mod_args + { 'dependencies': [selinux, contrib_mod_args['dependencies']], } diff --git a/contrib/xml2/meson.build b/contrib/xml2/meson.build index 89b0d677516..92ab3368428 100644 --- a/contrib/xml2/meson.build +++ b/contrib/xml2/meson.build @@ -15,6 +15,7 @@ endif xml2 = shared_module('pgxml', xml2_sources, + c_pch: pch_postgres_h, kwargs: contrib_mod_args + { 'dependencies': [libxml, libxslt, contrib_mod_args['dependencies']], }, diff --git a/.cirrus.yml b/.cirrus.yml index 965483550d1..a0e7acf5ec9 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -602,7 +602,7 @@ task: # Use /DEBUG:FASTLINK to avoid high memory usage during linking configure_script: | vcvarsall x64 - meson setup --backend ninja --buildtype debug -Dc_link_args=/DEBUG:FASTLINK -Dcassert=true -Dssl=openssl -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build + meson setup --backend ninja --buildtype debug -Dc_link_args=/DEBUG:FASTLINK -Dcassert=true -Db_pch=true -Dssl=openssl -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build build_script: | vcvarsall x64 @@ -630,7 +630,7 @@ task: configure_script: | vcvarsall x64 - meson setup --buildtype debug --backend vs -Dcassert=true -Dssl=openssl -Dlz4=enabled -Dzlib=enabled -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build + meson setup --buildtype debug --backend vs -Dcassert=true -Db_pch=true -Dssl=openssl -Dlz4=enabled -Dzlib=enabled -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build build_script: | vcvarsall x64 diff --git a/meson.build b/meson.build index 2b0cbb9a5a7..6ee9bbb3f46 100644 --- a/meson.build +++ b/meson.build @@ -15,6 +15,7 @@ project('postgresql', meson_version: '>=0.54', default_options: [ 'warning_level=1', #-Wall equivalent + 'b_pch=false', 'buildtype=release', ] ) @@ -1767,6 +1768,13 @@ if cc.get_id() == 'msvc' '/wd4267', # conversion from 'size_t' to 'type', possible loss of data ] + # Dirty hack to disable warnings due to some files defining + # UMDF_USING_NTSTATUS before including postgres.h. We need a better fix, but + # for now this allows us to see "real" warnings. + if get_option('b_pch') + cflags_warn += '/wd4005' # macro redefinition + endif + cppflags += [ '/DWIN32', '/DWINDOWS', -- 2.37.3.542.gdd3f6c4cae
v15-0012-meson-Add-xmllint-xsltproc-wrapper-script-to-han.patch (text/x-diff, 7.8K) download From cdd31870ecfb682ff1a405e1fcef3af4e13cb733 Mon Sep 17 00:00:00 2001 From: Andres Freund <andres@anarazel.de> Date: Wed, 21 Sep 2022 08:49:45 -0700 Subject: [PATCH v15 12/14] meson: Add xmllint/xsltproc wrapper script to handle dependencies automatically --- doc/src/sgml/meson.build | 38 ++++++++++++++------ doc/src/sgml/xmltools_dep_wrapper | 60 +++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 10 deletions(-) create mode 100644 doc/src/sgml/xmltools_dep_wrapper diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build index ba2a261e7a4..e6781d0deae 100644 --- a/doc/src/sgml/meson.build +++ b/doc/src/sgml/meson.build @@ -2,7 +2,7 @@ docs = [] alldocs = [] doc_generated = [] -xmllint = find_program(get_option('XMLLINT'), native: true, required: false) +xmllint_bin = find_program(get_option('XMLLINT'), native: true, required: false) version_sgml = configure_file( @@ -60,14 +60,23 @@ doc_generated += custom_target('keywords-table.sgml', ) # For everything else we need at least xmllint -if not xmllint.found() +if not xmllint_bin.found() subdir_done() endif pandoc = find_program('pandoc', native: true, required: false) -xsltproc = find_program(get_option('XSLTPROC'), native: true, required: false) +xsltproc_bin = find_program(get_option('XSLTPROC'), native: true, required: false) fop = find_program('fop', native: true, required: false) +xmltools_wrapper = [ + python, files('xmltools_dep_wrapper'), + '--targetname', '@OUTPUT@', '--depfile', '@DEPFILE@' +] + +xmllint = xmltools_wrapper + [ + '--tool', xmllint_bin, '--', +] + # Run validation only once, common to all subsequent targets. While # we're at it, also resolve all entities (that is, copy all included # files into one big file). This helps tools that don't understand @@ -75,6 +84,7 @@ fop = find_program('fop', native: true, required: false) postgres_full_xml = custom_target('postgres-full.xml', input: 'postgres.sgml', output: 'postgres-full.xml', + depfile: 'postgres-full.xml.d', command: [xmllint, '--noent', '--valid', '--path', '@OUTDIR@', '-o', '@OUTPUT@', '@INPUT@'], depends: doc_generated, build_by_default: false, @@ -86,18 +96,20 @@ alldocs += postgres_full_xml # # Full documentation as html, text # -if xsltproc.found() +if xsltproc_bin.found() xsltproc_flags = [ '--stringparam', 'pg.version', pg_version, '--param', 'website.stylesheet', '1' ] + xsltproc = xmltools_wrapper + [ + '--tool', xsltproc_bin, '--', + ] - # FIXME: Should use a wrapper around xsltproc --load-trace to compute a - # depfile html = custom_target('html', input: ['stylesheet.xsl', postgres_full_xml], output: 'html', + depfile: 'html.d', depends: doc_generated, command: [xsltproc, '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'], build_by_default: false, @@ -110,6 +122,7 @@ if xsltproc.found() html_help = custom_target('html_help', input: ['stylesheet-hh.xsl', postgres_full_xml], output: 'htmlhelp', + depfile: 'htmlhelp.d', depends: doc_generated, command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'], build_by_default: false, @@ -121,6 +134,7 @@ if xsltproc.found() postgres_html = custom_target('postgres.html', input: ['stylesheet-html-nochunk.xsl', postgres_full_xml], output: 'postgres.html', + depfile: 'postgres.html.d', depends: doc_generated, command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'], build_by_default: false, @@ -144,10 +158,11 @@ endif # # INSTALL in html, text # -if xsltproc.found() +if xsltproc_bin.found() install_xml = custom_target('INSTALL.xml', input: ['standalone-profile.xsl', 'standalone-install.xml'], output: 'INSTALL.xml', + depfile: 'INSTALL.xml.d', depends: doc_generated + [postgres_full_xml], command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '--xinclude', '@INPUT@'], build_by_default: false, @@ -155,6 +170,7 @@ if xsltproc.found() install_html = custom_target('INSTALL.html', input: ['stylesheet-text.xsl', install_xml], output: 'INSTALL.html', + depfile: 'INSTALL.html.d', command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'], build_by_default: false, ) @@ -177,11 +193,12 @@ endif # # Man pages # -if xsltproc.found() +if xsltproc_bin.found() # FIXME: implement / consider sqlmansectnum logic man = custom_target('man', input: ['stylesheet-man.xsl', postgres_full_xml], output: ['man1', 'man3', 'man7'], + depfile: 'man.d', depends: doc_generated, command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'], build_by_default: false, @@ -195,7 +212,7 @@ endif # # Full documentation as PDF # -if fop.found() and xsltproc.found() +if fop.found() and xsltproc_bin.found() xsltproc_fo_flags = xsltproc_flags + ['--stringparam', 'img.src.path', meson.current_source_dir() + '/'] foreach format, detail: {'A4': 'A4', 'US': 'USletter'} @@ -206,6 +223,7 @@ if fop.found() and xsltproc.found() input: ['stylesheet-fo.xsl', postgres_full_xml], output: [postgres_x_fo_f], depends: doc_generated, + depfile: postgres_x_fo_f + '.d', command: [xsltproc, '--path', '@OUTDIR@/', xsltproc_fo_flags, '--stringparam', 'paper.type', detail, '-o', '@OUTPUT@', '@INPUT@'], @@ -230,7 +248,7 @@ endif # This was previously implemented using dbtoepub - but that doesn't seem to # support running in build != source directory (i.e. VPATH builds already # weren't supported). -if pandoc.found() and xsltproc.found() +if pandoc.found() and xsltproc_bin.found() postgres_epub = custom_target('postgres.epub', input: postgres_full_xml, output: 'postgres.epub', diff --git a/doc/src/sgml/xmltools_dep_wrapper b/doc/src/sgml/xmltools_dep_wrapper new file mode 100644 index 00000000000..52b94e3fcaf --- /dev/null +++ b/doc/src/sgml/xmltools_dep_wrapper @@ -0,0 +1,60 @@ +#!/usr/bin/env python3 + +import argparse +import re +import subprocess +import sys + +parser = argparse.ArgumentParser( + description='generate dependency file for docs') + +parser.add_argument('--targetname', type=str, required=False, nargs='+') +parser.add_argument('--depfile', type=str, required=False) +parser.add_argument('--tool', type=str, required=True) + +parser.add_argument('flags', nargs='*') + +args = parser.parse_args() + +if args.depfile: + depfile_result_list = [] + + command = [args.tool, '--load-trace'] + args.flags + # --load-trace flag displays all the documents + # loaded during the processing to stderr + res = subprocess.run(command, stderr=subprocess.PIPE, + universal_newlines=True) + # if exit code is different than 0, exit + if res.returncode: + exit(res.returncode) + + # get line start from targetname + line_start = '' + for name in args.targetname: + line_start = line_start + name + ' ' + line_start = line_start.strip() + ': ' + + # collect only file paths + line_re = re.compile('^Loaded URL="([^"]+)"') + with open(args.depfile, 'w') as f: + for line in res.stderr.split('\n'): + if line == '': + continue + m = re.match(line_re, line) + + # continue to show errors + if m is None: + print(line, file=sys.stderr) + continue + + fname = m.group(1) + if fname.startswith('http:'): + continue + if fname.startswith('file://'): + fname = fname.split('file://')[1] + f.write(line_start + fname + '\n') + +else: + command = [args.tool] + args.flags + res = subprocess.run(command) + exit(res.returncode) -- 2.37.3.542.gdd3f6c4cae
v15-0013-meson-Remove-non-binary-targets-added-to-bin_tar.patch (text/x-diff, 1.0K) download From 0daba6f4cf617d777f27be47861e670eff5b6db4 Mon Sep 17 00:00:00 2001 From: Andres Freund <andres@anarazel.de> Date: Sat, 24 Sep 2022 11:01:41 -0700 Subject: [PATCH v15 13/14] meson: Remove non-binary targets added to bin_targets. --- src/bin/psql/meson.build | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/bin/psql/meson.build b/src/bin/psql/meson.build index 8ec07260d1b..a4c46bf5385 100644 --- a/src/bin/psql/meson.build +++ b/src/bin/psql/meson.build @@ -21,7 +21,6 @@ psqlscanslash = custom_target('psqlscanslash', command: [flex_cmd, '--no-backup', '--fix-warnings', '--', '-Cfe', '-p', '-p']) generated_sources += psqlscanslash psql_sources += psqlscanslash -bin_targets += psqlscanslash sql_help = custom_target('psql_help', output: ['sql_help.c', 'sql_help.h'], @@ -36,7 +35,6 @@ sql_help = custom_target('psql_help', ) generated_sources += sql_help.to_list() psql_sources += sql_help -bin_targets += sql_help if host_system == 'windows' psql_sources += rc_bin_gen.process(win32ver_rc, extra_args: [ -- 2.37.3.542.gdd3f6c4cae
v15-0014-meson-wip-headerchecks-cpluspluschecks.patch (text/x-diff, 3.2K) download From 8d5e8b15b85ae47f203ce8224414e75dae52437b Mon Sep 17 00:00:00 2001 From: Andres Freund <andres@anarazel.de> Date: Sat, 24 Sep 2022 11:02:21 -0700 Subject: [PATCH v15 14/14] meson: wip: headerchecks cpluspluschecks --- src/include/meson.build | 4 ++-- src/meson.build | 7 +++++++ src/tools/pginclude/cpluspluscheck | 5 +++-- src/tools/pginclude/headerscheck | 4 ++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/include/meson.build b/src/include/meson.build index 28ed9011c70..0f4ac9fdf68 100644 --- a/src/include/meson.build +++ b/src/include/meson.build @@ -42,8 +42,8 @@ config_paths_data.set_quoted('MANDIR', dir_prefix / dir_man) var_cc = ' '.join(cc.cmd_array()) var_cpp = ' '.join(cc.cmd_array() + ['-E']) -var_cflags = ' '.join(cflags + cflags_warn) -var_cxxflags = ' '.join(cxxflags + cxxflags_warn) +var_cflags = ' '.join([cflags, cflags_warn, '-Wall']) +var_cxxflags = ' '.join([cxxflags, cxxflags_warn, '-Wall']) var_cppflags = ' '.join(cppflags) var_cflags_sl = '-fPIC' #FIXME var_ldflags = ' '.join(ldflags) diff --git a/src/meson.build b/src/meson.build index ca99db42baa..1891e11cb26 100644 --- a/src/meson.build +++ b/src/meson.build @@ -269,3 +269,10 @@ install_data( install_data( 'makefiles/pgxs.mk', install_dir: dir_pgxs / 'src' / 'makefiles') + + +run_target('headerscheck', + command: [files('tools/pginclude/headerscheck'), '@SOURCE_ROOT@', '@BUILD_ROOT@']) + +run_target('cpluspluscheck', + command: [files('tools/pginclude/cpluspluscheck'), '@SOURCE_ROOT@', '@BUILD_ROOT@']) diff --git a/src/tools/pginclude/cpluspluscheck b/src/tools/pginclude/cpluspluscheck index b393f2a2eaa..37f3bfcaaf1 100755 --- a/src/tools/pginclude/cpluspluscheck +++ b/src/tools/pginclude/cpluspluscheck @@ -31,6 +31,7 @@ me=`basename $0` # These switches are g++ specific, you may override if necessary. CXXFLAGS=${CXXFLAGS:- -fsyntax-only -Wall} +CXXFLAGS="$CXXFLAGS -Wno-register" # Pull some info from configure's results. MGLOB="$builddir/src/Makefile.global" @@ -166,9 +167,9 @@ do # Some subdirectories need extra -I switches. case "$f" in src/pl/plperl/*) - EXTRAINCLUDES="$perl_includespec" ;; + EXTRAINCLUDES="$perl_includespec"; continue; ;; src/pl/plpython/*) - EXTRAINCLUDES="$python_includespec" ;; + EXTRAINCLUDES="$python_includespec"; continue; ;; src/interfaces/ecpg/*) EXTRAINCLUDES="-I $builddir/src/interfaces/ecpg/include -I $srcdir/src/interfaces/ecpg/include" ;; src/backend/parser/*) diff --git a/src/tools/pginclude/headerscheck b/src/tools/pginclude/headerscheck index 2a39856f88c..cc195ccc88f 100755 --- a/src/tools/pginclude/headerscheck +++ b/src/tools/pginclude/headerscheck @@ -149,9 +149,9 @@ do # Some subdirectories need extra -I switches. case "$f" in src/pl/plperl/*) - EXTRAINCLUDES="$perl_includespec" ;; + EXTRAINCLUDES="$perl_includespec"; continue; ;; src/pl/plpython/*) - EXTRAINCLUDES="$python_includespec" ;; + EXTRAINCLUDES="$python_includespec"; continue; ;; src/interfaces/ecpg/*) EXTRAINCLUDES="-I $builddir/src/interfaces/ecpg/include -I $srcdir/src/interfaces/ecpg/include" ;; src/backend/parser/*) -- 2.37.3.542.gdd3f6c4cae

view thread (81+ messages)  latest in thread

Message-ID: <20220924180955.2hevwoniwsj2q2tm@awork3.anarazel.de>
Permalink:  ../20220924180955.2hevwoniwsj2q2tm@awork3.anarazel.de/
Also on:    postgresql.org/message-id/20220924180955.2hevwoniwsj2q2tm@awork3.anarazel.de

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: andres@anarazel.de, tgl@sss.pgh.pa.us, nathandbossart@gmail.com, andrew@dunslane.net, peter.eisentraut@enterprisedb.com, thomas.munro@gmail.com, pryzby@telsasoft.com, smilingsamay@gmail.com, byavuz81@gmail.com
  Subject: Re: [RFC] building postgres with meson - v13
  In-Reply-To: <20220924180955.2hevwoniwsj2q2tm@awork3.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox