NLS in Meson

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: NLS in Meson
Date: 2025-09-27 11:01:57
Message-ID: cae76f1f-695f-473b-95ff-4bd804433ab1@app.fastmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

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. 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

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Borodin 2025-09-27 11:46:02 Re: Sending unflushed WAL in physical replication
Previous Message David Rowley 2025-09-27 10:43:13 Re: Fixing MSVC's inability to detect elog(ERROR) does not return