|
| 1 | +# Intro |
| 2 | +gettext-tiny provides lightweight replacements for tools typically used |
| 3 | +from the `GNU gettext` suite, which is incredibly bloated and takes |
| 4 | +a lot of time to build (in the order of an hour on slow devices). |
| 5 | +the most notable component is `msgfmt` which is used to create binary |
| 6 | +translation files in the `.mo` format out of textual input files in |
| 7 | +`.po` format. this is the most important tool for building software from |
| 8 | +source, because it is used from the build processes of many software packages. |
| 9 | + |
| 10 | +our `msgfmt` implementation was initially a fake implementation that would |
| 11 | +just output the english input string as the translation, which is sufficient |
| 12 | +to get software to work, but it has since grown into a complete implementation. |
| 13 | +unlike the GNU implementation, it can even expand input strings containing |
| 14 | +so-called `sysdep` strings into a constant translation table. |
| 15 | +`sysdep` strings were glued as an after-thought onto the GNU implementation to |
| 16 | +deal with system-specific format strings, and in the GNU implementation those |
| 17 | +are created at runtime, which requires mapping the entire `.mo` file into |
| 18 | +read/write memory locations, thereby wasting precious RAM for read-only data |
| 19 | +that could otherwise be shared among processes. |
| 20 | + |
| 21 | +other parts of gettext-tiny such as `xgettext` and `msgmerge` are still stubs, |
| 22 | +but they are sufficient to build many packages. |
| 23 | + |
| 24 | +since `musl` libc, our preferred target, didn't provide a `libintl` in the past, |
| 25 | +(and it's also part of `GNU gettext`) we also ship a no-op libintl providing |
| 26 | +a header and a library. |
| 27 | + |
| 28 | +it comes in two flavours: |
| 29 | + |
| 30 | +1) nop: gettext functions just return the input string as translation |
| 31 | +2) musl: a compat library providing a few compatibility symbols meant to be used |
| 32 | + together with the libintl built-in into recent musl versions. |
| 33 | + the compatibility symbols help to get past configure scripts that insist on |
| 34 | + using only the GNU gettext suite. |
| 35 | +additionally, it can be entirely disabled. |
| 36 | + |
| 37 | + |
| 38 | +# Compilation/Installation |
| 39 | + |
| 40 | +``` |
| 41 | +make LIBINTL=FLAVOR |
| 42 | +make DESTDIR=pkgdir prefix=/ install |
| 43 | +``` |
| 44 | + |
| 45 | +where FLAVOR can be one of NONE, MUSL, NOOP (as detailed above). |
| 46 | +you can override any variables used in the Makefile (such as `CFLAGS`) by |
| 47 | +appending them to the `make` invocation, or by saving them into a file called |
| 48 | +`config.mak` before running `make`. |
0 commit comments