2015-10-05 11:23:02 +01:00
|
|
|
{ stdenv, lib, fetchurl, freetype, fontconfig, openssl, unzip }:
|
2012-12-13 16:09:41 +00:00
|
|
|
|
2015-10-05 11:23:02 +01:00
|
|
|
let
|
|
|
|
platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ];
|
|
|
|
in
|
2012-12-13 16:09:41 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2014-11-05 21:23:25 +00:00
|
|
|
name = "phantomjs-1.9.8";
|
2012-12-13 16:09:41 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2018-08-20 20:11:29 +01:00
|
|
|
src = if stdenv.hostPlatform.system == "i686-linux" then
|
2012-12-13 16:09:41 +00:00
|
|
|
fetchurl {
|
2014-01-28 00:39:20 +00:00
|
|
|
url = "https://bitbucket.org/ariya/phantomjs/downloads/${name}-linux-i686.tar.bz2";
|
2014-11-05 21:23:25 +00:00
|
|
|
sha256 = "11fzmssz9pqf3arh4f36w06sl2nyz8l9h8iyxyd7w5aqnq5la0j1";
|
2012-12-13 16:09:41 +00:00
|
|
|
}
|
2014-02-11 23:46:46 +00:00
|
|
|
else
|
2018-08-20 20:11:29 +01:00
|
|
|
if stdenv.hostPlatform.system == "x86_64-linux" then
|
2014-02-11 23:46:46 +00:00
|
|
|
fetchurl {
|
|
|
|
url = "https://bitbucket.org/ariya/phantomjs/downloads/${name}-linux-x86_64.tar.bz2";
|
2014-11-05 21:23:25 +00:00
|
|
|
sha256 = "0fhnqxxsxhy125fmif1lwgnlhfx908spy7fx9mng4w72320n5nd1";
|
2014-02-11 23:46:46 +00:00
|
|
|
}
|
|
|
|
else # x86_64-darwin
|
|
|
|
fetchurl {
|
|
|
|
url = "https://bitbucket.org/ariya/phantomjs/downloads/${name}-macosx.zip";
|
2014-11-05 21:23:25 +00:00
|
|
|
sha256 = "0j0aq8dgzmb210xdrh0v3d4nblskl3zsckl8bzf1a603wcx085cg";
|
2014-02-11 23:46:46 +00:00
|
|
|
};
|
|
|
|
|
2015-10-05 11:23:02 +01:00
|
|
|
buildInputs = lib.optional stdenv.isDarwin unzip;
|
2012-12-13 16:09:41 +00:00
|
|
|
|
2015-10-05 11:23:02 +01:00
|
|
|
buildPhase = lib.optionalString (!stdenv.isDarwin) ''
|
2012-12-13 16:09:41 +00:00
|
|
|
patchelf \
|
2014-12-17 18:11:30 +00:00
|
|
|
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
2015-10-05 11:23:02 +01:00
|
|
|
--set-rpath "${stdenv.lib.makeLibraryPath [ freetype fontconfig stdenv.cc.cc stdenv.cc.cc openssl ]}" \
|
2012-12-13 16:09:41 +00:00
|
|
|
bin/phantomjs
|
|
|
|
'';
|
|
|
|
|
2013-10-02 06:17:32 +01:00
|
|
|
dontPatchELF = true;
|
|
|
|
dontStrip = true;
|
2012-12-13 16:09:41 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2019-07-10 20:52:51 +01:00
|
|
|
homepage = https://phantomjs.org/;
|
2015-10-05 11:23:02 +01:00
|
|
|
license = lib.licenses.bsd3;
|
2012-12-13 16:09:41 +00:00
|
|
|
|
2015-10-05 11:23:02 +01:00
|
|
|
maintainers = [ lib.maintainers.bluescreen303 ];
|
|
|
|
inherit platforms;
|
2012-12-13 16:09:41 +00:00
|
|
|
};
|
|
|
|
}
|