Hi, On 2026-01-20 08:03:58 +0100, Peter Eisentraut wrote: > 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.
Makes sense to me. > For illustration and continuous testing, I disabled static libraries in the > CI SanityCheck task. Hm. I guess that makes sense. > 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. I suspect there are some folks interested in that, although I don't find that a particularly interesting thing to do personally. It'd certainly a bit weird to document, since it fundamentally won't work for the server... > ############################################################### > @@ -3499,18 +3513,20 @@ endif > installed_targets = [ > backend_targets, > bin_targets, > - libpq_st, > pl_targets, > contrib_targets, > nls_mo_targets, > ecpg_targets, > ] > +if dep_static_lib.found() > + installed_targets += [libpq_st] > +endif Wonder if we ought to define installed_targets = [] earlier and allow different meson.build files to add themselves, instead of putting knowledge like this into a central spot. Separately, perhaps it'd be mildly nicer to have a boolean for static libs instead of using .found() everywhere. Greetings, Andres Freund
