Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

PhantomJS 2

thoop edited this page Sep 10, 2014 · 12 revisions

The next version, PhantomJS 2, is still in the development. It will be based on Qt 5.

As of May 2014 it is based on webkit 538.1 (7 months old).

Source code

git clone git:/ariya/phantomjs.git
cd phantomjs

Building

Warning: Building PhantomJS 2 from source can take a very long time (~30 minutes with 4 parallel compile jobs).

Linux

First, install the development packages of the following tools and libraries: GNU C++ compiler, bison, flex, gperf, Perl, Ruby, SQLite, FreeType, FontConfig, OpenSSL, and ICU. The actual package names may vary from one distribution to another.

On Debian-based distro (tested on Ubuntu 14.04), just run:

sudo apt-get install g++ flex bison gperf ruby perl \
  libsqlite3-dev libfontconfig1-dev libicu-dev libfreetype6 libssl-dev

Note: It is recommend also to install ttf-mscorefonts-installer package.

On Fedora-based distro (tested on CentOS 6), just run:

sudo yum -y install gcc gcc-c++ make flex bison gperf ruby \
  openssl-devel freetype-devel fontconfig-devel libicu-devel sqlite-devel \
  libpng-devel libjpeg-devel

Then, launch the build:

./build.sh --confirm

NOTE: Using sh, instead of bash explicitly, has been reported to fail on some systems.

Mac OS X

PhantomJS 2 depends on ICU and QT5.

If you use Homebrew, just run:

brew install qt5 fontconfig icu4c
brew link qt5 # (note: you may need to use --force)

If you don't/can't/won't use Homebrew, install ICU like this:

curl -O http://download.icu-project.org/files/icu4c/53.1/icu4c-53_1-src.tgz
tar xf icu4c-53_1-src.tgz
cd icu/source && ./runConfigureICU MacOSX
make -j4
sudo make install

Then, launch the build (if you've installed qt5 from homebrew use -I and -L paths supplied by it):

./build.sh --confirm --qt-config "-I /usr/local/include/ -L /usr/local/lib/"

FreeBSD

You will need to edit build.sh:

  • Add OSTYPE=freebsd
  • Change the two make -j$COMPILE_JOBS lines near the end to call gmake instead of make
  • Follow the Linux instructions above

Windows

NOTE: MSVC2012 is the toolchain currently supported.

After you get the source code, clone this repository to src\qt\3rdparty. This will download all 3rd party libraries, headers, which are needed to build PhantomJS 2 on Windows.

NOTE: Repository contains libraries for MSVC2012. If you need other versions, please let me know (Vitallium) by creating an issue in repository.

NOTE: You must have Perl, Python, and Ruby on PATH.

Use Visual Studio Command Prompt, go to src\qt\qtbase, and run configure.bat. This might fail, but you should get src\qt\qtbase\bin\qmake.exe.

Now you are ready to build. Use Visual Studio Command Prompt and run

build.cmd

from top directory. The results will go into bin.

Further Development

We have two development repositories: KDAB and Vitallium's. We're in the process of merge these two repositories into one.

The main goal before we will create a branch for 2 version is make PhantomJS build on all supported platforms: Linux, OS X and Windows. Those repositories can be found at:

Clone this wiki locally