about summary refs log tree commit diff
path: root/pkgs/development/tools/phantomjs
diff options
context:
space:
mode:
authorMathijs Kwik <mathijs@bluescreen303.nl>2012-12-13 17:09:41 +0100
committerMathijs Kwik <mathijs@bluescreen303.nl>2012-12-13 17:51:03 +0100
commit2cdc567ff5b725dc0f04aa562c54c26019397244 (patch)
tree1edcac7f59db660025c646dcf0087cc85d2be094 /pkgs/development/tools/phantomjs
parent591c27e58d810fcbe8ef9ddfe52ce15d6035f20b (diff)
downloadnixlib-2cdc567ff5b725dc0f04aa562c54c26019397244.tar
nixlib-2cdc567ff5b725dc0f04aa562c54c26019397244.tar.gz
nixlib-2cdc567ff5b725dc0f04aa562c54c26019397244.tar.bz2
nixlib-2cdc567ff5b725dc0f04aa562c54c26019397244.tar.lz
nixlib-2cdc567ff5b725dc0f04aa562c54c26019397244.tar.xz
nixlib-2cdc567ff5b725dc0f04aa562c54c26019397244.tar.zst
nixlib-2cdc567ff5b725dc0f04aa562c54c26019397244.zip
new package: phantomjs
Diffstat (limited to 'pkgs/development/tools/phantomjs')
-rw-r--r--pkgs/development/tools/phantomjs/default.nix62
1 files changed, 62 insertions, 0 deletions
diff --git a/pkgs/development/tools/phantomjs/default.nix b/pkgs/development/tools/phantomjs/default.nix
new file mode 100644
index 000000000000..5880afc3efb1
--- /dev/null
+++ b/pkgs/development/tools/phantomjs/default.nix
@@ -0,0 +1,62 @@
+{ stdenv, fetchurl, upx, freetype, fontconfig }:
+
+assert stdenv.lib.elem stdenv.system [ "i686-linux" "x86_64-linux" ];
+
+stdenv.mkDerivation rec {
+  name = "phantomjs-1.7.0";
+
+  # I chose to use the binary build for now.
+  # The source version is quite nasty to compile
+  # because it has bundled a lot of external libraries (like QT and Webkit)
+  # and no easy/nice way to use the system versions of these
+
+  src = if stdenv.system == "i686-linux" then
+          fetchurl {
+            url = "http://phantomjs.googlecode.com/files/${name}-linux-i686.tar.bz2";
+            sha256 = "045d80lymjxnsssa0sgp5pgkahm651jk69ibk3mjczk3ykc1k91f";
+          }
+        else # x86_64-linux
+          fetchurl {
+            url = "http://phantomjs.googlecode.com/files/${name}-linux-x86_64.tar.bz2";
+            sha256 = "1m14czhi3b388didn0a881glsx8bnsg9gnxgj5lghr4l5mgqyrd7";
+          };
+
+  buildNativeInputs = [ upx ];
+
+  buildPhase = ''
+    upx -d bin/phantomjs
+    patchelf \
+      --set-interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
+      --set-rpath ${freetype}/lib:${fontconfig}/lib:${stdenv.gcc.gcc}/lib64:${stdenv.gcc.gcc}/lib \
+      bin/phantomjs
+  '';
+
+  dontStrip = true;
+
+  installPhase = ''
+    mkdir -p $out/share/doc/phantomjs
+    cp -a bin $out
+    cp -a ChangeLog examples LICENSE.BSD README.md third-party.txt $out/share/doc/phantomjs
+  '';
+
+  meta = {
+    description = "Headless WebKit with JavaScript API";
+    longDescription = ''
+      PhantomJS is a headless WebKit with JavaScript API.
+      It has fast and native support for various web standards:
+      DOM handling, CSS selector, JSON, Canvas, and SVG.
+
+      PhantomJS is an optimal solution for:
+      - Headless Website Testing
+      - Screen Capture
+      - Page Automation
+      - Network Monitoring
+    '';
+
+    homepage = http://phantomjs.org/;
+    license = stdenv.lib.licenses.bsd3;
+
+    maintainers = [ stdenv.lib.maintainers.bluescreen303 ];
+    platforms = ["i686-linux" "x86_64-linux" ];
+  };
+}