Re: [PATCH] gnu: Add phantomjs.

2016-12-14 Thread Jan Nieuwenhuizen
ng0 writes:

> I think it will be easier to review when you split it. This is
> all somewhat related, but those are 6 new public(?) packages and
> one very long patch.

Sure I can do that, I'll prepare a new series.

> I don't know much about Qt, skipping through this I just saw one
> http which could be changed to https, that's all so far.

Okay.
Greetings,
Jan

-- 
Jan Nieuwenhuizen  | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | AvatarĀ®  http://AvatarAcademy.nl  



Re: [PATCH] gnu: Add phantomjs.

2016-12-14 Thread ng0
Jan Nieuwenhuizen  writes:

> Hi,
>
> I need phantomjs for a client and finally managed to built it from
> source.
>
> I tried to build it with our current qt-5.6/qtwebkit-5.7 but gave up;
> apparently phantomjs needs patches to even build with qt-5.5.
>
> While I think it's a waste not to share this patch, I don't intend to
> spend much effort on these (I have very little respect, patience or love
> for qt), please don't put too much effort in reviewing if this needs
> much work.
>
> Greetings,
> Jan.
>
> From 25f9e007ee2c7f641e7761d990c61bc142440430 Mon Sep 17 00:00:00 2001
> From: Jan Nieuwenhuizen 
> Date: Thu, 17 Nov 2016 11:39:00 +0100
> Subject: [PATCH] gnu: Add phantomjs.

I think it will be easier to review when you split it. This is
all somewhat related, but those are 6 new public(?) packages and
one very long patch.
I don't know much about Qt, skipping through this I just saw one
http which could be changed to https, that's all so far.

> * gnu/packages/patches/phantomjs-qt55.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Add it.
> * gnu/packages/qt.scm (qtbase55, qtsvg55, qtxmlpatterns55, qtdeclarative55,
> qtwebkit55, phantomjs): New variable.
> ---
>  gnu/local.mk  |   1 +
>  gnu/packages/patches/phantomjs-qt55.patch | 277 
> ++
>  gnu/packages/qt.scm   | 256 +++
>  3 files changed, 534 insertions(+)
>  create mode 100644 gnu/packages/patches/phantomjs-qt55.patch
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index f780b24..96fde14 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -787,6 +787,7 @@ dist_patch_DATA = 
> \
>%D%/packages/patches/perl-module-pluggable-search.patch\
>%D%/packages/patches/perl-reproducible-build-date.patch\
>%D%/packages/patches/perl-www-curl-remove-symbol.patch \
> +  %D%/packages/patches/phantomjs-qt55.patch  \
>%D%/packages/patches/pidgin-add-search-path.patch  \
>%D%/packages/patches/pinball-const-fix.patch   \
>%D%/packages/patches/pinball-cstddef.patch \
> diff --git a/gnu/packages/patches/phantomjs-qt55.patch 
> b/gnu/packages/patches/phantomjs-qt55.patch
> new file mode 100644
> index 000..2a306f0
> --- /dev/null
> +++ b/gnu/packages/patches/phantomjs-qt55.patch
> @@ -0,0 +1,277 @@
> +Taken from Debian phantomjs/debian/patches/
> +
> +Last-Update: 2016-02-15
> +Forwarded: no
> +Author: Dmitry Smirnov 
> +Description: fix FTBFS.
> +
> +--- a/src/phantomjs.pro
>  b/src/phantomjs.pro
> +@@ -8,9 +8,9 @@
> + }
> + 
> + TEMPLATE = app
> + TARGET = phantomjs
> +-QT += network webkitwidgets
> ++QT += network webkitwidgets printsupport
> + CONFIG += console
> + 
> + DESTDIR = ../bin
> + 
> +Last-Update: 2016-02-15
> +Forwarded: no
> +Bug-Upstream: https://github.com/ariya/phantomjs/issues/13727
> +Author: Ximin Luo 
> +Reviewed-By: Dmitry Smirnov 
> +Description: Port to Qt 5.5
> + - Remove second argument to evaluateJavascript(), which was not really used
> +   for anything, anyways
> +
> +--- a/src/utils.cpp
>  b/src/utils.cpp
> +@@ -37,8 +37,9 @@
> + #include 
> + #include 
> + #include 
> + 
> ++
> + static QString findScript(const QString& jsFilePath, const QString& 
> libraryPath)
> + {
> + if (!jsFilePath.isEmpty()) {
> + QFile jsFile;
> +@@ -131,9 +132,9 @@
> + }
> + 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;
> + }
> + 
> + bool loadJSForDebug(const QString& jsFilePath, const QString& libraryPath, 
> QWebFrame* targetFrame, const bool autorun)
> +@@ -146,12 +147,12 @@
> + QString scriptPath = findScript(jsFilePath, libraryPath);
> + 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;
> + }
> +-

[PATCH] gnu: Add phantomjs.

2016-11-22 Thread Jan Nieuwenhuizen
Hi,

I need phantomjs for a client and finally managed to built it from
source.

I tried to build it with our current qt-5.6/qtwebkit-5.7 but gave up;
apparently phantomjs needs patches to even build with qt-5.5.

While I think it's a waste not to share this patch, I don't intend to
spend much effort on these (I have very little respect, patience or love
for qt), please don't put too much effort in reviewing if this needs
much work.

Greetings,
Jan.

>From 25f9e007ee2c7f641e7761d990c61bc142440430 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen 
Date: Thu, 17 Nov 2016 11:39:00 +0100
Subject: [PATCH] gnu: Add phantomjs.

* gnu/packages/patches/phantomjs-qt55.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/qt.scm (qtbase55, qtsvg55, qtxmlpatterns55, qtdeclarative55,
qtwebkit55, phantomjs): New variable.
---
 gnu/local.mk  |   1 +
 gnu/packages/patches/phantomjs-qt55.patch | 277 ++
 gnu/packages/qt.scm   | 256 +++
 3 files changed, 534 insertions(+)
 create mode 100644 gnu/packages/patches/phantomjs-qt55.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index f780b24..96fde14 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -787,6 +787,7 @@ dist_patch_DATA =		\
   %D%/packages/patches/perl-module-pluggable-search.patch	\
   %D%/packages/patches/perl-reproducible-build-date.patch	\
   %D%/packages/patches/perl-www-curl-remove-symbol.patch	\
+  %D%/packages/patches/phantomjs-qt55.patch			\
   %D%/packages/patches/pidgin-add-search-path.patch		\
   %D%/packages/patches/pinball-const-fix.patch			\
   %D%/packages/patches/pinball-cstddef.patch			\
diff --git a/gnu/packages/patches/phantomjs-qt55.patch b/gnu/packages/patches/phantomjs-qt55.patch
new file mode 100644
index 000..2a306f0
--- /dev/null
+++ b/gnu/packages/patches/phantomjs-qt55.patch
@@ -0,0 +1,277 @@
+Taken from Debian phantomjs/debian/patches/
+
+Last-Update: 2016-02-15
+Forwarded: no
+Author: Dmitry Smirnov 
+Description: fix FTBFS.
+
+--- a/src/phantomjs.pro
 b/src/phantomjs.pro
+@@ -8,9 +8,9 @@
+ }
+ 
+ TEMPLATE = app
+ TARGET = phantomjs
+-QT += network webkitwidgets
++QT += network webkitwidgets printsupport
+ CONFIG += console
+ 
+ DESTDIR = ../bin
+ 
+Last-Update: 2016-02-15
+Forwarded: no
+Bug-Upstream: https://github.com/ariya/phantomjs/issues/13727
+Author: Ximin Luo 
+Reviewed-By: Dmitry Smirnov 
+Description: Port to Qt 5.5
+ - Remove second argument to evaluateJavascript(), which was not really used
+   for anything, anyways
+
+--- a/src/utils.cpp
 b/src/utils.cpp
+@@ -37,8 +37,9 @@
+ #include 
+ #include 
+ #include 
+ 
++
+ static QString findScript(const QString& jsFilePath, const QString& libraryPath)
+ {
+ if (!jsFilePath.isEmpty()) {
+ QFile jsFile;
+@@ -131,9 +132,9 @@
+ }
+ 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;
+ }
+ 
+ bool loadJSForDebug(const QString& jsFilePath, const QString& libraryPath, QWebFrame* targetFrame, const bool autorun)
+@@ -146,12 +147,12 @@
+ QString scriptPath = findScript(jsFilePath, libraryPath);
+ 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;
+ }
+--- a/src/repl.cpp
 b/src/repl.cpp
+@@ -146,9 +146,9 @@
+ // Set the static callback to offer Completions to the User
+ 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);
+ 
+@@ -183,10 +183,9 @@
+ // This will return an array of String with the possible completions
+ QStringList completions = REPL::getInstance()->m_webframe->evaluateJavaScript(
+   QString(JS_RETURN_POSSIBLE_COMPLETIONS).arg(
+   toInspect,
+-  toComplete),
+-  QString()
++