Skip to content

[libpq] Revise, use meson for all targets#51250

Draft
dg0yt wants to merge 12 commits intomicrosoft:masterfrom
dg0yt:libpq
Draft

[libpq] Revise, use meson for all targets#51250
dg0yt wants to merge 12 commits intomicrosoft:masterfrom
dg0yt:libpq

Conversation

@dg0yt
Copy link
Copy Markdown
Contributor

@dg0yt dg0yt commented Apr 19, 2026

Meson is the official build system for PostgreSQL for Windows, but still unofficial elsewhere (https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=5afaba6297a8dd6999c8bc9f517a3ad38bd39652). Vcpkg port libpq is broken for Windows (#51102, probably also breaking qt5-base in #51235). Instead of poorly patching two build systems, leverage the meson build for all targets.

Caveat: libpq's meson uses features deprecated in meson:

 * 0.55.0: {'ExternalProgram.path'}
 * 0.56.0: {'meson.source_root'}

@BillyONeal
Copy link
Copy Markdown
Member

autotools sucks

Evergreen

@frankhale
Copy link
Copy Markdown
Contributor

When I updated the libpq 18 port (as my first ever port) it was too much. Impossible to know all the nuances of every build as well as the meson build system. It took two weeks to get all builds working so it was a miracle at that point that anything worked. Thanks for fixing this.

Comment thread ports/libpq/libpq-and-client-tools.diff Outdated
backend_link_depends = []

+subdir_done()
+if false # vcpkg_abi_info
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
+if false # vcpkg_abi_info
+if false # vcpkg

oops, VS Code autocomplete 🤦

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the suggestion but don't see reason to force a rebuild over it.

@dg0yt dg0yt changed the title [libpq] Revise [libpq] Revise, use meson for all targets Apr 22, 2026
@dg0yt
Copy link
Copy Markdown
Contributor Author

dg0yt commented Apr 22, 2026

When I updated the libpq 18 port (as my first ever port) it was too much. Impossible to know all the nuances of every build as well as the meson build system. It took two weeks to get all builds working so it was a miracle at that point that anything worked. Thanks for fixing this.

There was a reason why the port wasn't already updated by people who were familar with the port :-) It is not a candidate for "my first ever port" update, with both upstream and vcpkg being tricky. My work was completely done on non-Windows. Using meson for both worlds should be an improvement. OTOH the state of the meson build isn't optimal, and vcpkg needs a subset not foreseen by upstream.

@dg0yt
Copy link
Copy Markdown
Contributor Author

dg0yt commented Apr 22, 2026

Of course dropping the features which don't make sense for the client is a significant simplification.

BillyONeal
BillyONeal previously approved these changes Apr 23, 2026
Copy link
Copy Markdown
Member

@BillyONeal BillyONeal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving but not merging in case @dg0yt wants to address nitpicks

Comment thread ports/libpq/libpq-and-client-tools.diff Outdated
backend_link_depends = []

+subdir_done()
+if false # vcpkg_abi_info
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the suggestion but don't see reason to force a rebuild over it.

# Copyright (c) 2022-2025, PostgreSQL Global Development Group

-subdir('initdb')
+# vcpkg: Reduced to documented "Client applications" (and scripts)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you include a link somewhere to where that document is so we know to keep this consistent across updates?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
+# vcpkg: Reduced to documented "Client applications" (and scripts)
+# vcpkg: Reduced to documented "Client applications" (and scripts)
+# Cf. https://www.postgresql.org/docs/current/reference-client.html

Comment thread ports/libpq/vcpkg.json
Copy link
Copy Markdown
Contributor Author

@dg0yt dg0yt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BillyONeal Either we merge as is quickly and I can reenable feature testing of the qtbase libpq SQL plugin in the zlib update PR. Or we apply the additional changes and merge after the zlib update, after forcing another qtbase feature test as part of this PR.

Given the zlib PR build time, I would prefer to have zlib merged first.

# Copyright (c) 2022-2025, PostgreSQL Global Development Group

-subdir('initdb')
+# vcpkg: Reduced to documented "Client applications" (and scripts)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
+# vcpkg: Reduced to documented "Client applications" (and scripts)
+# vcpkg: Reduced to documented "Client applications" (and scripts)
+# Cf. https://www.postgresql.org/docs/current/reference-client.html

Comment thread ports/libpq/vcpkg.json
Comment thread ports/libpq/vcpkg.json
Comment on lines +49 to +50
"client": {
"description": "Build all client tools and libraries",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... this feature might be renamed to tools to better reflect its purpose ("Client Applications"). There isn't much about client li which isn't core ("Client Interface": libpq, ecpg).

@dg0yt dg0yt marked this pull request as draft April 23, 2026 19:25
@dg0yt
Copy link
Copy Markdown
Contributor Author

dg0yt commented Apr 23, 2026

To be continued after the zlib update is merged.

@BillyONeal
Copy link
Copy Markdown
Member

To be continued after the zlib update is merged.

Just did :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants