# GNU libiconv 1.17
# =================
# 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.
# Guile, for example, might want this.
# 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 tarball
cd
test -f installed/libiconv-1.17.tar.gz && mv installed/libiconv-1.17.tar.gz .
test ! -f libiconv-1.17.tar.gz &&
wget https://ftpmirror.gnu.org/libiconv/libiconv-1.17.tar.gz
# Verify tarball w/ sha256sum:
# (this came from my gpg-verified tarball)
echo "8f74213b56238c85a50a5329f77e06198771e70dd9a739779f4c02f65d9713\
13 libiconv-1.17.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.17.tar.gz
cd libiconv-1.17
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
# If you only need libiconv so libunistring can include libiconv support
# (maybe then to be used by Guile) and you don't want to mess with
# /usr/include/iconv.h, use --prefix=/usr/local here instead of /usr
#
# Slackware does not include libiconv, so not much of a concern to match
# any /usr paths
# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
./configure --docdir=/usr/local/doc/libiconv-1.17 \
--libdir=/usr/local/lib64 --mandir=/usr/local/man \
--disable-nls
# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
./configures --docdir=/usr/local/doc/libiconv-1.17 \
--mandir=/usr/local/man --disable-nls
# Build it
make
# Become root to install it
su
# If using --prefix=/usr, 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
# If you're _sure_ you don't need them, remove old files from previous
# versions. The following are what should be installed.
# Best to go the safe route and just leave them there.
#
# /usr/local/bin/iconv
# /usr/local/include/iconv.h
# /usr/local/include/libcharset.h
# /usr/local/lib*/libcharset.*
# /usr/local/man/man1/iconv.1
# /usr/local/man/man3/iconv.3
# /usr/local/man/man3/iconv_close.3
# /usr/local/man/man3/iconv_open.3
# /usr/local/man/man3/iconv_open_into.3
# /usr/local/man/man3/iconvctl.3
# 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.17.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
find ${pfx}/doc -type d -name "libiconv-*" -exec rm -r {} \;
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.*