Linux HOWTOs

About | Home | Search


HOWTO: gettext
Description: Internationalization library
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# GNU gettext 0.19.8.1
# ====================
# Slackware 13.37, 14.0: gettext 0.18.1.1
# Slackware 14.1: gettext 0.18.2.1
# Slackware 14.2: gettext 0.19.8.1

# As of 0.12.1, you can install the runtime part and/or the tools part
# separately.  To install both, follow the howto below.  To install just the
# runtime, cd into gettext-runtime then run configure, make, make install.
# To install just the tools, cd into gettext-tools.

# When upgrading to a new version, skip down to the bottom to clean up
# old files from the previous version before beginning with the new one.

# Seems kind of weird to use --disable-nls here, but I live in the US and
# only read/write English (well), so do not need any translations.  If that
# is not the case for you, leave that off below.  Sometimes gettext is
# required to exist, even if you're going to end up skipping the .mo files.

# Prerequisites (both versions):
# Bison
# javac (java compiler), jar (optional; part of Sun's JDK)
# libc's iconv or libiconv
# Perl
# teTeX or TeX Live's dvips
# texinfo's texi2pdf
# Emacs (optional)

# Get it
cd
test -f installed/gettext-0.19.8.1.tar.lz &&
 mv -f installed/gettext-0.19.8.1.tar.lz .
test ! -f gettext-0.19.8.1.tar.lz &&
 wget http://ftpmirror.gnu.org/gettext/gettext-0.19.8.1.tar.lz

# Verify tarball w/ sha1sum:
# (this also came from my gpg-verified tarball)
echo "404e072c455f79be4a2458863c19fb55a217771e  gettext-0.19.8.1.tar.lz" | \
sha1sum -c

# Verify tarball w/ gpg:
( gpg --list-keys D7E69871 > /dev/null 2>&1 || gpg --recv-keys D7E69871 ) &&
 wget -nc http://ftpmirror.gnu.org/gettext/gettext-0.19.8.1.tar.lz.sig &&
  gpg --verify gettext-0.19.8.1.tar.lz.sig && rm gettext-0.19.8.1.tar.lz.sig

# Extract the source
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "gettext-*" -exec rm -r {} \;
tar xvf ~/gettext-0.19.8.1.tar.lz
cd gettext-0.19.8.1
test $UID = 0 && chown -R root:root .

# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
./configure --prefix=/usr --docdir=/usr/doc/gettext-0.19.8.1 \
--infodir=/usr/info --libdir=/usr/lib64 --mandir=/usr/man --disable-nls

# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
./configure --prefix=/usr --docdir=/usr/doc/gettext-0.19.8.1 \
--infodir=/usr/info --mandir=/usr/man --disable-nls

# Build it
make

# Become root to install it
su

# Remove the Slackware package(s)
test -x /sbin/removepkg && /sbin/removepkg gettext gettext-tools

# Install the new version
make install
ldconfig

# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .

# Become yourself again
exit

# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/gettext-*.tar.*
mv gettext-0.19.8.1.tar.lz installed/


# If you ever want to uninstall gettext, this should do it:
cd
su
test -d src/gettext-* && ( cd src/gettext-* ; make uninstall )

( cd /usr/bin ; rm -f
autopoint
envsubst
gettext
gettext.sh
gettextize
msgattrib
msgcat
msgcmp
msgcomm
msgconv
msgen
msgexec
msgfilter
msgfmt
msggrep
msginit
msgmerge
msgunfmt
msguniq
ngettext
recode-sr-latin
xgettext

 )
test -d /usr/doc/gettext && rm -r /usr/doc/gettext
find /usr/doc -maxdepth 1 -type d -name "gettext-*" -exec rm -r {} \;
( cd /usr/include ; rm -f autosprintf.h gettext-po.h libintl.h )
( cd /usr/info ; rm -f autosprintf.info gettext.info )
for libdir in /usr/lib /usr/lib64;
do
  test -d $libdir &&
   ( cd $libdir
     test -d ./gettext && rm -r ./gettext
     rm -f libasprintf.* libgettextlib-*.so libgettextlib.* \
      libgettextpo.* libgettextsrc-*.so libgettextsrc.* libgnuintl.* \
      libintl.* preloadable_libintl.so )
done

/usr/share/aclocal/gettext.m4

test -d /usr/share/gettext && rm -r /usr/share/gettext
find /usr/share -maxdepth 1 -type d -name "gettext-*" -exec rm -r {} \;
find /usr/share/locale -type f -name "gettext.mo" -exec rm {} \;
( cd /usr/man/man1 ; rm -f

autopoint.1
envsubst.1
gettext.1
gettextize.1
msgattrib.1
msgcat.1
msgcmp.1
msgcomm.1
msgconv.1
msgen.1
msgexec.1
msgfilter.1
msgfmt.1
msggrep.1
msginit.1
msgmerge.1
msgunfmt.1
msguniq.1
ngettext.1
recode-sr-latin.1
xgettext.1

)

( cd /usr/man/man3
  rm -f bind_textdomain_codeset.3 bindtextdomain.3 dcgettext.3 \
   dcngettext.3 dgettext.3 dngettext.3 gettext.3 ngettext.3 textdomain.3 )

ldconfig
exit
find ~/src -maxdepth 1 -type d -name "gettext-*" -exec rm -r {} \;
rm -f ~/installed/gettext-*.tar.*

Back to the list


Last updated: Wed, 29 Apr 2020 22:04:50 -0400
Jason Englander <jason at englanders dot us>