meson: Allow disabling static libraries

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Tristan Partin <tristan(at)partin(dot)io>
Subject: meson: Allow disabling static libraries
Date: 2026-01-20 07:03:58
Message-ID: e8aa97db-872b-4087-b073-f296baae948d@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
0001-meson-Allow-disabling-static-libraries.patch text/plain 8.9 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Soumya S Murali 2026-01-20 07:25:35 Re: 001_password.pl fails with --without-readline
Previous Message Ajit Awekar 2026-01-20 07:03:08 Re: Periodic authorization expiration checks using GoAway message