mirror of
https://github.com/encounter/phantomjs.git
synced 2026-03-30 11:35:11 -07:00
153 lines
6.4 KiB
HTML
Executable File
153 lines
6.4 KiB
HTML
Executable File
<!doctype html>
|
|
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
|
|
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
|
|
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
|
|
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>PhantomJS: Build Instructions</title>
|
|
<meta name="description" content="">
|
|
<meta name="author" content="">
|
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
<link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'>
|
|
<link rel="stylesheet" href="screen.min.css">
|
|
<script type="text/javascript">
|
|
var _gaq = _gaq || [];
|
|
_gaq.push(['_setAccount', 'UA-21665893-1']);
|
|
_gaq.push(['_trackPageview']);
|
|
(function() {
|
|
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
|
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
|
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
|
})();
|
|
</script>
|
|
<style>
|
|
#description p {
|
|
line-height: 125%;
|
|
text-align: left;
|
|
margin-bottom: 10px;
|
|
margin-top: 10px;
|
|
}
|
|
|
|
#description h2 {
|
|
text-align: left;
|
|
margin: 0.8em 0;
|
|
}
|
|
|
|
#description pre {
|
|
margin-left: 1em;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="intro">
|
|
<div id="header" class="container_12">
|
|
<a href="index.html" class="grid_4 alpha"><img src="images/phantomjs-logo.png" alt="PhantomJS" id="logo" width="240" height="80"></a>
|
|
<ul id="nav" class="grid_8 omega">
|
|
<li><a href="https://github.com/ariya/phantomjs">Source Code</a></li>
|
|
<li><a href="https://github.com/ariya/phantomjs/wiki">Documentation</a></li>
|
|
<li><a href="https://github.com/ariya/phantomjs/wiki/API-Reference">API</a></li>
|
|
<li><a href="https://github.com/ariya/phantomjs/wiki/Examples">Examples</a></li>
|
|
<li><a href="faq.html">FAQ</a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div id="introduction" class="container_12">
|
|
<div class="grid_7 alpha">
|
|
<h1>Build Instructions</h1>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="description" class="container_12">
|
|
|
|
<div class="grid_10">
|
|
|
|
<p><strong>Note</strong>: Starting for PhantomJS 1.5, there is a significant change in the build workflow. Before starting to build, ensure that the repository is clean from the build files of any previous versions. This can be done by using the <a href="http://linux.die.net/man/1/git-clean">Git clean</a> command. Alternatively, get a fresh clone of the repository.
|
|
|
|
<p><strong>Warning</strong>: Compiling PhantomJS from source takes a long time, mainly due to thousands of files in the WebKit module. With 4 parallel compile jobs on a modern machine, the entire process takes roughly 30 minutes. It is highly recommended to download and install the ready-made <a href="download.html">binary package</a> if it is available.</p>
|
|
|
|
<h2 id="mac">Mac OS X</h2>
|
|
|
|
<p>Install <a href="https://developer.apple.com/xcode/">Xcode</a> and the necessary SDK for development (gcc, various tools, libraries, etc).</p>
|
|
|
|
<pre>
|
|
git clone git://github.com/ariya/phantomjs.git
|
|
cd phantomjs
|
|
git checkout 1.7
|
|
./build.sh
|
|
</pre>
|
|
|
|
<p>This produces a static build <code>bin/phantomjs</code>. This is a self-contained executable, it can be moved to a different directory or another machine.</p>
|
|
|
|
<h2 id="linux">Linux</h2>
|
|
|
|
<p>For Ubuntu Linux (tested on a barebone install of Ubuntu 10.04 Lucid Lynx and Ubuntu 11.04 Natty Narwhal):</p>
|
|
|
|
<pre>
|
|
sudo apt-get install build-essential chrpath git-core libssl-dev libfontconfig1-dev
|
|
git clone git://github.com/ariya/phantomjs.git
|
|
cd phantomjs
|
|
git checkout 1.7
|
|
./build.sh
|
|
</pre>
|
|
|
|
<p>For Amazon EC2 AMI (tested on AMI release 2011.09 and 2012.03):</p>
|
|
|
|
<pre>
|
|
sudo yum install gcc gcc-c++ make git openssl-devel freetype-devel fontconfig-devel
|
|
git clone git://github.com/ariya/phantomjs.git
|
|
cd phantomjs
|
|
git checkout 1.7
|
|
./build.sh --jobs 1
|
|
</pre>
|
|
|
|
<p><strong>Note 1</strong>: <code>build.sh</code> by default will launch parallel compile jobs depending on the available CPU cores, e.g. 4 jobs on a modern hyperthreaded dual-core processor. If necessary, e.g. when building on a virtual machine/server or other limited environment, reduce the jobs by passing a number, e.g <code>./build.sh --jobs 1</code> to set only one compile job at a time.</p>
|
|
|
|
<p><strong>Note 2</strong>: After finishing the build, run <code>deploy/package.sh</code> which creates PhantomJS binary tarball that can be moved around and/or extracted to a different location. This is the correct way to install the built binary into an arbitrary directory, i.e. do not simply copy the executable as it won't work.</p>
|
|
|
|
<h2 id="windows">Windows</h2>
|
|
|
|
<p>Install <a href="http://www.microsoft.com/visualstudio/">Microsoft Visual C++</a>, either version 2010 or 2008 (the <a href="http://www.microsoft.com/visualstudio/en-us/products/2010-editions/express">Express edition</a> should work just fine).</p>
|
|
|
|
<p>First step is to build OpenSSL static library. Go to <a href="http://www.openssl.org/source/">openssl.org/source</a> and download the source package (tested with version 1.0.1). Unpack the package to a working directory, e.g. <code>C:\openssl</code>. Configure and build OpenSSL:</p>
|
|
<pre>
|
|
perl Configure VC-WIN32 no-asm --prefix=C:\openssl
|
|
ms\do_ms
|
|
nmake -f ms\nt.mak install
|
|
</pre>
|
|
<p>Get PhantomJS source code:</p>
|
|
<pre>
|
|
git clone git://github.com/ariya/phantomjs.git
|
|
cd phantomjs
|
|
git checkout 1.7
|
|
</pre>
|
|
|
|
<p>Edit file <code>src\qt\preconfig.cmd</code> and change OPEN_SSL_DIR variable to point to the OpenSSL working directory.</p>
|
|
|
|
<p>Finally, compile PhantomJS:</p>
|
|
<pre>
|
|
cd src\qt
|
|
preconfig.cmd
|
|
cd ..\..
|
|
src\qt\bin\qmake -r
|
|
nmake
|
|
</pre>
|
|
|
|
<p>This produces a static build <code>bin/phantomjs.exe</code>. This is a self-contained executable, it can be moved to a different directory or another machine.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div id="footer">
|
|
<div id="footer-content" class="container_12">
|
|
<p>
|
|
© Copyright 2010-2012 <a href="http://twitter.com/AriyaHidayat">Ariya Hidayat</a> — Website design by <a href="http://svay.com/">Maurice Svay</a>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|