NLS in Meson

Started by Álvaro Herrera4 months ago3 messages
#1Álvaro Herrera
alvherre@kurilemu.de

Hello,

While messing around with NLS under Make for commit [1]https://git.postgresql.org/cgit/postgresql.git/commit/?id=dbf8cfb4f02eb9ec5525de1761675f9babfd30e3, I noticed in the Ninja manual [2]https://mesonbuild.com/i18n-module.html that apparently calling the i18n.gettext() function generates a few "hidden" targets -- most notably, things like <module>-update-po and <module>-pot targets. These would presumably be used to build the POT and update the PO files fresh, using the source files. And you know what? It works! I tried this:

$ ninja --verbose postgres-19-pot
[0/1] /usr/bin/meson --internal gettext pot --pkgname=postgres-19 --source-root=/mnt/crypthome/alvherre/Code/pgsql/source/master/ --subdir=src/backend/po --xgettext=/usr/bin/xgettext
Could not find file POTFILES in /mnt/crypthome/alvherre/Code/pgsql/source/master/src/backend/po
FAILED: meson-internal__postgres-19-pot
/usr/bin/meson --internal gettext pot --pkgname=postgres-19 --source-root=/mnt/crypthome/alvherre/Code/pgsql/source/master/ --subdir=src/backend/po --xgettext=/usr/bin/xgettext
ninja: build stopped: subcommand failed.

I mean, it doesn't _actually_ work, but AFAICS we're quite close, we just need to populate a src/backend/po/POTFILES file. One way might be by looking at the recipe used by src/backend/nls.mk,
find src/backend src/common src/port src/include/ \( -name '*.c' -o -name "proctypelist.h" \) -print | LC_ALL=C sort > src/backend/po/POTFILES

Then running "ninja postgres-19.pot" works (no promises on its contents though, I think it's quite bogus). Something to play with, if anyone gets any round tuits.

[1]: https://git.postgresql.org/cgit/postgresql.git/commit/?id=dbf8cfb4f02eb9ec5525de1761675f9babfd30e3
[2]: https://mesonbuild.com/i18n-module.html

--
Álvaro Herrera

#2Peter Eisentraut
peter@eisentraut.org
In reply to: Álvaro Herrera (#1)
Re: NLS in Meson

On 27.09.25 13:01, Álvaro Herrera wrote:

While messing around with NLS under Make for commit [1], I noticed in the Ninja manual [2] that apparently calling the i18n.gettext() function generates a few "hidden" targets -- most notably, things like <module>-update-po and <module>-pot targets. These would presumably be used to build the POT and update the PO files fresh, using the source files.

But these targets want to create the pot files in the source directory.
I never quite understood what workflow they had in mind there, but it
doesn't seem to match ours. Might need more research.

#3Álvaro Herrera
alvherre@kurilemu.de
In reply to: Peter Eisentraut (#2)
Re: NLS in Meson

On 2025-Sep-29, Peter Eisentraut wrote:

On 27.09.25 13:01, Álvaro Herrera wrote:

While messing around with NLS under Make for commit [1], I noticed in the Ninja manual [2] that apparently calling the i18n.gettext() function generates a few "hidden" targets -- most notably, things like <module>-update-po and <module>-pot targets. These would presumably be used to build the POT and update the PO files fresh, using the source files.

But these targets want to create the pot files in the source directory.

True, that's a bother. Is this something that we could pester the Meson
people about? Admittedly, our Make support for it is quite weird also,
what with it creating ".po.new" files. That always struck me as odd.

--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
"You're _really_ hosed if the person doing the hiring doesn't understand
relational systems: you end up with a whole raft of programmers, none of
whom has had a Date with the clue stick." (Andrew Sullivan)
/messages/by-id/20050809113420.GD2768@phlogiston.dyndns.org