Get Source
Phantomjs source can be get from Github.
AArch64 support is introduced in since v2.1.0. For any version later than this, you can just build it without any patches. For versions before 2.1.0 you need to make changes to make it work on aarch64. These changes may be specific to certain version. A patche for most common used version, 1.9.8, is provided in here.
Install dependencies
For Ubuntu-16.04
sudo apt-get install build-essential g++ flex bison gperf ruby perl \ libsqlite3-dev libfontconfig1-dev libicu-dev libfreetype6 libssl-dev \ libpng-dev libjpeg-dev python libx11-dev libxext-dev
For CentOS-7
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
Build Steps
For version before 2.1.0
./build.sh --confirm --jobs $(getconf _NPROCESSORS_ONLN)
For version after 2.0.0
./build.py -c -j $(getconf _NPROCESSORS_ONLN)
Test
./test/run-tests.py
Install
./deploy/package.sh