7.7. gettext-tiny 0.3.3
gettext-tiny provides lightweight gettext tooling for builds in chroot, including msgfmt and a musl-compatible libintl flavor.
Input assumption:
gettext-tiny-0.3.3.tar.xz is already present in /sources from the chapter 4 source staging step.
Licenses:
- MIT
Dependencies:
- musl (libc)
- make
- clang/llvm toolchain
gettext-tiny is a lightweight replacement for key GNU gettext tools and libintl compatibility pieces. we need it to provide msgfmt and musl-friendly libintl compatibility for package builds inside chapter 7 chroot.
Extract and Enter the Source Tree
cd /sources
tar -xf gettext-tiny-0.3.3.tar.xz
cd gettext-tiny-0.3.3
Patch the install symlink rule for BSD install
The upstream install rule uses install -l for symlinks, but BSD install does not support that option. Replace that line with a normal directory creation plus ln -sf.
awk '
/^[[:space:]]*\$\(INSTALL\) -D -l / {
print "\tmkdir -p $(patsubst %m4/,%,$(dir $@))"
print "\tln -sf ../$(subst $(datarootdir)/,,$(datadir))/$< $(patsubst %m4/,%,$(dir $@))/$(notdir $@)"
next
}
{ print }
' Makefile > Makefile.new
mv Makefile.new Makefile
Build gettext-tiny
make $LWI_MAKE_FLAGS \
LIBINTL=musl \
CPPFLAGS="-I/system/headers" \
CFLAGS="-I/system/headers" \
LDFLAGS="-L/system/libraries" \
CC="cc -B/system/libraries -B/system/libraries/clang/22/lib/linux"
Install gettext-tiny
make $LWI_MAKE_FLAGS \
LIBINTL=musl \
CPPFLAGS="-I/system/headers" \
CFLAGS="-I/system/headers" \
LDFLAGS="-L/system/libraries" \
CC="cc -B/system/libraries -B/system/libraries/clang/22/lib/linux" \
prefix=/system \
bindir=/system/binaries \
includedir=/system/headers \
libdir=/system/libraries \
datarootdir=/system/documentation \
datadir=/system/documentation/gettext-tiny \
acdir=/system/documentation/aclocal \
install
Command Explanations
cd /sources,tar -xf, andcd gettext-tiny-...: Enter a fresh gettext-tiny source tree from the staged archive.awk ... Makefile > Makefile.new: Replaces the upstreaminstall -lsymlink rule with portablemkdirplusln -sfcommands.mv Makefile.new Makefile: Installs the rewritten Makefile after the replacement succeeds.make $LWI_MAKE_FLAGS: Builds with the shared parallel make policy.LIBINTL=musl: Uses musl's libc-provided gettext stubs instead of building a separate libintl.CPPFLAGS,CFLAGS, andLDFLAGS: Point the build at the target headers and libraries.CC="cc -B...": Tells the compiler where to find target startup objects and Clang runtime files.make ... install: Installs gettext-tiny with explicit/systembinary, library, header, and data paths.