Обсуждение: [Proposal] Generate pkg-config for server module development

Поиск
Список
Период
Сортировка

[Proposal] Generate pkg-config for server module development

От
"Anders Åstrand"
Дата:
Hello hackers!

I've been looking into making it easier for extension authors to use 
other build
systems than make. I don't have everything in place just yet, but I 
believe this
first part where we generate pkg-config files for building server 
modules can be
useful on it's own.

I'm not entirely sure about what parameters we should include in the 
pkg-config
file, but what I have in the attached patch is inspired by PGXS and the
pkg-config files we already generate for shared libraries.

A meson.build file using this could look something like this:

     project('my_extension', 'c', default_options: { 'b_lundef': false })
     pg_dep = dependency('postgresql-server')
     shared_library(
         'my_extension',
         name_prefix: '',
         sources: ['src/my_code.c'],
         dependencies: pg_dep,
         install: true,
         install_dir: pg_dep.get_variable('libdir'),
     )

I choose the Makefile to add this to quite arbitrarily, I'm sure 
arguments can
be made for many of them.

Any feedback is highly appreciated! We would also need to add pkg-config for
building frontend tools I believe.

-- 
Anders Åstrand
Percona

Вложения

Re: [Proposal] Generate pkg-config for server module development

От
Andreas Karlsson
Дата:
On 12/17/25 3:17 PM, Anders Åstrand wrote:
> I'm not entirely sure about what parameters we should include in the 
> pkg-config
> file, but what I have in the attached patch is inspired by PGXS and the
> pkg-config files we already generate for shared libraries.

Have you looked at Nazir's work in progress for generating pkg-config 
files in Meson[1]? Maybe he has some ideas for what parameters to 
include. In general I think the goal should be to include the stuff 
which is in pg_conifg.

Will look at the actual patch later.

References

1. 
https://www.postgresql.org/message-id/CAN55FZ138OBEehyxD1FKySMxKFteqf_VOR8LBkz-055YGU12rg%40mail.gmail.com

Andreas




Re: [Proposal] Generate pkg-config for server module development

От
"Anders Åstrand"
Дата:
On 2026-01-03 01:24, Andreas Karlsson wrote:
> On 12/17/25 3:17 PM, Anders Åstrand wrote:
>> I'm not entirely sure about what parameters we should include in the 
>> pkg-config
>> file, but what I have in the attached patch is inspired by PGXS and the
>> pkg-config files we already generate for shared libraries.
>
> Have you looked at Nazir's work in progress for generating pkg-config 
> files in Meson[1]? Maybe he has some ideas for what parameters to 
> include. In general I think the goal should be to include the stuff 
> which is in pg_conifg.

No I had not! Thank you for pointing me to that thread, it didn't seem 
related when I was looking for threads about this. That patch seems much 
more complete and I should probably just port it to make and include 
both patches here.

It's reassuring that that patch also add it to backends build file, I 
was very unsure about that.

> Will look at the actual patch later.
>
> References
>
> 1. 
> https://www.postgresql.org/message-id/CAN55FZ138OBEehyxD1FKySMxKFteqf_VOR8LBkz-055YGU12rg%40mail.gmail.com
>
> Andreas
>
-- 
Anders Åstrand
Percona