-
Notifications
You must be signed in to change notification settings - Fork 1
Home
This is a guide on how to create custom buildpacks for cloud foundry. Using the python-pdf2htmlEX-buildpack as an example, we will go through each step we need to take.
First of all, start off with a preexisting buildpack wherever possible. Since want to have python in our buildpack, we copied the python-buildpack. It includes already everything we need to use python. If you push your app to cloud foundry using this buildpack, it will automatically install all the requirements specified in your requirements.txt file.
So now let's see how we can add another program to our buildpack, in this case pdf2htmlEX, which converts pdfs to html files.
At first we need to get the binaries for pdf2htmlEX. Since the cloud foundry container is based on a Ubuntu 14.04 system, we are going to install pdf2htmlEX on a Ubuntu 14.04 system. Sometimes you can just install your program with apt-get. Unfortunately pdf2htmlEX is not part of the Ubuntu repositories, so we are going to compile it on our own.
At first we are installing all the dependencies we can install with apt-get:
sudo apt-get update && sudo apt-get install -qq git cmake autotools-dev libjpeg-dev libtiff4-dev libpng12-dev libgif-dev libxt-dev autoconf automake libtool bzip2 libxml2-dev libuninameslist-dev libspiro-dev python-dev libpango1.0-dev libcairo2-dev chrpath uuid-dev uthash-dev libopenjpeg-dev
Next we install poppler (for some reason I was not able to compile the newest version, so we are using version 0.33.0):
wget http://poppler.freedesktop.org/poppler-0.33.0.tar.xz
tar -xvf poppler-0.33.0.tar.xz
cd poppler-0.33.0/
./configure --enable-xpdf-headers
make
sudo make install
cd ..
Next we install fontforge:
git clone https://github.com/coolwanglu/fontforge.git fontforge.git
cd fontforge.git
git checkout pdf2htmlEX
./autogen.sh
./configure
make
sudo make install
Finally we can install pdf2htmlEX:
git clone git://github.com/coolwanglu/pdf2htmlEX.git
cd pdf2htmlEX
cmake .
make
sudo make install