guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] gnu: Add qtwebkit.


From: Thomas Danckaert
Subject: [PATCH] gnu: Add qtwebkit.
Date: Fri, 28 Oct 2016 11:26:01 +0200 (CEST)

Hi,

this patch adds QtWebKit 5.7 as a separate package (hopefully this will reduce 
security concerns: only packages which really need QtWebKit will include it).

QtWebKit is not officially supported anymore as of Qt 5.6, so this is a 
“community release” (not exactly sure what that entails, or if this includes 
any updates at all since the Qt 5.5 version).  I suppose many projects are 
switching to Qt WebEngine, and there are some efforts to create an updated 
version of QtWebKit (https://github.com/annulen/webkit), but in the mean time, 
this package might help build packages which still rely on the old QtWebKit.

By default, the qmake build system for qtwebkit insists on installing into the 
same prefix as qtbase, and it seems no command line parameters will change 
that. The solution I came up with, was to substitute all the necessary paths in 
the generated Makefiles. This makes the patch a bit lengthy.

I've also attached a minimal example.

Thomas
From ef2830cfc9342a88ce473f6a9bc55fee68991b74 Mon Sep 17 00:00:00 2001
From: Thomas Danckaert <address@hidden>
Date: Wed, 26 Oct 2016 11:11:01 +0200
Subject: [PATCH] gnu: Add qtwebkit.

* gnu/packages/qt.scm (qtwebkit): New variable.
---
 gnu/packages/qt.scm | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 113 insertions(+)

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index a1e5fde..8e710ab 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2015 Ludovic Courtès <address@hidden>
 ;;; Copyright © 2015, 2016 Efraim Flashner <address@hidden>
 ;;; Copyright © 2016 ng0 <address@hidden>
+;;; Copyright © 2016 Thomas Danckaert <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1112,3 +1113,115 @@ contain over 620 classes.")
       "QtKeychain is a Qt library to store passwords and other secret data
 securely.  It will not store any data unencrypted unless explicitly 
requested.")
     (license license:bsd-3)))
+
+(define-public qtwebkit
+  (package
+    (name "qtwebkit")
+    (version "5.7.0")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append "http://download.qt.io/community_releases/";
+                            (version-major+minor version)
+                            "/" version "/qtwebkit-opensource-src-" version
+                            ".tar.xz"))
+        (sha256
+         (base32
+          "1prlpl3zslzpr1iv7m3irvxjxn3v8nlxh21v9k2kaq4fpwy2b8y7"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("perl" ,perl)
+       ("python" ,python-2.7)
+       ("ruby" ,ruby)
+       ("bison" ,bison)
+       ("flex" ,flex)
+       ("gperf" ,gperf)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("icu" ,icu4c)
+       ("libjpeg" ,libjpeg)
+       ("libpng" ,libpng)
+       ("libwebp" ,libwebp)
+       ("sqlite" ,sqlite)
+       ("fontconfig" ,fontconfig)
+       ("libxrender", libxrender)
+       ("qtbase" ,qtbase)
+       ("qtdeclarative" ,qtdeclarative)
+       ("qtmultimedia" ,qtmultimedia)
+       ("libxml2" ,libxml2)
+       ("libxslt" ,libxslt)
+       ("libx11" ,libx11)
+       ("libxcomposite" ,libxcomposite)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'configure
+                  (lambda* (#:key outputs #:allow-other-keys)
+                    (let ((out (assoc-ref outputs "out")))
+                      (setenv "QMAKEPATH"
+                              (string-append (getcwd) "/Tools/qmake:"
+                                             (getenv "QMAKEPATH")))
+                      (system* "qmake"))))
+         ;; prevent webkit from trying to install into the qtbase store 
directory,
+         ;; and replace references to the build directory in linker options:
+         (add-before 'build 'patch-installpaths
+                     (lambda* (#:key outputs inputs #:allow-other-keys)
+                       (let* ((out (assoc-ref outputs "out"))
+                              (qtbase (assoc-ref inputs "qtbase"))
+                              (builddir (getcwd))
+                              (linkbuild (string-append "-L" builddir))
+                              (linkout (string-append "-L" out))
+                              (makefiles
+                               (map-in-order
+                                (lambda (i)
+                                  (let* ((in (car i))
+                                         (mf (string-append (dirname in) "/"
+                                                            (cdr i))))
+                                    ;; by default, these Makefiles are
+                                    ;; generated during install, but we need
+                                    ;; to generate them now
+                                    (system* "qmake" in "-o" mf)
+                                    mf))
+                                '(("Source/api.pri" . "Makefile.api")
+                                  ("Source/widgetsapi.pri"
+                                   . "Makefile.widgetsapi")
+                                  ("Source/WebKit2/WebProcess.pro"
+                                   . "Makefile.WebProcess")
+                                  ("Source/WebKit2/PluginProcess.pro"
+                                   . "Makefile.PluginProcess")
+                                  ("Source/WebKit/qt/declarative/public.pri"
+                                   . "Makefile.declarative.public")
+                                  
("Source/WebKit/qt/declarative/experimental/experimental.pri"
+                                   . "Makefile.declarative.experimental")
+                                  
("Source/WebKit/qt/examples/platformplugin/platformplugin.pro"
+                                   . "Makefile")))))
+                         ;; Order of qmake calls and substitutions matters 
here.
+                         (system* "qmake" "-prl" "Source/widgetsapi.pri"
+                                  "-o" "Source/Makefile")
+                         (substitute* (find-files "lib" "libQt5.*\\.prl")
+                           ((linkbuild) linkout))
+                         (substitute* (find-files "lib"
+                                                  "libQt5WebKit.*\\.la")
+                           (("libdir='.*'")
+                            (string-append "libdir='" out "/lib'"))
+                           ((linkbuild) linkout))
+                         (substitute* (find-files "lib/pkgconfig"
+                                                  "Qt5WebKit.*\\.pc")
+                           (((string-append "prefix=" qtbase))
+                            (string-append "prefix=" out))
+                           ((linkbuild) linkout))
+                         ;; Makefiles must be modified after .prl/.la/.pc
+                         ;; files, lest they get rebuilt:
+                         (substitute* makefiles
+                           (((string-append "\\$\\(INSTALL_ROOT\\)" qtbase))
+                            out )
+                           (((string-append "-Wl,-rpath," builddir))
+                            (string-append "-Wl,-rpath," out)))))))))
+    (home-page "https://www.webkit.org";)
+    (synopsis "Web browser engine and classes to render and interact with web
+content")
+    (description "QtWebKit provides a Web browser engine that makes it easy to
+embed content from the World Wide Web into your Qt application.  At the same
+time Web content can be enhanced with native controls.")
+
+    (license license:lgpl2.1+)))
-- 
2.7.4

QT += widgets
QT += webkit
QT += webkitwidgets
SOURCES = example.cpp
#include <QWebView>
#include <QApplication>

int main(int argc, char** argv) {
   QApplication app(argc, argv);
   QWebView view;
   view.show();
   view.setUrl(QUrl("https://www.gnu.org/software/guix";));
   return app.exec();
}

reply via email to

[Prev in Thread] Current Thread [Next in Thread]