-
-
Save wangkai2014/7c7b4f915cf9efb9271c2127e9f10a76 to your computer and use it in GitHub Desktop.
pdf2htmlEX install shell script for Ubuntu 16.04, using latest sources
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# pdf2htmlEX install shell script for Ubuntu 16.04, using latest sources | |
# Created by James A. Prempeh ( github.com/prmph ) | |
HOME_PATH=$(cd ~/ && pwd) | |
LINUX_ARCH="$(lscpu | grep 'Architecture' | awk -F\: '{ print $2 }' | tr -d ' ')" | |
POPPLER_SOURCE="https://poppler.freedesktop.org/poppler-0.43.0.tar.xz" | |
FONTFORGE_SOURCE="https://github.com/fontforge/fontforge.git" | |
PDF2HTMLEX_SOURCE="https://github.com/coolwanglu/pdf2htmlEX.git" | |
if [ "$LINUX_ARCH" == "x86_64" ]; then | |
echo "Updating all Ubuntu software repository lists ..." | |
apt-get update | |
echo "Installing gnu m4..." | |
wget ftp://ftp.gnu.org/gnu/m4/m4-1.4.17.tar.gz | |
tar -xvzf m4-1.4.17.tar.gz | |
cd m4-1.4.17 | |
./configure --prefix=/usr/local/m4 | |
make | |
sudo make install | |
cd "$HOME_PATH" | |
echo "Installing basic dependencies ..." | |
apt-get install -qq -y cmake gcc libgetopt++-dev git | |
echo "Installing poppler dependencies..." | |
apt-get install -qq -y pkg-config libopenjpeg-dev libfontconfig1-dev libfontforge-dev poppler-data poppler-utils poppler-dbg | |
echo "Downloading poppler via source ..." | |
wget "$POPPLER_SOURCE" --no-check-certificate | |
tar -xvf poppler-0.43.0.tar.xz | |
cd poppler-0.43.0/ | |
./configure --enable-xpdf-headers | |
make | |
sudo make install | |
echo "Installing fontforge dependencies..." | |
cd "$HOME_PATH" | |
apt-get install -qq -y packaging-dev pkg-config python-dev libpango1.0-dev libglib2.0-dev libxml2-dev giflib-dbg | |
apt-get install -qq -y libjpeg-dev libtiff-dev uthash-dev libspiro-dev | |
echo "cloning fontforge via source ..." | |
git clone --depth 1 "$FONTFORGE_SOURCE" | |
cd fontforge/ | |
./bootstrap | |
./configure | |
make | |
sudo make install | |
echo "Installing Pdf2htmlEx ..." | |
cd "$HOME_PATH" | |
git clone --depth 1 "$PDF2HTMLEX_SOURCE" | |
cd pdf2htmlEX/ | |
cmake . | |
make | |
sudo make install | |
echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> ~/.bashrc | |
source ~/.bashrc | |
cd "$HOME_PATH" && rm -rf "poppler-0.43.0.tar.xz" | |
cd "$HOME_PATH" && rm -rf "poppler-0.43.0" | |
cd "$HOME_PATH" && rm -rf "fontforge" | |
cd "$HOME_PATH" && rm -rf "pdf2htmlEX" | |
else | |
echo "********************************************************************" | |
echo "This script currently doesn't supports $LINUX_ARCH Linux archtecture" | |
fi | |
echo "----------------------------------" | |
echo "Restart your Ubuntu session for installation to complete..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment