2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fetchpatch
|
2020-01-06 11:17:25 +00:00
|
|
|
, bison, flex, fontconfig, freetype, gperf, icu, openssl, libjpeg
|
2017-08-04 10:44:14 +01:00
|
|
|
, libpng, perl, python, ruby, sqlite, qtwebkit, qmake, qtbase
|
2017-10-02 22:08:48 +01:00
|
|
|
, darwin, writeScriptBin, cups, makeWrapper
|
2015-07-07 14:30:41 +01:00
|
|
|
}:
|
|
|
|
|
2016-01-13 05:52:39 +00:00
|
|
|
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 {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "phantomjs";
|
2016-04-06 12:29:45 +01:00
|
|
|
version = "2.1.1";
|
2015-07-07 14:30:41 +01:00
|
|
|
|
2017-08-04 10:44:14 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ariya";
|
|
|
|
repo = "phantomjs";
|
|
|
|
rev = version;
|
|
|
|
sha256 = "1zsbpk1sgh9a16f1a5nx3qvk77ibjn812wqkxqck8n6fia85m5iq";
|
2015-07-07 14:30:41 +01:00
|
|
|
};
|
|
|
|
|
2017-08-04 10:44:14 +01:00
|
|
|
nativeBuildInputs = [ qmake ];
|
|
|
|
buildInputs = [
|
2020-01-06 11:17:25 +00:00
|
|
|
bison flex fontconfig freetype gperf icu openssl
|
2017-08-04 10:44:14 +01:00
|
|
|
libjpeg libpng perl python ruby sqlite qtwebkit qtbase
|
2017-10-02 22:08:48 +01:00
|
|
|
makeWrapper
|
2017-08-04 10:44:14 +01:00
|
|
|
] ++ stdenv.lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
|
|
|
|
AGL ApplicationServices AppKit Cocoa OpenGL
|
|
|
|
darwin.libobjc fakeClang cups
|
|
|
|
]);
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
2020-04-01 02:11:51 +01:00
|
|
|
url = "https://salsa.debian.org/debian/phantomjs/raw/0b20f0dd/debian/patches/build-hardening.patch";
|
2017-08-04 10:44:14 +01:00
|
|
|
sha256 = "1qs1r76w90qgpw742i7lf0y3b7m9zh5wxcbrhrak6mq1kqaphqb5";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
2020-04-01 02:11:51 +01:00
|
|
|
url = "https://salsa.debian.org/debian/phantomjs/raw/0b20f0dd/debian/patches/build-qt-components.patch";
|
2017-08-04 10:44:14 +01:00
|
|
|
sha256 = "1fw2q59aqcks3abvwkqg9903yif6aivdsznc0h6frhhjvpp19vsb";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
2020-04-01 02:11:51 +01:00
|
|
|
url = "https://salsa.debian.org/debian/phantomjs/raw/0b20f0dd/debian/patches/build-qt55-evaluateJavaScript.patch";
|
2017-08-04 10:44:14 +01:00
|
|
|
sha256 = "1avig9cfny8kv3s4mf3mdzvf3xlzgyh351yzwc4bkpnjvzv4fmq6";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
2020-04-01 02:11:51 +01:00
|
|
|
url = "https://salsa.debian.org/debian/phantomjs/raw/0b20f0dd/debian/patches/build-qt55-no-websecurity.patch";
|
2017-08-04 10:44:14 +01:00
|
|
|
sha256 = "1nykqpxa7lcf9iarz5lywgg3v3b1h19iwvjdg4kgq0ai6idhcab8";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
2020-04-01 02:11:51 +01:00
|
|
|
url = "https://salsa.debian.org/debian/phantomjs/raw/0b20f0dd/debian/patches/build-qt55-print.patch";
|
2017-08-04 10:44:14 +01:00
|
|
|
sha256 = "1fydmdjxnplglpbd3ypaih5l237jkxjirpdhzz92mcpy29yla6jw";
|
|
|
|
})
|
2018-01-01 20:02:22 +00:00
|
|
|
(fetchpatch {
|
2020-04-01 02:11:51 +01:00
|
|
|
url = "https://salsa.debian.org/debian/phantomjs/raw/0b20f0dd/debian/patches/unlock-qt.patch";
|
2018-01-01 20:02:22 +00:00
|
|
|
sha256 = "13bwz4iw17d6hq5pwkbpcckqyw7fhc6648lvs26m39pp31zwyp03";
|
|
|
|
})
|
2017-08-04 10:44:14 +01:00
|
|
|
./system-qtbase.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
2015-07-07 14:30:41 +01:00
|
|
|
patchShebangs .
|
2017-08-04 10:44:14 +01:00
|
|
|
substituteInPlace src/phantomjs.pro \
|
|
|
|
--replace "QT_MINOR_VERSION, 5" "QT_MINOR_VERSION, 9"
|
2015-07-07 14:30:41 +01:00
|
|
|
'';
|
|
|
|
|
2019-12-05 12:56:30 +00:00
|
|
|
# Avoids error in webpage.cpp:80:89:
|
|
|
|
# invalid suffix on literal; C++11 requires a space between litend identifier
|
|
|
|
NIX_CFLAGS_COMPILE = "-Wno-reserved-user-defined-literal";
|
|
|
|
|
2016-01-13 05:52:39 +00:00
|
|
|
__impureHostDeps = stdenv.lib.optional stdenv.isDarwin "/usr/lib/libicucore.dylib";
|
|
|
|
|
2016-04-06 12:29:45 +01:00
|
|
|
enableParallelBuilding = true;
|
2015-07-07 14:30:41 +01: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
|
2016-01-13 05:52:39 +00:00
|
|
|
'' + 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
|
2017-10-02 22:08:48 +01:00
|
|
|
'' + ''
|
|
|
|
wrapProgram $out/bin/phantomjs \
|
2018-01-20 05:49:49 +00:00
|
|
|
--set QT_QPA_PLATFORM offscreen \
|
2017-10-02 22:08:48 +01:00
|
|
|
--prefix PATH : ${stdenv.lib.makeBinPath [ qtbase ]}
|
2015-07-07 14:30:41 +01:00
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2015-07-07 14:30:41 +01:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://phantomjs.org/";
|
2016-01-13 07:31:37 +00:00
|
|
|
license = licenses.bsd3;
|
2015-07-07 14:30:41 +01:00
|
|
|
|
2016-01-13 07:31:37 +00:00
|
|
|
maintainers = [ maintainers.aflatter ];
|
|
|
|
platforms = platforms.darwin ++ platforms.linux;
|
2015-07-07 14:30:41 +01:00
|
|
|
};
|
|
|
|
}
|