How to install jpegoptim on Ubuntu 16.04

# compile and install libjpeg

mkdir -p "$HOME/tmp/tar_gz"
cd "$HOME/tmp/tar_gz"
if [[ ! -f "$HOME/tmp/tar_gz/jpegsrc.v9c.tar.gz" ]]; then
  wget -O "$HOME/tmp/tar_gz/jpegsrc.v9c.tar.gz" "http://www.ijg.org/files/jpegsrc.v9c.tar.gz"
fi
tar xf "$HOME/tmp/tar_gz/jpegsrc.v9c.tar.gz"
cd "$HOME/tmp/tar_gz/jpeg-9c"
make clean
make distclean
./configure
make
sudo make install
sudo ldconfig

# compile

mkdir -p "$HOME/tmp/tar_gz"
cd "$HOME/tmp/tar_gz"
if [[ ! -f "$HOME/tmp/tar_gz/jpegoptim-1.4.4.tar.gz" ]]; then
  wget -O "$HOME/tmp/tar_gz/jpegoptim-1.4.4.tar.gz" "https://github.com/tjko/jpegoptim/archive/RELEASE.1.4.4.tar.gz"
fi
tar xf "$HOME/tmp/tar_gz/jpegoptim-1.4.4.tar.gz"
if [[ -d "$HOME/tmp/tar_gz/jpegoptim-RELEASE.1.4.4" ]]; then
  cd "$HOME/tmp/tar_gz/jpegoptim-RELEASE.1.4.4"
else
  cd "$HOME/tmp/tar_gz/jpegoptim-1.4.4"
fi
make clean
make distclean
if [[ -f /usr/local/lib/libjpeg.so.9 ]]; then
  ./configure --with-libjpeg=/usr/local/lib
elif [[ -f /usr/lib/libjpeg.so.9 ]]; then
  ./configure --with-libjpeg=/usr/lib
else
  ./configure
fi
make

# install

sudo make install
sudo ldconfig

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.