# GNU libiconv 1.16
# =================
# Modern versions of glibc can do what this library does. You most likely
# don't need this library unless your libc doesn't have a iconv() or if
# you want a different/better iconv() than the one that comes with glibc.
# NOTE: If you already have a /usr/include/iconv.h, this will replace it
# You could always use the default prefix (/usr/local) to have both
# available...
# The recommended procedure if you don't already have gettext, is to install this,
# then gettext, then this again
# If you ever want to remove libiconv, skip down to the bottom
# If you don't have wget, see the wget HOWTO for alternatives to use
# such as 'curl -O ...' or ncftpget
# Get the source
cd
test -f installed/libiconv-1.16.tar.gz && mv installed/libiconv-1.16.tar.gz .
test ! -f libiconv-1.16.tar.gz &&
wget https://ftpmirror.gnu.org/libiconv/libiconv-1.16.tar.gz
# Verify tarball w/ sha256sum:
# (this came from my gpg-verified tarball)
echo "e6a1b1b589654277ee790cce3734f07876ac4ccfaecbee8afa0b649cf529cc04 libiconv-1.16.tar.gz" | sha256sum -c
# Extract the source
mkdir -p -m 0700 ~/src
cd src
find -maxdepth 1 -type d -name "libiconv-*" -exec rm -r {} \;
tar xzvf ~/libiconv-1.16.tar.gz
cd libiconv-1.16
test $UID = 0 && chown -R root:root .
# I use --disable-nls because I don't reed or right anything other than
# English (well), though these days the drive space savings are not much of
# a concern
# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
./configure --disable-nls --prefix=/usr --docdir=/usr/doc --libdir=/usr/lib64 --mandir=/usr/man
# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
./configure --disable-nls --prefix=/usr --docdir=/usr/doc --mandir=/usr/man
# Build it
make
# Become root to install it
su
# If you're sure you don't need them (check with lsof), remove old library
# files
test -d /usr/lib64 &&
( cd /usr/lib64
rm -f ./libcharset.* )
test ! -d /usr/lib64 &&
( cd /usr/lib
rm -f ./libcharset.* )
# Back up the glibc iconv.h just in case, if it's there
test -f /usr/include/iconv.h &&
grep -q "The GNU C Library" /usr/include/iconv.h &&
cp -a /usr/include/iconv.h /usr/include/iconv.h.glibc
# Install it
make install
ldconfig
# Become yourself again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/libiconv-*.tar.gz
mv libiconv-1.16.tar.gz installed/
# If you ever want to uninstall libiconv, this should do it
# 'make uninstall' from the source directory as root should do it
# The rest is just in case old files are left over
cd
su
test -d src/libiconv-* && ( cd src/libiconv-* ; make uninstall )
for pfx in /usr /usr/local;
do
test -d ${pfx}/doc/libiconv && rm -f ${pfx}/doc/libiconv
( cd ${pfx}/include
rm -f iconv.h localcharset.h libcharset.h )
( cd ${pfx}/lib
rm -f libcharset.* libiconv.* preloadable_libiconv.so )
test -d ${pfx}/lib64 &&
( cd ${pfx}/lib
rm -f libcharset.* libiconv.* preloadable_libiconv.so )
( cd ${pfx}/man/man3
rm -f iconv.3 iconv_close.3 iconv_open.3 iconv_open_into.3 iconvctl.3 )
test -d ${pfx}/share/doc/libiconv && rm -f ${pfx}/share/doc/libiconv
find ${pfx}/share/locale -type f -name libiconv.mo
( cd ${pfx}/share/man/man3
rm -f iconv.3 iconv_close.3 iconv_open.3 iconv_open_into.3 iconvctl.3 )
rm -f ${pfx}/bin/iconv ${pfx}/share/man/man1/iconv.1
done
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "libiconv-*" -exec rm -r {} \;
rm -f ~/installed/libiconv-*.tar.*