Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] New package: phantomjs-2.1.1
@ 2023-02-02  6:15 ezag
  2023-02-02  6:55 ` [PR PATCH] [Updated] " ezag
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ezag @ 2023-02-02  6:15 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1823 bytes --]

There is a new pull request by ezag against master on the void-packages repository

https://github.com/ezag/void-packages phantomjs
https://github.com/void-linux/void-packages/pull/42024

New package: phantomjs-2.1.1
This package [has been removed due to dead upstream](https://github.com/void-linux/void-packages/commit/702d6cb7f3a881f32e69d01baaba54217a8c38a8).

However, with few patches cherry-picked from upstream development version, it does build with against current Qt5 version.

Since youtube-dl/yt-dlp still [optionally depends on it](https://github.com/void-linux/void-packages/pull/12244) as fallback to avoid throttling, it would be nice to have this package available, despite its [suspended development](https://github.com/ariya/phantomjs/issues/15344).

<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl (crossbuild)
  - armv7l (crossbuild)
  - armv6l-musl (crossbuild)



A patch file from https://github.com/void-linux/void-packages/pull/42024.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-phantomjs-42024.patch --]
[-- Type: text/x-diff, Size: 60416 bytes --]

From 1f19409ec4ac3b199c08136d9a47058d157eeb65 Mon Sep 17 00:00:00 2001
From: Eugen Zagorodniy <zag@disroot.org>
Date: Thu, 2 Feb 2023 07:41:58 +0200
Subject: [PATCH] New package: phantomjs-2.1.1

---
 ...low-user-to-change-DPI-of-a-web-page.patch |  260 +++++
 ...-Add-support-to-render-pdf-to-base64.patch |  279 +++++
 ...me-API-for-the-latest-QtWebKit-15341.patch |  195 ++++
 .../0004-Use-CMake-build-system-15397.patch   | 1008 +++++++++++++++++
 srcpkgs/phantomjs/template                    |   18 +
 5 files changed, 1760 insertions(+)
 create mode 100644 srcpkgs/phantomjs/patches/0001-Allow-user-to-change-DPI-of-a-web-page.patch
 create mode 100644 srcpkgs/phantomjs/patches/0002-Add-support-to-render-pdf-to-base64.patch
 create mode 100644 srcpkgs/phantomjs/patches/0003-Adjust-some-API-for-the-latest-QtWebKit-15341.patch
 create mode 100644 srcpkgs/phantomjs/patches/0004-Use-CMake-build-system-15397.patch
 create mode 100644 srcpkgs/phantomjs/template

diff --git a/srcpkgs/phantomjs/patches/0001-Allow-user-to-change-DPI-of-a-web-page.patch b/srcpkgs/phantomjs/patches/0001-Allow-user-to-change-DPI-of-a-web-page.patch
new file mode 100644
index 000000000000..7618cb4736e3
--- /dev/null
+++ b/srcpkgs/phantomjs/patches/0001-Allow-user-to-change-DPI-of-a-web-page.patch
@@ -0,0 +1,260 @@
+From 46bfca843ee2ef466262b02bfcd1675407e13db6 Mon Sep 17 00:00:00 2001
+From: Vitaly Slobodin <vitaliy.slobodin@gmail.com>
+Date: Fri, 11 Mar 2016 19:08:35 +0300
+Subject: [PATCH 1/4] Allow user to change DPI of a web page
+
+Issue: #12085
+---
+ src/consts.h    |  1 +
+ src/phantom.cpp | 21 +++++++++++-------
+ src/phantom.h   |  1 +
+ src/webpage.cpp | 57 ++++++++++++++++++++++++++-----------------------
+ src/webpage.h   |  5 +++++
+ 5 files changed, 50 insertions(+), 35 deletions(-)
+
+diff --git a/src/consts.h b/src/consts.h
+index 28b237221..54226d012 100644
+--- a/src/consts.h
++++ b/src/consts.h
+@@ -67,6 +67,7 @@
+ #define PAGE_SETTINGS_WEB_SECURITY_ENABLED  "webSecurityEnabled"
+ #define PAGE_SETTINGS_JS_CAN_OPEN_WINDOWS   "javascriptCanOpenWindows"
+ #define PAGE_SETTINGS_JS_CAN_CLOSE_WINDOWS  "javascriptCanCloseWindows"
++#define PAGE_SETTINGS_DPI                   "dpi"
+ 
+ #define DEFAULT_WEBDRIVER_CONFIG            "127.0.0.1:8910"
+ 
+diff --git a/src/phantom.cpp b/src/phantom.cpp
+index afabaadda..5417b9beb 100644
+--- a/src/phantom.cpp
++++ b/src/phantom.cpp
+@@ -31,25 +31,26 @@
+ #include "phantom.h"
+ 
+ #include <QApplication>
++#include <QDebug>
+ #include <QDir>
+-#include <QFileInfo>
+ #include <QFile>
+-#include <QtWebKitWidgets/QWebPage>
+-#include <QDebug>
++#include <QFileInfo>
+ #include <QMetaObject>
+ #include <QMetaProperty>
++#include <QScreen>
+ #include <QStandardPaths>
++#include <QtWebKitWidgets/QWebPage>
+ 
++#include "callback.h"
++#include "childprocess.h"
+ #include "consts.h"
++#include "cookiejar.h"
++#include "repl.h"
++#include "system.h"
+ #include "terminal.h"
+ #include "utils.h"
+ #include "webpage.h"
+ #include "webserver.h"
+-#include "repl.h"
+-#include "system.h"
+-#include "callback.h"
+-#include "cookiejar.h"
+-#include "childprocess.h"
+ 
+ static Phantom* phantomInstance = NULL;
+ 
+@@ -100,6 +101,9 @@ void Phantom::init()
+     // Initialize the CookieJar
+     m_defaultCookieJar = new CookieJar(m_config.cookiesFile());
+ 
++    // set the default DPI
++    m_defaultDpi = qRound(QApplication::primaryScreen()->logicalDotsPerInch());
++
+     QWebSettings::setOfflineWebApplicationCachePath(QStandardPaths::writableLocation(QStandardPaths::DataLocation));
+     if (m_config.offlineStoragePath().isEmpty()) {
+         QWebSettings::setOfflineStoragePath(QStandardPaths::writableLocation(QStandardPaths::DataLocation));
+@@ -139,6 +143,7 @@ void Phantom::init()
+     m_defaultPageSettings[PAGE_SETTINGS_WEB_SECURITY_ENABLED] = QVariant::fromValue(m_config.webSecurityEnabled());
+     m_defaultPageSettings[PAGE_SETTINGS_JS_CAN_OPEN_WINDOWS] = QVariant::fromValue(m_config.javascriptCanOpenWindows());
+     m_defaultPageSettings[PAGE_SETTINGS_JS_CAN_CLOSE_WINDOWS] = QVariant::fromValue(m_config.javascriptCanCloseWindows());
++    m_defaultPageSettings[PAGE_SETTINGS_DPI] = QVariant::fromValue(m_defaultDpi);
+     m_page->applySettings(m_defaultPageSettings);
+ 
+     setLibraryPath(QFileInfo(m_config.scriptFile()).dir().absolutePath());
+diff --git a/src/phantom.h b/src/phantom.h
+index 7c32eb141..c7e5b787f 100644
+--- a/src/phantom.h
++++ b/src/phantom.h
+@@ -237,6 +237,7 @@ private:
+     QList<QPointer<WebServer> > m_servers;
+     Config m_config;
+     CookieJar* m_defaultCookieJar;
++    qreal m_defaultDpi;
+ 
+     friend class CustomPage;
+ };
+diff --git a/src/webpage.cpp b/src/webpage.cpp
+index fc235bc56..4158064d4 100644
+--- a/src/webpage.cpp
++++ b/src/webpage.cpp
+@@ -30,47 +30,47 @@
+ 
+ #include "webpage.h"
+ 
+-#include <math.h>
+-
+ #include <QApplication>
++#include <QBuffer>
+ #include <QContextMenuEvent>
+-#include <QDesktopServices>
+ #include <QDateTime>
++#include <QDebug>
++#include <QDesktopServices>
+ #include <QDir>
+ #include <QFileInfo>
++#include <QImageWriter>
+ #include <QKeyEvent>
++#include <QMapIterator>
+ #include <QMouseEvent>
+ #include <QNetworkAccessManager>
+ #include <QNetworkCookie>
++#include <QNetworkProxy>
+ #include <QNetworkRequest>
+ #include <QPainter>
+-#include <QtPrintSupport/QPrinter>
+-#include <QWebHistory>
+-#include <QWebHistoryItem>
++#include <QScreen>
++#include <QUrl>
++#include <QUuid>
+ #include <QWebElement>
+ #include <QWebFrame>
+-#include <QWebPage>
++#include <QWebHistory>
++#include <QWebHistoryItem>
+ #include <QWebInspector>
+-#include <QMapIterator>
+-#include <QBuffer>
+-#include <QDebug>
+-#include <QImageWriter>
+-#include <QUuid>
+-#include <QUrl>
+-#include <QNetworkProxy>
++#include <QWebPage>
++#include <QtPrintSupport/QPrinter>
++#include <math.h>
+ 
+-#include "phantom.h"
+-#include "networkaccessmanager.h"
+-#include "utils.h"
++#include "callback.h"
+ #include "config.h"
+ #include "consts.h"
+-#include "callback.h"
+ #include "cookiejar.h"
++#include "networkaccessmanager.h"
++#include "phantom.h"
+ #include "system.h"
++#include "utils.h"
+ 
+ #ifdef Q_OS_WIN
+-#include <io.h>
+ #include <fcntl.h>
++#include <io.h>
+ #endif
+ 
+ // Ensure we have at least head and body.
+@@ -435,6 +435,7 @@ WebPage::WebPage(QObject* parent, const QUrl& baseUrl)
+     connect(m_networkAccessManager, SIGNAL(resourceTimeout(QVariant)),
+             SIGNAL(resourceTimeout(QVariant)));
+ 
++    m_dpi = qRound(QApplication::primaryScreen()->logicalDotsPerInch());
+     m_customWebPage->setViewportSize(QSize(400, 300));
+ }
+ 
+@@ -649,6 +650,10 @@ void WebPage::applySettings(const QVariantMap& def)
+     if (def.contains(PAGE_SETTINGS_PROXY)) {
+         setProxy(def[PAGE_SETTINGS_PROXY].toString());
+     }
++
++    if (def.contains(PAGE_SETTINGS_DPI)) {
++        m_dpi = def[PAGE_SETTINGS_DPI].toReal();
++    }
+ }
+ 
+ void WebPage::setProxy(const QString& proxyUrl)
+@@ -1124,9 +1129,7 @@ QImage WebPage::renderImage()
+     return buffer;
+ }
+ 
+-#define PHANTOMJS_PDF_DPI 72            // Different defaults. OSX: 72, X11: 75(?), Windows: 96
+-
+-qreal stringToPointSize(const QString& string)
++qreal WebPage::stringToPointSize(const QString& string) const
+ {
+     static const struct {
+         QString unit;
+@@ -1135,8 +1138,8 @@ qreal stringToPointSize(const QString& string)
+         { "mm", 72 / 25.4 },
+         { "cm", 72 / 2.54 },
+         { "in", 72 },
+-        { "px", 72.0 / PHANTOMJS_PDF_DPI },
+-        { "", 72.0 / PHANTOMJS_PDF_DPI }
++        { "px", 72.0 / m_dpi },
++        { "", 72.0 / m_dpi }
+     };
+     for (uint i = 0; i < sizeof(units) / sizeof(units[0]); ++i) {
+         if (string.endsWith(units[i].unit)) {
+@@ -1148,7 +1151,7 @@ qreal stringToPointSize(const QString& string)
+     return 0;
+ }
+ 
+-qreal printMargin(const QVariantMap& map, const QString& key)
++qreal WebPage::printMargin(const QVariantMap& map, const QString& key)
+ {
+     const QVariant margin = map.value(key);
+     if (margin.isValid() && margin.canConvert(QVariant::String)) {
+@@ -1163,7 +1166,7 @@ bool WebPage::renderPdf(const QString& fileName)
+     QPrinter printer;
+     printer.setOutputFormat(QPrinter::PdfFormat);
+     printer.setOutputFileName(fileName);
+-    printer.setResolution(PHANTOMJS_PDF_DPI);
++    printer.setResolution(m_dpi);
+     QVariantMap paperSize = m_paperSize;
+ 
+     if (paperSize.isEmpty()) {
+@@ -1276,7 +1279,7 @@ QString WebPage::windowName() const
+     return m_mainFrame->evaluateJavaScript("window.name;").toString();
+ }
+ 
+-qreal getHeight(const QVariantMap& map, const QString& key)
++qreal WebPage::getHeight(const QVariantMap& map, const QString& key) const
+ {
+     QVariant footer = map.value(key);
+     if (!footer.canConvert(QVariant::Map)) {
+diff --git a/src/webpage.h b/src/webpage.h
+index 4e41ec246..59279db85 100644
+--- a/src/webpage.h
++++ b/src/webpage.h
+@@ -483,6 +483,10 @@ public slots:
+ 
+     void setProxy(const QString& proxyUrl);
+ 
++    qreal stringToPointSize(const QString&) const;
++    qreal printMargin(const QVariantMap&, const QString&);
++    qreal getHeight(const QVariantMap&, const QString&) const;
++
+ signals:
+     void initialized();
+     void loadStarted();
+@@ -544,6 +548,7 @@ private:
+     int m_loadingProgress;
+     bool m_shouldInterruptJs;
+     CookieJar* m_cookieJar;
++    qreal m_dpi;
+ 
+     friend class Phantom;
+     friend class CustomPage;
+-- 
+2.39.0
+
diff --git a/srcpkgs/phantomjs/patches/0002-Add-support-to-render-pdf-to-base64.patch b/srcpkgs/phantomjs/patches/0002-Add-support-to-render-pdf-to-base64.patch
new file mode 100644
index 000000000000..12fbe6d62845
--- /dev/null
+++ b/srcpkgs/phantomjs/patches/0002-Add-support-to-render-pdf-to-base64.patch
@@ -0,0 +1,279 @@
+From 43b9ec48bdf4aaeaeebe6f5926b119d876b39fa9 Mon Sep 17 00:00:00 2001
+From: Connor Dunn <connorhd@squareup.com>
+Date: Thu, 28 Apr 2016 23:06:15 -0700
+Subject: [PATCH 2/4] Add support to render pdf to base64.
+
+https://github.com/ariya/phantomjs/issues/11192
+https://github.com/ariya/phantomjs/issues/12392
+---
+ src/webpage.cpp                     | 122 +++++++++++++++-------------
+ src/webpage.h                       |   3 +-
+ test/module/webpage/renderBase64.js |  51 ++++++++++++
+ 3 files changed, 118 insertions(+), 58 deletions(-)
+ create mode 100644 test/module/webpage/renderBase64.js
+
+diff --git a/src/webpage.cpp b/src/webpage.cpp
+index 4158064d4..305085d87 100644
+--- a/src/webpage.cpp
++++ b/src/webpage.cpp
+@@ -56,7 +56,6 @@
+ #include <QWebHistoryItem>
+ #include <QWebInspector>
+ #include <QWebPage>
+-#include <QtPrintSupport/QPrinter>
+ #include <math.h>
+ 
+ #include "callback.h"
+@@ -999,7 +998,8 @@ bool WebPage::render(const QString& fileName, const QVariantMap& option)
+ 
+     bool retval = true;
+     if (format == "pdf") {
+-        retval = renderPdf(outFileName);
++        QPdfWriter pdfWriter(fileName);
++        retval = renderPdf(pdfWriter);
+     } else {
+         QImage rawPageRendering = renderImage();
+ 
+@@ -1053,23 +1053,31 @@ QString WebPage::renderBase64(const QByteArray& format)
+ {
+     QByteArray nformat = format.toLower();
+ 
+-    // Check if the given format is supported
+-    if (QImageWriter::supportedImageFormats().contains(nformat)) {
+-        QImage rawPageRendering = renderImage();
++    if (format != "pdf" && !QImageWriter::supportedImageFormats().contains(nformat)) {
++        // Return an empty string in case an unsupported format was provided
++        return "";
++    }
++
++    // Prepare buffer for writing
++    QByteArray bytes;
++    QBuffer buffer(&bytes);
++    buffer.open(QIODevice::WriteOnly);
++
++    if (format == "pdf") {
++        QPdfWriter pdfWriter(&buffer);
+ 
+-        // Prepare buffer for writing
+-        QByteArray bytes;
+-        QBuffer buffer(&bytes);
+-        buffer.open(QIODevice::WriteOnly);
++        if (!renderPdf(pdfWriter)) {
++            // Return an empty string if pdf render fails
++            return "";
++        }
++    } else {
++        QImage rawPageRendering = renderImage();
+ 
+         // Writing image to the buffer, using PNG encoding
+         rawPageRendering.save(&buffer, nformat);
+-
+-        return bytes.toBase64();
+     }
+ 
+-    // Return an empty string in case an unsupported format was provided
+-    return "";
++    return bytes.toBase64();
+ }
+ 
+ QImage WebPage::renderImage()
+@@ -1161,12 +1169,9 @@ qreal WebPage::printMargin(const QVariantMap& map, const QString& key)
+     }
+ }
+ 
+-bool WebPage::renderPdf(const QString& fileName)
++bool WebPage::renderPdf(QPdfWriter& pdfWriter)
+ {
+-    QPrinter printer;
+-    printer.setOutputFormat(QPrinter::PdfFormat);
+-    printer.setOutputFileName(fileName);
+-    printer.setResolution(m_dpi);
++    pdfWriter.setResolution(m_dpi);
+     QVariantMap paperSize = m_paperSize;
+ 
+     if (paperSize.isEmpty()) {
+@@ -1179,51 +1184,51 @@ bool WebPage::renderPdf(const QString& fileName)
+     if (paperSize.contains("width") && paperSize.contains("height")) {
+         const QSizeF sizePt(ceil(stringToPointSize(paperSize.value("width").toString())),
+                             ceil(stringToPointSize(paperSize.value("height").toString())));
+-        printer.setPaperSize(sizePt, QPrinter::Point);
++        pdfWriter.setPageSize(QPageSize(sizePt, QPageSize::Point));
+     } else if (paperSize.contains("format")) {
+-        const QPrinter::Orientation orientation = paperSize.contains("orientation")
++        const QPageLayout::Orientation orientation = paperSize.contains("orientation")
+                 && paperSize.value("orientation").toString().compare("landscape", Qt::CaseInsensitive) == 0 ?
+-                QPrinter::Landscape : QPrinter::Portrait;
+-        printer.setOrientation(orientation);
++                QPageLayout::Portrait : QPageLayout::Landscape;
++        pdfWriter.setPageOrientation(orientation);
+         static const struct {
+             QString format;
+-            QPrinter::PaperSize paperSize;
++            QPageSize::PageSizeId paperSize;
+         } formats[] = {
+-            { "A0", QPrinter::A0 },
+-            { "A1", QPrinter::A1 },
+-            { "A2", QPrinter::A2 },
+-            { "A3", QPrinter::A3 },
+-            { "A4", QPrinter::A4 },
+-            { "A5", QPrinter::A5 },
+-            { "A6", QPrinter::A6 },
+-            { "A7", QPrinter::A7 },
+-            { "A8", QPrinter::A8 },
+-            { "A9", QPrinter::A9 },
+-            { "B0", QPrinter::B0 },
+-            { "B1", QPrinter::B1 },
+-            { "B2", QPrinter::B2 },
+-            { "B3", QPrinter::B3 },
+-            { "B4", QPrinter::B4 },
+-            { "B5", QPrinter::B5 },
+-            { "B6", QPrinter::B6 },
+-            { "B7", QPrinter::B7 },
+-            { "B8", QPrinter::B8 },
+-            { "B9", QPrinter::B9 },
+-            { "B10", QPrinter::B10 },
+-            { "C5E", QPrinter::C5E },
+-            { "Comm10E", QPrinter::Comm10E },
+-            { "DLE", QPrinter::DLE },
+-            { "Executive", QPrinter::Executive },
+-            { "Folio", QPrinter::Folio },
+-            { "Ledger", QPrinter::Ledger },
+-            { "Legal", QPrinter::Legal },
+-            { "Letter", QPrinter::Letter },
+-            { "Tabloid", QPrinter::Tabloid }
++            { "A0", QPageSize::A0 },
++            { "A1", QPageSize::A1 },
++            { "A2", QPageSize::A2 },
++            { "A3", QPageSize::A3 },
++            { "A4", QPageSize::A4 },
++            { "A5", QPageSize::A5 },
++            { "A6", QPageSize::A6 },
++            { "A7", QPageSize::A7 },
++            { "A8", QPageSize::A8 },
++            { "A9", QPageSize::A9 },
++            { "B0", QPageSize::B0 },
++            { "B1", QPageSize::B1 },
++            { "B2", QPageSize::B2 },
++            { "B3", QPageSize::B3 },
++            { "B4", QPageSize::B4 },
++            { "B5", QPageSize::B5 },
++            { "B6", QPageSize::B6 },
++            { "B7", QPageSize::B7 },
++            { "B8", QPageSize::B8 },
++            { "B9", QPageSize::B9 },
++            { "B10", QPageSize::B10 },
++            { "C5E", QPageSize::C5E },
++            { "Comm10E", QPageSize::Comm10E },
++            { "DLE", QPageSize::DLE },
++            { "Executive", QPageSize::Executive },
++            { "Folio", QPageSize::Folio },
++            { "Ledger", QPageSize::Ledger },
++            { "Legal", QPageSize::Legal },
++            { "Letter", QPageSize::Letter },
++            { "Tabloid", QPageSize::Tabloid }
+         };
+-        printer.setPaperSize(QPrinter::A4); // Fallback
++        pdfWriter.setPageSize(QPageSize(QPageSize::A4)); // Fallback
+         for (uint i = 0; i < sizeof(formats) / sizeof(formats[0]); ++i) {
+             if (paperSize.value("format").toString().compare(formats[i].format, Qt::CaseInsensitive) == 0) {
+-                printer.setPaperSize(formats[i].paperSize);
++                pdfWriter.setPageSize(QPageSize(formats[i].paperSize));
+                 break;
+             }
+         }
+@@ -1258,9 +1263,12 @@ bool WebPage::renderPdf(const QString& fileName)
+         }
+     }
+ 
+-    printer.setPageMargins(marginLeft, marginTop, marginRight, marginBottom, QPrinter::Point);
++    pdfWriter.setPageMargins(QMarginsF(marginLeft, marginTop, marginRight, marginBottom), QPageLayout::Point);
++
++    QPainter painter(&pdfWriter);
++    m_mainFrame->render(&painter);
++    painter.end();
+ 
+-    m_mainFrame->print(&printer, this);
+     return true;
+ }
+ 
+diff --git a/src/webpage.h b/src/webpage.h
+index 59279db85..062179d27 100644
+--- a/src/webpage.h
++++ b/src/webpage.h
+@@ -35,6 +35,7 @@
+ #include <QVariantMap>
+ #include <QtWebKitWidgets/QWebPage>
+ #include <QtWebKitWidgets/QWebFrame>
++#include <QPdfWriter>
+ 
+ #include "cookiejar.h"
+ 
+@@ -514,7 +515,7 @@ private slots:
+ 
+ private:
+     QImage renderImage();
+-    bool renderPdf(const QString& fileName);
++    bool renderPdf(QPdfWriter& pdfWriter);
+     void applySettings(const QVariantMap& defaultSettings);
+     QString userAgent() const;
+ 
+diff --git a/test/module/webpage/renderBase64.js b/test/module/webpage/renderBase64.js
+new file mode 100644
+index 000000000..17797d576
+--- /dev/null
++++ b/test/module/webpage/renderBase64.js
+@@ -0,0 +1,51 @@
++var fs      = require("fs");
++var system  = require("system");
++var webpage = require("webpage");
++var renders = require("./renders");
++
++function clean_pdf(data) {
++    // FIXME: This is not nearly enough normalization.
++    data = data.replace(/\/(Title|Creator|Producer|CreationDate) \([^\n]*\)/g, "/$1 ()");
++    data = data.replace(/\nxref\n[0-9 nf\n]+trailer\b/, "\ntrailer");
++    data = data.replace(/\nstartxref\n[0-9]+\n%%EOF\n/, "\n");
++    return data;
++}
++
++function render_test(format) {
++    var expect_content = btoa(renders.get(format, ""));
++    var p = webpage.create();
++
++    p.paperSize = { width: '300px', height: '300px', border: '0px' };
++    p.clipRect = { top: 0, left: 0, width: 300, height: 300};
++    p.viewportSize = { width: 300, height: 300};
++
++    p.open(TEST_HTTP_BASE + "render/", this.step_func_done(function (status) {
++        var content = p.renderBase64(format);
++
++        // expected variation in PDF output
++        if (format === "pdf") {
++            content = clean_pdf(content);
++            expect_content = clean_pdf(expect_content);
++        }
++
++        // Don't dump entire images to the log on failure.
++        assert_is_true(content === expect_content);
++    }));
++}
++
++[
++    "pdf",
++    "png",
++    "jpg",
++]
++.forEach(function (format) {
++    var props  = {};
++
++    // All tests fail on Linux.  All tests except JPG fail on Mac.
++    // Currently unknown which tests fail on Windows.
++    if (format !== "jpg" || system.os.name !== "mac")
++        props.expected_fail = true;
++
++    async_test(function () { render_test.call(this, format); },
++               format, props);
++});
+-- 
+2.39.0
+
diff --git a/srcpkgs/phantomjs/patches/0003-Adjust-some-API-for-the-latest-QtWebKit-15341.patch b/srcpkgs/phantomjs/patches/0003-Adjust-some-API-for-the-latest-QtWebKit-15341.patch
new file mode 100644
index 000000000000..eafb86b88212
--- /dev/null
+++ b/srcpkgs/phantomjs/patches/0003-Adjust-some-API-for-the-latest-QtWebKit-15341.patch
@@ -0,0 +1,195 @@
+From 48752bfeaaf6d16b1cfb51fbcd300d1f25e17a6a Mon Sep 17 00:00:00 2001
+From: Ariya Hidayat <ariya.hidayat@gmail.com>
+Date: Fri, 29 Nov 2019 22:39:09 -0800
+Subject: [PATCH 3/4] Adjust some API for the latest QtWebKit (#15341)
+
+---
+ src/bootstrap.js       | 3 ++-
+ src/config.cpp         | 2 +-
+ src/modules/webpage.js | 3 ++-
+ src/phantom.cpp        | 5 ++---
+ src/repl.cpp           | 7 +++----
+ src/utils.cpp          | 6 +++---
+ src/webpage.cpp        | 9 ++++-----
+ src/webpage.h          | 2 +-
+ 8 files changed, 18 insertions(+), 19 deletions(-)
+
+diff --git a/src/bootstrap.js b/src/bootstrap.js
+index 788d45202..1042ceb6a 100644
+--- a/src/bootstrap.js
++++ b/src/bootstrap.js
+@@ -73,7 +73,8 @@ phantom.__defineErrorSignalHandler__ = function(obj, page, handlers) {
+             return (!!handlerObj && typeof handlerObj.callback === "function" && typeof handlerObj.connector === "function") ?
+                 handlers[handlerName].callback :
+                 undefined;
+-        }
++        },
++        configurable: true
+     });
+ };
+ 
+diff --git a/src/config.cpp b/src/config.cpp
+index a81be2f36..661d6c8c9 100644
+--- a/src/config.cpp
++++ b/src/config.cpp
+@@ -177,7 +177,7 @@ void Config::loadJsonFile(const QString& filePath)
+     // Add this object to the global scope
+     webPage.mainFrame()->addToJavaScriptWindowObject("config", this);
+     // Apply the JSON config settings to this very object
+-    webPage.mainFrame()->evaluateJavaScript(configurator.arg(jsonConfig), QString());
++    webPage.mainFrame()->evaluateJavaScript(configurator.arg(jsonConfig));
+ }
+ 
+ QString Config::helpText() const
+diff --git a/src/modules/webpage.js b/src/modules/webpage.js
+index 20eae9a85..0760a74b4 100644
+--- a/src/modules/webpage.js
++++ b/src/modules/webpage.js
+@@ -115,7 +115,8 @@ function definePageSignalHandler(page, handlers, handlerName, signalName) {
+             return !!handlers[handlerName] && typeof handlers[handlerName].callback === "function" ?
+                 handlers[handlerName].callback :
+                 undefined;
+-        }
++        },
++        configurable: true
+     });
+ }
+ 
+diff --git a/src/phantom.cpp b/src/phantom.cpp
+index 5417b9beb..9565a89ea 100644
+--- a/src/phantom.cpp
++++ b/src/phantom.cpp
+@@ -386,7 +386,7 @@ void Phantom::loadModule(const QString& moduleSource, const QString& filename)
+         "require.cache['" + filename + "'].exports," +
+         "require.cache['" + filename + "']" +
+         "));";
+-    m_page->mainFrame()->evaluateJavaScript(scriptSource, QString(JAVASCRIPT_SOURCE_PLATFORM_URL).arg(QFileInfo(filename).fileName()));
++    m_page->mainFrame()->evaluateJavaScript(scriptSource);
+ }
+ 
+ bool Phantom::injectJs(const QString& jsFilePath)
+@@ -483,8 +483,7 @@ void Phantom::onInitialized()
+ 
+     // Bootstrap the PhantomJS scope
+     m_page->mainFrame()->evaluateJavaScript(
+-        Utils::readResourceFileUtf8(":/bootstrap.js"),
+-        QString(JAVASCRIPT_SOURCE_PLATFORM_URL).arg("bootstrap.js")
++        Utils::readResourceFileUtf8(":/bootstrap.js")
+     );
+ }
+ 
+diff --git a/src/repl.cpp b/src/repl.cpp
+index 45a475bc1..7f25a22b0 100644
+--- a/src/repl.cpp
++++ b/src/repl.cpp
+@@ -147,7 +147,7 @@ REPL::REPL(QWebFrame* webframe, Phantom* parent)
+     linenoiseSetCompletionCallback(REPL::offerCompletion);
+ 
+     // Inject REPL utility functions
+-    m_webframe->evaluateJavaScript(Utils::readResourceFileUtf8(":/repl.js"), QString(JAVASCRIPT_SOURCE_PLATFORM_URL).arg("repl.js"));
++    m_webframe->evaluateJavaScript(Utils::readResourceFileUtf8(":/repl.js"));
+ 
+     // Add self to JavaScript world
+     m_webframe->addToJavaScriptWindowObject("_repl", this);
+@@ -184,8 +184,7 @@ void REPL::offerCompletion(const char* buf, linenoiseCompletions* lc)
+     QStringList completions = REPL::getInstance()->m_webframe->evaluateJavaScript(
+                                   QString(JS_RETURN_POSSIBLE_COMPLETIONS).arg(
+                                       toInspect,
+-                                      toComplete),
+-                                  QString()
++                                      toComplete)
+                               ).toStringList();
+ 
+     foreach(QString c, completions) {
+@@ -210,7 +209,7 @@ void REPL::startLoop()
+             // Send the user input to the main Phantom frame for evaluation
+             m_webframe->evaluateJavaScript(
+                 QString(JS_EVAL_USER_INPUT).arg(
+-                    QString(userInput).replace('"', "\\\"")), QString("phantomjs://repl-input"));
++                    QString(userInput).replace('"', "\\\"")));
+ 
+             // Save command in the REPL history
+             linenoiseHistoryAdd(userInput);
+diff --git a/src/utils.cpp b/src/utils.cpp
+index 16d933ef9..9970e1cc0 100644
+--- a/src/utils.cpp
++++ b/src/utils.cpp
+@@ -132,7 +132,7 @@ bool injectJsInFrame(const QString& jsFilePath, const QString& jsFileLanguage, c
+         return false;
+     }
+     // Execute JS code in the context of the document
+-    targetFrame->evaluateJavaScript(scriptBody, QString(JAVASCRIPT_SOURCE_CODE_URL).arg(QFileInfo(scriptPath).fileName()));
++    targetFrame->evaluateJavaScript(scriptBody);
+     return true;
+ }
+ 
+@@ -147,10 +147,10 @@ bool loadJSForDebug(const QString& jsFilePath, const QString& jsFileLanguage, co
+     QString scriptBody = jsFromScriptFile(scriptPath, jsFileLanguage, jsFileEnc);
+ 
+     scriptBody = QString("function __run() {\n%1\n}").arg(scriptBody);
+-    targetFrame->evaluateJavaScript(scriptBody, QString(JAVASCRIPT_SOURCE_CODE_URL).arg(QFileInfo(scriptPath).fileName()));
++    targetFrame->evaluateJavaScript(scriptBody);
+ 
+     if (autorun) {
+-        targetFrame->evaluateJavaScript("__run()", QString());
++        targetFrame->evaluateJavaScript("__run()");
+     }
+ 
+     return true;
+diff --git a/src/webpage.cpp b/src/webpage.cpp
+index 305085d87..df95049a6 100644
+--- a/src/webpage.cpp
++++ b/src/webpage.cpp
+@@ -757,8 +757,7 @@ QVariant WebPage::evaluateJavaScript(const QString& code)
+     qDebug() << "WebPage - evaluateJavaScript" << function;
+ 
+     evalResult = m_currentFrame->evaluateJavaScript(
+-                     function,                                   //< function evaluated
+-                     QString("phantomjs://webpage.evaluate()")); //< reference source file
++                     function);
+ 
+     qDebug() << "WebPage - evaluateJavaScript result" << evalResult;
+ 
+@@ -930,7 +929,7 @@ void WebPage::openUrl(const QString& address, const QVariant& op, const QVariant
+     }
+ 
+     if (networkOp == QNetworkAccessManager::UnknownOperation) {
+-        m_mainFrame->evaluateJavaScript("console.error('Unknown network operation: " + operation + "');", QString());
++        m_mainFrame->evaluateJavaScript("console.error('Unknown network operation: " + operation + "');");
+         return;
+     }
+ 
+@@ -1326,7 +1325,7 @@ QString getHeaderFooter(const QVariantMap& map, const QString& key, QWebFrame* f
+             }
+         }
+     }
+-    frame->evaluateJavaScript("console.error('Bad header callback given, use phantom.callback);", QString());
++    frame->evaluateJavaScript("console.error('Bad header callback given, use phantom.callback);");
+     return QString();
+ }
+ 
+@@ -1365,7 +1364,7 @@ bool WebPage::injectJs(const QString& jsFilePath)
+ 
+ void WebPage::_appendScriptElement(const QString& scriptUrl)
+ {
+-    m_currentFrame->evaluateJavaScript(QString(JS_APPEND_SCRIPT_ELEMENT).arg(scriptUrl), scriptUrl);
++    m_currentFrame->evaluateJavaScript(QString(JS_APPEND_SCRIPT_ELEMENT).arg(scriptUrl));
+ }
+ 
+ QObject* WebPage::_getGenericCallback()
+diff --git a/src/webpage.h b/src/webpage.h
+index 062179d27..0d5e06b7f 100644
+--- a/src/webpage.h
++++ b/src/webpage.h
+@@ -46,7 +46,7 @@ class NetworkAccessManager;
+ class QWebInspector;
+ class Phantom;
+ 
+-class WebPage : public QObject, public QWebFrame::PrintCallback
++class WebPage : public QObject
+ {
+     Q_OBJECT
+     Q_PROPERTY(QString title READ title)
+-- 
+2.39.0
+
diff --git a/srcpkgs/phantomjs/patches/0004-Use-CMake-build-system-15397.patch b/srcpkgs/phantomjs/patches/0004-Use-CMake-build-system-15397.patch
new file mode 100644
index 000000000000..a5d0fa1bbc00
--- /dev/null
+++ b/srcpkgs/phantomjs/patches/0004-Use-CMake-build-system-15397.patch
@@ -0,0 +1,1008 @@
+From 538d05ed26f830522597c2623894a2193785abaf Mon Sep 17 00:00:00 2001
+From: Ariya Hidayat <ariya.hidayat@gmail.com>
+Date: Fri, 29 Nov 2019 22:29:15 -0800
+Subject: [PATCH 4/4] Use CMake build system (#15397)
+
+---
+ .gitignore                        |  15 ++
+ CMakeLists.txt                    |  34 ++++
+ INSTALL                           |  46 +++++
+ configure                         | 317 ++++++++++++++++++++++++++++++
+ deploy/.gitignore                 |   2 -
+ deploy/README.md                  |  44 -----
+ deploy/brandelf.c                 | 212 --------------------
+ deploy/build-and-package.sh       |   6 -
+ deploy/docker-build.sh            |  62 ------
+ deploy/package.sh                 | 120 -----------
+ phantomjs.pro                     |   3 -
+ src/linenoise/linenoise.pri       |   9 -
+ src/mongoose/mongoose.pri         |   7 -
+ src/qcommandline/qcommandline.pri |   7 -
+ 14 files changed, 412 insertions(+), 472 deletions(-)
+ create mode 100644 CMakeLists.txt
+ create mode 100644 INSTALL
+ create mode 100755 configure
+ delete mode 100644 deploy/.gitignore
+ delete mode 100644 deploy/README.md
+ delete mode 100644 deploy/brandelf.c
+ delete mode 100755 deploy/build-and-package.sh
+ delete mode 100755 deploy/docker-build.sh
+ delete mode 100755 deploy/package.sh
+ delete mode 100644 phantomjs.pro
+ delete mode 100644 src/linenoise/linenoise.pri
+ delete mode 100644 src/mongoose/mongoose.pri
+ delete mode 100644 src/qcommandline/qcommandline.pri
+
+diff --git a/.gitignore b/.gitignore
+index 7c8a9c08a..53ef2055d 100644
+--- a/.gitignore
++++ b/.gitignore
+@@ -60,3 +60,18 @@ bin/
+ *.class
+ build/
+ .gradle/
++
++# CMake
++CMakeLists.txt.user
++CMakeCache.txt
++CMakeFiles
++CMakeScripts
++Testing
++Makefile
++cmake_install.cmake
++install_manifest.txt
++compile_commands.json
++CTestTestfile.cmake
++_deps
++*_autogen
++
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+new file mode 100644
+index 000000000..c23e11f49
+--- /dev/null
++++ b/CMakeLists.txt
+@@ -0,0 +1,34 @@
++cmake_minimum_required(VERSION 3.5.0)
++project(phantomjs)
++
++set (CMAKE_CXX_STANDARD 11)
++
++find_package(Qt5 COMPONENTS Core Network WebKitWidgets REQUIRED)
++find_package(Threads REQUIRED)
++
++message("Using Qt version ${Qt5Core_VERSION}")
++if (Qt5Core_VERSION VERSION_LESS 5.5.0)
++  message(FATAL_ERROR "This version of Qt is not supported. Please use Qt 5.5 or later")
++endif()
++
++set(CMAKE_AUTOMOC ON)
++set(CMAKE_AUTORCC ON)
++
++set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
++
++file(GLOB_RECURSE PHANTOMJS_SOURCES src/*.cpp)
++include_directories(src)
++set(CMAKE_INCLUDE_CURRENT_DIR ON)
++
++set(THIRDPARTY_SOURCES src/mongoose/mongoose.c src/qcommandline/qcommandline.cpp src/linenoise/src/linenoise.c)
++include_directories(src/linenoise/src)
++include_directories(src/mongoose)
++include_directories(src/qcommandline)
++
++set(EXTRA_LIBS dl)
++
++add_executable(${PROJECT_NAME} src/phantomjs.qrc src/ghostdriver/ghostdriver.qrc ${PHANTOMJS_SOURCES} ${THIRDPARTY_SOURCES})
++target_link_libraries(${PROJECT_NAME} ${EXTRA_LIBS} Qt5::Core Qt5::Network Qt5::WebKitWidgets Threads::Threads)
++install(TARGETS ${PROJECT_NAME} DESTINATION bin)
++
++add_custom_target(check COMMAND python test/run-tests.py -v)
+diff --git a/INSTALL b/INSTALL
+new file mode 100644
+index 000000000..6c8b5ea65
+--- /dev/null
++++ b/INSTALL
+@@ -0,0 +1,46 @@
++Installation Instructions
++*************************
++
++System requirements:
++
++  * C++ toolchain such as g++ 7 or later
++  * CMake version 3.5 or later
++  * Qt 5 toolkit
++  * Python 2.7 (to run the tests)
++
++
++Installation on Linux
++---------------------
++
++On Debian/Ubuntu, the requirements can be fulfilled by installing these packages:
++
++  sudo apt install g++ cmake qt5-default libqt5webkit5-dev python
++
++After unpacking the source tarball or cloning the repository:
++
++  ./configure && make
++
++Do a quick sanity check:
++
++  ./bin/phantomjs --version
++
++Run the test suite:
++
++  make check
++
++Install it (may require sudo):
++
++  make install
++
++
++Installation on Windows
++-----------------------
++
++To be written.
++
++
++Installation on macOS
++---------------------
++
++To be written.
++
+diff --git a/configure b/configure
+new file mode 100755
+index 000000000..a8a75d566
+--- /dev/null
++++ b/configure
+@@ -0,0 +1,317 @@
++#!/bin/sh
++
++# Autotools-style (./configure) wrapper for CMake
++# <https://github.com/nemequ/configure-cmake>
++#
++#   *** IMPORTANT ***
++#
++#   You must include the GNUInstallDirs module (which comes with
++#   CMake) in your project.  Just put "include (GNUInstallDirs)" in
++#   you CMakeLists.txt and you should be good.
++#
++# This script was originally written for Squash
++# <https://quixdb.github.io/squash/> by Evan Nemerson
++# <evan@nemerson.com>, but has been spun off into a separate
++# repository.  Please feel free to copy it into your own repository,
++# though I would appreciate it if you would post improvements, bugs,
++# feature requests, etc. to the issue tracker at
++# <https://github.com/nemequ/configure-cmake/issues>.
++#
++# To the extent possible under law, the author(s) hereby waive all
++# copyright and related or neighboring rights to this work.  For
++# details, see <https://creativecommons.org/publicdomain/zero/1.0/>
++
++TOP_SRCDIR="$(dirname $0)"
++
++if [ "${CMAKE_CMD}" = "" ]; then
++    CMAKE_CMD="cmake"
++fi
++
++BUILD_TYPE="Debug"
++PREFIX=/usr/local
++LIBDIR=
++CMAKE_ARGS=
++
++if [ -e "${TOP_SRCDIR}/.configure-custom.sh" ]; then
++    . "${TOP_SRCDIR}/.configure-custom.sh"
++fi
++
++quote() {
++    echo "$1" | sed -e "s|'|'\\\\''|g; 1s/^/'/; \$s/\$/'/"
++}
++
++extract_var_string() {
++    VAR_NAME=$1
++    VAR_NAME=$(echo $1 | sed -e 's/[ \t]*$//')
++    if [ "x$2" != "x" ]; then
++        VAR_VALUE=$2
++    else
++        VAR_VALUE=yes
++    fi
++
++    if [ "x$3" != "x" ]; then
++        VAR_UC_NAME=$3
++    else
++        VAR_UC_NAME=$(echo "$1" | tr '[:lower:]' '[:upper:]' | tr -c '[:alnum:]' '_' | sed 's/_$//g')
++    fi
++}
++
++set_config_var() {
++    is_with=n
++    case "$1" in
++        "--enable-"*)
++            name="${1#--enable-}"
++            cfg="${ENABLE_VARS}"
++            ;;
++        "--disable-"*)
++            name="${1#--disable-}";
++            cfg="${DISABLE_VARS}";
++            ;;
++        "--with-"*)
++            # IFS="=" read -ra WITHARGS <<< "${1}"
++            name="${1#--with-}"
++            cfg="${WITH_VARS}"
++            is_with=y
++            ;;
++    esac
++
++    found=n
++    for varstring in $cfg; do
++        extract_var_string $(echo "${varstring}" | tr '|' ' ')
++        if [ "x$VAR_NAME" = "x$name" ]; then
++            found=y
++            break;
++        fi
++    done
++
++    if [ "$found" = "y" ]; then
++        if [ "x$is_with" = "xy" ]; then
++            CMAKE_ARGS="$CMAKE_ARGS -D${VAR_UC_NAME}=$(quote "$2")"
++        else
++            CMAKE_ARGS="$CMAKE_ARGS -D${VAR_UC_NAME}=$(quote "${VAR_VALUE}")"
++        fi
++    else
++        echo "Unknown parameter: ${1}"
++        exit 1
++    fi
++}
++
++prefix_to_offset() {
++    expr $(echo "${1}" | awk '{ print length }') + 1
++}
++
++print_help() {
++    cat <<EOF >&2
++  -h, --help              display this help and exit
++  --disable-debug         disable debugging mode
++  --pass-thru             pass remaining arguments through to CMake
++
++  --prefix=PREFIX         install architecture-independent files in PREFIX
++                          [$PREFIX]
++  --bindir=DIR            user executables [PREFIX/bin]
++  --sbindir=DIR           system admin executables [PREFIX/sbin]
++  --libexecdir=DIR        program executables [PREFIX/libexec]
++  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
++  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
++  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
++  --libdir=DIR            object code libraries [PREFIX/lib]
++  --includedir=DIR        C header files [PREFIX/include]
++  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
++  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
++  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
++  --infodir=DIR           info documentation [DATAROOTDIR/info]
++  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
++  --mandir=DIR            man documentation [DATAROOTDIR/man]
++  --docdir=DIR            documentation root [DATAROOTDIR/doc/PROJECT_NAME]
++EOF
++
++    first=y
++    for varstring in ${ENABLE_VARS}; do
++        if [ $first = 'y' ]; then
++            echo ""
++            first=n
++        fi
++        extract_var_string $(echo "${varstring}" | tr '|' ' ')
++        var_doc_name="ENABLE_${VAR_UC_NAME}_DOC"
++        eval "docstring=\$$var_doc_name"
++        if [ "x${docstring}" = "x" ]; then
++            printf "  --enable-%-14s enable %s support\n" "${VAR_NAME}" "$(echo -n "${VAR_NAME}" | tr '-' ' ')"
++        else
++            printf "  --enable-%-14s %s\n" "${VAR_NAME}" "$docstring"
++        fi
++    done
++
++    first=y
++    for varstring in ${DISABLE_VARS}; do
++        if [ $first = 'y' ]; then
++            echo ""
++            first=n
++        fi
++        extract_var_string $(echo "${varstring}" | tr '|' ' ')
++        var_doc_name="DISABLE_${VAR_UC_NAME}_DOC"
++        eval "docstring=\$$var_doc_name"
++        if [ "x${docstring}" = "x" ]; then
++            printf "  --disable-%-13s disable %s support\n" "${VAR_NAME}" "$(echo -n "${VAR_NAME}" | tr '-' ' ')"
++        else
++            printf "  --disable-%-13s %s\n" "${VAR_NAME}" "$docstring"
++        fi
++    done
++
++    first=y
++    for varstring in ${WITH_VARS}; do
++        if [ $first = 'y' ]; then
++            echo ""
++            first=n
++        fi
++        extract_var_string $(echo "${varstring}" | tr '|' ' ')
++        var_doc_name="WITH_${VAR_UC_NAME}_DOC"
++        eval "docstring=\$$var_doc_name"
++        paraminfo="${VAR_NAME}=${VAR_VALUE}"
++        if [ "x${docstring}" = "x" ]; then
++            printf "  --with-%-16s enable %s support\n" "$paraminfo" "$(echo -n "${VAR_NAME}" | tr '-' ' ')"
++        else
++            printf "  --with-%-16s %s\n" "$paraminfo" "$docstring"
++        fi
++    done
++
++    exit 0
++}
++
++while [ $# != 0 ]; do
++    case "$1" in
++        "--prefix="*)
++            PREFIX="${1#*=}";;
++        "--prefix")
++            PREFIX="${2}"; shift;;
++        "--bindir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_BINDIR=$(quote "${1#*=}")";;
++        "--bindir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_BINDIR=$(quote "$2")"; shift;;
++        "--sbindir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SBINDIR=$(quote "${1#*=}")";;
++        "--sbindir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SBINDIR=$(quote "$2")"; shift;;
++        "--libexecdir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LIBEXECDIR=$(quote "${1#*=}")";;
++        "--libexecdir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LIBEXECDIR=$(quote "$2")"; shift;;
++        "--sysconfdir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SYSCONFDIR=$(quote "${1#*=}")";;
++        "--sysconfdir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SYSCONFDIR=$(quote "$2")"; shift;;
++        "--sharedstatedir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SHAREDSTATEDIR=$(quote "${1#*=}")";;
++        "--sharedstatedir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SHAREDSTATEDIR=$(quote "$2")"; shift;;
++        "--localstatedir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LOCALSTATEDIR=$(quote "${1#*=}")";;
++        "--localstatedir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LOCALSTATEDIR=$(quote "$2")"; shift;;
++        "--libdir="*)
++            LIBDIR="${1#*=}";;
++        "--libdir")
++            LIBDIR="${2}"; shift;;
++        "--includedir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_INCLUDEDIR=$(quote "${1#*=}")";;
++        "--includedir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_INCLUDEDIR=$(quote "$2")"; shift;;
++        "--oldincludedir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_OLDINCLUDEDIR=$(quote "${1#*=}")";;
++        "--oldincludedir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_OLDINCLUDEDIR=$(quote "$2")"; shift;;
++        "--datarootdir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DATAROOTDIR=$(quote "${1#*=}")";;
++        "--datarootdir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DATAROOTDIR=$(quote "$2")"; shift;;
++        "--datadir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DATADIR=$(quote "${1#*=}")";;
++        "--datadir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DATADIR=$(quote "$2")"; shift;;
++        "--infodir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_INFODIR=$(quote "${1#*=}")";;
++        "--infodir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_INFODIR=$(quote "$2")"; shift;;
++        "--localedir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LOCALEDIR=$(quote "${1#*=}")";;
++        "--localedir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LOCALEDIR=$(quote "$2")"; shift;;
++        "--mandir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_MANDIR=$(quote "${1#*=}")";;
++        "--mandir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_MANDIR=$(quote "$2")"; shift;;
++        "--docdir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DOCDIR=$(quote "${1#*=}")";;
++        "--docdir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DOCDIR=$(quote "$2")"; shift;;
++
++        "CC="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_C_COMPILER=$(quote "${1#*=}")";;
++        "CXX="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CXX_COMPILER=$(quote "${1#*=}")";;
++        "CFLAGS="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_C_FLAGS=$(quote "${1#*=}")";;
++        "CXXFLAGS="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CXX_FLAGS=$(quote "${1#*=}")";;
++        "LDFLAGS="*)
++            LDFLAGS="$LDFLAGS ${1#*=}";;
++
++        "--help")
++            print_help;;
++        "-h")
++            print_help;;
++
++        # This flag is the only one which may be a bit surprising to
++        # people.  Autotools always builds with debugging symbols enabled
++        # (AFAIK), but for cmake you have to do -DCMAKE_BUILD_TYPE=Debug.
++        # Unfortunately this can change other things as well, so although
++        # I realize there is no --disable-debug flag I thought it would be
++        # prudent to support one here.
++        "--disable-debug")
++            BUILD_TYPE="Release";;
++
++        "--pass-thru")
++            while [ $# != 1 ]; do
++                shift;
++                CMAKE_ARGS="$CMAKE_ARGS $(quote "${1}")";
++            done;;
++
++        "--enable-"*)
++            set_config_var "$1"
++            ;;
++
++        "--disable-"*)
++            set_config_var "$1"
++            ;;
++
++        "--with-"*)
++            name=$(echo "${1#--with-}" | awk '{split($1,v,"="); print v[1]}')
++            case "${1}" in
++                "--with-${name}="*)
++                    set_config_var "--with-${name}" "${1#--with-${name}=}";;
++                "--with-${name}")
++                    set_config_var "$1" "$2";
++                    shift;;
++            esac
++            ;;
++
++        *)
++            echo "$0: error: unrecognized option: \`$1'" >&2
++            echo "Try \`$0 --help' for more information" >&2
++            exit -1
++    esac;
++    shift
++done
++
++if [ "x${LIBDIR}" = "x" ]; then
++    LIBDIR="${PREFIX}/lib"
++fi
++
++# Unlike CFLAGS/CXXFLAGS/CC/CXX, LDFLAGS isn't handled by CMake, so we
++# need to parse it here.
++if [ "x${LDFLAGS}" != "x" ]; then
++    for varname in EXE MODULE SHARED STATIC; do
++        CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_${varname}_LINKER_FLAGS=$(quote "$LDFLAGS")"
++    done
++fi
++
++eval "${CMAKE_CMD}" "${TOP_SRCDIR}" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_INSTALL_LIBDIR="${LIBDIR}" ${CMAKE_ARGS}
+diff --git a/deploy/.gitignore b/deploy/.gitignore
+deleted file mode 100644
+index 3c2196584..000000000
+--- a/deploy/.gitignore
++++ /dev/null
+@@ -1,2 +0,0 @@
+-.vagrant
+-/brandelf
+diff --git a/deploy/README.md b/deploy/README.md
+deleted file mode 100644
+index 7f23b7d7f..000000000
+--- a/deploy/README.md
++++ /dev/null
+@@ -1,44 +0,0 @@
+-Packaging PhantomJS
+-===================
+-
+-This directory contains various scripts to assist with making PhantomJS
+-packages.
+-
+-Packaging for Linux
+--------------------
+-
+-Linux building/packaging is best done in a container to ensure
+-isolation.  We use [Docker](https://www.docker.com/) to automate the
+-process. Please see the [Docker documentation](https://docs.docker.com/)
+-for instructions on installing Docker. For OS X or Windows host,
+-please use [Docker Toolbox](https://www.docker.com/docker-toolbox).
+-
+-Once you have Docker installed, run these commands from the top level
+-of the PhantomJS source repository:
+-
+-```bash
+- $ git clean -xfd .
+- $ docker run -v $PWD:/src debian:wheezy /src/deploy/docker-build.sh
+-```
+-
+-For the 32-bit version:
+-
+-```bash
+- $ git clean -xfd .
+- $ docker run -v $PWD:/src tubia/debian:wheezy /src/deploy/docker-build.sh
+-```
+-
+-The built binary will be extracted out of the container and copied to
+-the current directory.
+-
+-
+-Packaging for OS X
+-------------------
+-
+-Run `deploy/build-and-package.sh`. That's it.
+-
+-However, if you have previously built the sources in release mode, you
+-should clean your tree to make sure all the debugging symbols gets
+-compiled:
+-
+-  $ make clean && cd src/qt && make clean && cd ../..
+diff --git a/deploy/brandelf.c b/deploy/brandelf.c
+deleted file mode 100644
+index 530297bbf..000000000
+--- a/deploy/brandelf.c
++++ /dev/null
+@@ -1,212 +0,0 @@
+-/*-
+- * Copyright (c) 2000, 2001 David O'Brien
+- * Copyright (c) 1996 Søren Schmidt
+- * All rights reserved.
+- *
+- * Redistribution and use in source and binary forms, with or without
+- * modification, are permitted provided that the following conditions
+- * are met:
+- * 1. Redistributions of source code must retain the above copyright
+- *    notice, this list of conditions and the following disclaimer
+- *    in this position and unchanged.
+- * 2. Redistributions in binary form must reproduce the above copyright
+- *    notice, this list of conditions and the following disclaimer in the
+- *    documentation and/or other materials provided with the distribution.
+- * 3. The name of the author may not be used to endorse or promote products
+- *    derived from this software without specific prior written permission
+- *
+- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+- */
+-
+-#include <sys/cdefs.h>
+-//NOTE: commented out to make it compile on linux
+-// __FBSDID("$FreeBSD: src/usr.bin/brandelf/brandelf.c,v 1.25.22.2 2012/03/16 03:22:37 eadler Exp $");
+-
+-#include <sys/types.h>
+-//NOTE: changed path to make it compile on linux
+-#include <elf.h>
+-#include <sys/errno.h>
+-#include <err.h>
+-#include <fcntl.h>
+-#include <stdio.h>
+-#include <stdlib.h>
+-#include <string.h>
+-#include <unistd.h>
+-
+-static int elftype(const char *);
+-static const char *iselftype(int);
+-static void printelftypes(void);
+-static void usage(void);
+-
+-struct ELFtypes {
+-	const char *str;
+-	int value;
+-};
+-/* XXX - any more types? */
+-static struct ELFtypes elftypes[] = {
+-	{ "FreeBSD",	ELFOSABI_FREEBSD },
+-	{ "Linux",	ELFOSABI_LINUX },
+-	{ "Solaris",	ELFOSABI_SOLARIS },
+-	{ "SVR4",	ELFOSABI_SYSV }
+-};
+-
+-int
+-main(int argc, char **argv)
+-{
+-
+-	const char *strtype = "FreeBSD";
+-	int type = ELFOSABI_FREEBSD;
+-	int retval = 0;
+-	int ch, change = 0, force = 0, listed = 0;
+-
+-	while ((ch = getopt(argc, argv, "f:lt:v")) != -1)
+-		switch (ch) {
+-		case 'f':
+-			if (change)
+-				errx(1, "f option incompatible with t option");
+-			force = 1;
+-			type = atoi(optarg);
+-			if (errno == ERANGE || type < 0 || type > 255) {
+-				warnx("invalid argument to option f: %s",
+-				    optarg);
+-				usage();
+-			}
+-			break;
+-		case 'l':
+-			printelftypes();
+-			listed = 1;
+-			break;
+-		case 'v':
+-			/* does nothing */
+-			break;
+-		case 't':
+-			if (force)
+-				errx(1, "t option incompatible with f option");
+-			change = 1;
+-			strtype = optarg;
+-			break;
+-		default:
+-			usage();
+-	}
+-	argc -= optind;
+-	argv += optind;
+-	if (!argc) {
+-		if (listed)
+-			exit(0);
+-		else {
+-			warnx("no file(s) specified");
+-			usage();
+-		}
+-	}
+-
+-	if (!force && (type = elftype(strtype)) == -1) {
+-		warnx("invalid ELF type '%s'", strtype);
+-		printelftypes();
+-		usage();
+-	}
+-
+-	while (argc) {
+-		int fd;
+-		char buffer[EI_NIDENT];
+-
+-		if ((fd = open(argv[0], change || force ? O_RDWR : O_RDONLY, 0)) < 0) {
+-			warn("error opening file %s", argv[0]);
+-			retval = 1;
+-			goto fail;
+-		}
+-		if (read(fd, buffer, EI_NIDENT) < EI_NIDENT) {
+-			warnx("file '%s' too short", argv[0]);
+-			retval = 1;
+-			goto fail;
+-		}
+-		if (buffer[0] != ELFMAG0 || buffer[1] != ELFMAG1 ||
+-		    buffer[2] != ELFMAG2 || buffer[3] != ELFMAG3) {
+-			warnx("file '%s' is not ELF format", argv[0]);
+-			retval = 1;
+-			goto fail;
+-		}
+-		if (!change && !force) {
+-			fprintf(stdout,
+-				"File '%s' is of brand '%s' (%u).\n",
+-				argv[0], iselftype(buffer[EI_OSABI]),
+-				buffer[EI_OSABI]);
+-			if (!iselftype(type)) {
+-				warnx("ELF ABI Brand '%u' is unknown",
+-				      type);
+-				printelftypes();
+-			}
+-		}
+-		else {
+-			buffer[EI_OSABI] = type;
+-			lseek(fd, 0, SEEK_SET);
+-			if (write(fd, buffer, EI_NIDENT) != EI_NIDENT) {
+-				warn("error writing %s %d", argv[0], fd);
+-				retval = 1;
+-				goto fail;
+-			}
+-		}
+-fail:
+-		close(fd);
+-		argc--;
+-		argv++;
+-	}
+-
+-	return retval;
+-}
+-
+-static void
+-usage(void)
+-{
+-	(void)fprintf(stderr,
+-	    "usage: brandelf [-lv] [-f ELF_ABI_number] [-t string] file ...\n");
+-	exit(1);
+-}
+-
+-static const char *
+-iselftype(int etype)
+-{
+-	size_t elfwalk;
+-
+-	for (elfwalk = 0;
+-	     elfwalk < sizeof(elftypes)/sizeof(elftypes[0]);
+-	     elfwalk++)
+-		if (etype == elftypes[elfwalk].value)
+-			return elftypes[elfwalk].str;
+-	return 0;
+-}
+-
+-static int
+-elftype(const char *elfstrtype)
+-{
+-	size_t elfwalk;
+-
+-	for (elfwalk = 0;
+-	     elfwalk < sizeof(elftypes)/sizeof(elftypes[0]);
+-	     elfwalk++)
+-		if (strcasecmp(elfstrtype, elftypes[elfwalk].str) == 0)
+-			return elftypes[elfwalk].value;
+-	return -1;
+-}
+-
+-static void
+-printelftypes(void)
+-{
+-	size_t elfwalk;
+-
+-	fprintf(stderr, "known ELF types are: ");
+-	for (elfwalk = 0;
+-	     elfwalk < sizeof(elftypes)/sizeof(elftypes[0]);
+-	     elfwalk++)
+-		fprintf(stderr, "%s(%u) ", elftypes[elfwalk].str,
+-			elftypes[elfwalk].value);
+-	fprintf(stderr, "\n");
+-}
+diff --git a/deploy/build-and-package.sh b/deploy/build-and-package.sh
+deleted file mode 100755
+index d11501fa9..000000000
+--- a/deploy/build-and-package.sh
++++ /dev/null
+@@ -1,6 +0,0 @@
+-#!/usr/bin/env bash
+-
+-cd `dirname $0`/..
+-
+-./build.py --confirm --release --git-clean-qtbase --git-clean-qtwebkit "$@" || exit 1
+-
+diff --git a/deploy/docker-build.sh b/deploy/docker-build.sh
+deleted file mode 100755
+index 5ceb08931..000000000
+--- a/deploy/docker-build.sh
++++ /dev/null
+@@ -1,62 +0,0 @@
+-#!/usr/bin/env bash
+-
+-set -e
+-
+-SOURCE_PATH=/src
+-BUILD_PATH=$HOME/build
+-
+-# In case the old package URL is still being used
+-sed -i 's/http\.debian\.net/httpredir\.debian\.org/g' /etc/apt/sources.list
+-
+-echo "Installing packages for development tools..." && sleep 1
+-apt-get -y update
+-apt-get install -y build-essential git flex bison gperf python ruby git libfontconfig1-dev
+-echo
+-
+-echo "Preparing to download Debian source package..."
+-echo "deb-src http://httpredir.debian.org/debian wheezy main" >> /etc/apt/sources.list
+-apt-get -y update
+-echo
+-
+-OPENSSL_TARGET='linux-x86_64'
+-if [ `getconf LONG_BIT` -eq 32 ]; then
+-    OPENSSL_TARGET='linux-generic32'
+-fi
+-echo "Recompiling OpenSSL for ${OPENSSL_TARGET}..." && sleep 1
+-apt-get source openssl
+-cd openssl-1.0.1e
+-OPENSSL_FLAGS='no-idea no-mdc2 no-rc5 no-zlib enable-tlsext no-ssl2 no-ssl3 no-ssl3-method enable-rfc3779 enable-cms'
+-./Configure --prefix=/usr --openssldir=/etc/ssl --libdir=lib ${OPENSSL_FLAGS} ${OPENSSL_TARGET}
+-make depend && make && make install
+-cd ..
+-echo
+-
+-echo "Building the static version of ICU library..." && sleep 1
+-apt-get source icu
+-cd icu-4.8.1.1/source
+-./configure --prefix=/usr --enable-static --disable-shared
+-make && make install
+-cd ..
+-echo
+-
+-echo "Recreating the build directory $BUILD_PATH..."
+-rm -rf $BUILD_PATH && mkdir -p $BUILD_PATH
+-echo
+-
+-echo "Transferring the source: $SOURCE_PATH -> $BUILD_PATH. Please wait..."
+-cd $BUILD_PATH && cp -rp $SOURCE_PATH . && cd src
+-echo
+-
+-echo "Compiling PhantomJS..." && sleep 1
+-python build.py --confirm --release --qt-config="-no-pkg-config" --git-clean-qtbase --git-clean-qtwebkit
+-echo
+-
+-echo "Stripping the executable..." && sleep 1
+-ls -l bin/phantomjs
+-strip bin/phantomjs
+-echo "Copying the executable..." && sleep 1
+-ls -l bin/phantomjs
+-cp bin/phantomjs $SOURCE_PATH
+-echo
+-
+-echo "Finished."
+diff --git a/deploy/package.sh b/deploy/package.sh
+deleted file mode 100755
+index 16d6525bc..000000000
+--- a/deploy/package.sh
++++ /dev/null
+@@ -1,120 +0,0 @@
+-#!/usr/bin/env bash
+-
+-#
+-# usage: just run this script (after having run build.sh)
+-#        and deploy the created tarball to your target machine.
+-#
+-# It creates a phantomjs-$version folder and copies the binary,
+-# example, license etc. together with all shared library dependencies
+-# to that folder. Furthermore brandelf is used to make the lib
+-# and binary compatible with older unix/linux machines that don't
+-# know the new Linux ELF ABI.
+-#
+-
+-cd $(dirname $0)
+-
+-if [[ ! -f ../bin/phantomjs ]]; then
+-    echo "phantomjs was not built yet, please run build.sh first"
+-    exit 1
+-fi
+-
+-if [[ "$1" = "--bundle-libs" ]]; then
+-    bundle_libs=1
+-else
+-    bundle_libs=0
+-fi
+-
+-version=$(../bin/phantomjs --version | sed 's/ /-/' | sed 's/[()]//g')
+-src=..
+-
+-echo "packaging phantomjs $version"
+-
+-if [[ $OSTYPE = darwin* ]]; then
+-    dest="phantomjs-$version-macosx"
+-else
+-    dest="phantomjs-$version-linux-$(uname -m)"
+-fi
+-
+-rm -Rf $dest{.tar.bz2,} &> /dev/null
+-mkdir -p $dest/bin
+-
+-echo
+-
+-echo -n "copying files..."
+-cp $src/bin/phantomjs $dest/bin
+-cp -r $src/{ChangeLog,examples,LICENSE.BSD,third-party.txt,README.md} $dest/
+-echo "done"
+-echo
+-
+-phantomjs=$dest/bin/phantomjs
+-
+-if [[ "$bundle_libs" = "1" ]]; then
+-    mkdir -p $dest/lib
+-
+-    if [[ ! -f brandelf ]]; then
+-        echo
+-        echo "brandelf executable not found in current dir"
+-        echo -n "compiling it now..."
+-        g++ brandelf.c -o brandelf || exit 1
+-        echo "done"
+-    fi
+-
+-    libs=$(ldd $phantomjs | egrep -o "/[^ ]+ ")
+-
+-    echo -n "copying shared libs..."
+-    libld=
+-    for l in $libs; do
+-        ll=$(basename $l)
+-        cp $l $dest/lib/$ll
+-
+-        if [[ "$bundle_libs" = "1" ]]; then
+-            # ensure OS ABI compatibility
+-            ./brandelf -t SVR4 $dest/lib/$ll
+-            if [[ "$l" == *"ld-linux"* ]]; then
+-                libld=$ll
+-            fi
+-        fi
+-    done
+-    echo "done"
+-    echo
+-
+-    echo -n "writing run script..."
+-    mv $phantomjs $phantomjs.bin
+-    phantomjs=$phantomjs.bin
+-    run=$dest/bin/phantomjs
+-    echo '#!/bin/sh' >> $run
+-    echo 'path=$(dirname $(dirname $(readlink -f $0)))' >> $run
+-    echo 'export LD_LIBRARY_PATH=$path/lib' >> $run
+-    echo 'exec $path/lib/'$libld' $phantomjs $@' >> $run
+-    chmod +x $run
+-    echo "done"
+-    echo
+-fi
+-
+-echo -n "stripping binary and libs..."
+-if [[ $OSTYPE = darwin* ]]; then
+-    strip -x $phantomjs
+-else
+-    strip -s $phantomjs
+-    [[ -d $dest/lib ]] && strip -s $dest/lib/*
+-fi
+-echo "done"
+-echo
+-
+-echo -n "compressing binary..."
+-if type upx >/dev/null 2>&1; then
+-    upx -qqq -9 $phantomjs
+-    echo "done"
+-else
+-    echo "upx not found"
+-fi
+-echo
+-
+-echo -n "creating archive..."
+-if [[ $OSTYPE = darwin* ]]; then
+-    zip -r $dest.zip $dest
+-else
+-    tar -cjf $dest{.tar.bz2,}
+-fi
+-echo "done"
+-echo
+diff --git a/phantomjs.pro b/phantomjs.pro
+deleted file mode 100644
+index 24663df32..000000000
+--- a/phantomjs.pro
++++ /dev/null
+@@ -1,3 +0,0 @@
+-TEMPLATE = subdirs
+-CONFIG += ordered
+-SUBDIRS += src/phantomjs.pro
+diff --git a/src/linenoise/linenoise.pri b/src/linenoise/linenoise.pri
+deleted file mode 100644
+index 9095bae9c..000000000
+--- a/src/linenoise/linenoise.pri
++++ /dev/null
+@@ -1,9 +0,0 @@
+-VPATH += $$PWD/src
+-INCLUDEPATH += $$PWD/src
+-
+-DEFINES += USE_UTF8
+-
+-SOURCES += linenoise.c \
+-    utf8.c
+-HEADERS += linenoise.h \
+-    utf8.h
+diff --git a/src/mongoose/mongoose.pri b/src/mongoose/mongoose.pri
+deleted file mode 100644
+index 5fb16f996..000000000
+--- a/src/mongoose/mongoose.pri
++++ /dev/null
+@@ -1,7 +0,0 @@
+-VPATH += $$PWD
+-INCLUDEPATH += $$PWD
+-
+-SOURCES += mongoose.c
+-HEADERS += mongoose.h
+-linux*:LIBS += -ldl
+-win32:LIBS += -lWs2_32
+diff --git a/src/qcommandline/qcommandline.pri b/src/qcommandline/qcommandline.pri
+deleted file mode 100644
+index e994f19b2..000000000
+--- a/src/qcommandline/qcommandline.pri
++++ /dev/null
+@@ -1,7 +0,0 @@
+-VPATH += $$PWD
+-INCLUDEPATH += $$PWD
+-
+-DEFINES += STATIC_BUILD QCOMMANDLINE_STATIC
+-
+-SOURCES += qcommandline.cpp
+-HEADERS += qcommandline.h
+-- 
+2.39.0
+
diff --git a/srcpkgs/phantomjs/template b/srcpkgs/phantomjs/template
new file mode 100644
index 000000000000..1350486a0d78
--- /dev/null
+++ b/srcpkgs/phantomjs/template
@@ -0,0 +1,18 @@
+# Template file for 'phantomjs'
+pkgname=phantomjs
+version=2.1.1
+revision=1
+build_style=configure
+configure_args="--prefix=/usr"
+hostmakedepends="cmake qt5-host-tools qt5-qmake"
+makedepends="qt5-devel qt5-webkit-devel"
+short_desc="Headless web browser scriptable with JavaScript"
+maintainer="Eugen Zagorodniy <zag@disroot.org>"
+license=BSD-3-Clause
+homepage="https://phantomjs.org/"
+distfiles="https://github.com/ariya/phantomjs/archive/refs/tags/${version}.tar.gz"
+checksum=bd1e63e9cd48d5a9c8ff1affc254eeae14704304437710729f133cb80cf98cf1
+
+post_install() {
+	vlicense LICENSE.BSD
+}

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PR PATCH] [Updated] New package: phantomjs-2.1.1
  2023-02-02  6:15 [PR PATCH] New package: phantomjs-2.1.1 ezag
@ 2023-02-02  6:55 ` ezag
  2023-02-02  6:56 ` ezag
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: ezag @ 2023-02-02  6:55 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1823 bytes --]

There is an updated pull request by ezag against master on the void-packages repository

https://github.com/ezag/void-packages phantomjs
https://github.com/void-linux/void-packages/pull/42024

New package: phantomjs-2.1.1
This package [has been removed due to dead upstream](https://github.com/void-linux/void-packages/commit/702d6cb7f3a881f32e69d01baaba54217a8c38a8).

However, with few patches cherry-picked from upstream development version, it does build against current Qt5 version.

Since youtube-dl/yt-dlp still [optionally depends on it](https://github.com/void-linux/void-packages/pull/12244) as fallback to avoid throttling, it would be nice to have this package available, despite its [suspended development](https://github.com/ariya/phantomjs/issues/15344).

<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl (crossbuild)
  - armv7l (crossbuild)
  - armv6l-musl (crossbuild)



A patch file from https://github.com/void-linux/void-packages/pull/42024.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-phantomjs-42024.patch --]
[-- Type: text/x-diff, Size: 60468 bytes --]

From df8e13430d12fabdd92179342f3b00aeb6ecf907 Mon Sep 17 00:00:00 2001
From: Eugen Zagorodniy <zag@disroot.org>
Date: Thu, 2 Feb 2023 07:41:58 +0200
Subject: [PATCH] New package: phantomjs-2.1.1

---
 ...low-user-to-change-DPI-of-a-web-page.patch |  260 +++++
 ...-Add-support-to-render-pdf-to-base64.patch |  279 +++++
 ...me-API-for-the-latest-QtWebKit-15341.patch |  195 ++++
 .../0004-Use-CMake-build-system-15397.patch   | 1008 +++++++++++++++++
 srcpkgs/phantomjs/template                    |   22 +
 5 files changed, 1764 insertions(+)
 create mode 100644 srcpkgs/phantomjs/patches/0001-Allow-user-to-change-DPI-of-a-web-page.patch
 create mode 100644 srcpkgs/phantomjs/patches/0002-Add-support-to-render-pdf-to-base64.patch
 create mode 100644 srcpkgs/phantomjs/patches/0003-Adjust-some-API-for-the-latest-QtWebKit-15341.patch
 create mode 100644 srcpkgs/phantomjs/patches/0004-Use-CMake-build-system-15397.patch
 create mode 100644 srcpkgs/phantomjs/template

diff --git a/srcpkgs/phantomjs/patches/0001-Allow-user-to-change-DPI-of-a-web-page.patch b/srcpkgs/phantomjs/patches/0001-Allow-user-to-change-DPI-of-a-web-page.patch
new file mode 100644
index 000000000000..7618cb4736e3
--- /dev/null
+++ b/srcpkgs/phantomjs/patches/0001-Allow-user-to-change-DPI-of-a-web-page.patch
@@ -0,0 +1,260 @@
+From 46bfca843ee2ef466262b02bfcd1675407e13db6 Mon Sep 17 00:00:00 2001
+From: Vitaly Slobodin <vitaliy.slobodin@gmail.com>
+Date: Fri, 11 Mar 2016 19:08:35 +0300
+Subject: [PATCH 1/4] Allow user to change DPI of a web page
+
+Issue: #12085
+---
+ src/consts.h    |  1 +
+ src/phantom.cpp | 21 +++++++++++-------
+ src/phantom.h   |  1 +
+ src/webpage.cpp | 57 ++++++++++++++++++++++++++-----------------------
+ src/webpage.h   |  5 +++++
+ 5 files changed, 50 insertions(+), 35 deletions(-)
+
+diff --git a/src/consts.h b/src/consts.h
+index 28b237221..54226d012 100644
+--- a/src/consts.h
++++ b/src/consts.h
+@@ -67,6 +67,7 @@
+ #define PAGE_SETTINGS_WEB_SECURITY_ENABLED  "webSecurityEnabled"
+ #define PAGE_SETTINGS_JS_CAN_OPEN_WINDOWS   "javascriptCanOpenWindows"
+ #define PAGE_SETTINGS_JS_CAN_CLOSE_WINDOWS  "javascriptCanCloseWindows"
++#define PAGE_SETTINGS_DPI                   "dpi"
+ 
+ #define DEFAULT_WEBDRIVER_CONFIG            "127.0.0.1:8910"
+ 
+diff --git a/src/phantom.cpp b/src/phantom.cpp
+index afabaadda..5417b9beb 100644
+--- a/src/phantom.cpp
++++ b/src/phantom.cpp
+@@ -31,25 +31,26 @@
+ #include "phantom.h"
+ 
+ #include <QApplication>
++#include <QDebug>
+ #include <QDir>
+-#include <QFileInfo>
+ #include <QFile>
+-#include <QtWebKitWidgets/QWebPage>
+-#include <QDebug>
++#include <QFileInfo>
+ #include <QMetaObject>
+ #include <QMetaProperty>
++#include <QScreen>
+ #include <QStandardPaths>
++#include <QtWebKitWidgets/QWebPage>
+ 
++#include "callback.h"
++#include "childprocess.h"
+ #include "consts.h"
++#include "cookiejar.h"
++#include "repl.h"
++#include "system.h"
+ #include "terminal.h"
+ #include "utils.h"
+ #include "webpage.h"
+ #include "webserver.h"
+-#include "repl.h"
+-#include "system.h"
+-#include "callback.h"
+-#include "cookiejar.h"
+-#include "childprocess.h"
+ 
+ static Phantom* phantomInstance = NULL;
+ 
+@@ -100,6 +101,9 @@ void Phantom::init()
+     // Initialize the CookieJar
+     m_defaultCookieJar = new CookieJar(m_config.cookiesFile());
+ 
++    // set the default DPI
++    m_defaultDpi = qRound(QApplication::primaryScreen()->logicalDotsPerInch());
++
+     QWebSettings::setOfflineWebApplicationCachePath(QStandardPaths::writableLocation(QStandardPaths::DataLocation));
+     if (m_config.offlineStoragePath().isEmpty()) {
+         QWebSettings::setOfflineStoragePath(QStandardPaths::writableLocation(QStandardPaths::DataLocation));
+@@ -139,6 +143,7 @@ void Phantom::init()
+     m_defaultPageSettings[PAGE_SETTINGS_WEB_SECURITY_ENABLED] = QVariant::fromValue(m_config.webSecurityEnabled());
+     m_defaultPageSettings[PAGE_SETTINGS_JS_CAN_OPEN_WINDOWS] = QVariant::fromValue(m_config.javascriptCanOpenWindows());
+     m_defaultPageSettings[PAGE_SETTINGS_JS_CAN_CLOSE_WINDOWS] = QVariant::fromValue(m_config.javascriptCanCloseWindows());
++    m_defaultPageSettings[PAGE_SETTINGS_DPI] = QVariant::fromValue(m_defaultDpi);
+     m_page->applySettings(m_defaultPageSettings);
+ 
+     setLibraryPath(QFileInfo(m_config.scriptFile()).dir().absolutePath());
+diff --git a/src/phantom.h b/src/phantom.h
+index 7c32eb141..c7e5b787f 100644
+--- a/src/phantom.h
++++ b/src/phantom.h
+@@ -237,6 +237,7 @@ private:
+     QList<QPointer<WebServer> > m_servers;
+     Config m_config;
+     CookieJar* m_defaultCookieJar;
++    qreal m_defaultDpi;
+ 
+     friend class CustomPage;
+ };
+diff --git a/src/webpage.cpp b/src/webpage.cpp
+index fc235bc56..4158064d4 100644
+--- a/src/webpage.cpp
++++ b/src/webpage.cpp
+@@ -30,47 +30,47 @@
+ 
+ #include "webpage.h"
+ 
+-#include <math.h>
+-
+ #include <QApplication>
++#include <QBuffer>
+ #include <QContextMenuEvent>
+-#include <QDesktopServices>
+ #include <QDateTime>
++#include <QDebug>
++#include <QDesktopServices>
+ #include <QDir>
+ #include <QFileInfo>
++#include <QImageWriter>
+ #include <QKeyEvent>
++#include <QMapIterator>
+ #include <QMouseEvent>
+ #include <QNetworkAccessManager>
+ #include <QNetworkCookie>
++#include <QNetworkProxy>
+ #include <QNetworkRequest>
+ #include <QPainter>
+-#include <QtPrintSupport/QPrinter>
+-#include <QWebHistory>
+-#include <QWebHistoryItem>
++#include <QScreen>
++#include <QUrl>
++#include <QUuid>
+ #include <QWebElement>
+ #include <QWebFrame>
+-#include <QWebPage>
++#include <QWebHistory>
++#include <QWebHistoryItem>
+ #include <QWebInspector>
+-#include <QMapIterator>
+-#include <QBuffer>
+-#include <QDebug>
+-#include <QImageWriter>
+-#include <QUuid>
+-#include <QUrl>
+-#include <QNetworkProxy>
++#include <QWebPage>
++#include <QtPrintSupport/QPrinter>
++#include <math.h>
+ 
+-#include "phantom.h"
+-#include "networkaccessmanager.h"
+-#include "utils.h"
++#include "callback.h"
+ #include "config.h"
+ #include "consts.h"
+-#include "callback.h"
+ #include "cookiejar.h"
++#include "networkaccessmanager.h"
++#include "phantom.h"
+ #include "system.h"
++#include "utils.h"
+ 
+ #ifdef Q_OS_WIN
+-#include <io.h>
+ #include <fcntl.h>
++#include <io.h>
+ #endif
+ 
+ // Ensure we have at least head and body.
+@@ -435,6 +435,7 @@ WebPage::WebPage(QObject* parent, const QUrl& baseUrl)
+     connect(m_networkAccessManager, SIGNAL(resourceTimeout(QVariant)),
+             SIGNAL(resourceTimeout(QVariant)));
+ 
++    m_dpi = qRound(QApplication::primaryScreen()->logicalDotsPerInch());
+     m_customWebPage->setViewportSize(QSize(400, 300));
+ }
+ 
+@@ -649,6 +650,10 @@ void WebPage::applySettings(const QVariantMap& def)
+     if (def.contains(PAGE_SETTINGS_PROXY)) {
+         setProxy(def[PAGE_SETTINGS_PROXY].toString());
+     }
++
++    if (def.contains(PAGE_SETTINGS_DPI)) {
++        m_dpi = def[PAGE_SETTINGS_DPI].toReal();
++    }
+ }
+ 
+ void WebPage::setProxy(const QString& proxyUrl)
+@@ -1124,9 +1129,7 @@ QImage WebPage::renderImage()
+     return buffer;
+ }
+ 
+-#define PHANTOMJS_PDF_DPI 72            // Different defaults. OSX: 72, X11: 75(?), Windows: 96
+-
+-qreal stringToPointSize(const QString& string)
++qreal WebPage::stringToPointSize(const QString& string) const
+ {
+     static const struct {
+         QString unit;
+@@ -1135,8 +1138,8 @@ qreal stringToPointSize(const QString& string)
+         { "mm", 72 / 25.4 },
+         { "cm", 72 / 2.54 },
+         { "in", 72 },
+-        { "px", 72.0 / PHANTOMJS_PDF_DPI },
+-        { "", 72.0 / PHANTOMJS_PDF_DPI }
++        { "px", 72.0 / m_dpi },
++        { "", 72.0 / m_dpi }
+     };
+     for (uint i = 0; i < sizeof(units) / sizeof(units[0]); ++i) {
+         if (string.endsWith(units[i].unit)) {
+@@ -1148,7 +1151,7 @@ qreal stringToPointSize(const QString& string)
+     return 0;
+ }
+ 
+-qreal printMargin(const QVariantMap& map, const QString& key)
++qreal WebPage::printMargin(const QVariantMap& map, const QString& key)
+ {
+     const QVariant margin = map.value(key);
+     if (margin.isValid() && margin.canConvert(QVariant::String)) {
+@@ -1163,7 +1166,7 @@ bool WebPage::renderPdf(const QString& fileName)
+     QPrinter printer;
+     printer.setOutputFormat(QPrinter::PdfFormat);
+     printer.setOutputFileName(fileName);
+-    printer.setResolution(PHANTOMJS_PDF_DPI);
++    printer.setResolution(m_dpi);
+     QVariantMap paperSize = m_paperSize;
+ 
+     if (paperSize.isEmpty()) {
+@@ -1276,7 +1279,7 @@ QString WebPage::windowName() const
+     return m_mainFrame->evaluateJavaScript("window.name;").toString();
+ }
+ 
+-qreal getHeight(const QVariantMap& map, const QString& key)
++qreal WebPage::getHeight(const QVariantMap& map, const QString& key) const
+ {
+     QVariant footer = map.value(key);
+     if (!footer.canConvert(QVariant::Map)) {
+diff --git a/src/webpage.h b/src/webpage.h
+index 4e41ec246..59279db85 100644
+--- a/src/webpage.h
++++ b/src/webpage.h
+@@ -483,6 +483,10 @@ public slots:
+ 
+     void setProxy(const QString& proxyUrl);
+ 
++    qreal stringToPointSize(const QString&) const;
++    qreal printMargin(const QVariantMap&, const QString&);
++    qreal getHeight(const QVariantMap&, const QString&) const;
++
+ signals:
+     void initialized();
+     void loadStarted();
+@@ -544,6 +548,7 @@ private:
+     int m_loadingProgress;
+     bool m_shouldInterruptJs;
+     CookieJar* m_cookieJar;
++    qreal m_dpi;
+ 
+     friend class Phantom;
+     friend class CustomPage;
+-- 
+2.39.0
+
diff --git a/srcpkgs/phantomjs/patches/0002-Add-support-to-render-pdf-to-base64.patch b/srcpkgs/phantomjs/patches/0002-Add-support-to-render-pdf-to-base64.patch
new file mode 100644
index 000000000000..12fbe6d62845
--- /dev/null
+++ b/srcpkgs/phantomjs/patches/0002-Add-support-to-render-pdf-to-base64.patch
@@ -0,0 +1,279 @@
+From 43b9ec48bdf4aaeaeebe6f5926b119d876b39fa9 Mon Sep 17 00:00:00 2001
+From: Connor Dunn <connorhd@squareup.com>
+Date: Thu, 28 Apr 2016 23:06:15 -0700
+Subject: [PATCH 2/4] Add support to render pdf to base64.
+
+https://github.com/ariya/phantomjs/issues/11192
+https://github.com/ariya/phantomjs/issues/12392
+---
+ src/webpage.cpp                     | 122 +++++++++++++++-------------
+ src/webpage.h                       |   3 +-
+ test/module/webpage/renderBase64.js |  51 ++++++++++++
+ 3 files changed, 118 insertions(+), 58 deletions(-)
+ create mode 100644 test/module/webpage/renderBase64.js
+
+diff --git a/src/webpage.cpp b/src/webpage.cpp
+index 4158064d4..305085d87 100644
+--- a/src/webpage.cpp
++++ b/src/webpage.cpp
+@@ -56,7 +56,6 @@
+ #include <QWebHistoryItem>
+ #include <QWebInspector>
+ #include <QWebPage>
+-#include <QtPrintSupport/QPrinter>
+ #include <math.h>
+ 
+ #include "callback.h"
+@@ -999,7 +998,8 @@ bool WebPage::render(const QString& fileName, const QVariantMap& option)
+ 
+     bool retval = true;
+     if (format == "pdf") {
+-        retval = renderPdf(outFileName);
++        QPdfWriter pdfWriter(fileName);
++        retval = renderPdf(pdfWriter);
+     } else {
+         QImage rawPageRendering = renderImage();
+ 
+@@ -1053,23 +1053,31 @@ QString WebPage::renderBase64(const QByteArray& format)
+ {
+     QByteArray nformat = format.toLower();
+ 
+-    // Check if the given format is supported
+-    if (QImageWriter::supportedImageFormats().contains(nformat)) {
+-        QImage rawPageRendering = renderImage();
++    if (format != "pdf" && !QImageWriter::supportedImageFormats().contains(nformat)) {
++        // Return an empty string in case an unsupported format was provided
++        return "";
++    }
++
++    // Prepare buffer for writing
++    QByteArray bytes;
++    QBuffer buffer(&bytes);
++    buffer.open(QIODevice::WriteOnly);
++
++    if (format == "pdf") {
++        QPdfWriter pdfWriter(&buffer);
+ 
+-        // Prepare buffer for writing
+-        QByteArray bytes;
+-        QBuffer buffer(&bytes);
+-        buffer.open(QIODevice::WriteOnly);
++        if (!renderPdf(pdfWriter)) {
++            // Return an empty string if pdf render fails
++            return "";
++        }
++    } else {
++        QImage rawPageRendering = renderImage();
+ 
+         // Writing image to the buffer, using PNG encoding
+         rawPageRendering.save(&buffer, nformat);
+-
+-        return bytes.toBase64();
+     }
+ 
+-    // Return an empty string in case an unsupported format was provided
+-    return "";
++    return bytes.toBase64();
+ }
+ 
+ QImage WebPage::renderImage()
+@@ -1161,12 +1169,9 @@ qreal WebPage::printMargin(const QVariantMap& map, const QString& key)
+     }
+ }
+ 
+-bool WebPage::renderPdf(const QString& fileName)
++bool WebPage::renderPdf(QPdfWriter& pdfWriter)
+ {
+-    QPrinter printer;
+-    printer.setOutputFormat(QPrinter::PdfFormat);
+-    printer.setOutputFileName(fileName);
+-    printer.setResolution(m_dpi);
++    pdfWriter.setResolution(m_dpi);
+     QVariantMap paperSize = m_paperSize;
+ 
+     if (paperSize.isEmpty()) {
+@@ -1179,51 +1184,51 @@ bool WebPage::renderPdf(const QString& fileName)
+     if (paperSize.contains("width") && paperSize.contains("height")) {
+         const QSizeF sizePt(ceil(stringToPointSize(paperSize.value("width").toString())),
+                             ceil(stringToPointSize(paperSize.value("height").toString())));
+-        printer.setPaperSize(sizePt, QPrinter::Point);
++        pdfWriter.setPageSize(QPageSize(sizePt, QPageSize::Point));
+     } else if (paperSize.contains("format")) {
+-        const QPrinter::Orientation orientation = paperSize.contains("orientation")
++        const QPageLayout::Orientation orientation = paperSize.contains("orientation")
+                 && paperSize.value("orientation").toString().compare("landscape", Qt::CaseInsensitive) == 0 ?
+-                QPrinter::Landscape : QPrinter::Portrait;
+-        printer.setOrientation(orientation);
++                QPageLayout::Portrait : QPageLayout::Landscape;
++        pdfWriter.setPageOrientation(orientation);
+         static const struct {
+             QString format;
+-            QPrinter::PaperSize paperSize;
++            QPageSize::PageSizeId paperSize;
+         } formats[] = {
+-            { "A0", QPrinter::A0 },
+-            { "A1", QPrinter::A1 },
+-            { "A2", QPrinter::A2 },
+-            { "A3", QPrinter::A3 },
+-            { "A4", QPrinter::A4 },
+-            { "A5", QPrinter::A5 },
+-            { "A6", QPrinter::A6 },
+-            { "A7", QPrinter::A7 },
+-            { "A8", QPrinter::A8 },
+-            { "A9", QPrinter::A9 },
+-            { "B0", QPrinter::B0 },
+-            { "B1", QPrinter::B1 },
+-            { "B2", QPrinter::B2 },
+-            { "B3", QPrinter::B3 },
+-            { "B4", QPrinter::B4 },
+-            { "B5", QPrinter::B5 },
+-            { "B6", QPrinter::B6 },
+-            { "B7", QPrinter::B7 },
+-            { "B8", QPrinter::B8 },
+-            { "B9", QPrinter::B9 },
+-            { "B10", QPrinter::B10 },
+-            { "C5E", QPrinter::C5E },
+-            { "Comm10E", QPrinter::Comm10E },
+-            { "DLE", QPrinter::DLE },
+-            { "Executive", QPrinter::Executive },
+-            { "Folio", QPrinter::Folio },
+-            { "Ledger", QPrinter::Ledger },
+-            { "Legal", QPrinter::Legal },
+-            { "Letter", QPrinter::Letter },
+-            { "Tabloid", QPrinter::Tabloid }
++            { "A0", QPageSize::A0 },
++            { "A1", QPageSize::A1 },
++            { "A2", QPageSize::A2 },
++            { "A3", QPageSize::A3 },
++            { "A4", QPageSize::A4 },
++            { "A5", QPageSize::A5 },
++            { "A6", QPageSize::A6 },
++            { "A7", QPageSize::A7 },
++            { "A8", QPageSize::A8 },
++            { "A9", QPageSize::A9 },
++            { "B0", QPageSize::B0 },
++            { "B1", QPageSize::B1 },
++            { "B2", QPageSize::B2 },
++            { "B3", QPageSize::B3 },
++            { "B4", QPageSize::B4 },
++            { "B5", QPageSize::B5 },
++            { "B6", QPageSize::B6 },
++            { "B7", QPageSize::B7 },
++            { "B8", QPageSize::B8 },
++            { "B9", QPageSize::B9 },
++            { "B10", QPageSize::B10 },
++            { "C5E", QPageSize::C5E },
++            { "Comm10E", QPageSize::Comm10E },
++            { "DLE", QPageSize::DLE },
++            { "Executive", QPageSize::Executive },
++            { "Folio", QPageSize::Folio },
++            { "Ledger", QPageSize::Ledger },
++            { "Legal", QPageSize::Legal },
++            { "Letter", QPageSize::Letter },
++            { "Tabloid", QPageSize::Tabloid }
+         };
+-        printer.setPaperSize(QPrinter::A4); // Fallback
++        pdfWriter.setPageSize(QPageSize(QPageSize::A4)); // Fallback
+         for (uint i = 0; i < sizeof(formats) / sizeof(formats[0]); ++i) {
+             if (paperSize.value("format").toString().compare(formats[i].format, Qt::CaseInsensitive) == 0) {
+-                printer.setPaperSize(formats[i].paperSize);
++                pdfWriter.setPageSize(QPageSize(formats[i].paperSize));
+                 break;
+             }
+         }
+@@ -1258,9 +1263,12 @@ bool WebPage::renderPdf(const QString& fileName)
+         }
+     }
+ 
+-    printer.setPageMargins(marginLeft, marginTop, marginRight, marginBottom, QPrinter::Point);
++    pdfWriter.setPageMargins(QMarginsF(marginLeft, marginTop, marginRight, marginBottom), QPageLayout::Point);
++
++    QPainter painter(&pdfWriter);
++    m_mainFrame->render(&painter);
++    painter.end();
+ 
+-    m_mainFrame->print(&printer, this);
+     return true;
+ }
+ 
+diff --git a/src/webpage.h b/src/webpage.h
+index 59279db85..062179d27 100644
+--- a/src/webpage.h
++++ b/src/webpage.h
+@@ -35,6 +35,7 @@
+ #include <QVariantMap>
+ #include <QtWebKitWidgets/QWebPage>
+ #include <QtWebKitWidgets/QWebFrame>
++#include <QPdfWriter>
+ 
+ #include "cookiejar.h"
+ 
+@@ -514,7 +515,7 @@ private slots:
+ 
+ private:
+     QImage renderImage();
+-    bool renderPdf(const QString& fileName);
++    bool renderPdf(QPdfWriter& pdfWriter);
+     void applySettings(const QVariantMap& defaultSettings);
+     QString userAgent() const;
+ 
+diff --git a/test/module/webpage/renderBase64.js b/test/module/webpage/renderBase64.js
+new file mode 100644
+index 000000000..17797d576
+--- /dev/null
++++ b/test/module/webpage/renderBase64.js
+@@ -0,0 +1,51 @@
++var fs      = require("fs");
++var system  = require("system");
++var webpage = require("webpage");
++var renders = require("./renders");
++
++function clean_pdf(data) {
++    // FIXME: This is not nearly enough normalization.
++    data = data.replace(/\/(Title|Creator|Producer|CreationDate) \([^\n]*\)/g, "/$1 ()");
++    data = data.replace(/\nxref\n[0-9 nf\n]+trailer\b/, "\ntrailer");
++    data = data.replace(/\nstartxref\n[0-9]+\n%%EOF\n/, "\n");
++    return data;
++}
++
++function render_test(format) {
++    var expect_content = btoa(renders.get(format, ""));
++    var p = webpage.create();
++
++    p.paperSize = { width: '300px', height: '300px', border: '0px' };
++    p.clipRect = { top: 0, left: 0, width: 300, height: 300};
++    p.viewportSize = { width: 300, height: 300};
++
++    p.open(TEST_HTTP_BASE + "render/", this.step_func_done(function (status) {
++        var content = p.renderBase64(format);
++
++        // expected variation in PDF output
++        if (format === "pdf") {
++            content = clean_pdf(content);
++            expect_content = clean_pdf(expect_content);
++        }
++
++        // Don't dump entire images to the log on failure.
++        assert_is_true(content === expect_content);
++    }));
++}
++
++[
++    "pdf",
++    "png",
++    "jpg",
++]
++.forEach(function (format) {
++    var props  = {};
++
++    // All tests fail on Linux.  All tests except JPG fail on Mac.
++    // Currently unknown which tests fail on Windows.
++    if (format !== "jpg" || system.os.name !== "mac")
++        props.expected_fail = true;
++
++    async_test(function () { render_test.call(this, format); },
++               format, props);
++});
+-- 
+2.39.0
+
diff --git a/srcpkgs/phantomjs/patches/0003-Adjust-some-API-for-the-latest-QtWebKit-15341.patch b/srcpkgs/phantomjs/patches/0003-Adjust-some-API-for-the-latest-QtWebKit-15341.patch
new file mode 100644
index 000000000000..eafb86b88212
--- /dev/null
+++ b/srcpkgs/phantomjs/patches/0003-Adjust-some-API-for-the-latest-QtWebKit-15341.patch
@@ -0,0 +1,195 @@
+From 48752bfeaaf6d16b1cfb51fbcd300d1f25e17a6a Mon Sep 17 00:00:00 2001
+From: Ariya Hidayat <ariya.hidayat@gmail.com>
+Date: Fri, 29 Nov 2019 22:39:09 -0800
+Subject: [PATCH 3/4] Adjust some API for the latest QtWebKit (#15341)
+
+---
+ src/bootstrap.js       | 3 ++-
+ src/config.cpp         | 2 +-
+ src/modules/webpage.js | 3 ++-
+ src/phantom.cpp        | 5 ++---
+ src/repl.cpp           | 7 +++----
+ src/utils.cpp          | 6 +++---
+ src/webpage.cpp        | 9 ++++-----
+ src/webpage.h          | 2 +-
+ 8 files changed, 18 insertions(+), 19 deletions(-)
+
+diff --git a/src/bootstrap.js b/src/bootstrap.js
+index 788d45202..1042ceb6a 100644
+--- a/src/bootstrap.js
++++ b/src/bootstrap.js
+@@ -73,7 +73,8 @@ phantom.__defineErrorSignalHandler__ = function(obj, page, handlers) {
+             return (!!handlerObj && typeof handlerObj.callback === "function" && typeof handlerObj.connector === "function") ?
+                 handlers[handlerName].callback :
+                 undefined;
+-        }
++        },
++        configurable: true
+     });
+ };
+ 
+diff --git a/src/config.cpp b/src/config.cpp
+index a81be2f36..661d6c8c9 100644
+--- a/src/config.cpp
++++ b/src/config.cpp
+@@ -177,7 +177,7 @@ void Config::loadJsonFile(const QString& filePath)
+     // Add this object to the global scope
+     webPage.mainFrame()->addToJavaScriptWindowObject("config", this);
+     // Apply the JSON config settings to this very object
+-    webPage.mainFrame()->evaluateJavaScript(configurator.arg(jsonConfig), QString());
++    webPage.mainFrame()->evaluateJavaScript(configurator.arg(jsonConfig));
+ }
+ 
+ QString Config::helpText() const
+diff --git a/src/modules/webpage.js b/src/modules/webpage.js
+index 20eae9a85..0760a74b4 100644
+--- a/src/modules/webpage.js
++++ b/src/modules/webpage.js
+@@ -115,7 +115,8 @@ function definePageSignalHandler(page, handlers, handlerName, signalName) {
+             return !!handlers[handlerName] && typeof handlers[handlerName].callback === "function" ?
+                 handlers[handlerName].callback :
+                 undefined;
+-        }
++        },
++        configurable: true
+     });
+ }
+ 
+diff --git a/src/phantom.cpp b/src/phantom.cpp
+index 5417b9beb..9565a89ea 100644
+--- a/src/phantom.cpp
++++ b/src/phantom.cpp
+@@ -386,7 +386,7 @@ void Phantom::loadModule(const QString& moduleSource, const QString& filename)
+         "require.cache['" + filename + "'].exports," +
+         "require.cache['" + filename + "']" +
+         "));";
+-    m_page->mainFrame()->evaluateJavaScript(scriptSource, QString(JAVASCRIPT_SOURCE_PLATFORM_URL).arg(QFileInfo(filename).fileName()));
++    m_page->mainFrame()->evaluateJavaScript(scriptSource);
+ }
+ 
+ bool Phantom::injectJs(const QString& jsFilePath)
+@@ -483,8 +483,7 @@ void Phantom::onInitialized()
+ 
+     // Bootstrap the PhantomJS scope
+     m_page->mainFrame()->evaluateJavaScript(
+-        Utils::readResourceFileUtf8(":/bootstrap.js"),
+-        QString(JAVASCRIPT_SOURCE_PLATFORM_URL).arg("bootstrap.js")
++        Utils::readResourceFileUtf8(":/bootstrap.js")
+     );
+ }
+ 
+diff --git a/src/repl.cpp b/src/repl.cpp
+index 45a475bc1..7f25a22b0 100644
+--- a/src/repl.cpp
++++ b/src/repl.cpp
+@@ -147,7 +147,7 @@ REPL::REPL(QWebFrame* webframe, Phantom* parent)
+     linenoiseSetCompletionCallback(REPL::offerCompletion);
+ 
+     // Inject REPL utility functions
+-    m_webframe->evaluateJavaScript(Utils::readResourceFileUtf8(":/repl.js"), QString(JAVASCRIPT_SOURCE_PLATFORM_URL).arg("repl.js"));
++    m_webframe->evaluateJavaScript(Utils::readResourceFileUtf8(":/repl.js"));
+ 
+     // Add self to JavaScript world
+     m_webframe->addToJavaScriptWindowObject("_repl", this);
+@@ -184,8 +184,7 @@ void REPL::offerCompletion(const char* buf, linenoiseCompletions* lc)
+     QStringList completions = REPL::getInstance()->m_webframe->evaluateJavaScript(
+                                   QString(JS_RETURN_POSSIBLE_COMPLETIONS).arg(
+                                       toInspect,
+-                                      toComplete),
+-                                  QString()
++                                      toComplete)
+                               ).toStringList();
+ 
+     foreach(QString c, completions) {
+@@ -210,7 +209,7 @@ void REPL::startLoop()
+             // Send the user input to the main Phantom frame for evaluation
+             m_webframe->evaluateJavaScript(
+                 QString(JS_EVAL_USER_INPUT).arg(
+-                    QString(userInput).replace('"', "\\\"")), QString("phantomjs://repl-input"));
++                    QString(userInput).replace('"', "\\\"")));
+ 
+             // Save command in the REPL history
+             linenoiseHistoryAdd(userInput);
+diff --git a/src/utils.cpp b/src/utils.cpp
+index 16d933ef9..9970e1cc0 100644
+--- a/src/utils.cpp
++++ b/src/utils.cpp
+@@ -132,7 +132,7 @@ bool injectJsInFrame(const QString& jsFilePath, const QString& jsFileLanguage, c
+         return false;
+     }
+     // Execute JS code in the context of the document
+-    targetFrame->evaluateJavaScript(scriptBody, QString(JAVASCRIPT_SOURCE_CODE_URL).arg(QFileInfo(scriptPath).fileName()));
++    targetFrame->evaluateJavaScript(scriptBody);
+     return true;
+ }
+ 
+@@ -147,10 +147,10 @@ bool loadJSForDebug(const QString& jsFilePath, const QString& jsFileLanguage, co
+     QString scriptBody = jsFromScriptFile(scriptPath, jsFileLanguage, jsFileEnc);
+ 
+     scriptBody = QString("function __run() {\n%1\n}").arg(scriptBody);
+-    targetFrame->evaluateJavaScript(scriptBody, QString(JAVASCRIPT_SOURCE_CODE_URL).arg(QFileInfo(scriptPath).fileName()));
++    targetFrame->evaluateJavaScript(scriptBody);
+ 
+     if (autorun) {
+-        targetFrame->evaluateJavaScript("__run()", QString());
++        targetFrame->evaluateJavaScript("__run()");
+     }
+ 
+     return true;
+diff --git a/src/webpage.cpp b/src/webpage.cpp
+index 305085d87..df95049a6 100644
+--- a/src/webpage.cpp
++++ b/src/webpage.cpp
+@@ -757,8 +757,7 @@ QVariant WebPage::evaluateJavaScript(const QString& code)
+     qDebug() << "WebPage - evaluateJavaScript" << function;
+ 
+     evalResult = m_currentFrame->evaluateJavaScript(
+-                     function,                                   //< function evaluated
+-                     QString("phantomjs://webpage.evaluate()")); //< reference source file
++                     function);
+ 
+     qDebug() << "WebPage - evaluateJavaScript result" << evalResult;
+ 
+@@ -930,7 +929,7 @@ void WebPage::openUrl(const QString& address, const QVariant& op, const QVariant
+     }
+ 
+     if (networkOp == QNetworkAccessManager::UnknownOperation) {
+-        m_mainFrame->evaluateJavaScript("console.error('Unknown network operation: " + operation + "');", QString());
++        m_mainFrame->evaluateJavaScript("console.error('Unknown network operation: " + operation + "');");
+         return;
+     }
+ 
+@@ -1326,7 +1325,7 @@ QString getHeaderFooter(const QVariantMap& map, const QString& key, QWebFrame* f
+             }
+         }
+     }
+-    frame->evaluateJavaScript("console.error('Bad header callback given, use phantom.callback);", QString());
++    frame->evaluateJavaScript("console.error('Bad header callback given, use phantom.callback);");
+     return QString();
+ }
+ 
+@@ -1365,7 +1364,7 @@ bool WebPage::injectJs(const QString& jsFilePath)
+ 
+ void WebPage::_appendScriptElement(const QString& scriptUrl)
+ {
+-    m_currentFrame->evaluateJavaScript(QString(JS_APPEND_SCRIPT_ELEMENT).arg(scriptUrl), scriptUrl);
++    m_currentFrame->evaluateJavaScript(QString(JS_APPEND_SCRIPT_ELEMENT).arg(scriptUrl));
+ }
+ 
+ QObject* WebPage::_getGenericCallback()
+diff --git a/src/webpage.h b/src/webpage.h
+index 062179d27..0d5e06b7f 100644
+--- a/src/webpage.h
++++ b/src/webpage.h
+@@ -46,7 +46,7 @@ class NetworkAccessManager;
+ class QWebInspector;
+ class Phantom;
+ 
+-class WebPage : public QObject, public QWebFrame::PrintCallback
++class WebPage : public QObject
+ {
+     Q_OBJECT
+     Q_PROPERTY(QString title READ title)
+-- 
+2.39.0
+
diff --git a/srcpkgs/phantomjs/patches/0004-Use-CMake-build-system-15397.patch b/srcpkgs/phantomjs/patches/0004-Use-CMake-build-system-15397.patch
new file mode 100644
index 000000000000..a5d0fa1bbc00
--- /dev/null
+++ b/srcpkgs/phantomjs/patches/0004-Use-CMake-build-system-15397.patch
@@ -0,0 +1,1008 @@
+From 538d05ed26f830522597c2623894a2193785abaf Mon Sep 17 00:00:00 2001
+From: Ariya Hidayat <ariya.hidayat@gmail.com>
+Date: Fri, 29 Nov 2019 22:29:15 -0800
+Subject: [PATCH 4/4] Use CMake build system (#15397)
+
+---
+ .gitignore                        |  15 ++
+ CMakeLists.txt                    |  34 ++++
+ INSTALL                           |  46 +++++
+ configure                         | 317 ++++++++++++++++++++++++++++++
+ deploy/.gitignore                 |   2 -
+ deploy/README.md                  |  44 -----
+ deploy/brandelf.c                 | 212 --------------------
+ deploy/build-and-package.sh       |   6 -
+ deploy/docker-build.sh            |  62 ------
+ deploy/package.sh                 | 120 -----------
+ phantomjs.pro                     |   3 -
+ src/linenoise/linenoise.pri       |   9 -
+ src/mongoose/mongoose.pri         |   7 -
+ src/qcommandline/qcommandline.pri |   7 -
+ 14 files changed, 412 insertions(+), 472 deletions(-)
+ create mode 100644 CMakeLists.txt
+ create mode 100644 INSTALL
+ create mode 100755 configure
+ delete mode 100644 deploy/.gitignore
+ delete mode 100644 deploy/README.md
+ delete mode 100644 deploy/brandelf.c
+ delete mode 100755 deploy/build-and-package.sh
+ delete mode 100755 deploy/docker-build.sh
+ delete mode 100755 deploy/package.sh
+ delete mode 100644 phantomjs.pro
+ delete mode 100644 src/linenoise/linenoise.pri
+ delete mode 100644 src/mongoose/mongoose.pri
+ delete mode 100644 src/qcommandline/qcommandline.pri
+
+diff --git a/.gitignore b/.gitignore
+index 7c8a9c08a..53ef2055d 100644
+--- a/.gitignore
++++ b/.gitignore
+@@ -60,3 +60,18 @@ bin/
+ *.class
+ build/
+ .gradle/
++
++# CMake
++CMakeLists.txt.user
++CMakeCache.txt
++CMakeFiles
++CMakeScripts
++Testing
++Makefile
++cmake_install.cmake
++install_manifest.txt
++compile_commands.json
++CTestTestfile.cmake
++_deps
++*_autogen
++
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+new file mode 100644
+index 000000000..c23e11f49
+--- /dev/null
++++ b/CMakeLists.txt
+@@ -0,0 +1,34 @@
++cmake_minimum_required(VERSION 3.5.0)
++project(phantomjs)
++
++set (CMAKE_CXX_STANDARD 11)
++
++find_package(Qt5 COMPONENTS Core Network WebKitWidgets REQUIRED)
++find_package(Threads REQUIRED)
++
++message("Using Qt version ${Qt5Core_VERSION}")
++if (Qt5Core_VERSION VERSION_LESS 5.5.0)
++  message(FATAL_ERROR "This version of Qt is not supported. Please use Qt 5.5 or later")
++endif()
++
++set(CMAKE_AUTOMOC ON)
++set(CMAKE_AUTORCC ON)
++
++set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
++
++file(GLOB_RECURSE PHANTOMJS_SOURCES src/*.cpp)
++include_directories(src)
++set(CMAKE_INCLUDE_CURRENT_DIR ON)
++
++set(THIRDPARTY_SOURCES src/mongoose/mongoose.c src/qcommandline/qcommandline.cpp src/linenoise/src/linenoise.c)
++include_directories(src/linenoise/src)
++include_directories(src/mongoose)
++include_directories(src/qcommandline)
++
++set(EXTRA_LIBS dl)
++
++add_executable(${PROJECT_NAME} src/phantomjs.qrc src/ghostdriver/ghostdriver.qrc ${PHANTOMJS_SOURCES} ${THIRDPARTY_SOURCES})
++target_link_libraries(${PROJECT_NAME} ${EXTRA_LIBS} Qt5::Core Qt5::Network Qt5::WebKitWidgets Threads::Threads)
++install(TARGETS ${PROJECT_NAME} DESTINATION bin)
++
++add_custom_target(check COMMAND python test/run-tests.py -v)
+diff --git a/INSTALL b/INSTALL
+new file mode 100644
+index 000000000..6c8b5ea65
+--- /dev/null
++++ b/INSTALL
+@@ -0,0 +1,46 @@
++Installation Instructions
++*************************
++
++System requirements:
++
++  * C++ toolchain such as g++ 7 or later
++  * CMake version 3.5 or later
++  * Qt 5 toolkit
++  * Python 2.7 (to run the tests)
++
++
++Installation on Linux
++---------------------
++
++On Debian/Ubuntu, the requirements can be fulfilled by installing these packages:
++
++  sudo apt install g++ cmake qt5-default libqt5webkit5-dev python
++
++After unpacking the source tarball or cloning the repository:
++
++  ./configure && make
++
++Do a quick sanity check:
++
++  ./bin/phantomjs --version
++
++Run the test suite:
++
++  make check
++
++Install it (may require sudo):
++
++  make install
++
++
++Installation on Windows
++-----------------------
++
++To be written.
++
++
++Installation on macOS
++---------------------
++
++To be written.
++
+diff --git a/configure b/configure
+new file mode 100755
+index 000000000..a8a75d566
+--- /dev/null
++++ b/configure
+@@ -0,0 +1,317 @@
++#!/bin/sh
++
++# Autotools-style (./configure) wrapper for CMake
++# <https://github.com/nemequ/configure-cmake>
++#
++#   *** IMPORTANT ***
++#
++#   You must include the GNUInstallDirs module (which comes with
++#   CMake) in your project.  Just put "include (GNUInstallDirs)" in
++#   you CMakeLists.txt and you should be good.
++#
++# This script was originally written for Squash
++# <https://quixdb.github.io/squash/> by Evan Nemerson
++# <evan@nemerson.com>, but has been spun off into a separate
++# repository.  Please feel free to copy it into your own repository,
++# though I would appreciate it if you would post improvements, bugs,
++# feature requests, etc. to the issue tracker at
++# <https://github.com/nemequ/configure-cmake/issues>.
++#
++# To the extent possible under law, the author(s) hereby waive all
++# copyright and related or neighboring rights to this work.  For
++# details, see <https://creativecommons.org/publicdomain/zero/1.0/>
++
++TOP_SRCDIR="$(dirname $0)"
++
++if [ "${CMAKE_CMD}" = "" ]; then
++    CMAKE_CMD="cmake"
++fi
++
++BUILD_TYPE="Debug"
++PREFIX=/usr/local
++LIBDIR=
++CMAKE_ARGS=
++
++if [ -e "${TOP_SRCDIR}/.configure-custom.sh" ]; then
++    . "${TOP_SRCDIR}/.configure-custom.sh"
++fi
++
++quote() {
++    echo "$1" | sed -e "s|'|'\\\\''|g; 1s/^/'/; \$s/\$/'/"
++}
++
++extract_var_string() {
++    VAR_NAME=$1
++    VAR_NAME=$(echo $1 | sed -e 's/[ \t]*$//')
++    if [ "x$2" != "x" ]; then
++        VAR_VALUE=$2
++    else
++        VAR_VALUE=yes
++    fi
++
++    if [ "x$3" != "x" ]; then
++        VAR_UC_NAME=$3
++    else
++        VAR_UC_NAME=$(echo "$1" | tr '[:lower:]' '[:upper:]' | tr -c '[:alnum:]' '_' | sed 's/_$//g')
++    fi
++}
++
++set_config_var() {
++    is_with=n
++    case "$1" in
++        "--enable-"*)
++            name="${1#--enable-}"
++            cfg="${ENABLE_VARS}"
++            ;;
++        "--disable-"*)
++            name="${1#--disable-}";
++            cfg="${DISABLE_VARS}";
++            ;;
++        "--with-"*)
++            # IFS="=" read -ra WITHARGS <<< "${1}"
++            name="${1#--with-}"
++            cfg="${WITH_VARS}"
++            is_with=y
++            ;;
++    esac
++
++    found=n
++    for varstring in $cfg; do
++        extract_var_string $(echo "${varstring}" | tr '|' ' ')
++        if [ "x$VAR_NAME" = "x$name" ]; then
++            found=y
++            break;
++        fi
++    done
++
++    if [ "$found" = "y" ]; then
++        if [ "x$is_with" = "xy" ]; then
++            CMAKE_ARGS="$CMAKE_ARGS -D${VAR_UC_NAME}=$(quote "$2")"
++        else
++            CMAKE_ARGS="$CMAKE_ARGS -D${VAR_UC_NAME}=$(quote "${VAR_VALUE}")"
++        fi
++    else
++        echo "Unknown parameter: ${1}"
++        exit 1
++    fi
++}
++
++prefix_to_offset() {
++    expr $(echo "${1}" | awk '{ print length }') + 1
++}
++
++print_help() {
++    cat <<EOF >&2
++  -h, --help              display this help and exit
++  --disable-debug         disable debugging mode
++  --pass-thru             pass remaining arguments through to CMake
++
++  --prefix=PREFIX         install architecture-independent files in PREFIX
++                          [$PREFIX]
++  --bindir=DIR            user executables [PREFIX/bin]
++  --sbindir=DIR           system admin executables [PREFIX/sbin]
++  --libexecdir=DIR        program executables [PREFIX/libexec]
++  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
++  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
++  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
++  --libdir=DIR            object code libraries [PREFIX/lib]
++  --includedir=DIR        C header files [PREFIX/include]
++  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
++  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
++  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
++  --infodir=DIR           info documentation [DATAROOTDIR/info]
++  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
++  --mandir=DIR            man documentation [DATAROOTDIR/man]
++  --docdir=DIR            documentation root [DATAROOTDIR/doc/PROJECT_NAME]
++EOF
++
++    first=y
++    for varstring in ${ENABLE_VARS}; do
++        if [ $first = 'y' ]; then
++            echo ""
++            first=n
++        fi
++        extract_var_string $(echo "${varstring}" | tr '|' ' ')
++        var_doc_name="ENABLE_${VAR_UC_NAME}_DOC"
++        eval "docstring=\$$var_doc_name"
++        if [ "x${docstring}" = "x" ]; then
++            printf "  --enable-%-14s enable %s support\n" "${VAR_NAME}" "$(echo -n "${VAR_NAME}" | tr '-' ' ')"
++        else
++            printf "  --enable-%-14s %s\n" "${VAR_NAME}" "$docstring"
++        fi
++    done
++
++    first=y
++    for varstring in ${DISABLE_VARS}; do
++        if [ $first = 'y' ]; then
++            echo ""
++            first=n
++        fi
++        extract_var_string $(echo "${varstring}" | tr '|' ' ')
++        var_doc_name="DISABLE_${VAR_UC_NAME}_DOC"
++        eval "docstring=\$$var_doc_name"
++        if [ "x${docstring}" = "x" ]; then
++            printf "  --disable-%-13s disable %s support\n" "${VAR_NAME}" "$(echo -n "${VAR_NAME}" | tr '-' ' ')"
++        else
++            printf "  --disable-%-13s %s\n" "${VAR_NAME}" "$docstring"
++        fi
++    done
++
++    first=y
++    for varstring in ${WITH_VARS}; do
++        if [ $first = 'y' ]; then
++            echo ""
++            first=n
++        fi
++        extract_var_string $(echo "${varstring}" | tr '|' ' ')
++        var_doc_name="WITH_${VAR_UC_NAME}_DOC"
++        eval "docstring=\$$var_doc_name"
++        paraminfo="${VAR_NAME}=${VAR_VALUE}"
++        if [ "x${docstring}" = "x" ]; then
++            printf "  --with-%-16s enable %s support\n" "$paraminfo" "$(echo -n "${VAR_NAME}" | tr '-' ' ')"
++        else
++            printf "  --with-%-16s %s\n" "$paraminfo" "$docstring"
++        fi
++    done
++
++    exit 0
++}
++
++while [ $# != 0 ]; do
++    case "$1" in
++        "--prefix="*)
++            PREFIX="${1#*=}";;
++        "--prefix")
++            PREFIX="${2}"; shift;;
++        "--bindir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_BINDIR=$(quote "${1#*=}")";;
++        "--bindir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_BINDIR=$(quote "$2")"; shift;;
++        "--sbindir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SBINDIR=$(quote "${1#*=}")";;
++        "--sbindir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SBINDIR=$(quote "$2")"; shift;;
++        "--libexecdir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LIBEXECDIR=$(quote "${1#*=}")";;
++        "--libexecdir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LIBEXECDIR=$(quote "$2")"; shift;;
++        "--sysconfdir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SYSCONFDIR=$(quote "${1#*=}")";;
++        "--sysconfdir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SYSCONFDIR=$(quote "$2")"; shift;;
++        "--sharedstatedir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SHAREDSTATEDIR=$(quote "${1#*=}")";;
++        "--sharedstatedir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SHAREDSTATEDIR=$(quote "$2")"; shift;;
++        "--localstatedir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LOCALSTATEDIR=$(quote "${1#*=}")";;
++        "--localstatedir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LOCALSTATEDIR=$(quote "$2")"; shift;;
++        "--libdir="*)
++            LIBDIR="${1#*=}";;
++        "--libdir")
++            LIBDIR="${2}"; shift;;
++        "--includedir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_INCLUDEDIR=$(quote "${1#*=}")";;
++        "--includedir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_INCLUDEDIR=$(quote "$2")"; shift;;
++        "--oldincludedir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_OLDINCLUDEDIR=$(quote "${1#*=}")";;
++        "--oldincludedir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_OLDINCLUDEDIR=$(quote "$2")"; shift;;
++        "--datarootdir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DATAROOTDIR=$(quote "${1#*=}")";;
++        "--datarootdir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DATAROOTDIR=$(quote "$2")"; shift;;
++        "--datadir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DATADIR=$(quote "${1#*=}")";;
++        "--datadir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DATADIR=$(quote "$2")"; shift;;
++        "--infodir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_INFODIR=$(quote "${1#*=}")";;
++        "--infodir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_INFODIR=$(quote "$2")"; shift;;
++        "--localedir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LOCALEDIR=$(quote "${1#*=}")";;
++        "--localedir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LOCALEDIR=$(quote "$2")"; shift;;
++        "--mandir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_MANDIR=$(quote "${1#*=}")";;
++        "--mandir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_MANDIR=$(quote "$2")"; shift;;
++        "--docdir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DOCDIR=$(quote "${1#*=}")";;
++        "--docdir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DOCDIR=$(quote "$2")"; shift;;
++
++        "CC="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_C_COMPILER=$(quote "${1#*=}")";;
++        "CXX="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CXX_COMPILER=$(quote "${1#*=}")";;
++        "CFLAGS="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_C_FLAGS=$(quote "${1#*=}")";;
++        "CXXFLAGS="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CXX_FLAGS=$(quote "${1#*=}")";;
++        "LDFLAGS="*)
++            LDFLAGS="$LDFLAGS ${1#*=}";;
++
++        "--help")
++            print_help;;
++        "-h")
++            print_help;;
++
++        # This flag is the only one which may be a bit surprising to
++        # people.  Autotools always builds with debugging symbols enabled
++        # (AFAIK), but for cmake you have to do -DCMAKE_BUILD_TYPE=Debug.
++        # Unfortunately this can change other things as well, so although
++        # I realize there is no --disable-debug flag I thought it would be
++        # prudent to support one here.
++        "--disable-debug")
++            BUILD_TYPE="Release";;
++
++        "--pass-thru")
++            while [ $# != 1 ]; do
++                shift;
++                CMAKE_ARGS="$CMAKE_ARGS $(quote "${1}")";
++            done;;
++
++        "--enable-"*)
++            set_config_var "$1"
++            ;;
++
++        "--disable-"*)
++            set_config_var "$1"
++            ;;
++
++        "--with-"*)
++            name=$(echo "${1#--with-}" | awk '{split($1,v,"="); print v[1]}')
++            case "${1}" in
++                "--with-${name}="*)
++                    set_config_var "--with-${name}" "${1#--with-${name}=}";;
++                "--with-${name}")
++                    set_config_var "$1" "$2";
++                    shift;;
++            esac
++            ;;
++
++        *)
++            echo "$0: error: unrecognized option: \`$1'" >&2
++            echo "Try \`$0 --help' for more information" >&2
++            exit -1
++    esac;
++    shift
++done
++
++if [ "x${LIBDIR}" = "x" ]; then
++    LIBDIR="${PREFIX}/lib"
++fi
++
++# Unlike CFLAGS/CXXFLAGS/CC/CXX, LDFLAGS isn't handled by CMake, so we
++# need to parse it here.
++if [ "x${LDFLAGS}" != "x" ]; then
++    for varname in EXE MODULE SHARED STATIC; do
++        CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_${varname}_LINKER_FLAGS=$(quote "$LDFLAGS")"
++    done
++fi
++
++eval "${CMAKE_CMD}" "${TOP_SRCDIR}" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_INSTALL_LIBDIR="${LIBDIR}" ${CMAKE_ARGS}
+diff --git a/deploy/.gitignore b/deploy/.gitignore
+deleted file mode 100644
+index 3c2196584..000000000
+--- a/deploy/.gitignore
++++ /dev/null
+@@ -1,2 +0,0 @@
+-.vagrant
+-/brandelf
+diff --git a/deploy/README.md b/deploy/README.md
+deleted file mode 100644
+index 7f23b7d7f..000000000
+--- a/deploy/README.md
++++ /dev/null
+@@ -1,44 +0,0 @@
+-Packaging PhantomJS
+-===================
+-
+-This directory contains various scripts to assist with making PhantomJS
+-packages.
+-
+-Packaging for Linux
+--------------------
+-
+-Linux building/packaging is best done in a container to ensure
+-isolation.  We use [Docker](https://www.docker.com/) to automate the
+-process. Please see the [Docker documentation](https://docs.docker.com/)
+-for instructions on installing Docker. For OS X or Windows host,
+-please use [Docker Toolbox](https://www.docker.com/docker-toolbox).
+-
+-Once you have Docker installed, run these commands from the top level
+-of the PhantomJS source repository:
+-
+-```bash
+- $ git clean -xfd .
+- $ docker run -v $PWD:/src debian:wheezy /src/deploy/docker-build.sh
+-```
+-
+-For the 32-bit version:
+-
+-```bash
+- $ git clean -xfd .
+- $ docker run -v $PWD:/src tubia/debian:wheezy /src/deploy/docker-build.sh
+-```
+-
+-The built binary will be extracted out of the container and copied to
+-the current directory.
+-
+-
+-Packaging for OS X
+-------------------
+-
+-Run `deploy/build-and-package.sh`. That's it.
+-
+-However, if you have previously built the sources in release mode, you
+-should clean your tree to make sure all the debugging symbols gets
+-compiled:
+-
+-  $ make clean && cd src/qt && make clean && cd ../..
+diff --git a/deploy/brandelf.c b/deploy/brandelf.c
+deleted file mode 100644
+index 530297bbf..000000000
+--- a/deploy/brandelf.c
++++ /dev/null
+@@ -1,212 +0,0 @@
+-/*-
+- * Copyright (c) 2000, 2001 David O'Brien
+- * Copyright (c) 1996 Søren Schmidt
+- * All rights reserved.
+- *
+- * Redistribution and use in source and binary forms, with or without
+- * modification, are permitted provided that the following conditions
+- * are met:
+- * 1. Redistributions of source code must retain the above copyright
+- *    notice, this list of conditions and the following disclaimer
+- *    in this position and unchanged.
+- * 2. Redistributions in binary form must reproduce the above copyright
+- *    notice, this list of conditions and the following disclaimer in the
+- *    documentation and/or other materials provided with the distribution.
+- * 3. The name of the author may not be used to endorse or promote products
+- *    derived from this software without specific prior written permission
+- *
+- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+- */
+-
+-#include <sys/cdefs.h>
+-//NOTE: commented out to make it compile on linux
+-// __FBSDID("$FreeBSD: src/usr.bin/brandelf/brandelf.c,v 1.25.22.2 2012/03/16 03:22:37 eadler Exp $");
+-
+-#include <sys/types.h>
+-//NOTE: changed path to make it compile on linux
+-#include <elf.h>
+-#include <sys/errno.h>
+-#include <err.h>
+-#include <fcntl.h>
+-#include <stdio.h>
+-#include <stdlib.h>
+-#include <string.h>
+-#include <unistd.h>
+-
+-static int elftype(const char *);
+-static const char *iselftype(int);
+-static void printelftypes(void);
+-static void usage(void);
+-
+-struct ELFtypes {
+-	const char *str;
+-	int value;
+-};
+-/* XXX - any more types? */
+-static struct ELFtypes elftypes[] = {
+-	{ "FreeBSD",	ELFOSABI_FREEBSD },
+-	{ "Linux",	ELFOSABI_LINUX },
+-	{ "Solaris",	ELFOSABI_SOLARIS },
+-	{ "SVR4",	ELFOSABI_SYSV }
+-};
+-
+-int
+-main(int argc, char **argv)
+-{
+-
+-	const char *strtype = "FreeBSD";
+-	int type = ELFOSABI_FREEBSD;
+-	int retval = 0;
+-	int ch, change = 0, force = 0, listed = 0;
+-
+-	while ((ch = getopt(argc, argv, "f:lt:v")) != -1)
+-		switch (ch) {
+-		case 'f':
+-			if (change)
+-				errx(1, "f option incompatible with t option");
+-			force = 1;
+-			type = atoi(optarg);
+-			if (errno == ERANGE || type < 0 || type > 255) {
+-				warnx("invalid argument to option f: %s",
+-				    optarg);
+-				usage();
+-			}
+-			break;
+-		case 'l':
+-			printelftypes();
+-			listed = 1;
+-			break;
+-		case 'v':
+-			/* does nothing */
+-			break;
+-		case 't':
+-			if (force)
+-				errx(1, "t option incompatible with f option");
+-			change = 1;
+-			strtype = optarg;
+-			break;
+-		default:
+-			usage();
+-	}
+-	argc -= optind;
+-	argv += optind;
+-	if (!argc) {
+-		if (listed)
+-			exit(0);
+-		else {
+-			warnx("no file(s) specified");
+-			usage();
+-		}
+-	}
+-
+-	if (!force && (type = elftype(strtype)) == -1) {
+-		warnx("invalid ELF type '%s'", strtype);
+-		printelftypes();
+-		usage();
+-	}
+-
+-	while (argc) {
+-		int fd;
+-		char buffer[EI_NIDENT];
+-
+-		if ((fd = open(argv[0], change || force ? O_RDWR : O_RDONLY, 0)) < 0) {
+-			warn("error opening file %s", argv[0]);
+-			retval = 1;
+-			goto fail;
+-		}
+-		if (read(fd, buffer, EI_NIDENT) < EI_NIDENT) {
+-			warnx("file '%s' too short", argv[0]);
+-			retval = 1;
+-			goto fail;
+-		}
+-		if (buffer[0] != ELFMAG0 || buffer[1] != ELFMAG1 ||
+-		    buffer[2] != ELFMAG2 || buffer[3] != ELFMAG3) {
+-			warnx("file '%s' is not ELF format", argv[0]);
+-			retval = 1;
+-			goto fail;
+-		}
+-		if (!change && !force) {
+-			fprintf(stdout,
+-				"File '%s' is of brand '%s' (%u).\n",
+-				argv[0], iselftype(buffer[EI_OSABI]),
+-				buffer[EI_OSABI]);
+-			if (!iselftype(type)) {
+-				warnx("ELF ABI Brand '%u' is unknown",
+-				      type);
+-				printelftypes();
+-			}
+-		}
+-		else {
+-			buffer[EI_OSABI] = type;
+-			lseek(fd, 0, SEEK_SET);
+-			if (write(fd, buffer, EI_NIDENT) != EI_NIDENT) {
+-				warn("error writing %s %d", argv[0], fd);
+-				retval = 1;
+-				goto fail;
+-			}
+-		}
+-fail:
+-		close(fd);
+-		argc--;
+-		argv++;
+-	}
+-
+-	return retval;
+-}
+-
+-static void
+-usage(void)
+-{
+-	(void)fprintf(stderr,
+-	    "usage: brandelf [-lv] [-f ELF_ABI_number] [-t string] file ...\n");
+-	exit(1);
+-}
+-
+-static const char *
+-iselftype(int etype)
+-{
+-	size_t elfwalk;
+-
+-	for (elfwalk = 0;
+-	     elfwalk < sizeof(elftypes)/sizeof(elftypes[0]);
+-	     elfwalk++)
+-		if (etype == elftypes[elfwalk].value)
+-			return elftypes[elfwalk].str;
+-	return 0;
+-}
+-
+-static int
+-elftype(const char *elfstrtype)
+-{
+-	size_t elfwalk;
+-
+-	for (elfwalk = 0;
+-	     elfwalk < sizeof(elftypes)/sizeof(elftypes[0]);
+-	     elfwalk++)
+-		if (strcasecmp(elfstrtype, elftypes[elfwalk].str) == 0)
+-			return elftypes[elfwalk].value;
+-	return -1;
+-}
+-
+-static void
+-printelftypes(void)
+-{
+-	size_t elfwalk;
+-
+-	fprintf(stderr, "known ELF types are: ");
+-	for (elfwalk = 0;
+-	     elfwalk < sizeof(elftypes)/sizeof(elftypes[0]);
+-	     elfwalk++)
+-		fprintf(stderr, "%s(%u) ", elftypes[elfwalk].str,
+-			elftypes[elfwalk].value);
+-	fprintf(stderr, "\n");
+-}
+diff --git a/deploy/build-and-package.sh b/deploy/build-and-package.sh
+deleted file mode 100755
+index d11501fa9..000000000
+--- a/deploy/build-and-package.sh
++++ /dev/null
+@@ -1,6 +0,0 @@
+-#!/usr/bin/env bash
+-
+-cd `dirname $0`/..
+-
+-./build.py --confirm --release --git-clean-qtbase --git-clean-qtwebkit "$@" || exit 1
+-
+diff --git a/deploy/docker-build.sh b/deploy/docker-build.sh
+deleted file mode 100755
+index 5ceb08931..000000000
+--- a/deploy/docker-build.sh
++++ /dev/null
+@@ -1,62 +0,0 @@
+-#!/usr/bin/env bash
+-
+-set -e
+-
+-SOURCE_PATH=/src
+-BUILD_PATH=$HOME/build
+-
+-# In case the old package URL is still being used
+-sed -i 's/http\.debian\.net/httpredir\.debian\.org/g' /etc/apt/sources.list
+-
+-echo "Installing packages for development tools..." && sleep 1
+-apt-get -y update
+-apt-get install -y build-essential git flex bison gperf python ruby git libfontconfig1-dev
+-echo
+-
+-echo "Preparing to download Debian source package..."
+-echo "deb-src http://httpredir.debian.org/debian wheezy main" >> /etc/apt/sources.list
+-apt-get -y update
+-echo
+-
+-OPENSSL_TARGET='linux-x86_64'
+-if [ `getconf LONG_BIT` -eq 32 ]; then
+-    OPENSSL_TARGET='linux-generic32'
+-fi
+-echo "Recompiling OpenSSL for ${OPENSSL_TARGET}..." && sleep 1
+-apt-get source openssl
+-cd openssl-1.0.1e
+-OPENSSL_FLAGS='no-idea no-mdc2 no-rc5 no-zlib enable-tlsext no-ssl2 no-ssl3 no-ssl3-method enable-rfc3779 enable-cms'
+-./Configure --prefix=/usr --openssldir=/etc/ssl --libdir=lib ${OPENSSL_FLAGS} ${OPENSSL_TARGET}
+-make depend && make && make install
+-cd ..
+-echo
+-
+-echo "Building the static version of ICU library..." && sleep 1
+-apt-get source icu
+-cd icu-4.8.1.1/source
+-./configure --prefix=/usr --enable-static --disable-shared
+-make && make install
+-cd ..
+-echo
+-
+-echo "Recreating the build directory $BUILD_PATH..."
+-rm -rf $BUILD_PATH && mkdir -p $BUILD_PATH
+-echo
+-
+-echo "Transferring the source: $SOURCE_PATH -> $BUILD_PATH. Please wait..."
+-cd $BUILD_PATH && cp -rp $SOURCE_PATH . && cd src
+-echo
+-
+-echo "Compiling PhantomJS..." && sleep 1
+-python build.py --confirm --release --qt-config="-no-pkg-config" --git-clean-qtbase --git-clean-qtwebkit
+-echo
+-
+-echo "Stripping the executable..." && sleep 1
+-ls -l bin/phantomjs
+-strip bin/phantomjs
+-echo "Copying the executable..." && sleep 1
+-ls -l bin/phantomjs
+-cp bin/phantomjs $SOURCE_PATH
+-echo
+-
+-echo "Finished."
+diff --git a/deploy/package.sh b/deploy/package.sh
+deleted file mode 100755
+index 16d6525bc..000000000
+--- a/deploy/package.sh
++++ /dev/null
+@@ -1,120 +0,0 @@
+-#!/usr/bin/env bash
+-
+-#
+-# usage: just run this script (after having run build.sh)
+-#        and deploy the created tarball to your target machine.
+-#
+-# It creates a phantomjs-$version folder and copies the binary,
+-# example, license etc. together with all shared library dependencies
+-# to that folder. Furthermore brandelf is used to make the lib
+-# and binary compatible with older unix/linux machines that don't
+-# know the new Linux ELF ABI.
+-#
+-
+-cd $(dirname $0)
+-
+-if [[ ! -f ../bin/phantomjs ]]; then
+-    echo "phantomjs was not built yet, please run build.sh first"
+-    exit 1
+-fi
+-
+-if [[ "$1" = "--bundle-libs" ]]; then
+-    bundle_libs=1
+-else
+-    bundle_libs=0
+-fi
+-
+-version=$(../bin/phantomjs --version | sed 's/ /-/' | sed 's/[()]//g')
+-src=..
+-
+-echo "packaging phantomjs $version"
+-
+-if [[ $OSTYPE = darwin* ]]; then
+-    dest="phantomjs-$version-macosx"
+-else
+-    dest="phantomjs-$version-linux-$(uname -m)"
+-fi
+-
+-rm -Rf $dest{.tar.bz2,} &> /dev/null
+-mkdir -p $dest/bin
+-
+-echo
+-
+-echo -n "copying files..."
+-cp $src/bin/phantomjs $dest/bin
+-cp -r $src/{ChangeLog,examples,LICENSE.BSD,third-party.txt,README.md} $dest/
+-echo "done"
+-echo
+-
+-phantomjs=$dest/bin/phantomjs
+-
+-if [[ "$bundle_libs" = "1" ]]; then
+-    mkdir -p $dest/lib
+-
+-    if [[ ! -f brandelf ]]; then
+-        echo
+-        echo "brandelf executable not found in current dir"
+-        echo -n "compiling it now..."
+-        g++ brandelf.c -o brandelf || exit 1
+-        echo "done"
+-    fi
+-
+-    libs=$(ldd $phantomjs | egrep -o "/[^ ]+ ")
+-
+-    echo -n "copying shared libs..."
+-    libld=
+-    for l in $libs; do
+-        ll=$(basename $l)
+-        cp $l $dest/lib/$ll
+-
+-        if [[ "$bundle_libs" = "1" ]]; then
+-            # ensure OS ABI compatibility
+-            ./brandelf -t SVR4 $dest/lib/$ll
+-            if [[ "$l" == *"ld-linux"* ]]; then
+-                libld=$ll
+-            fi
+-        fi
+-    done
+-    echo "done"
+-    echo
+-
+-    echo -n "writing run script..."
+-    mv $phantomjs $phantomjs.bin
+-    phantomjs=$phantomjs.bin
+-    run=$dest/bin/phantomjs
+-    echo '#!/bin/sh' >> $run
+-    echo 'path=$(dirname $(dirname $(readlink -f $0)))' >> $run
+-    echo 'export LD_LIBRARY_PATH=$path/lib' >> $run
+-    echo 'exec $path/lib/'$libld' $phantomjs $@' >> $run
+-    chmod +x $run
+-    echo "done"
+-    echo
+-fi
+-
+-echo -n "stripping binary and libs..."
+-if [[ $OSTYPE = darwin* ]]; then
+-    strip -x $phantomjs
+-else
+-    strip -s $phantomjs
+-    [[ -d $dest/lib ]] && strip -s $dest/lib/*
+-fi
+-echo "done"
+-echo
+-
+-echo -n "compressing binary..."
+-if type upx >/dev/null 2>&1; then
+-    upx -qqq -9 $phantomjs
+-    echo "done"
+-else
+-    echo "upx not found"
+-fi
+-echo
+-
+-echo -n "creating archive..."
+-if [[ $OSTYPE = darwin* ]]; then
+-    zip -r $dest.zip $dest
+-else
+-    tar -cjf $dest{.tar.bz2,}
+-fi
+-echo "done"
+-echo
+diff --git a/phantomjs.pro b/phantomjs.pro
+deleted file mode 100644
+index 24663df32..000000000
+--- a/phantomjs.pro
++++ /dev/null
+@@ -1,3 +0,0 @@
+-TEMPLATE = subdirs
+-CONFIG += ordered
+-SUBDIRS += src/phantomjs.pro
+diff --git a/src/linenoise/linenoise.pri b/src/linenoise/linenoise.pri
+deleted file mode 100644
+index 9095bae9c..000000000
+--- a/src/linenoise/linenoise.pri
++++ /dev/null
+@@ -1,9 +0,0 @@
+-VPATH += $$PWD/src
+-INCLUDEPATH += $$PWD/src
+-
+-DEFINES += USE_UTF8
+-
+-SOURCES += linenoise.c \
+-    utf8.c
+-HEADERS += linenoise.h \
+-    utf8.h
+diff --git a/src/mongoose/mongoose.pri b/src/mongoose/mongoose.pri
+deleted file mode 100644
+index 5fb16f996..000000000
+--- a/src/mongoose/mongoose.pri
++++ /dev/null
+@@ -1,7 +0,0 @@
+-VPATH += $$PWD
+-INCLUDEPATH += $$PWD
+-
+-SOURCES += mongoose.c
+-HEADERS += mongoose.h
+-linux*:LIBS += -ldl
+-win32:LIBS += -lWs2_32
+diff --git a/src/qcommandline/qcommandline.pri b/src/qcommandline/qcommandline.pri
+deleted file mode 100644
+index e994f19b2..000000000
+--- a/src/qcommandline/qcommandline.pri
++++ /dev/null
+@@ -1,7 +0,0 @@
+-VPATH += $$PWD
+-INCLUDEPATH += $$PWD
+-
+-DEFINES += STATIC_BUILD QCOMMANDLINE_STATIC
+-
+-SOURCES += qcommandline.cpp
+-HEADERS += qcommandline.h
+-- 
+2.39.0
+
diff --git a/srcpkgs/phantomjs/template b/srcpkgs/phantomjs/template
new file mode 100644
index 000000000000..5f5dea7bb0c0
--- /dev/null
+++ b/srcpkgs/phantomjs/template
@@ -0,0 +1,22 @@
+# Template file for 'phantomjs'
+pkgname=phantomjs
+version=2.1.1
+revision=1
+build_style=configure
+configure_args="--prefix=/usr"
+hostmakedepends="cmake qt5-host-tools qt5-qmake"
+makedepends="qt5-devel qt5-webkit-devel"
+short_desc="Headless web browser scriptable with JavaScript"
+maintainer="Eugen Zagorodniy <zag@disroot.org>"
+license=BSD-3-Clause
+homepage="https://phantomjs.org/"
+distfiles="https://github.com/ariya/phantomjs/archive/refs/tags/${version}.tar.gz"
+checksum=bd1e63e9cd48d5a9c8ff1affc254eeae14704304437710729f133cb80cf98cf1
+
+post_install() {
+	vlicense LICENSE.BSD
+}
+
+do_check () {
+	: # too many tests are broken
+}

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PR PATCH] [Updated] New package: phantomjs-2.1.1
  2023-02-02  6:15 [PR PATCH] New package: phantomjs-2.1.1 ezag
  2023-02-02  6:55 ` [PR PATCH] [Updated] " ezag
@ 2023-02-02  6:56 ` ezag
  2023-05-04  1:51 ` github-actions
  2023-05-18  1:53 ` [PR PATCH] [Closed]: " github-actions
  3 siblings, 0 replies; 5+ messages in thread
From: ezag @ 2023-02-02  6:56 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1823 bytes --]

There is an updated pull request by ezag against master on the void-packages repository

https://github.com/ezag/void-packages phantomjs
https://github.com/void-linux/void-packages/pull/42024

New package: phantomjs-2.1.1
This package [has been removed due to dead upstream](https://github.com/void-linux/void-packages/commit/702d6cb7f3a881f32e69d01baaba54217a8c38a8).

However, with few patches cherry-picked from upstream development version, it does build against current Qt5 version.

Since youtube-dl/yt-dlp still [optionally depends on it](https://github.com/void-linux/void-packages/pull/12244) as fallback to avoid throttling, it would be nice to have this package available, despite its [suspended development](https://github.com/ariya/phantomjs/issues/15344).

<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl (crossbuild)
  - armv7l (crossbuild)
  - armv6l-musl (crossbuild)



A patch file from https://github.com/void-linux/void-packages/pull/42024.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-phantomjs-42024.patch --]
[-- Type: text/x-diff, Size: 60467 bytes --]

From 7d09cd1b4e05f5496c038ce27ac32b095c4ed0cd Mon Sep 17 00:00:00 2001
From: Eugen Zagorodniy <zag@disroot.org>
Date: Thu, 2 Feb 2023 07:41:58 +0200
Subject: [PATCH] New package: phantomjs-2.1.1

---
 ...low-user-to-change-DPI-of-a-web-page.patch |  260 +++++
 ...-Add-support-to-render-pdf-to-base64.patch |  279 +++++
 ...me-API-for-the-latest-QtWebKit-15341.patch |  195 ++++
 .../0004-Use-CMake-build-system-15397.patch   | 1008 +++++++++++++++++
 srcpkgs/phantomjs/template                    |   22 +
 5 files changed, 1764 insertions(+)
 create mode 100644 srcpkgs/phantomjs/patches/0001-Allow-user-to-change-DPI-of-a-web-page.patch
 create mode 100644 srcpkgs/phantomjs/patches/0002-Add-support-to-render-pdf-to-base64.patch
 create mode 100644 srcpkgs/phantomjs/patches/0003-Adjust-some-API-for-the-latest-QtWebKit-15341.patch
 create mode 100644 srcpkgs/phantomjs/patches/0004-Use-CMake-build-system-15397.patch
 create mode 100644 srcpkgs/phantomjs/template

diff --git a/srcpkgs/phantomjs/patches/0001-Allow-user-to-change-DPI-of-a-web-page.patch b/srcpkgs/phantomjs/patches/0001-Allow-user-to-change-DPI-of-a-web-page.patch
new file mode 100644
index 000000000000..7618cb4736e3
--- /dev/null
+++ b/srcpkgs/phantomjs/patches/0001-Allow-user-to-change-DPI-of-a-web-page.patch
@@ -0,0 +1,260 @@
+From 46bfca843ee2ef466262b02bfcd1675407e13db6 Mon Sep 17 00:00:00 2001
+From: Vitaly Slobodin <vitaliy.slobodin@gmail.com>
+Date: Fri, 11 Mar 2016 19:08:35 +0300
+Subject: [PATCH 1/4] Allow user to change DPI of a web page
+
+Issue: #12085
+---
+ src/consts.h    |  1 +
+ src/phantom.cpp | 21 +++++++++++-------
+ src/phantom.h   |  1 +
+ src/webpage.cpp | 57 ++++++++++++++++++++++++++-----------------------
+ src/webpage.h   |  5 +++++
+ 5 files changed, 50 insertions(+), 35 deletions(-)
+
+diff --git a/src/consts.h b/src/consts.h
+index 28b237221..54226d012 100644
+--- a/src/consts.h
++++ b/src/consts.h
+@@ -67,6 +67,7 @@
+ #define PAGE_SETTINGS_WEB_SECURITY_ENABLED  "webSecurityEnabled"
+ #define PAGE_SETTINGS_JS_CAN_OPEN_WINDOWS   "javascriptCanOpenWindows"
+ #define PAGE_SETTINGS_JS_CAN_CLOSE_WINDOWS  "javascriptCanCloseWindows"
++#define PAGE_SETTINGS_DPI                   "dpi"
+ 
+ #define DEFAULT_WEBDRIVER_CONFIG            "127.0.0.1:8910"
+ 
+diff --git a/src/phantom.cpp b/src/phantom.cpp
+index afabaadda..5417b9beb 100644
+--- a/src/phantom.cpp
++++ b/src/phantom.cpp
+@@ -31,25 +31,26 @@
+ #include "phantom.h"
+ 
+ #include <QApplication>
++#include <QDebug>
+ #include <QDir>
+-#include <QFileInfo>
+ #include <QFile>
+-#include <QtWebKitWidgets/QWebPage>
+-#include <QDebug>
++#include <QFileInfo>
+ #include <QMetaObject>
+ #include <QMetaProperty>
++#include <QScreen>
+ #include <QStandardPaths>
++#include <QtWebKitWidgets/QWebPage>
+ 
++#include "callback.h"
++#include "childprocess.h"
+ #include "consts.h"
++#include "cookiejar.h"
++#include "repl.h"
++#include "system.h"
+ #include "terminal.h"
+ #include "utils.h"
+ #include "webpage.h"
+ #include "webserver.h"
+-#include "repl.h"
+-#include "system.h"
+-#include "callback.h"
+-#include "cookiejar.h"
+-#include "childprocess.h"
+ 
+ static Phantom* phantomInstance = NULL;
+ 
+@@ -100,6 +101,9 @@ void Phantom::init()
+     // Initialize the CookieJar
+     m_defaultCookieJar = new CookieJar(m_config.cookiesFile());
+ 
++    // set the default DPI
++    m_defaultDpi = qRound(QApplication::primaryScreen()->logicalDotsPerInch());
++
+     QWebSettings::setOfflineWebApplicationCachePath(QStandardPaths::writableLocation(QStandardPaths::DataLocation));
+     if (m_config.offlineStoragePath().isEmpty()) {
+         QWebSettings::setOfflineStoragePath(QStandardPaths::writableLocation(QStandardPaths::DataLocation));
+@@ -139,6 +143,7 @@ void Phantom::init()
+     m_defaultPageSettings[PAGE_SETTINGS_WEB_SECURITY_ENABLED] = QVariant::fromValue(m_config.webSecurityEnabled());
+     m_defaultPageSettings[PAGE_SETTINGS_JS_CAN_OPEN_WINDOWS] = QVariant::fromValue(m_config.javascriptCanOpenWindows());
+     m_defaultPageSettings[PAGE_SETTINGS_JS_CAN_CLOSE_WINDOWS] = QVariant::fromValue(m_config.javascriptCanCloseWindows());
++    m_defaultPageSettings[PAGE_SETTINGS_DPI] = QVariant::fromValue(m_defaultDpi);
+     m_page->applySettings(m_defaultPageSettings);
+ 
+     setLibraryPath(QFileInfo(m_config.scriptFile()).dir().absolutePath());
+diff --git a/src/phantom.h b/src/phantom.h
+index 7c32eb141..c7e5b787f 100644
+--- a/src/phantom.h
++++ b/src/phantom.h
+@@ -237,6 +237,7 @@ private:
+     QList<QPointer<WebServer> > m_servers;
+     Config m_config;
+     CookieJar* m_defaultCookieJar;
++    qreal m_defaultDpi;
+ 
+     friend class CustomPage;
+ };
+diff --git a/src/webpage.cpp b/src/webpage.cpp
+index fc235bc56..4158064d4 100644
+--- a/src/webpage.cpp
++++ b/src/webpage.cpp
+@@ -30,47 +30,47 @@
+ 
+ #include "webpage.h"
+ 
+-#include <math.h>
+-
+ #include <QApplication>
++#include <QBuffer>
+ #include <QContextMenuEvent>
+-#include <QDesktopServices>
+ #include <QDateTime>
++#include <QDebug>
++#include <QDesktopServices>
+ #include <QDir>
+ #include <QFileInfo>
++#include <QImageWriter>
+ #include <QKeyEvent>
++#include <QMapIterator>
+ #include <QMouseEvent>
+ #include <QNetworkAccessManager>
+ #include <QNetworkCookie>
++#include <QNetworkProxy>
+ #include <QNetworkRequest>
+ #include <QPainter>
+-#include <QtPrintSupport/QPrinter>
+-#include <QWebHistory>
+-#include <QWebHistoryItem>
++#include <QScreen>
++#include <QUrl>
++#include <QUuid>
+ #include <QWebElement>
+ #include <QWebFrame>
+-#include <QWebPage>
++#include <QWebHistory>
++#include <QWebHistoryItem>
+ #include <QWebInspector>
+-#include <QMapIterator>
+-#include <QBuffer>
+-#include <QDebug>
+-#include <QImageWriter>
+-#include <QUuid>
+-#include <QUrl>
+-#include <QNetworkProxy>
++#include <QWebPage>
++#include <QtPrintSupport/QPrinter>
++#include <math.h>
+ 
+-#include "phantom.h"
+-#include "networkaccessmanager.h"
+-#include "utils.h"
++#include "callback.h"
+ #include "config.h"
+ #include "consts.h"
+-#include "callback.h"
+ #include "cookiejar.h"
++#include "networkaccessmanager.h"
++#include "phantom.h"
+ #include "system.h"
++#include "utils.h"
+ 
+ #ifdef Q_OS_WIN
+-#include <io.h>
+ #include <fcntl.h>
++#include <io.h>
+ #endif
+ 
+ // Ensure we have at least head and body.
+@@ -435,6 +435,7 @@ WebPage::WebPage(QObject* parent, const QUrl& baseUrl)
+     connect(m_networkAccessManager, SIGNAL(resourceTimeout(QVariant)),
+             SIGNAL(resourceTimeout(QVariant)));
+ 
++    m_dpi = qRound(QApplication::primaryScreen()->logicalDotsPerInch());
+     m_customWebPage->setViewportSize(QSize(400, 300));
+ }
+ 
+@@ -649,6 +650,10 @@ void WebPage::applySettings(const QVariantMap& def)
+     if (def.contains(PAGE_SETTINGS_PROXY)) {
+         setProxy(def[PAGE_SETTINGS_PROXY].toString());
+     }
++
++    if (def.contains(PAGE_SETTINGS_DPI)) {
++        m_dpi = def[PAGE_SETTINGS_DPI].toReal();
++    }
+ }
+ 
+ void WebPage::setProxy(const QString& proxyUrl)
+@@ -1124,9 +1129,7 @@ QImage WebPage::renderImage()
+     return buffer;
+ }
+ 
+-#define PHANTOMJS_PDF_DPI 72            // Different defaults. OSX: 72, X11: 75(?), Windows: 96
+-
+-qreal stringToPointSize(const QString& string)
++qreal WebPage::stringToPointSize(const QString& string) const
+ {
+     static const struct {
+         QString unit;
+@@ -1135,8 +1138,8 @@ qreal stringToPointSize(const QString& string)
+         { "mm", 72 / 25.4 },
+         { "cm", 72 / 2.54 },
+         { "in", 72 },
+-        { "px", 72.0 / PHANTOMJS_PDF_DPI },
+-        { "", 72.0 / PHANTOMJS_PDF_DPI }
++        { "px", 72.0 / m_dpi },
++        { "", 72.0 / m_dpi }
+     };
+     for (uint i = 0; i < sizeof(units) / sizeof(units[0]); ++i) {
+         if (string.endsWith(units[i].unit)) {
+@@ -1148,7 +1151,7 @@ qreal stringToPointSize(const QString& string)
+     return 0;
+ }
+ 
+-qreal printMargin(const QVariantMap& map, const QString& key)
++qreal WebPage::printMargin(const QVariantMap& map, const QString& key)
+ {
+     const QVariant margin = map.value(key);
+     if (margin.isValid() && margin.canConvert(QVariant::String)) {
+@@ -1163,7 +1166,7 @@ bool WebPage::renderPdf(const QString& fileName)
+     QPrinter printer;
+     printer.setOutputFormat(QPrinter::PdfFormat);
+     printer.setOutputFileName(fileName);
+-    printer.setResolution(PHANTOMJS_PDF_DPI);
++    printer.setResolution(m_dpi);
+     QVariantMap paperSize = m_paperSize;
+ 
+     if (paperSize.isEmpty()) {
+@@ -1276,7 +1279,7 @@ QString WebPage::windowName() const
+     return m_mainFrame->evaluateJavaScript("window.name;").toString();
+ }
+ 
+-qreal getHeight(const QVariantMap& map, const QString& key)
++qreal WebPage::getHeight(const QVariantMap& map, const QString& key) const
+ {
+     QVariant footer = map.value(key);
+     if (!footer.canConvert(QVariant::Map)) {
+diff --git a/src/webpage.h b/src/webpage.h
+index 4e41ec246..59279db85 100644
+--- a/src/webpage.h
++++ b/src/webpage.h
+@@ -483,6 +483,10 @@ public slots:
+ 
+     void setProxy(const QString& proxyUrl);
+ 
++    qreal stringToPointSize(const QString&) const;
++    qreal printMargin(const QVariantMap&, const QString&);
++    qreal getHeight(const QVariantMap&, const QString&) const;
++
+ signals:
+     void initialized();
+     void loadStarted();
+@@ -544,6 +548,7 @@ private:
+     int m_loadingProgress;
+     bool m_shouldInterruptJs;
+     CookieJar* m_cookieJar;
++    qreal m_dpi;
+ 
+     friend class Phantom;
+     friend class CustomPage;
+-- 
+2.39.0
+
diff --git a/srcpkgs/phantomjs/patches/0002-Add-support-to-render-pdf-to-base64.patch b/srcpkgs/phantomjs/patches/0002-Add-support-to-render-pdf-to-base64.patch
new file mode 100644
index 000000000000..12fbe6d62845
--- /dev/null
+++ b/srcpkgs/phantomjs/patches/0002-Add-support-to-render-pdf-to-base64.patch
@@ -0,0 +1,279 @@
+From 43b9ec48bdf4aaeaeebe6f5926b119d876b39fa9 Mon Sep 17 00:00:00 2001
+From: Connor Dunn <connorhd@squareup.com>
+Date: Thu, 28 Apr 2016 23:06:15 -0700
+Subject: [PATCH 2/4] Add support to render pdf to base64.
+
+https://github.com/ariya/phantomjs/issues/11192
+https://github.com/ariya/phantomjs/issues/12392
+---
+ src/webpage.cpp                     | 122 +++++++++++++++-------------
+ src/webpage.h                       |   3 +-
+ test/module/webpage/renderBase64.js |  51 ++++++++++++
+ 3 files changed, 118 insertions(+), 58 deletions(-)
+ create mode 100644 test/module/webpage/renderBase64.js
+
+diff --git a/src/webpage.cpp b/src/webpage.cpp
+index 4158064d4..305085d87 100644
+--- a/src/webpage.cpp
++++ b/src/webpage.cpp
+@@ -56,7 +56,6 @@
+ #include <QWebHistoryItem>
+ #include <QWebInspector>
+ #include <QWebPage>
+-#include <QtPrintSupport/QPrinter>
+ #include <math.h>
+ 
+ #include "callback.h"
+@@ -999,7 +998,8 @@ bool WebPage::render(const QString& fileName, const QVariantMap& option)
+ 
+     bool retval = true;
+     if (format == "pdf") {
+-        retval = renderPdf(outFileName);
++        QPdfWriter pdfWriter(fileName);
++        retval = renderPdf(pdfWriter);
+     } else {
+         QImage rawPageRendering = renderImage();
+ 
+@@ -1053,23 +1053,31 @@ QString WebPage::renderBase64(const QByteArray& format)
+ {
+     QByteArray nformat = format.toLower();
+ 
+-    // Check if the given format is supported
+-    if (QImageWriter::supportedImageFormats().contains(nformat)) {
+-        QImage rawPageRendering = renderImage();
++    if (format != "pdf" && !QImageWriter::supportedImageFormats().contains(nformat)) {
++        // Return an empty string in case an unsupported format was provided
++        return "";
++    }
++
++    // Prepare buffer for writing
++    QByteArray bytes;
++    QBuffer buffer(&bytes);
++    buffer.open(QIODevice::WriteOnly);
++
++    if (format == "pdf") {
++        QPdfWriter pdfWriter(&buffer);
+ 
+-        // Prepare buffer for writing
+-        QByteArray bytes;
+-        QBuffer buffer(&bytes);
+-        buffer.open(QIODevice::WriteOnly);
++        if (!renderPdf(pdfWriter)) {
++            // Return an empty string if pdf render fails
++            return "";
++        }
++    } else {
++        QImage rawPageRendering = renderImage();
+ 
+         // Writing image to the buffer, using PNG encoding
+         rawPageRendering.save(&buffer, nformat);
+-
+-        return bytes.toBase64();
+     }
+ 
+-    // Return an empty string in case an unsupported format was provided
+-    return "";
++    return bytes.toBase64();
+ }
+ 
+ QImage WebPage::renderImage()
+@@ -1161,12 +1169,9 @@ qreal WebPage::printMargin(const QVariantMap& map, const QString& key)
+     }
+ }
+ 
+-bool WebPage::renderPdf(const QString& fileName)
++bool WebPage::renderPdf(QPdfWriter& pdfWriter)
+ {
+-    QPrinter printer;
+-    printer.setOutputFormat(QPrinter::PdfFormat);
+-    printer.setOutputFileName(fileName);
+-    printer.setResolution(m_dpi);
++    pdfWriter.setResolution(m_dpi);
+     QVariantMap paperSize = m_paperSize;
+ 
+     if (paperSize.isEmpty()) {
+@@ -1179,51 +1184,51 @@ bool WebPage::renderPdf(const QString& fileName)
+     if (paperSize.contains("width") && paperSize.contains("height")) {
+         const QSizeF sizePt(ceil(stringToPointSize(paperSize.value("width").toString())),
+                             ceil(stringToPointSize(paperSize.value("height").toString())));
+-        printer.setPaperSize(sizePt, QPrinter::Point);
++        pdfWriter.setPageSize(QPageSize(sizePt, QPageSize::Point));
+     } else if (paperSize.contains("format")) {
+-        const QPrinter::Orientation orientation = paperSize.contains("orientation")
++        const QPageLayout::Orientation orientation = paperSize.contains("orientation")
+                 && paperSize.value("orientation").toString().compare("landscape", Qt::CaseInsensitive) == 0 ?
+-                QPrinter::Landscape : QPrinter::Portrait;
+-        printer.setOrientation(orientation);
++                QPageLayout::Portrait : QPageLayout::Landscape;
++        pdfWriter.setPageOrientation(orientation);
+         static const struct {
+             QString format;
+-            QPrinter::PaperSize paperSize;
++            QPageSize::PageSizeId paperSize;
+         } formats[] = {
+-            { "A0", QPrinter::A0 },
+-            { "A1", QPrinter::A1 },
+-            { "A2", QPrinter::A2 },
+-            { "A3", QPrinter::A3 },
+-            { "A4", QPrinter::A4 },
+-            { "A5", QPrinter::A5 },
+-            { "A6", QPrinter::A6 },
+-            { "A7", QPrinter::A7 },
+-            { "A8", QPrinter::A8 },
+-            { "A9", QPrinter::A9 },
+-            { "B0", QPrinter::B0 },
+-            { "B1", QPrinter::B1 },
+-            { "B2", QPrinter::B2 },
+-            { "B3", QPrinter::B3 },
+-            { "B4", QPrinter::B4 },
+-            { "B5", QPrinter::B5 },
+-            { "B6", QPrinter::B6 },
+-            { "B7", QPrinter::B7 },
+-            { "B8", QPrinter::B8 },
+-            { "B9", QPrinter::B9 },
+-            { "B10", QPrinter::B10 },
+-            { "C5E", QPrinter::C5E },
+-            { "Comm10E", QPrinter::Comm10E },
+-            { "DLE", QPrinter::DLE },
+-            { "Executive", QPrinter::Executive },
+-            { "Folio", QPrinter::Folio },
+-            { "Ledger", QPrinter::Ledger },
+-            { "Legal", QPrinter::Legal },
+-            { "Letter", QPrinter::Letter },
+-            { "Tabloid", QPrinter::Tabloid }
++            { "A0", QPageSize::A0 },
++            { "A1", QPageSize::A1 },
++            { "A2", QPageSize::A2 },
++            { "A3", QPageSize::A3 },
++            { "A4", QPageSize::A4 },
++            { "A5", QPageSize::A5 },
++            { "A6", QPageSize::A6 },
++            { "A7", QPageSize::A7 },
++            { "A8", QPageSize::A8 },
++            { "A9", QPageSize::A9 },
++            { "B0", QPageSize::B0 },
++            { "B1", QPageSize::B1 },
++            { "B2", QPageSize::B2 },
++            { "B3", QPageSize::B3 },
++            { "B4", QPageSize::B4 },
++            { "B5", QPageSize::B5 },
++            { "B6", QPageSize::B6 },
++            { "B7", QPageSize::B7 },
++            { "B8", QPageSize::B8 },
++            { "B9", QPageSize::B9 },
++            { "B10", QPageSize::B10 },
++            { "C5E", QPageSize::C5E },
++            { "Comm10E", QPageSize::Comm10E },
++            { "DLE", QPageSize::DLE },
++            { "Executive", QPageSize::Executive },
++            { "Folio", QPageSize::Folio },
++            { "Ledger", QPageSize::Ledger },
++            { "Legal", QPageSize::Legal },
++            { "Letter", QPageSize::Letter },
++            { "Tabloid", QPageSize::Tabloid }
+         };
+-        printer.setPaperSize(QPrinter::A4); // Fallback
++        pdfWriter.setPageSize(QPageSize(QPageSize::A4)); // Fallback
+         for (uint i = 0; i < sizeof(formats) / sizeof(formats[0]); ++i) {
+             if (paperSize.value("format").toString().compare(formats[i].format, Qt::CaseInsensitive) == 0) {
+-                printer.setPaperSize(formats[i].paperSize);
++                pdfWriter.setPageSize(QPageSize(formats[i].paperSize));
+                 break;
+             }
+         }
+@@ -1258,9 +1263,12 @@ bool WebPage::renderPdf(const QString& fileName)
+         }
+     }
+ 
+-    printer.setPageMargins(marginLeft, marginTop, marginRight, marginBottom, QPrinter::Point);
++    pdfWriter.setPageMargins(QMarginsF(marginLeft, marginTop, marginRight, marginBottom), QPageLayout::Point);
++
++    QPainter painter(&pdfWriter);
++    m_mainFrame->render(&painter);
++    painter.end();
+ 
+-    m_mainFrame->print(&printer, this);
+     return true;
+ }
+ 
+diff --git a/src/webpage.h b/src/webpage.h
+index 59279db85..062179d27 100644
+--- a/src/webpage.h
++++ b/src/webpage.h
+@@ -35,6 +35,7 @@
+ #include <QVariantMap>
+ #include <QtWebKitWidgets/QWebPage>
+ #include <QtWebKitWidgets/QWebFrame>
++#include <QPdfWriter>
+ 
+ #include "cookiejar.h"
+ 
+@@ -514,7 +515,7 @@ private slots:
+ 
+ private:
+     QImage renderImage();
+-    bool renderPdf(const QString& fileName);
++    bool renderPdf(QPdfWriter& pdfWriter);
+     void applySettings(const QVariantMap& defaultSettings);
+     QString userAgent() const;
+ 
+diff --git a/test/module/webpage/renderBase64.js b/test/module/webpage/renderBase64.js
+new file mode 100644
+index 000000000..17797d576
+--- /dev/null
++++ b/test/module/webpage/renderBase64.js
+@@ -0,0 +1,51 @@
++var fs      = require("fs");
++var system  = require("system");
++var webpage = require("webpage");
++var renders = require("./renders");
++
++function clean_pdf(data) {
++    // FIXME: This is not nearly enough normalization.
++    data = data.replace(/\/(Title|Creator|Producer|CreationDate) \([^\n]*\)/g, "/$1 ()");
++    data = data.replace(/\nxref\n[0-9 nf\n]+trailer\b/, "\ntrailer");
++    data = data.replace(/\nstartxref\n[0-9]+\n%%EOF\n/, "\n");
++    return data;
++}
++
++function render_test(format) {
++    var expect_content = btoa(renders.get(format, ""));
++    var p = webpage.create();
++
++    p.paperSize = { width: '300px', height: '300px', border: '0px' };
++    p.clipRect = { top: 0, left: 0, width: 300, height: 300};
++    p.viewportSize = { width: 300, height: 300};
++
++    p.open(TEST_HTTP_BASE + "render/", this.step_func_done(function (status) {
++        var content = p.renderBase64(format);
++
++        // expected variation in PDF output
++        if (format === "pdf") {
++            content = clean_pdf(content);
++            expect_content = clean_pdf(expect_content);
++        }
++
++        // Don't dump entire images to the log on failure.
++        assert_is_true(content === expect_content);
++    }));
++}
++
++[
++    "pdf",
++    "png",
++    "jpg",
++]
++.forEach(function (format) {
++    var props  = {};
++
++    // All tests fail on Linux.  All tests except JPG fail on Mac.
++    // Currently unknown which tests fail on Windows.
++    if (format !== "jpg" || system.os.name !== "mac")
++        props.expected_fail = true;
++
++    async_test(function () { render_test.call(this, format); },
++               format, props);
++});
+-- 
+2.39.0
+
diff --git a/srcpkgs/phantomjs/patches/0003-Adjust-some-API-for-the-latest-QtWebKit-15341.patch b/srcpkgs/phantomjs/patches/0003-Adjust-some-API-for-the-latest-QtWebKit-15341.patch
new file mode 100644
index 000000000000..eafb86b88212
--- /dev/null
+++ b/srcpkgs/phantomjs/patches/0003-Adjust-some-API-for-the-latest-QtWebKit-15341.patch
@@ -0,0 +1,195 @@
+From 48752bfeaaf6d16b1cfb51fbcd300d1f25e17a6a Mon Sep 17 00:00:00 2001
+From: Ariya Hidayat <ariya.hidayat@gmail.com>
+Date: Fri, 29 Nov 2019 22:39:09 -0800
+Subject: [PATCH 3/4] Adjust some API for the latest QtWebKit (#15341)
+
+---
+ src/bootstrap.js       | 3 ++-
+ src/config.cpp         | 2 +-
+ src/modules/webpage.js | 3 ++-
+ src/phantom.cpp        | 5 ++---
+ src/repl.cpp           | 7 +++----
+ src/utils.cpp          | 6 +++---
+ src/webpage.cpp        | 9 ++++-----
+ src/webpage.h          | 2 +-
+ 8 files changed, 18 insertions(+), 19 deletions(-)
+
+diff --git a/src/bootstrap.js b/src/bootstrap.js
+index 788d45202..1042ceb6a 100644
+--- a/src/bootstrap.js
++++ b/src/bootstrap.js
+@@ -73,7 +73,8 @@ phantom.__defineErrorSignalHandler__ = function(obj, page, handlers) {
+             return (!!handlerObj && typeof handlerObj.callback === "function" && typeof handlerObj.connector === "function") ?
+                 handlers[handlerName].callback :
+                 undefined;
+-        }
++        },
++        configurable: true
+     });
+ };
+ 
+diff --git a/src/config.cpp b/src/config.cpp
+index a81be2f36..661d6c8c9 100644
+--- a/src/config.cpp
++++ b/src/config.cpp
+@@ -177,7 +177,7 @@ void Config::loadJsonFile(const QString& filePath)
+     // Add this object to the global scope
+     webPage.mainFrame()->addToJavaScriptWindowObject("config", this);
+     // Apply the JSON config settings to this very object
+-    webPage.mainFrame()->evaluateJavaScript(configurator.arg(jsonConfig), QString());
++    webPage.mainFrame()->evaluateJavaScript(configurator.arg(jsonConfig));
+ }
+ 
+ QString Config::helpText() const
+diff --git a/src/modules/webpage.js b/src/modules/webpage.js
+index 20eae9a85..0760a74b4 100644
+--- a/src/modules/webpage.js
++++ b/src/modules/webpage.js
+@@ -115,7 +115,8 @@ function definePageSignalHandler(page, handlers, handlerName, signalName) {
+             return !!handlers[handlerName] && typeof handlers[handlerName].callback === "function" ?
+                 handlers[handlerName].callback :
+                 undefined;
+-        }
++        },
++        configurable: true
+     });
+ }
+ 
+diff --git a/src/phantom.cpp b/src/phantom.cpp
+index 5417b9beb..9565a89ea 100644
+--- a/src/phantom.cpp
++++ b/src/phantom.cpp
+@@ -386,7 +386,7 @@ void Phantom::loadModule(const QString& moduleSource, const QString& filename)
+         "require.cache['" + filename + "'].exports," +
+         "require.cache['" + filename + "']" +
+         "));";
+-    m_page->mainFrame()->evaluateJavaScript(scriptSource, QString(JAVASCRIPT_SOURCE_PLATFORM_URL).arg(QFileInfo(filename).fileName()));
++    m_page->mainFrame()->evaluateJavaScript(scriptSource);
+ }
+ 
+ bool Phantom::injectJs(const QString& jsFilePath)
+@@ -483,8 +483,7 @@ void Phantom::onInitialized()
+ 
+     // Bootstrap the PhantomJS scope
+     m_page->mainFrame()->evaluateJavaScript(
+-        Utils::readResourceFileUtf8(":/bootstrap.js"),
+-        QString(JAVASCRIPT_SOURCE_PLATFORM_URL).arg("bootstrap.js")
++        Utils::readResourceFileUtf8(":/bootstrap.js")
+     );
+ }
+ 
+diff --git a/src/repl.cpp b/src/repl.cpp
+index 45a475bc1..7f25a22b0 100644
+--- a/src/repl.cpp
++++ b/src/repl.cpp
+@@ -147,7 +147,7 @@ REPL::REPL(QWebFrame* webframe, Phantom* parent)
+     linenoiseSetCompletionCallback(REPL::offerCompletion);
+ 
+     // Inject REPL utility functions
+-    m_webframe->evaluateJavaScript(Utils::readResourceFileUtf8(":/repl.js"), QString(JAVASCRIPT_SOURCE_PLATFORM_URL).arg("repl.js"));
++    m_webframe->evaluateJavaScript(Utils::readResourceFileUtf8(":/repl.js"));
+ 
+     // Add self to JavaScript world
+     m_webframe->addToJavaScriptWindowObject("_repl", this);
+@@ -184,8 +184,7 @@ void REPL::offerCompletion(const char* buf, linenoiseCompletions* lc)
+     QStringList completions = REPL::getInstance()->m_webframe->evaluateJavaScript(
+                                   QString(JS_RETURN_POSSIBLE_COMPLETIONS).arg(
+                                       toInspect,
+-                                      toComplete),
+-                                  QString()
++                                      toComplete)
+                               ).toStringList();
+ 
+     foreach(QString c, completions) {
+@@ -210,7 +209,7 @@ void REPL::startLoop()
+             // Send the user input to the main Phantom frame for evaluation
+             m_webframe->evaluateJavaScript(
+                 QString(JS_EVAL_USER_INPUT).arg(
+-                    QString(userInput).replace('"', "\\\"")), QString("phantomjs://repl-input"));
++                    QString(userInput).replace('"', "\\\"")));
+ 
+             // Save command in the REPL history
+             linenoiseHistoryAdd(userInput);
+diff --git a/src/utils.cpp b/src/utils.cpp
+index 16d933ef9..9970e1cc0 100644
+--- a/src/utils.cpp
++++ b/src/utils.cpp
+@@ -132,7 +132,7 @@ bool injectJsInFrame(const QString& jsFilePath, const QString& jsFileLanguage, c
+         return false;
+     }
+     // Execute JS code in the context of the document
+-    targetFrame->evaluateJavaScript(scriptBody, QString(JAVASCRIPT_SOURCE_CODE_URL).arg(QFileInfo(scriptPath).fileName()));
++    targetFrame->evaluateJavaScript(scriptBody);
+     return true;
+ }
+ 
+@@ -147,10 +147,10 @@ bool loadJSForDebug(const QString& jsFilePath, const QString& jsFileLanguage, co
+     QString scriptBody = jsFromScriptFile(scriptPath, jsFileLanguage, jsFileEnc);
+ 
+     scriptBody = QString("function __run() {\n%1\n}").arg(scriptBody);
+-    targetFrame->evaluateJavaScript(scriptBody, QString(JAVASCRIPT_SOURCE_CODE_URL).arg(QFileInfo(scriptPath).fileName()));
++    targetFrame->evaluateJavaScript(scriptBody);
+ 
+     if (autorun) {
+-        targetFrame->evaluateJavaScript("__run()", QString());
++        targetFrame->evaluateJavaScript("__run()");
+     }
+ 
+     return true;
+diff --git a/src/webpage.cpp b/src/webpage.cpp
+index 305085d87..df95049a6 100644
+--- a/src/webpage.cpp
++++ b/src/webpage.cpp
+@@ -757,8 +757,7 @@ QVariant WebPage::evaluateJavaScript(const QString& code)
+     qDebug() << "WebPage - evaluateJavaScript" << function;
+ 
+     evalResult = m_currentFrame->evaluateJavaScript(
+-                     function,                                   //< function evaluated
+-                     QString("phantomjs://webpage.evaluate()")); //< reference source file
++                     function);
+ 
+     qDebug() << "WebPage - evaluateJavaScript result" << evalResult;
+ 
+@@ -930,7 +929,7 @@ void WebPage::openUrl(const QString& address, const QVariant& op, const QVariant
+     }
+ 
+     if (networkOp == QNetworkAccessManager::UnknownOperation) {
+-        m_mainFrame->evaluateJavaScript("console.error('Unknown network operation: " + operation + "');", QString());
++        m_mainFrame->evaluateJavaScript("console.error('Unknown network operation: " + operation + "');");
+         return;
+     }
+ 
+@@ -1326,7 +1325,7 @@ QString getHeaderFooter(const QVariantMap& map, const QString& key, QWebFrame* f
+             }
+         }
+     }
+-    frame->evaluateJavaScript("console.error('Bad header callback given, use phantom.callback);", QString());
++    frame->evaluateJavaScript("console.error('Bad header callback given, use phantom.callback);");
+     return QString();
+ }
+ 
+@@ -1365,7 +1364,7 @@ bool WebPage::injectJs(const QString& jsFilePath)
+ 
+ void WebPage::_appendScriptElement(const QString& scriptUrl)
+ {
+-    m_currentFrame->evaluateJavaScript(QString(JS_APPEND_SCRIPT_ELEMENT).arg(scriptUrl), scriptUrl);
++    m_currentFrame->evaluateJavaScript(QString(JS_APPEND_SCRIPT_ELEMENT).arg(scriptUrl));
+ }
+ 
+ QObject* WebPage::_getGenericCallback()
+diff --git a/src/webpage.h b/src/webpage.h
+index 062179d27..0d5e06b7f 100644
+--- a/src/webpage.h
++++ b/src/webpage.h
+@@ -46,7 +46,7 @@ class NetworkAccessManager;
+ class QWebInspector;
+ class Phantom;
+ 
+-class WebPage : public QObject, public QWebFrame::PrintCallback
++class WebPage : public QObject
+ {
+     Q_OBJECT
+     Q_PROPERTY(QString title READ title)
+-- 
+2.39.0
+
diff --git a/srcpkgs/phantomjs/patches/0004-Use-CMake-build-system-15397.patch b/srcpkgs/phantomjs/patches/0004-Use-CMake-build-system-15397.patch
new file mode 100644
index 000000000000..a5d0fa1bbc00
--- /dev/null
+++ b/srcpkgs/phantomjs/patches/0004-Use-CMake-build-system-15397.patch
@@ -0,0 +1,1008 @@
+From 538d05ed26f830522597c2623894a2193785abaf Mon Sep 17 00:00:00 2001
+From: Ariya Hidayat <ariya.hidayat@gmail.com>
+Date: Fri, 29 Nov 2019 22:29:15 -0800
+Subject: [PATCH 4/4] Use CMake build system (#15397)
+
+---
+ .gitignore                        |  15 ++
+ CMakeLists.txt                    |  34 ++++
+ INSTALL                           |  46 +++++
+ configure                         | 317 ++++++++++++++++++++++++++++++
+ deploy/.gitignore                 |   2 -
+ deploy/README.md                  |  44 -----
+ deploy/brandelf.c                 | 212 --------------------
+ deploy/build-and-package.sh       |   6 -
+ deploy/docker-build.sh            |  62 ------
+ deploy/package.sh                 | 120 -----------
+ phantomjs.pro                     |   3 -
+ src/linenoise/linenoise.pri       |   9 -
+ src/mongoose/mongoose.pri         |   7 -
+ src/qcommandline/qcommandline.pri |   7 -
+ 14 files changed, 412 insertions(+), 472 deletions(-)
+ create mode 100644 CMakeLists.txt
+ create mode 100644 INSTALL
+ create mode 100755 configure
+ delete mode 100644 deploy/.gitignore
+ delete mode 100644 deploy/README.md
+ delete mode 100644 deploy/brandelf.c
+ delete mode 100755 deploy/build-and-package.sh
+ delete mode 100755 deploy/docker-build.sh
+ delete mode 100755 deploy/package.sh
+ delete mode 100644 phantomjs.pro
+ delete mode 100644 src/linenoise/linenoise.pri
+ delete mode 100644 src/mongoose/mongoose.pri
+ delete mode 100644 src/qcommandline/qcommandline.pri
+
+diff --git a/.gitignore b/.gitignore
+index 7c8a9c08a..53ef2055d 100644
+--- a/.gitignore
++++ b/.gitignore
+@@ -60,3 +60,18 @@ bin/
+ *.class
+ build/
+ .gradle/
++
++# CMake
++CMakeLists.txt.user
++CMakeCache.txt
++CMakeFiles
++CMakeScripts
++Testing
++Makefile
++cmake_install.cmake
++install_manifest.txt
++compile_commands.json
++CTestTestfile.cmake
++_deps
++*_autogen
++
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+new file mode 100644
+index 000000000..c23e11f49
+--- /dev/null
++++ b/CMakeLists.txt
+@@ -0,0 +1,34 @@
++cmake_minimum_required(VERSION 3.5.0)
++project(phantomjs)
++
++set (CMAKE_CXX_STANDARD 11)
++
++find_package(Qt5 COMPONENTS Core Network WebKitWidgets REQUIRED)
++find_package(Threads REQUIRED)
++
++message("Using Qt version ${Qt5Core_VERSION}")
++if (Qt5Core_VERSION VERSION_LESS 5.5.0)
++  message(FATAL_ERROR "This version of Qt is not supported. Please use Qt 5.5 or later")
++endif()
++
++set(CMAKE_AUTOMOC ON)
++set(CMAKE_AUTORCC ON)
++
++set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
++
++file(GLOB_RECURSE PHANTOMJS_SOURCES src/*.cpp)
++include_directories(src)
++set(CMAKE_INCLUDE_CURRENT_DIR ON)
++
++set(THIRDPARTY_SOURCES src/mongoose/mongoose.c src/qcommandline/qcommandline.cpp src/linenoise/src/linenoise.c)
++include_directories(src/linenoise/src)
++include_directories(src/mongoose)
++include_directories(src/qcommandline)
++
++set(EXTRA_LIBS dl)
++
++add_executable(${PROJECT_NAME} src/phantomjs.qrc src/ghostdriver/ghostdriver.qrc ${PHANTOMJS_SOURCES} ${THIRDPARTY_SOURCES})
++target_link_libraries(${PROJECT_NAME} ${EXTRA_LIBS} Qt5::Core Qt5::Network Qt5::WebKitWidgets Threads::Threads)
++install(TARGETS ${PROJECT_NAME} DESTINATION bin)
++
++add_custom_target(check COMMAND python test/run-tests.py -v)
+diff --git a/INSTALL b/INSTALL
+new file mode 100644
+index 000000000..6c8b5ea65
+--- /dev/null
++++ b/INSTALL
+@@ -0,0 +1,46 @@
++Installation Instructions
++*************************
++
++System requirements:
++
++  * C++ toolchain such as g++ 7 or later
++  * CMake version 3.5 or later
++  * Qt 5 toolkit
++  * Python 2.7 (to run the tests)
++
++
++Installation on Linux
++---------------------
++
++On Debian/Ubuntu, the requirements can be fulfilled by installing these packages:
++
++  sudo apt install g++ cmake qt5-default libqt5webkit5-dev python
++
++After unpacking the source tarball or cloning the repository:
++
++  ./configure && make
++
++Do a quick sanity check:
++
++  ./bin/phantomjs --version
++
++Run the test suite:
++
++  make check
++
++Install it (may require sudo):
++
++  make install
++
++
++Installation on Windows
++-----------------------
++
++To be written.
++
++
++Installation on macOS
++---------------------
++
++To be written.
++
+diff --git a/configure b/configure
+new file mode 100755
+index 000000000..a8a75d566
+--- /dev/null
++++ b/configure
+@@ -0,0 +1,317 @@
++#!/bin/sh
++
++# Autotools-style (./configure) wrapper for CMake
++# <https://github.com/nemequ/configure-cmake>
++#
++#   *** IMPORTANT ***
++#
++#   You must include the GNUInstallDirs module (which comes with
++#   CMake) in your project.  Just put "include (GNUInstallDirs)" in
++#   you CMakeLists.txt and you should be good.
++#
++# This script was originally written for Squash
++# <https://quixdb.github.io/squash/> by Evan Nemerson
++# <evan@nemerson.com>, but has been spun off into a separate
++# repository.  Please feel free to copy it into your own repository,
++# though I would appreciate it if you would post improvements, bugs,
++# feature requests, etc. to the issue tracker at
++# <https://github.com/nemequ/configure-cmake/issues>.
++#
++# To the extent possible under law, the author(s) hereby waive all
++# copyright and related or neighboring rights to this work.  For
++# details, see <https://creativecommons.org/publicdomain/zero/1.0/>
++
++TOP_SRCDIR="$(dirname $0)"
++
++if [ "${CMAKE_CMD}" = "" ]; then
++    CMAKE_CMD="cmake"
++fi
++
++BUILD_TYPE="Debug"
++PREFIX=/usr/local
++LIBDIR=
++CMAKE_ARGS=
++
++if [ -e "${TOP_SRCDIR}/.configure-custom.sh" ]; then
++    . "${TOP_SRCDIR}/.configure-custom.sh"
++fi
++
++quote() {
++    echo "$1" | sed -e "s|'|'\\\\''|g; 1s/^/'/; \$s/\$/'/"
++}
++
++extract_var_string() {
++    VAR_NAME=$1
++    VAR_NAME=$(echo $1 | sed -e 's/[ \t]*$//')
++    if [ "x$2" != "x" ]; then
++        VAR_VALUE=$2
++    else
++        VAR_VALUE=yes
++    fi
++
++    if [ "x$3" != "x" ]; then
++        VAR_UC_NAME=$3
++    else
++        VAR_UC_NAME=$(echo "$1" | tr '[:lower:]' '[:upper:]' | tr -c '[:alnum:]' '_' | sed 's/_$//g')
++    fi
++}
++
++set_config_var() {
++    is_with=n
++    case "$1" in
++        "--enable-"*)
++            name="${1#--enable-}"
++            cfg="${ENABLE_VARS}"
++            ;;
++        "--disable-"*)
++            name="${1#--disable-}";
++            cfg="${DISABLE_VARS}";
++            ;;
++        "--with-"*)
++            # IFS="=" read -ra WITHARGS <<< "${1}"
++            name="${1#--with-}"
++            cfg="${WITH_VARS}"
++            is_with=y
++            ;;
++    esac
++
++    found=n
++    for varstring in $cfg; do
++        extract_var_string $(echo "${varstring}" | tr '|' ' ')
++        if [ "x$VAR_NAME" = "x$name" ]; then
++            found=y
++            break;
++        fi
++    done
++
++    if [ "$found" = "y" ]; then
++        if [ "x$is_with" = "xy" ]; then
++            CMAKE_ARGS="$CMAKE_ARGS -D${VAR_UC_NAME}=$(quote "$2")"
++        else
++            CMAKE_ARGS="$CMAKE_ARGS -D${VAR_UC_NAME}=$(quote "${VAR_VALUE}")"
++        fi
++    else
++        echo "Unknown parameter: ${1}"
++        exit 1
++    fi
++}
++
++prefix_to_offset() {
++    expr $(echo "${1}" | awk '{ print length }') + 1
++}
++
++print_help() {
++    cat <<EOF >&2
++  -h, --help              display this help and exit
++  --disable-debug         disable debugging mode
++  --pass-thru             pass remaining arguments through to CMake
++
++  --prefix=PREFIX         install architecture-independent files in PREFIX
++                          [$PREFIX]
++  --bindir=DIR            user executables [PREFIX/bin]
++  --sbindir=DIR           system admin executables [PREFIX/sbin]
++  --libexecdir=DIR        program executables [PREFIX/libexec]
++  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
++  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
++  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
++  --libdir=DIR            object code libraries [PREFIX/lib]
++  --includedir=DIR        C header files [PREFIX/include]
++  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
++  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
++  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
++  --infodir=DIR           info documentation [DATAROOTDIR/info]
++  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
++  --mandir=DIR            man documentation [DATAROOTDIR/man]
++  --docdir=DIR            documentation root [DATAROOTDIR/doc/PROJECT_NAME]
++EOF
++
++    first=y
++    for varstring in ${ENABLE_VARS}; do
++        if [ $first = 'y' ]; then
++            echo ""
++            first=n
++        fi
++        extract_var_string $(echo "${varstring}" | tr '|' ' ')
++        var_doc_name="ENABLE_${VAR_UC_NAME}_DOC"
++        eval "docstring=\$$var_doc_name"
++        if [ "x${docstring}" = "x" ]; then
++            printf "  --enable-%-14s enable %s support\n" "${VAR_NAME}" "$(echo -n "${VAR_NAME}" | tr '-' ' ')"
++        else
++            printf "  --enable-%-14s %s\n" "${VAR_NAME}" "$docstring"
++        fi
++    done
++
++    first=y
++    for varstring in ${DISABLE_VARS}; do
++        if [ $first = 'y' ]; then
++            echo ""
++            first=n
++        fi
++        extract_var_string $(echo "${varstring}" | tr '|' ' ')
++        var_doc_name="DISABLE_${VAR_UC_NAME}_DOC"
++        eval "docstring=\$$var_doc_name"
++        if [ "x${docstring}" = "x" ]; then
++            printf "  --disable-%-13s disable %s support\n" "${VAR_NAME}" "$(echo -n "${VAR_NAME}" | tr '-' ' ')"
++        else
++            printf "  --disable-%-13s %s\n" "${VAR_NAME}" "$docstring"
++        fi
++    done
++
++    first=y
++    for varstring in ${WITH_VARS}; do
++        if [ $first = 'y' ]; then
++            echo ""
++            first=n
++        fi
++        extract_var_string $(echo "${varstring}" | tr '|' ' ')
++        var_doc_name="WITH_${VAR_UC_NAME}_DOC"
++        eval "docstring=\$$var_doc_name"
++        paraminfo="${VAR_NAME}=${VAR_VALUE}"
++        if [ "x${docstring}" = "x" ]; then
++            printf "  --with-%-16s enable %s support\n" "$paraminfo" "$(echo -n "${VAR_NAME}" | tr '-' ' ')"
++        else
++            printf "  --with-%-16s %s\n" "$paraminfo" "$docstring"
++        fi
++    done
++
++    exit 0
++}
++
++while [ $# != 0 ]; do
++    case "$1" in
++        "--prefix="*)
++            PREFIX="${1#*=}";;
++        "--prefix")
++            PREFIX="${2}"; shift;;
++        "--bindir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_BINDIR=$(quote "${1#*=}")";;
++        "--bindir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_BINDIR=$(quote "$2")"; shift;;
++        "--sbindir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SBINDIR=$(quote "${1#*=}")";;
++        "--sbindir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SBINDIR=$(quote "$2")"; shift;;
++        "--libexecdir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LIBEXECDIR=$(quote "${1#*=}")";;
++        "--libexecdir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LIBEXECDIR=$(quote "$2")"; shift;;
++        "--sysconfdir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SYSCONFDIR=$(quote "${1#*=}")";;
++        "--sysconfdir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SYSCONFDIR=$(quote "$2")"; shift;;
++        "--sharedstatedir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SHAREDSTATEDIR=$(quote "${1#*=}")";;
++        "--sharedstatedir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_SHAREDSTATEDIR=$(quote "$2")"; shift;;
++        "--localstatedir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LOCALSTATEDIR=$(quote "${1#*=}")";;
++        "--localstatedir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LOCALSTATEDIR=$(quote "$2")"; shift;;
++        "--libdir="*)
++            LIBDIR="${1#*=}";;
++        "--libdir")
++            LIBDIR="${2}"; shift;;
++        "--includedir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_INCLUDEDIR=$(quote "${1#*=}")";;
++        "--includedir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_INCLUDEDIR=$(quote "$2")"; shift;;
++        "--oldincludedir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_OLDINCLUDEDIR=$(quote "${1#*=}")";;
++        "--oldincludedir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_OLDINCLUDEDIR=$(quote "$2")"; shift;;
++        "--datarootdir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DATAROOTDIR=$(quote "${1#*=}")";;
++        "--datarootdir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DATAROOTDIR=$(quote "$2")"; shift;;
++        "--datadir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DATADIR=$(quote "${1#*=}")";;
++        "--datadir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DATADIR=$(quote "$2")"; shift;;
++        "--infodir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_INFODIR=$(quote "${1#*=}")";;
++        "--infodir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_INFODIR=$(quote "$2")"; shift;;
++        "--localedir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LOCALEDIR=$(quote "${1#*=}")";;
++        "--localedir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_LOCALEDIR=$(quote "$2")"; shift;;
++        "--mandir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_MANDIR=$(quote "${1#*=}")";;
++        "--mandir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_MANDIR=$(quote "$2")"; shift;;
++        "--docdir="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DOCDIR=$(quote "${1#*=}")";;
++        "--docdir")
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_INSTALL_DOCDIR=$(quote "$2")"; shift;;
++
++        "CC="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_C_COMPILER=$(quote "${1#*=}")";;
++        "CXX="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CXX_COMPILER=$(quote "${1#*=}")";;
++        "CFLAGS="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_C_FLAGS=$(quote "${1#*=}")";;
++        "CXXFLAGS="*)
++            CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CXX_FLAGS=$(quote "${1#*=}")";;
++        "LDFLAGS="*)
++            LDFLAGS="$LDFLAGS ${1#*=}";;
++
++        "--help")
++            print_help;;
++        "-h")
++            print_help;;
++
++        # This flag is the only one which may be a bit surprising to
++        # people.  Autotools always builds with debugging symbols enabled
++        # (AFAIK), but for cmake you have to do -DCMAKE_BUILD_TYPE=Debug.
++        # Unfortunately this can change other things as well, so although
++        # I realize there is no --disable-debug flag I thought it would be
++        # prudent to support one here.
++        "--disable-debug")
++            BUILD_TYPE="Release";;
++
++        "--pass-thru")
++            while [ $# != 1 ]; do
++                shift;
++                CMAKE_ARGS="$CMAKE_ARGS $(quote "${1}")";
++            done;;
++
++        "--enable-"*)
++            set_config_var "$1"
++            ;;
++
++        "--disable-"*)
++            set_config_var "$1"
++            ;;
++
++        "--with-"*)
++            name=$(echo "${1#--with-}" | awk '{split($1,v,"="); print v[1]}')
++            case "${1}" in
++                "--with-${name}="*)
++                    set_config_var "--with-${name}" "${1#--with-${name}=}";;
++                "--with-${name}")
++                    set_config_var "$1" "$2";
++                    shift;;
++            esac
++            ;;
++
++        *)
++            echo "$0: error: unrecognized option: \`$1'" >&2
++            echo "Try \`$0 --help' for more information" >&2
++            exit -1
++    esac;
++    shift
++done
++
++if [ "x${LIBDIR}" = "x" ]; then
++    LIBDIR="${PREFIX}/lib"
++fi
++
++# Unlike CFLAGS/CXXFLAGS/CC/CXX, LDFLAGS isn't handled by CMake, so we
++# need to parse it here.
++if [ "x${LDFLAGS}" != "x" ]; then
++    for varname in EXE MODULE SHARED STATIC; do
++        CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_${varname}_LINKER_FLAGS=$(quote "$LDFLAGS")"
++    done
++fi
++
++eval "${CMAKE_CMD}" "${TOP_SRCDIR}" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DCMAKE_INSTALL_LIBDIR="${LIBDIR}" ${CMAKE_ARGS}
+diff --git a/deploy/.gitignore b/deploy/.gitignore
+deleted file mode 100644
+index 3c2196584..000000000
+--- a/deploy/.gitignore
++++ /dev/null
+@@ -1,2 +0,0 @@
+-.vagrant
+-/brandelf
+diff --git a/deploy/README.md b/deploy/README.md
+deleted file mode 100644
+index 7f23b7d7f..000000000
+--- a/deploy/README.md
++++ /dev/null
+@@ -1,44 +0,0 @@
+-Packaging PhantomJS
+-===================
+-
+-This directory contains various scripts to assist with making PhantomJS
+-packages.
+-
+-Packaging for Linux
+--------------------
+-
+-Linux building/packaging is best done in a container to ensure
+-isolation.  We use [Docker](https://www.docker.com/) to automate the
+-process. Please see the [Docker documentation](https://docs.docker.com/)
+-for instructions on installing Docker. For OS X or Windows host,
+-please use [Docker Toolbox](https://www.docker.com/docker-toolbox).
+-
+-Once you have Docker installed, run these commands from the top level
+-of the PhantomJS source repository:
+-
+-```bash
+- $ git clean -xfd .
+- $ docker run -v $PWD:/src debian:wheezy /src/deploy/docker-build.sh
+-```
+-
+-For the 32-bit version:
+-
+-```bash
+- $ git clean -xfd .
+- $ docker run -v $PWD:/src tubia/debian:wheezy /src/deploy/docker-build.sh
+-```
+-
+-The built binary will be extracted out of the container and copied to
+-the current directory.
+-
+-
+-Packaging for OS X
+-------------------
+-
+-Run `deploy/build-and-package.sh`. That's it.
+-
+-However, if you have previously built the sources in release mode, you
+-should clean your tree to make sure all the debugging symbols gets
+-compiled:
+-
+-  $ make clean && cd src/qt && make clean && cd ../..
+diff --git a/deploy/brandelf.c b/deploy/brandelf.c
+deleted file mode 100644
+index 530297bbf..000000000
+--- a/deploy/brandelf.c
++++ /dev/null
+@@ -1,212 +0,0 @@
+-/*-
+- * Copyright (c) 2000, 2001 David O'Brien
+- * Copyright (c) 1996 Søren Schmidt
+- * All rights reserved.
+- *
+- * Redistribution and use in source and binary forms, with or without
+- * modification, are permitted provided that the following conditions
+- * are met:
+- * 1. Redistributions of source code must retain the above copyright
+- *    notice, this list of conditions and the following disclaimer
+- *    in this position and unchanged.
+- * 2. Redistributions in binary form must reproduce the above copyright
+- *    notice, this list of conditions and the following disclaimer in the
+- *    documentation and/or other materials provided with the distribution.
+- * 3. The name of the author may not be used to endorse or promote products
+- *    derived from this software without specific prior written permission
+- *
+- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+- */
+-
+-#include <sys/cdefs.h>
+-//NOTE: commented out to make it compile on linux
+-// __FBSDID("$FreeBSD: src/usr.bin/brandelf/brandelf.c,v 1.25.22.2 2012/03/16 03:22:37 eadler Exp $");
+-
+-#include <sys/types.h>
+-//NOTE: changed path to make it compile on linux
+-#include <elf.h>
+-#include <sys/errno.h>
+-#include <err.h>
+-#include <fcntl.h>
+-#include <stdio.h>
+-#include <stdlib.h>
+-#include <string.h>
+-#include <unistd.h>
+-
+-static int elftype(const char *);
+-static const char *iselftype(int);
+-static void printelftypes(void);
+-static void usage(void);
+-
+-struct ELFtypes {
+-	const char *str;
+-	int value;
+-};
+-/* XXX - any more types? */
+-static struct ELFtypes elftypes[] = {
+-	{ "FreeBSD",	ELFOSABI_FREEBSD },
+-	{ "Linux",	ELFOSABI_LINUX },
+-	{ "Solaris",	ELFOSABI_SOLARIS },
+-	{ "SVR4",	ELFOSABI_SYSV }
+-};
+-
+-int
+-main(int argc, char **argv)
+-{
+-
+-	const char *strtype = "FreeBSD";
+-	int type = ELFOSABI_FREEBSD;
+-	int retval = 0;
+-	int ch, change = 0, force = 0, listed = 0;
+-
+-	while ((ch = getopt(argc, argv, "f:lt:v")) != -1)
+-		switch (ch) {
+-		case 'f':
+-			if (change)
+-				errx(1, "f option incompatible with t option");
+-			force = 1;
+-			type = atoi(optarg);
+-			if (errno == ERANGE || type < 0 || type > 255) {
+-				warnx("invalid argument to option f: %s",
+-				    optarg);
+-				usage();
+-			}
+-			break;
+-		case 'l':
+-			printelftypes();
+-			listed = 1;
+-			break;
+-		case 'v':
+-			/* does nothing */
+-			break;
+-		case 't':
+-			if (force)
+-				errx(1, "t option incompatible with f option");
+-			change = 1;
+-			strtype = optarg;
+-			break;
+-		default:
+-			usage();
+-	}
+-	argc -= optind;
+-	argv += optind;
+-	if (!argc) {
+-		if (listed)
+-			exit(0);
+-		else {
+-			warnx("no file(s) specified");
+-			usage();
+-		}
+-	}
+-
+-	if (!force && (type = elftype(strtype)) == -1) {
+-		warnx("invalid ELF type '%s'", strtype);
+-		printelftypes();
+-		usage();
+-	}
+-
+-	while (argc) {
+-		int fd;
+-		char buffer[EI_NIDENT];
+-
+-		if ((fd = open(argv[0], change || force ? O_RDWR : O_RDONLY, 0)) < 0) {
+-			warn("error opening file %s", argv[0]);
+-			retval = 1;
+-			goto fail;
+-		}
+-		if (read(fd, buffer, EI_NIDENT) < EI_NIDENT) {
+-			warnx("file '%s' too short", argv[0]);
+-			retval = 1;
+-			goto fail;
+-		}
+-		if (buffer[0] != ELFMAG0 || buffer[1] != ELFMAG1 ||
+-		    buffer[2] != ELFMAG2 || buffer[3] != ELFMAG3) {
+-			warnx("file '%s' is not ELF format", argv[0]);
+-			retval = 1;
+-			goto fail;
+-		}
+-		if (!change && !force) {
+-			fprintf(stdout,
+-				"File '%s' is of brand '%s' (%u).\n",
+-				argv[0], iselftype(buffer[EI_OSABI]),
+-				buffer[EI_OSABI]);
+-			if (!iselftype(type)) {
+-				warnx("ELF ABI Brand '%u' is unknown",
+-				      type);
+-				printelftypes();
+-			}
+-		}
+-		else {
+-			buffer[EI_OSABI] = type;
+-			lseek(fd, 0, SEEK_SET);
+-			if (write(fd, buffer, EI_NIDENT) != EI_NIDENT) {
+-				warn("error writing %s %d", argv[0], fd);
+-				retval = 1;
+-				goto fail;
+-			}
+-		}
+-fail:
+-		close(fd);
+-		argc--;
+-		argv++;
+-	}
+-
+-	return retval;
+-}
+-
+-static void
+-usage(void)
+-{
+-	(void)fprintf(stderr,
+-	    "usage: brandelf [-lv] [-f ELF_ABI_number] [-t string] file ...\n");
+-	exit(1);
+-}
+-
+-static const char *
+-iselftype(int etype)
+-{
+-	size_t elfwalk;
+-
+-	for (elfwalk = 0;
+-	     elfwalk < sizeof(elftypes)/sizeof(elftypes[0]);
+-	     elfwalk++)
+-		if (etype == elftypes[elfwalk].value)
+-			return elftypes[elfwalk].str;
+-	return 0;
+-}
+-
+-static int
+-elftype(const char *elfstrtype)
+-{
+-	size_t elfwalk;
+-
+-	for (elfwalk = 0;
+-	     elfwalk < sizeof(elftypes)/sizeof(elftypes[0]);
+-	     elfwalk++)
+-		if (strcasecmp(elfstrtype, elftypes[elfwalk].str) == 0)
+-			return elftypes[elfwalk].value;
+-	return -1;
+-}
+-
+-static void
+-printelftypes(void)
+-{
+-	size_t elfwalk;
+-
+-	fprintf(stderr, "known ELF types are: ");
+-	for (elfwalk = 0;
+-	     elfwalk < sizeof(elftypes)/sizeof(elftypes[0]);
+-	     elfwalk++)
+-		fprintf(stderr, "%s(%u) ", elftypes[elfwalk].str,
+-			elftypes[elfwalk].value);
+-	fprintf(stderr, "\n");
+-}
+diff --git a/deploy/build-and-package.sh b/deploy/build-and-package.sh
+deleted file mode 100755
+index d11501fa9..000000000
+--- a/deploy/build-and-package.sh
++++ /dev/null
+@@ -1,6 +0,0 @@
+-#!/usr/bin/env bash
+-
+-cd `dirname $0`/..
+-
+-./build.py --confirm --release --git-clean-qtbase --git-clean-qtwebkit "$@" || exit 1
+-
+diff --git a/deploy/docker-build.sh b/deploy/docker-build.sh
+deleted file mode 100755
+index 5ceb08931..000000000
+--- a/deploy/docker-build.sh
++++ /dev/null
+@@ -1,62 +0,0 @@
+-#!/usr/bin/env bash
+-
+-set -e
+-
+-SOURCE_PATH=/src
+-BUILD_PATH=$HOME/build
+-
+-# In case the old package URL is still being used
+-sed -i 's/http\.debian\.net/httpredir\.debian\.org/g' /etc/apt/sources.list
+-
+-echo "Installing packages for development tools..." && sleep 1
+-apt-get -y update
+-apt-get install -y build-essential git flex bison gperf python ruby git libfontconfig1-dev
+-echo
+-
+-echo "Preparing to download Debian source package..."
+-echo "deb-src http://httpredir.debian.org/debian wheezy main" >> /etc/apt/sources.list
+-apt-get -y update
+-echo
+-
+-OPENSSL_TARGET='linux-x86_64'
+-if [ `getconf LONG_BIT` -eq 32 ]; then
+-    OPENSSL_TARGET='linux-generic32'
+-fi
+-echo "Recompiling OpenSSL for ${OPENSSL_TARGET}..." && sleep 1
+-apt-get source openssl
+-cd openssl-1.0.1e
+-OPENSSL_FLAGS='no-idea no-mdc2 no-rc5 no-zlib enable-tlsext no-ssl2 no-ssl3 no-ssl3-method enable-rfc3779 enable-cms'
+-./Configure --prefix=/usr --openssldir=/etc/ssl --libdir=lib ${OPENSSL_FLAGS} ${OPENSSL_TARGET}
+-make depend && make && make install
+-cd ..
+-echo
+-
+-echo "Building the static version of ICU library..." && sleep 1
+-apt-get source icu
+-cd icu-4.8.1.1/source
+-./configure --prefix=/usr --enable-static --disable-shared
+-make && make install
+-cd ..
+-echo
+-
+-echo "Recreating the build directory $BUILD_PATH..."
+-rm -rf $BUILD_PATH && mkdir -p $BUILD_PATH
+-echo
+-
+-echo "Transferring the source: $SOURCE_PATH -> $BUILD_PATH. Please wait..."
+-cd $BUILD_PATH && cp -rp $SOURCE_PATH . && cd src
+-echo
+-
+-echo "Compiling PhantomJS..." && sleep 1
+-python build.py --confirm --release --qt-config="-no-pkg-config" --git-clean-qtbase --git-clean-qtwebkit
+-echo
+-
+-echo "Stripping the executable..." && sleep 1
+-ls -l bin/phantomjs
+-strip bin/phantomjs
+-echo "Copying the executable..." && sleep 1
+-ls -l bin/phantomjs
+-cp bin/phantomjs $SOURCE_PATH
+-echo
+-
+-echo "Finished."
+diff --git a/deploy/package.sh b/deploy/package.sh
+deleted file mode 100755
+index 16d6525bc..000000000
+--- a/deploy/package.sh
++++ /dev/null
+@@ -1,120 +0,0 @@
+-#!/usr/bin/env bash
+-
+-#
+-# usage: just run this script (after having run build.sh)
+-#        and deploy the created tarball to your target machine.
+-#
+-# It creates a phantomjs-$version folder and copies the binary,
+-# example, license etc. together with all shared library dependencies
+-# to that folder. Furthermore brandelf is used to make the lib
+-# and binary compatible with older unix/linux machines that don't
+-# know the new Linux ELF ABI.
+-#
+-
+-cd $(dirname $0)
+-
+-if [[ ! -f ../bin/phantomjs ]]; then
+-    echo "phantomjs was not built yet, please run build.sh first"
+-    exit 1
+-fi
+-
+-if [[ "$1" = "--bundle-libs" ]]; then
+-    bundle_libs=1
+-else
+-    bundle_libs=0
+-fi
+-
+-version=$(../bin/phantomjs --version | sed 's/ /-/' | sed 's/[()]//g')
+-src=..
+-
+-echo "packaging phantomjs $version"
+-
+-if [[ $OSTYPE = darwin* ]]; then
+-    dest="phantomjs-$version-macosx"
+-else
+-    dest="phantomjs-$version-linux-$(uname -m)"
+-fi
+-
+-rm -Rf $dest{.tar.bz2,} &> /dev/null
+-mkdir -p $dest/bin
+-
+-echo
+-
+-echo -n "copying files..."
+-cp $src/bin/phantomjs $dest/bin
+-cp -r $src/{ChangeLog,examples,LICENSE.BSD,third-party.txt,README.md} $dest/
+-echo "done"
+-echo
+-
+-phantomjs=$dest/bin/phantomjs
+-
+-if [[ "$bundle_libs" = "1" ]]; then
+-    mkdir -p $dest/lib
+-
+-    if [[ ! -f brandelf ]]; then
+-        echo
+-        echo "brandelf executable not found in current dir"
+-        echo -n "compiling it now..."
+-        g++ brandelf.c -o brandelf || exit 1
+-        echo "done"
+-    fi
+-
+-    libs=$(ldd $phantomjs | egrep -o "/[^ ]+ ")
+-
+-    echo -n "copying shared libs..."
+-    libld=
+-    for l in $libs; do
+-        ll=$(basename $l)
+-        cp $l $dest/lib/$ll
+-
+-        if [[ "$bundle_libs" = "1" ]]; then
+-            # ensure OS ABI compatibility
+-            ./brandelf -t SVR4 $dest/lib/$ll
+-            if [[ "$l" == *"ld-linux"* ]]; then
+-                libld=$ll
+-            fi
+-        fi
+-    done
+-    echo "done"
+-    echo
+-
+-    echo -n "writing run script..."
+-    mv $phantomjs $phantomjs.bin
+-    phantomjs=$phantomjs.bin
+-    run=$dest/bin/phantomjs
+-    echo '#!/bin/sh' >> $run
+-    echo 'path=$(dirname $(dirname $(readlink -f $0)))' >> $run
+-    echo 'export LD_LIBRARY_PATH=$path/lib' >> $run
+-    echo 'exec $path/lib/'$libld' $phantomjs $@' >> $run
+-    chmod +x $run
+-    echo "done"
+-    echo
+-fi
+-
+-echo -n "stripping binary and libs..."
+-if [[ $OSTYPE = darwin* ]]; then
+-    strip -x $phantomjs
+-else
+-    strip -s $phantomjs
+-    [[ -d $dest/lib ]] && strip -s $dest/lib/*
+-fi
+-echo "done"
+-echo
+-
+-echo -n "compressing binary..."
+-if type upx >/dev/null 2>&1; then
+-    upx -qqq -9 $phantomjs
+-    echo "done"
+-else
+-    echo "upx not found"
+-fi
+-echo
+-
+-echo -n "creating archive..."
+-if [[ $OSTYPE = darwin* ]]; then
+-    zip -r $dest.zip $dest
+-else
+-    tar -cjf $dest{.tar.bz2,}
+-fi
+-echo "done"
+-echo
+diff --git a/phantomjs.pro b/phantomjs.pro
+deleted file mode 100644
+index 24663df32..000000000
+--- a/phantomjs.pro
++++ /dev/null
+@@ -1,3 +0,0 @@
+-TEMPLATE = subdirs
+-CONFIG += ordered
+-SUBDIRS += src/phantomjs.pro
+diff --git a/src/linenoise/linenoise.pri b/src/linenoise/linenoise.pri
+deleted file mode 100644
+index 9095bae9c..000000000
+--- a/src/linenoise/linenoise.pri
++++ /dev/null
+@@ -1,9 +0,0 @@
+-VPATH += $$PWD/src
+-INCLUDEPATH += $$PWD/src
+-
+-DEFINES += USE_UTF8
+-
+-SOURCES += linenoise.c \
+-    utf8.c
+-HEADERS += linenoise.h \
+-    utf8.h
+diff --git a/src/mongoose/mongoose.pri b/src/mongoose/mongoose.pri
+deleted file mode 100644
+index 5fb16f996..000000000
+--- a/src/mongoose/mongoose.pri
++++ /dev/null
+@@ -1,7 +0,0 @@
+-VPATH += $$PWD
+-INCLUDEPATH += $$PWD
+-
+-SOURCES += mongoose.c
+-HEADERS += mongoose.h
+-linux*:LIBS += -ldl
+-win32:LIBS += -lWs2_32
+diff --git a/src/qcommandline/qcommandline.pri b/src/qcommandline/qcommandline.pri
+deleted file mode 100644
+index e994f19b2..000000000
+--- a/src/qcommandline/qcommandline.pri
++++ /dev/null
+@@ -1,7 +0,0 @@
+-VPATH += $$PWD
+-INCLUDEPATH += $$PWD
+-
+-DEFINES += STATIC_BUILD QCOMMANDLINE_STATIC
+-
+-SOURCES += qcommandline.cpp
+-HEADERS += qcommandline.h
+-- 
+2.39.0
+
diff --git a/srcpkgs/phantomjs/template b/srcpkgs/phantomjs/template
new file mode 100644
index 000000000000..f60a738da3c0
--- /dev/null
+++ b/srcpkgs/phantomjs/template
@@ -0,0 +1,22 @@
+# Template file for 'phantomjs'
+pkgname=phantomjs
+version=2.1.1
+revision=1
+build_style=configure
+configure_args="--prefix=/usr"
+hostmakedepends="cmake qt5-host-tools qt5-qmake"
+makedepends="qt5-devel qt5-webkit-devel"
+short_desc="Headless web browser scriptable with JavaScript"
+maintainer="Eugen Zagorodniy <zag@disroot.org>"
+license=BSD-3-Clause
+homepage="https://phantomjs.org/"
+distfiles="https://github.com/ariya/phantomjs/archive/refs/tags/${version}.tar.gz"
+checksum=bd1e63e9cd48d5a9c8ff1affc254eeae14704304437710729f133cb80cf98cf1
+
+post_install() {
+	vlicense LICENSE.BSD
+}
+
+do_check() {
+	: # too many tests are broken
+}

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: New package: phantomjs-2.1.1
  2023-02-02  6:15 [PR PATCH] New package: phantomjs-2.1.1 ezag
  2023-02-02  6:55 ` [PR PATCH] [Updated] " ezag
  2023-02-02  6:56 ` ezag
@ 2023-05-04  1:51 ` github-actions
  2023-05-18  1:53 ` [PR PATCH] [Closed]: " github-actions
  3 siblings, 0 replies; 5+ messages in thread
From: github-actions @ 2023-05-04  1:51 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

New comment by github-actions[bot] on void-packages repository

https://github.com/void-linux/void-packages/pull/42024#issuecomment-1533974285

Comment:
Pull Requests become stale 90 days after last activity and are closed 14 days after that.  If this pull request is still relevant bump it or assign it.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PR PATCH] [Closed]: New package: phantomjs-2.1.1
  2023-02-02  6:15 [PR PATCH] New package: phantomjs-2.1.1 ezag
                   ` (2 preceding siblings ...)
  2023-05-04  1:51 ` github-actions
@ 2023-05-18  1:53 ` github-actions
  3 siblings, 0 replies; 5+ messages in thread
From: github-actions @ 2023-05-18  1:53 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1671 bytes --]

There's a closed pull request on the void-packages repository

New package: phantomjs-2.1.1
https://github.com/void-linux/void-packages/pull/42024

Description:
This package [has been removed due to dead upstream](https://github.com/void-linux/void-packages/commit/702d6cb7f3a881f32e69d01baaba54217a8c38a8).

However, with few patches cherry-picked from upstream development version, it does build against current Qt5 version.

Since youtube-dl/yt-dlp still [optionally depends on it](https://github.com/void-linux/void-packages/pull/12244) as fallback to avoid throttling, it would be nice to have this package available, despite its [suspended development](https://github.com/ariya/phantomjs/issues/15344).

<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, x86_64
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl (crossbuild)
  - armv7l (crossbuild)
  - armv6l-musl (crossbuild)



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-05-18  1:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-02  6:15 [PR PATCH] New package: phantomjs-2.1.1 ezag
2023-02-02  6:55 ` [PR PATCH] [Updated] " ezag
2023-02-02  6:56 ` ezag
2023-05-04  1:51 ` github-actions
2023-05-18  1:53 ` [PR PATCH] [Closed]: " github-actions

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).