meson: Allow disabling static libraries
Peter Eisentraut <peter@eisentraut.org>
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: Tristan Partin <tristan@partin.io>
Date: 2026-01-20T07:03:58Z
Lists: pgsql-hackers
Attachments
- 0001-meson-Allow-disabling-static-libraries.patch (text/plain) patch 0001
This patch allows disabling the build of static libraries using the standard meson option -Ddefault_library=shared (defaults to "both"). This option would work out of the box if you use the library() function to build libraries, but we use shared_library() and static_library() separately, for reasons that are explained in src/interfaces/libpq/meson.build. So now with this, the option works again as expected from the end user's perspective. This approach was suggested by Tristan Partin over in the AIX thread[0], but I figured this could be a generally usable feature, as some distributions don't want to build static libraries. For illustration and continuous testing, I disabled static libraries in the CI SanityCheck task. The internal use static libraries like libpgcommon.a are still built in any case, but if you disable static libraries, they are not installed. The opposite case of disabling shared libraries doesn't work at the moment. I think that is much less useful, but if someone wanted to, they could implement it in this same framework. [0]: https://www.postgresql.org/message-id/SJ4PPFB817783261597674B9814FE523944DB8EA%40SJ4PPFB81778326.namprd15.prod.outlook.com
Commits
-
meson: allow disabling building/installation of static libraries.
- 78727dcba32e 19 (unreleased) landed
-
meson: Refactor libpq targets variables
- 4bfbbeb679c0 19 (unreleased) landed