about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/phantomjs2
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:36 +0000
committerAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:47 +0000
commit36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch)
treeb3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/development/tools/phantomjs2
parent4e31070265257dc67d120c27e0f75c2344fdfa9a (diff)
parentabf060725d7614bd3b9f96764262dfbc2f9c2199 (diff)
downloadnixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs
git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a
git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/development/tools/phantomjs2')
-rw-r--r--nixpkgs/pkgs/development/tools/phantomjs2/default.nix114
-rw-r--r--nixpkgs/pkgs/development/tools/phantomjs2/system-qtbase.patch13
2 files changed, 127 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/tools/phantomjs2/default.nix b/nixpkgs/pkgs/development/tools/phantomjs2/default.nix
new file mode 100644
index 000000000000..51cecd81ecac
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/phantomjs2/default.nix
@@ -0,0 +1,114 @@
+{ stdenv, fetchFromGitHub, fetchpatch
+, bison2, flex, fontconfig, freetype, gperf, icu, openssl, libjpeg
+, libpng, perl, python, ruby, sqlite, qtwebkit, qmake, qtbase
+, darwin, writeScriptBin, cups, makeWrapper
+}:
+
+let
+  fakeClang = writeScriptBin "clang" ''
+    #!${stdenv.shell}
+    if [[ "$@" == *.c ]]; then
+      exec "${stdenv.cc}/bin/clang" "$@"
+    else
+      exec "${stdenv.cc}/bin/clang++" "$@"
+    fi
+  '';
+
+in stdenv.mkDerivation rec {
+  name = "phantomjs-${version}";
+  version = "2.1.1";
+
+  src = fetchFromGitHub {
+    owner = "ariya";
+    repo = "phantomjs";
+    rev = version;
+    sha256 = "1zsbpk1sgh9a16f1a5nx3qvk77ibjn812wqkxqck8n6fia85m5iq";
+  };
+
+  nativeBuildInputs = [ qmake ];
+  buildInputs = [
+    bison2 flex fontconfig freetype gperf icu openssl
+    libjpeg libpng perl python ruby sqlite qtwebkit qtbase
+    makeWrapper
+  ] ++ stdenv.lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
+    AGL ApplicationServices AppKit Cocoa OpenGL
+    darwin.libobjc fakeClang cups
+  ]);
+
+  patches = [
+    (fetchpatch {
+      url = https://salsa.debian.org/debian/phantomjs/raw/0b20f0dd/debian/patches/build-hardening.patch;
+      sha256 = "1qs1r76w90qgpw742i7lf0y3b7m9zh5wxcbrhrak6mq1kqaphqb5";
+    })
+    (fetchpatch {
+      url = https://salsa.debian.org/debian/phantomjs/raw/0b20f0dd/debian/patches/build-qt-components.patch;
+      sha256 = "1fw2q59aqcks3abvwkqg9903yif6aivdsznc0h6frhhjvpp19vsb";
+    })
+    (fetchpatch {
+      url = https://salsa.debian.org/debian/phantomjs/raw/0b20f0dd/debian/patches/build-qt55-evaluateJavaScript.patch;
+      sha256 = "1avig9cfny8kv3s4mf3mdzvf3xlzgyh351yzwc4bkpnjvzv4fmq6";
+    })
+    (fetchpatch {
+      url = https://salsa.debian.org/debian/phantomjs/raw/0b20f0dd/debian/patches/build-qt55-no-websecurity.patch;
+      sha256 = "1nykqpxa7lcf9iarz5lywgg3v3b1h19iwvjdg4kgq0ai6idhcab8";
+    })
+    (fetchpatch {
+      url = https://salsa.debian.org/debian/phantomjs/raw/0b20f0dd/debian/patches/build-qt55-print.patch;
+      sha256 = "1fydmdjxnplglpbd3ypaih5l237jkxjirpdhzz92mcpy29yla6jw";
+    })
+    (fetchpatch {
+      url = https://salsa.debian.org/debian/phantomjs/raw/0b20f0dd/debian/patches/unlock-qt.patch;
+      sha256 = "13bwz4iw17d6hq5pwkbpcckqyw7fhc6648lvs26m39pp31zwyp03";
+    })
+    ./system-qtbase.patch
+  ];
+
+  postPatch = ''
+    patchShebangs .
+    substituteInPlace src/phantomjs.pro \
+      --replace "QT_MINOR_VERSION, 5" "QT_MINOR_VERSION, 9"
+  '';
+
+  __impureHostDeps = stdenv.lib.optional stdenv.isDarwin "/usr/lib/libicucore.dylib";
+
+  enableParallelBuilding = 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
+  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+    install_name_tool -change \
+        ${darwin.CF}/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation \
+        /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation \
+      -change \
+        ${darwin.configd}/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration \
+        /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration \
+    $out/bin/phantomjs
+  '' + ''
+    wrapProgram $out/bin/phantomjs \
+    --set QT_QPA_PLATFORM offscreen \
+    --prefix PATH : ${stdenv.lib.makeBinPath [ qtbase ]}
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Headless WebKit with JavaScript API";
+    longDescription = ''
+      PhantomJS2 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 = licenses.bsd3;
+
+    maintainers = [ maintainers.aflatter ];
+    platforms = platforms.darwin ++ platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/tools/phantomjs2/system-qtbase.patch b/nixpkgs/pkgs/development/tools/phantomjs2/system-qtbase.patch
new file mode 100644
index 000000000000..743372b0f0bc
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/phantomjs2/system-qtbase.patch
@@ -0,0 +1,13 @@
+--- a/build.py
++++ b/build.py
+@@ -80,9 +80,9 @@
+ def qmakePath():
+     exe = "qmake"
+     if platform.system() == "Windows":
+         exe += ".exe"
+-    return os.path.abspath("src/qt/qtbase/bin/" + exe)
++    return os.path.abspath("@qtbase@" + exe)
+ 
+ # returns paths for 3rd party libraries (Windows only)
+ def findThirdPartyDeps():
+     include_dirs = []