# Get the tarball
cd
test -f installed/libffi-3.4.4.tar.gz &&
mv installed/libffi-3.4.4.tar.gz .
test ! -f libffi-3.4.4.tar.gz &&
wget https://github.com/libffi/libffi/releases/download/v3.4.4/\
libffi-3.4.4.tar.gz
# Verify tarball w/ sha256sum:
# (from mine, so this only proves yours is the same)
echo "d66c56ad259a82cf2a9dfc408b32bf5da52371500b84745f7fb8b645712df6\
76 libffi-3.4.4.tar.gz" | sha256sum -c
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -name "libffi-*" -exec rm -r {} \;
tar xzvf ~/libffi-3.4.4.tar.gz
cd libffi-3.4.4
test $UID = 0 && chown -R root:root .
# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
./configure --prefix=/usr --docdir=/usr/doc/libffi-3.4.4 \
--infodir=/usr/info --libdir=/usr/lib64 --localstatedir=/var \
--mandir=/usr/man --sysconfdir=/etc
# Configure the build for anything else
test $(uname -m) = 'x86_64' &&
./configure --prefix=/usr --docdir=/usr/doc/libffi-3.4.4 \
--infodir=/usr/info --localstatedir=/var --mandir=/usr/man \
--sysconfdir=/etc
# Build it
make
# Check the build
make check
# Become root to install it
su
# WARNING: make may be linked with libffi, so when you remove it...
# You may want to be safe and save a copy of /usr/lib*/libffi.so.*
# to copy back in there manually
# Remove the Slackware package, if there is one
test -x /sbin/removepkg && /sbin/removepkg libffi
# Clean up files from old versions that would not be replaced
# You may want to skip or at least be cautious about removing the old
# library files, in case they are in use by something running right now
# (check with lsof)
find /usr/doc -maxdepth 1 -type d -name "libffi-*" -exec rm -r {} \;
find /usr/lib -maxdepth 1 -type d -name "libffi-*" -exec rm -r {} \;
test -d /usr/lib64 &&
( find /usr/lib64 -maxdepth 1 -type d -name "libffi-*" -exec rm -r {} \;
rm -f /usr/lib64/libffi.* )
## If 'make' fails here, because it is linked with libffo.so.6
## (ldd /usr/bin/make|grep libffi) and you just
## removed it, you can do something like this in a pinch (maybe):
# cp -a x86_64-pc-linux-gnu/.libs/libffi.so.8.1.2 /usr/lib64/
# ln -s /usr/lib64/libffi.so.8.1.2 /usr/lib64/libffi.so.6
# ldconfig
# Install it
make install
ldconfig
# Become your non-root user again
exit
# Keep the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/libffi-*.tar.*
mv libffi-3.4.4.tar.gz installed/
# If you ever want to uninstall libffi, this should do it:
cd
su
test -d src/libffi-* && ( cd src/libffi-* ; make uninstall )
find /usr/doc -maxdepth 1 -type d -name "libffi-*" -exec rm -r {} \;
( cd /usr/include
rm -f ffi.h ffitarget.h )
find /usr/lib -maxdepth 1 -type d -name "libffi-*" -exec rm -r {} \;
test -d /usr/lib64 &&
find /usr/lib64 -maxdepth 1 -type d -name "libffi-*" -exec rm -r {} \;
( cd /usr/man/man3 ; rm -f ffi.3 ffi_*.3 )
rm -f /usr/info/libffi.info /usr/lib*/libffi.* /usr/lib*/pkgconfig/libffi.pc
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "libffi-*" -exec rm -r {} \;
rm -f ~/installed/libffi-*.tar.*