Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Docker to build Linux executable. #1

Merged
merged 1 commit into from
Jan 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 19 additions & 35 deletions deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,30 @@ packages.
Packaging for Linux
-------------------

Linux building/packaging is best done in a virtual machine to ensure
isolation and clean state. This is also necessary to build for different
architectures.
Linux building/packaging is best done in a container to ensure
isolation. We use [Docker](https://www.docker.com/) to automate the
process. Please see the [Docker documentation](https://docs.docker.com/)
for instructions on installing Docker. For OS X or Windows host,
please use [Docker Toolbox](https://www.docker.com/docker-toolbox).

We use [Vagrant](http://vagrantup.com/) to help with this. Please see
the [Vagrant
documentation](http://vagrantup.com/v1/docs/getting-started/index.html)
for instructions on how to install VirtualBox and Vagrant.
Once you have Docker installed, run these commands from the top level
of the PhantomJS source repository:

Once you have Vagrant installed, building should be as simple as
running:
```bash
$ git clean -xfd .
$ docker run -v $PWD:/src debian:wheezy /src/deploy/docker-build.sh
```

$ export PHANTOMJS_VERSION=1.6.0 # change as necessary
$ vagrant up $ARCH
For the 32-bit version:

Where $ARCH is either `i686` or `x86_64`.
```bash
$ git clean -xfd .
$ docker run -v $PWD:/src tubia/debian:wheezy /src/deploy/docker-build.sh
```

This runs the `provision_vm.sh` script, which installs the necessary
dependencies, checks out a fresh copy of the PhantomJS repository,
switches to the relevant tag, builds and packages the software and the
associated debugging symbols tarball, and copies the tarballs out of the
VM onto your host machine.
The built binary will be extracted out of the container and copied to
the current directory.

If it runs successfully, you will see the tarballs in this directory,
ready for upload.

If there are any problems, you can re-run the script with:

$ vagrant provision $ARCH

Or SSH into the VM:

$ vagrant ssh $ARCH

Once you're done, you can destroy the VM with:

$ vagrant destroy $ARCH

If you need to build a new version, you should destroy the VM and start
again to ensure a clean state. (Or SSH in and do a git clean.)

Packaging for OS X
------------------
Expand All @@ -57,4 +41,4 @@ However, if you have previously built the sources in release mode, you
should clean your tree to make sure all the debugging symbols gets
compiled:

$ make clean && cd src/qt && make clean && cd ../..
$ make clean && cd src/qt && make clean && cd ../..
42 changes: 0 additions & 42 deletions deploy/Vagrantfile

This file was deleted.

63 changes: 63 additions & 0 deletions deploy/docker-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/env bash

set -e

SOURCE_PATH=/src
BUILD_PATH=$HOME/build

# In case the old package URL is still being used
sed -i 's/http\.debian\.net/httpredir\.debian\.org/g' /etc/apt/sources.list

echo "Installing packages for development tools..." && sleep 1
apt-get -y update
apt-get install -y build-essential git flex bison gperf python ruby git libfontconfig1-dev
echo

echo "Preparing to download Debian source package..."
echo "deb-src http://httpredir.debian.org/debian wheezy main" >> /etc/apt/sources.list
apt-get -y update
echo

OPENSSL_TARGET='linux-x86_64'
if [ `getconf LONG_BIT` -eq 32 ]; then
OPENSSL_TARGET='linux-generic32'
fi
echo "Recompiling OpenSSL for ${OPENSSL_TARGET}..." && sleep 1
apt-get source openssl
cd openssl-1.0.1e
OPENSSL_FLAGS='no-idea no-mdc2 no-rc5 no-zlib enable-tlsext no-ssl2 no-ssl3 no-ssl3-method enable-rfc3779 enable-cms'
./Configure --prefix=/usr --openssldir=/etc/ssl --libdir=lib ${OPENSSL_FLAGS} ${OPENSSL_TARGET}
make depend && make && make install
cd ..
echo

echo "Building the static version of ICU library..." && sleep 1
apt-get source icu
cd icu-4.8.1.1/source
./configure --prefix=/usr --enable-static --disable-shared
make && make install
cd ..
echo

echo "Recreating the build directory $BUILD_PATH..."
rm -rf $BUILD_PATH && mkdir -p $BUILD_PATH
echo

echo "Transferring the source: $SOURCE_PATH -> $BUILD_PATH. Please wait..."
cd $BUILD_PATH && cp -rp $SOURCE_PATH . && cd src
echo

echo "Compiling PhantomJS..." && sleep 1
python build.py --confirm --qt-config="-no-pkg-config" --git-clean-qtbase --git-clean-qtwebkit
echo

echo "Stripping the executable..." && sleep 1
ls -l bin/phantomjs
strip bin/phantomjs
echo "Copying the executable..." && sleep 1
ls -l bin/phantomjs
cp bin/phantomjs $SOURCE_PATH
echo

echo "Finished."

42 changes: 0 additions & 42 deletions deploy/provision-vm.sh

This file was deleted.