Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at release-19.03 70 lines 2.4 kB view raw
1{ stdenv, lib, fetchurl, freetype, fontconfig, openssl, unzip }: 2 3let 4 platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ]; 5in 6 7stdenv.mkDerivation rec { 8 name = "phantomjs-1.9.8"; 9 10 # I chose to use the binary build for now. 11 # The source version is quite nasty to compile 12 # because it has bundled a lot of external libraries (like QT and Webkit) 13 # and no easy/nice way to use the system versions of these 14 15 src = if stdenv.hostPlatform.system == "i686-linux" then 16 fetchurl { 17 url = "https://bitbucket.org/ariya/phantomjs/downloads/${name}-linux-i686.tar.bz2"; 18 sha256 = "11fzmssz9pqf3arh4f36w06sl2nyz8l9h8iyxyd7w5aqnq5la0j1"; 19 } 20 else 21 if stdenv.hostPlatform.system == "x86_64-linux" then 22 fetchurl { 23 url = "https://bitbucket.org/ariya/phantomjs/downloads/${name}-linux-x86_64.tar.bz2"; 24 sha256 = "0fhnqxxsxhy125fmif1lwgnlhfx908spy7fx9mng4w72320n5nd1"; 25 } 26 else # x86_64-darwin 27 fetchurl { 28 url = "https://bitbucket.org/ariya/phantomjs/downloads/${name}-macosx.zip"; 29 sha256 = "0j0aq8dgzmb210xdrh0v3d4nblskl3zsckl8bzf1a603wcx085cg"; 30 }; 31 32 buildInputs = lib.optional stdenv.isDarwin unzip; 33 34 buildPhase = lib.optionalString (!stdenv.isDarwin) '' 35 patchelf \ 36 --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ 37 --set-rpath "${stdenv.lib.makeLibraryPath [ freetype fontconfig stdenv.cc.cc stdenv.cc.cc openssl ]}" \ 38 bin/phantomjs 39 ''; 40 41 dontPatchELF = true; 42 dontStrip = true; 43 44 installPhase = '' 45 mkdir -p $out/share/doc/phantomjs 46 cp -a bin $out 47 cp -a ChangeLog examples LICENSE.BSD README.md third-party.txt $out/share/doc/phantomjs 48 ''; 49 50 meta = { 51 description = "Headless WebKit with JavaScript API"; 52 longDescription = '' 53 PhantomJS is a headless WebKit with JavaScript API. 54 It has fast and native support for various web standards: 55 DOM handling, CSS selector, JSON, Canvas, and SVG. 56 57 PhantomJS is an optimal solution for: 58 - Headless Website Testing 59 - Screen Capture 60 - Page Automation 61 - Network Monitoring 62 ''; 63 64 homepage = http://phantomjs.org/; 65 license = lib.licenses.bsd3; 66 67 maintainers = [ lib.maintainers.bluescreen303 ]; 68 inherit platforms; 69 }; 70}