54.2. gettext-1.0
Utilities for internationalization and localization
| Version | 1.0, release 1 |
| Shelf | i18n — Unicode, locale, text shaping and segmentation, conversion, and translation |
| Phase | 30_foundation (Build Foundation), 20 of 127 in build order |
| Licence | GPL-3.0-or-later AND LGPL-2.1-or-later |
| Homepage | https://www.gnu.org/software/gettext/ |
| Build time | 6.2 SBU |
| Installed size | 29.0 MiB in 2394 files |
| Recipe | ports/core/i18n/gettext/kpkgbuild |
About
GNU gettext is the toolchain for translating programs: xgettext extracts the strings to translate, msgmerge and the other msg* programs maintain the .po catalogues, msgfmt compiles them, and autopoint and gettextize add gettext’s autotools machinery to a source tree. It also installs libtextstyle, the library that colours terminal output, which bison depends on gettext for, and libasprintf and libgettextpo.
KDOS ships no translations (see Size and language policy), but a great many builds still run these tools: an autoreconf that calls autopoint, a meson i18n module that runs msgfmt over a desktop entry or an AppStream file, an intltool or itstool step. Many ports depend on it for that alone.
The C library side is different from a glibc distribution. musl carries its own gettext() and its own libintl.h, and this package, built --disable-nls, installs neither a libintl.h nor a libintl library. The libintl port builds the GNU runtime library alone from this same tarball for the programs that need its symbols; see Gettext on musl.
Sources
gettext-1.0.tar.xz(10.2 MiB)
sha25671132a3fb71e68245b8f2ac4e9e97137d3e5c02f415636eb508ae607bc01add7
upstream: https://mirrors.ocf.berkeley.edu/gnu/gettext/gettext-1.0.tar.xz
archive copy: sources-3/i18n--gettext-1.0.tar.xz
Dependencies
Depends on: ncurses, libunistring, acl, attr, xz.
Required by (131): accountsservice, aisleriot, audacious, audacious-plugins, avahi, bison, brasero, brltty, calcurse, celluloid, darktable, dasher, deja-dup, digikam, exo, fcitx5, fcitx5-anthy, fcitx5-chinese-addons, fcitx5-configtool, fcitx5-hangul, fcitx5-qt, font-manager, fontforge, fprintd, fwupd, geany, geoclue, gimagereader, gimp, git, glabels, gnome-disk-utility, gnome-mahjongg, gnome-mines, gnome-sudoku, gnucash, gnumeric, goffice, gparted, gpredict, gramps, gthumb, gtk-vnc, gvfs, handbrake, homebank, hunspell, impression, inkscape, iso-codes, json-glib, kalzium, kconfigwidgets, kdesdk-thumbnailers, kdoctools, kfilemetadata, ki18n, kiconthemes, koreader, kpackage, kpty, krita, kservice, kunitconversion, kwave, kxmlgui, lasem, libbytesize, libexif, libgphoto2, libgpod, libgsf, libhangul, libime, libintl, libiptcdata, libosinfo, libpeas, libpulse, libqalculate, libreoffice, libvirt-glib, libxfce4ui, libxfce4util, linuxcnc, lynx, mc, minicom, minidlna, modemmanager, musl-locales, neovim, networkmanager-openvpn, newsboat, opencpn, openscad, opensp, orca, osinfo-db-tools, phodav, picard, podman, poxml, ptouch-print, qv4l2, resources, rhythmbox, rkward, sdcv, shared-mime-info, spice-gtk, system-config-printer, tenacity, texinfo, totem-pl-parser, tuxpaint, udisks2, v4l-utils, viking, virt-manager, webkitgtk, webkitgtk6, widelands, wine, xfburn, xfconf, xfsprogs, xkeyboard-config, xnec2c, zbar, zenity.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/30_foundation/phase.env && kpkg install gettext'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/i18n/gettext.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/i18n/gettext
echo '71132a3fb71e68245b8f2ac4e9e97137d3e5c02f415636eb508ae607bc01add7 gettext-1.0.tar.xz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/gettext
SRC=$SRC_ROOT/gettext-1.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf gettext-1.0.tar.xz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
./configure \
--prefix=/usr \
--disable-nls \
--disable-java \
--disable-csharp \
--without-git \
--with-xz \
--without-emacs \
--with-included-libxml \
--with-libunistring-prefix=/usr \
--with-libncurses-prefix=/usr \
--without-selinux \
--without-libsmack
make
make DESTDIR=$PKG install
rm -f "$PKG/usr/share/gettext/javaversion.class"
The switches, and why each is set:
--disable-nls— Builds the programs without their own translations, and installs nolibintl; the libintl port provides that library.--disable-java— Builds none of gettext’s Java sources, such as theintl-javaruntime classes. openjdk is a port, but of a later phase.--disable-csharp— Builds none of the C# support, such as theintl-csharpruntime. Neither Mono nor .NET is a port.--without-git— Keeps configure from choosing the git format forautopoint’s infrastructure archive. Under--with-xzthe choice is xz whatever this switch says.--with-xz— Stores the infrastructure archive thatautopointunpacks asarchive.dir.tar.xz. Left to probe, configure picks the format from whichever of xz, git and bzip2 the build root holds, gzip when it holds none, andautopointthen needs that same program on every machine it runs on. The switch fixes the format on every build, and xz is independssoautopointcan always unpack it (see An optional tool found in the tree).--without-emacs— Installs no Emacs PO mode. Emacs is not a port.--with-included-libxml— Builds the copy of libxml2’s parser that gettext carries into its own libraries, for the tools that read XML (ITS rules, Glade and AppData files). The system libxml2 cannot be used: libxml2 depends on doxygen, doxygen on bison, and bison on gettext, so linking it here would be a dependency cycle.--with-libunistring-prefix=/usr— Links the system libunistring, which is independs, instead of the parts of it gettext can compile in.--with-libncurses-prefix=/usr— Searches for ncurses in/usr/includeand/usr/lib. libtextstyle reads the terminal’s capabilities through it.--without-selinux— Builds without SELinux support. libselinux is not a port: SELinux is outside what KDOS builds (see Features whose library has no port).--without-libsmack— Builds without Smack label support, for the same reason.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/gettext, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf gettext-1.0-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/gettext, and runs the triggers its paths call for.
Contents
Installed programs: autopoint, envsubst, gettext, gettext.sh, gettextize, msgattrib, msgcat, msgcmp, msgcomm, msgconv, msgen, msgexec, msgfilter, msgfmt, msggrep, msginit, msgmerge, msgpre, msgunfmt, msguniq, ngettext, po-fetch, printf_gettext, printf_ngettext, recode-sr-latin, spit, xgettext.
Installed libraries: libasprintf.a, libasprintf.so, libgettextlib-1.0.so, libgettextlib.a, libgettextlib.so, libgettextpo.a, libgettextpo.so, libgettextsrc-1.0.so, libgettextsrc.a, libgettextsrc.so, libtextstyle.a, libtextstyle.so.
Installed directories: /usr/include/textstyle, /usr/lib/gettext, /usr/libexec/gettext, /usr/share/doc/gettext, /usr/share/gettext-1.0, /usr/share/gettext/m4, /usr/share/gettext/po, /usr/share/gettext/projects, /usr/share/gettext/schema, /usr/share/gettext/styles, /usr/share/licenses/gettext.
Short descriptions
autopoint |
copies standard gettext infrastructure |
envsubst |
substitutes environment variables in shell format strings |
gettext |
translate message |
gettextize |
install or upgrade gettext infrastructure |
msgattrib |
attribute matching and manipulation on message catalog |
msgcat |
combines several message catalogs |
msgcmp |
compare message catalog and template |
msgcomm |
match two message catalogs |
msgconv |
character set conversion for message catalog |
msgen |
create English message catalog |
msgexec |
process translations of message catalog |
msgfilter |
edit translations of message catalog |
msgfmt |
compile message catalog to binary format |
msggrep |
pattern matching on message catalog |
msginit |
initialize a message catalog |
msgmerge |
merge message catalog and template |
msgpre |
pretranslate a message catalog |
msgunfmt |
uncompile message catalog from binary format |
msguniq |
unify duplicate translations in message catalog |
ngettext |
translate message and choose plural form |
po-fetch |
fetches a set of PO files from a translation project's site |
printf_gettext |
translate format string and apply it |
printf_ngettext |
translate format string and apply it |
recode-sr-latin |
convert Serbian text from Cyrillic to Latin script |
spit |
translate some text through a Large Language Model |
xgettext |
extract gettext strings from source |
Notes
rm -f "$PKG/usr/share/gettext/javaversion.class" removes a compiled Java class that --disable-java still installs. It is not built here: the release tarball carries it already compiled, beside its javaversion.java, and libgettextlib hands it to a Java virtual machine to learn the machine’s version. A prebuilt object that fits none of the exempt classes is deleted from the package (see What is built from source).
acl and attr are in depends. configure turns on support for access control lists and extended attributes when it finds their libraries, so with both always present libgettextlib links libacl and libattr, and its file-copying code carries both. Without them in depends, the result would follow whatever the build root held.