Building from source - fpdetective/phantomjs GitHub Wiki
You can follow the instructions below to build modified PhantomJS on Ubuntu:
sudo apt-get update
sudo apt-get install build-essential chrpath git-core libssl-dev libfontconfig1-dev
git clone git://github.com/fpdetective/phantomjs.git
cd phantomjs
git checkout 1.9
./build.sh
For more information, please read PhantomJS build instructions.
Please note that you need to use git://github.com/fpdetective/phantomjs.git instead of git://github.com/ariya/phantomjs.git as the repository URL to build modified PhantomJS.