Skip to content

Commit

Permalink
v2.1.1 for both wheezy and jessie
Browse files Browse the repository at this point in the history
  • Loading branch information
fg2it committed Aug 29, 2016
1 parent 40cf816 commit 93b4bdc
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 3 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# phantomjs-on-raspberry (raspbian wheezy and jessie)
[Phantomjs](http://phantomjs.org/) *unofficial* binaries for arm based raspberry pi 2.


PhantomJS doesn't provide packages for arm, so these packages are here
to allow easy install of recent versions.

Expand All @@ -11,9 +12,11 @@ if you are not confortable with unofficial packages. Debian packages were create
`fpm`.

## Caveat
Builds are based on v2.0 of PhantomJS which is not yet as static as the developpers want it to be
(see this [issue](https://github.com/ariya/phantomjs/issues/12948)). As a consequence, the binary
in this repo have more dependencies than they should.
Beside the last build, the others are based on v2.0 of PhantomJS which is not
yet as static as the developpers want it to be (see this
[issue](https://github.com/ariya/phantomjs/issues/12948)). As a consequence, the
binary in this repo have more dependencies than they should. In addition, this
prevents the use of a single binary working for both wheezy and jessie.

## License
see Phantomjs [license](https://github.com/ariya/phantomjs/blob/master/LICENSE.BSD).
Expand Down
12 changes: 12 additions & 0 deletions wheezy-jessie/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# phantomjs-on-raspberry (pi 2/*wheezy and jessie*)
[Phantomjs](http://phantomjs.org/) *unofficial* binaries for arm based raspberry pi 2 running raspbian/jessie.

Packages were build, using docker and an armhf wheezy based image, from the PhantomJS
[source](https://github.com/ariya/phantomjs).
Each directory contains a README.md
file that discribes how binaries were build and so, how you can do it yourself
if you are not confortable with unofficial packages. Debian packages were created with
`fpm` and install `phantomjs` in `/usr/local/bin/`.

## License
see Phantomjs [license](https://github.com/ariya/phantomjs/blob/master/LICENSE.BSD).
40 changes: 40 additions & 0 deletions wheezy-jessie/v2.1.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM resin/armv7hf-debian:wheezy
MAINTAINER fg2it

ARG BUILDOP

ENV OPENSSL_FLAGS='no-idea no-mdc2 no-rc5 no-zlib enable-tlsext no-ssl2 no-ssl3 no-ssl3-method enable-rfc3779 enable-cms'

RUN echo "deb-src http://httpredir.debian.org/debian wheezy main" >> /etc/apt/sources.list && \
apt-get update && \
apt-get install -y \
build-essential git flex bison gperf python ruby git libfontconfig1-dev \
dpkg-dev binutils gcc g++ libc-dev \
libjpeg8-dev libpng12-dev

WORKDIR /tmp

RUN git clone git://github.com/ariya/phantomjs.git && \
cd phantomjs && \
git checkout 2.1.1 && \
git submodule init && \
git submodule update && \
apt-get source openssl && \
apt-get source icu

RUN echo "Recompiling OpenSSL" && \
cd phantomjs/openssl-1.0.1e && \
./Configure --prefix=/usr --openssldir=/etc/ssl --libdir=lib ${OPENSSL_FLAGS} linux-armv4 && \
make depend && make && make install

RUN echo "Building the static version of ICU library..." && \
cd phantomjs/icu-4.8.1.1/source && \
./configure --prefix=/usr --enable-static --disable-shared && \
make && make install


RUN echo "Compiling PhantomJS..." && \
cd phantomjs && \
python build.py ${BUILDOP} --confirm --release --qt-config="-no-pkg-config" --git-clean-qtbase --git-clean-qtwebkit

CMD ["/bin/bash"]
81 changes: 81 additions & 0 deletions wheezy-jessie/v2.1.1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# phantomjs-on-raspberry (pi 2/*wheezy and jessie*)
[Phantomjs](http://phantomjs.org/) *unofficial* binaries for arm based raspberry pi 2 running raspbian/wheezy or raspbian/jessie.

## Binary
Binary build from commit tag
[v2.1.1](https://github.com/ariya/phantomjs/tree/2.1.1): I mearly adapt the
[docker build process](https://github.com/ariya/phantomjs/blob/2.1.1/deploy/docker-build.sh).
See the `Dockerfile`.

As can be seen from this `Dockerfile`, the base image used is resin/armv7hf-
debian:wheezy. The build was not done on a Pi but in x64-debian-vm running the
docker container. Nothing fancy on the debian-vm, but the resin container comes
with a nice feature: it inclures a `qemu-arm-static` binary. Thus you can run
it on a x64 cpu easily. The details are in a [blog post](https://resin.io/blog
/building-arm-containers-on-any-x86-machine-even-dockerhub/) of resin.

Basically, for us, mere mortal (well, not exactly since you need to have root
power), we just have to do:
```bash
mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm-static:' > /proc/sys/fs/binfmt_misc/register
```

## Do it yourself
If you want to build Phantomjs yourself, be patient, your up for several hours.
If you plan to use your raspberry pi, you should :
- increase the swap. This can be done by changing `CONF_SWAPSIZE` (in megabytes,
512 was enough for me)
in `/etc/dphys-swapfile` and restarting the daemon to take the change into account:
```bash
$ sudo service dphys-swapfile stop
$ sudo service dphys-swapfile start
```
- don't use all the core. This allows to limit memory consumption during build process and, so, swapping (which is bad for memory card and compile time). Two should be fine.
```bash
docker build --build-arg BUILDOP='-j 2' -t phjs-build .
```

## PhantomJs Install
### Manual
You should only have to download the binary and install the dependencies:
```bash
sudo apt-get install libfontconfig
curl -o /tmp/phantomjs -sSL https://github.com/fg2it/phantomjs-on-raspberry/releases/download/v2.1.1/phantomjs
sudo mv /tmp/phantomjs /usr/local/bin/phantomjs
```

### Package
```bash
sudo apt-get install libfontconfig
curl -o /tmp/phantomjs_2.1.1_armhf.deb -sSL https://github.com/fg2it/phantomjs-on-raspberry/releases/download/v2.1.1/phantomjs_2.1.1_armhf.deb
sudo dpkg -i /tmp/phantomjs_2.1.1_armhf.deb
```
The package will install `phantomjs` in `/usr/local/bin`.

The package was created with `fpm` :
```bash
fpm -s dir -t deb --description "Unofficial PhantomJS Package" --url https://github.com/fg2it/phantomjs-on-raspberry --license BSD -n phantomjs --vendor "" --maintainer [email protected] --version 2.1.1 --depends libfontconfig1 --depends libfreetype6 usr/
```

```bash
$ dpkg -I phantomjs_2.1.1_armhf.deb
new debian package, version 2.0.
size 22593558 bytes: control archive=461 bytes.
288 bytes, 11 lines control
129 bytes, 2 lines md5sums
Package: phantomjs
Version: 2.1.1
License: BSD
Architecture: armhf
Maintainer: [email protected]
Installed-Size: 47386
Depends: libfontconfig1, libfreetype6
Section: default
Priority: extra
Homepage: https://github.com/fg2it/phantomjs-on-raspberry
Description: Unofficial PhantomJS Package
```

## License
see Phantomjs [license](https://github.com/ariya/phantomjs/blob/master/LICENSE.BSD).
Binary file added wheezy-jessie/v2.1.1/phantomjs
Binary file not shown.
Binary file added wheezy-jessie/v2.1.1/phantomjs_2.1.1_armhf.deb
Binary file not shown.

0 comments on commit 93b4bdc

Please sign in to comment.