Re: [RFC] building postgres with meson - v11

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: pgsql-hackers@postgresql.org, samay sharma <smilingsamay@gmail.com>, Nazir Bilal Yavuz <byavuz81@gmail.com>, Andrew Dunstan <andrew@dunslane.net>
Date: 2022-08-11T00:20:12Z
Lists: pgsql-hackers

Attachments

Hi,

Attached is a new version of the meson patchset. Plenty changes:

- Added a postgresql-extension.pc pkg-config file. That allows building server
  extensions without integrating directly with the postgres buildsystem. I
  have tested that this allows to build a simple out-of-tree extension on
  linux and windows - the latter is something that we didn't really support
  before.  I think we could add something similar to the autoconf build in the
  back branches, which'd make it easier to build extensions using this
  mechanism across server versions.

- A significant number of the preparatory patches has been committed

- Lots of cleanup / simplification around exporting symbols, including
  reunifying gendef.pl that I had previously copied

- Ecpg is now built and tested on windows, thanks to the above

- If there are any leftover generated files in the source tree, we now error
  out, with instructions for how to fix it. That might need a better answer at
  some point (think building from tarball), but I think that's good enough for
  now.

  It might be worth generating a file to perform the cleanups, it can be a
  long list.

- CI for Openbsd, Netbsd (thanks Bilal!), that found a few minor issues

- I hadn't fully implemented the defaults for semaphores. Turns out named
  semaphores are really slow on openbsd and netbsd.

- I went through all the "configure" tests to see if there are mismatches, and
  either fixed them or added FIXMEs. There's maybe a handful.

- The PGXS compat layer is good enough to build at least a few moderately
  complicated extensions (postgis, postgis), but currently their tests fail
  against 15 (independent of the buildsystem)...

- Improved configure summary to show CFLAGS

- Some other CI improvements, we e.g. didn't use the same test concurrency and
  CFLAGSs between the meson and autoconf tasks.

- Lots of small cleanups

- The testrunner now creates a test.start file when starting and either a
  test.success or test.failure when ending. I'd like to use that to select the
  list of log files etc to report in CI / the buildfarm, while still allowing
  concurrent testing.  Andrew, does that make sense to you?

- Lots of other small stuff


I think this is getting closer to being initially mergeable. As we'd
discussed, we're more likely to succeed if we accept working somewhat
incrementally on this.


Samay, with a bit of input from me, started on adding a docs chapter for
building with meson. I hope to include that in the next version.

I'll next send out an email discussing where test outputs should be when
running them with meson and how tests and "testsuites" should be named.

Greetings,

Andres

Commits

  1. meson: Add 'running' test setup, as a replacement for installcheck

  2. meson: Add support for building with precompiled headers

  3. windows: Adjust FD_SETSIZE via commandline define

  4. meson: docs: Add xml{lint,proc} wrapper to collect dependencies

  5. meson: ecpg: Split definition of static and shared libraries

  6. windows: Set UMDF_USING_NTSTATUS globally, include ntstatus.h

  7. ci: Add hint about downloadable logs to README

  8. meson: Set up absolute rpaths to libdir

  9. meson: Include CFLAGS/c_args in summary and pg_config output

  10. windows: remove date from version number in win32ver.rc

  11. meson: Add initial version of meson based build system

  12. ci: windows: set error mode to not include SEM_NOGPFAULTERRORBOX

  13. Refactor PG_TEST_EXTRA logic in autoconf build

  14. Split TESTDIR into TESTLOGDIR and TESTDATADIR

  15. Don't hardcode tmp_check/ as test directory for tap tests

  16. Extend gendef.pl in preparation for meson

  17. Include c.h instead of postgres.h in src/port/*p{read,write}*.c

  18. Remove DLLTOOL, DLLWRAP from configure / Makefile.global.in

  19. Run xmllint validation only once

  20. Bump minimum Perl version to 5.14

  21. Move gramparse.h to src/backend/parser

  22. Run perltidy over Catalog.pm

  23. Parse catalog .dat files as a whole when compiling the backend

  24. Build all Flex files standalone

  25. Move private declarations shared between guc.c and guc-file.l to new header

  26. Preparatory refactoring for compiling guc-file.c standalone

  27. Move darwin sysroot determination into separate file

  28. Fix MSVC warning in compat_informix/rnull.pgc

  29. solaris: Use versioning scripts instead of -Bsymbolic

  30. Change shared library installation naming on macOS

  31. regress: allow to specify directory containing expected files, for ecpg

  32. Don't add HAVE_LDAP_H HAVE_WINLDAP_H to pg_config.h

  33. Refactor dtrace postprocessing make rules

  34. Add output directory option to gen_node_support.pl

  35. Add output directory argument to generate-unicode_norm_table.pl

  36. Add output file argument to generate-errcodes.pl

  37. Add output path arg in generate-lwlocknames.pl

  38. Move snowball_create.sql creation into perl file

  39. ecpg: Output dir, source dir, stamp file argument for preproc/*.pl

  40. psql: Output dir and dependency generation for sql_help

  41. Deal with paths containing \ and spaces in basebackup_to_shell tests

  42. Remove LLVM_CONFIG from Makefile.global.in

  43. Make update-unicode target work in vpath builds

  44. Refactor DLSUFFIX handling

  45. ldap tests: Add paths for openbsd.

  46. ldap tests: Don't run on unsupported operating systems.

  47. Remove check for accept() argument types

  48. Move our p{read,write}v replacements into their own files.

  49. Adjust yywrap macro for non-reentrant scanners for MSVC.

  50. Remove any -arch switches given in ExtUtils::Embed's ldopts from our

  51. Change PL/Perl and Pg interface build to use configured compiler and

  52. Apparently, on some systems, ExtUtils::Embed and MakeMaker are slightly