-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
139 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
Binary file not shown.