Compiling PhantomJS 1.5 on Webfaction

Webfaction is a cool web host because they allow you to compile source code and run custom binaries.  One example of when this might be useful is to run PhantomJS.  Normally, you would download and install the pre-compiled version as described in an earlier post, but I ran into a bug the other day that was fixed in trunk and I couldn't wait for 1.5.1 to be released so I compiled PhantomJS on Webfaction myself and thought I'd share it in case it's useful for anyone else:

mkdir -p $HOME/src

cd $HOME/src

wget 'http://ftp.tux.org/pub/X-Windows/ftp.hungry.com/chrpath/chrpath-0.13.tar.gz'
 
tar -xzf chrpath-0.13.tar.gz
 
cd chrpath-0.13

mkdir build

./configure --prefix=$HOME/src/chrpath-0.13/build

make && make install

cp $HOME/src/chrpath-0.13/build/bin/chrpath $HOME/bin

cd $HOME/src

git clone git://github.com/ariya/phantomjs.git && cd phantomjs
 
git checkout 1.5
 
./build.sh

cp $HOME/src/phantomjs/bin/phantomjs $HOME/bin


To test:

phantomjs --version
 

Comments

Popular Posts