diff mbox series

[bug#35866] gnu: Add qtwebengine.

Message ID 20190523062344.20601-1-mrosset@bufio.org
State Accepted
Headers show
Series [bug#35866] gnu: Add qtwebengine. | expand

Checks

Context Check Description
cbaines/applying patch success Successfully applied

Commit Message

Mike Rosset May 23, 2019, 6:23 a.m. UTC
From: mike rosset <mike.rosset@gmail.com>

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

Comments

Ludovic Courtès May 27, 2019, 9:05 p.m. UTC | #1
Hello Mike,

mike rosset <mrosset@bufio.org> skribis:

> From: mike rosset <mike.rosset@gmail.com>
>
> * gnu/packages/qt.scm (qtwebengine): New variable.

<https://github.com/mrosset/nomad/> looks pretty exciting, which
motivates me to take a look at this patch.  :-)

> +    (synopsis "Qt5WebEngine")
> +    (description "Qt5WebEngine provides support for web
> +applications using the Chromium browser project.")

As you may know, Guix contains a variant of ‘ungoogled-chromium’, which
goes to great lengths to remove non-free software, DRM support, spyware, etc.

The problem is that QtWebEngine bundles Chromium.  We would need to
“unbundle” it and/or replace it with ‘ungoogled-chromium’.  I’m not sure
how hard that is.

Have you thought about this?  Would you like to give it a try?

Thanks,
Ludo’.
Mike Rosset May 28, 2019, 5:48 p.m. UTC | #2
Ludovic Courtès <ludo@gnu.org> writes:


Hello Ludovic, thank you for looking at this.

>
> <https://github.com/mrosset/nomad/> looks pretty exciting, which
> motivates me to take a look at this patch.  :-)

This is my motivation for having this included with guix. the main URL
is https://savannah.nongnu.org/projects/nomad/ and the main source is
http://git.savannah.nongnu.org/cgit/nomad.git?h=feature-qt. Development
is currently being done on the feature-qt branch.

Nomad is still very much WIP. And some early documentation can be found
here. http://git.savannah.nongnu.org/cgit/nomad.git/tree/org/README.txt?h=feature-qt.

In short Nomad is an extensible web browser that uses GNU guile as it's
extension language. And is heavily modeled after Emacs.


>> +    (synopsis "Qt5WebEngine")
>> +    (description "Qt5WebEngine provides support for web
>> +applications using the Chromium browser project.")
>
> As you may know, Guix contains a variant of ‘ungoogled-chromium’, which
> goes to great lengths to remove non-free software, DRM support, spyware, etc.
>
> The problem is that QtWebEngine bundles Chromium.  We would need to
> “unbundle” it and/or replace it with ‘ungoogled-chromium’.  I’m not sure
> how hard that is.

I have done some research as to how best to handle the chromium sources
that are distributed with qtwebengine. From my understanding so far. QT
has similar goals as ungoogle-chromium. Based off of the information
found here https://wiki.qt.io/QtWebEngine. Binaries are stripped from
source tree. Services that talk to Google are removed. And the code is
refactored to use system libraries like OpenSSL.

There is a more in depth break down on the chromium rebase process found
here. https://wiki.qt.io/QtWebEngine/Rebase_on_New_Chromium .

It seems to me that QT is already doing the right thing
here. Unfortunately I don't think it will be easy to reuse the
ungoogle-chrome code base. It would probably require manually re-basing
then applying qt patches. Also there is no clear benefit for it. Since
updating ungoogle-chromium would not directly benefit qtwebengine. In
short QT seems to already be doing the necessary work.

I can though now, do my best to ensure that the least amount of 3rd
party libraries are used. I'll update my patch as soon as possible. And
I will explore the chromium source issue more in the process.

Regards,

Mike Rosset
Mike Rosset May 29, 2019, 11:37 p.m. UTC | #3
This patch ensures qtwebengine uses only Guix libraries. There are some
libraries that fail to be detect or are missing features. I have documented
them within the input expression.

Note. I'm not sure if I've sent this patch right. If this is wrong I can resend
the complete series
Ludovic Courtès June 1, 2019, 9:46 a.m. UTC | #4
Hello,

mrosset@bufio.org skribis:

> It seems to me that QT is already doing the right thing
> here. Unfortunately I don't think it will be easy to reuse the
> ungoogle-chrome code base. It would probably require manually re-basing
> then applying qt patches. Also there is no clear benefit for it. Since
> updating ungoogle-chromium would not directly benefit qtwebengine. In
> short QT seems to already be doing the necessary work.

I think this would require a careful analysis like the one Marius Bakke
carried out when packaging ‘ungoogled-chromium’.

It would be both nicer and easier if QtWebEngine could be tweaked to use
our own ‘ungoogled-chromium’ directly instead of rebuilding one, but
yeah, that sounds tricky.

> I can though now, do my best to ensure that the least amount of 3rd
> party libraries are used. I'll update my patch as soon as possible. And
> I will explore the chromium source issue more in the process.

OK.

Thank you!

Ludo’.
Ricardo Wurmus July 18, 2019, 9:26 a.m. UTC | #5
Hi Mike,

I’m curious about the current state of this patch.  Have you been able
to take a look at whether we could use our ungoogled-chromium package
here?

I’m working on getting the latest R Studio into Guix (upgrading and
moving it from the guix-bimsb channel) and since all versions since 1.2
depend on qtwebengine I have some motivation to see this patch make it
into Guix at some point :)

--
Ricardo
Brendan Tildesley July 24, 2019, 2:06 p.m. UTC | #6
I was able to apply this patch and succeeded in building qtwebengine. I
then tried to add  it as a dependency to python-pyqt and build it, but I
get this error:

sip/QtPrintSupport/qprinter.sip:28:22: fatal error: qprinter.h: No such
file or directory


It sounds like some simple search path error. Anyone know how that can
be fixed?
Pierre Neidhardt Oct. 6, 2019, 3:45 p.m. UTC | #7
+1! :)

As far as I can tell, in its current state the package will trigger the
following error when we try to make a webengine view:

--8<---------------cut here---------------start------------->8---
	15:50:10 INFO: Run :adblock-update to get adblock lists.
	15:50:10 CRITICAL: Could not find QtWebEngineProcess
--8<---------------cut here---------------end--------------->8---

Maybe something like this would help?

--8<---------------cut here---------------start------------->8---
    (native-search-paths
     (list (search-path-specification
            (variable "QTWEBENGINEPROCESS_PATH")
            (files '("lib/qt5/libexec/QtWebEngineProcess")))))
--8<---------------cut here---------------end--------------->8---
Mike Rosset Oct. 7, 2019, 3:49 p.m. UTC | #8
Pierre Neidhardt <mail@ambrevar.xyz> writes:

> Maybe something like this would help?
>
>     (native-search-paths
>      (list (search-path-specification
>             (variable "QTWEBENGINEPROCESS_PATH")
>             (files '("lib/qt5/libexec/QtWebEngineProcess")))))

Right I think this is what I was going to propose for
https://gitlab.com/nonguix/nonguix/blob/master/nongnu/packages/qt.scm#L58. Though
you can temporarily get around this with this ugly hack.

export QTWEBENGINEPROCESS_PATH="$(guix build qtwebengine)/lib/qt5/libexec/QtWebEngineProcess"

I'll add the native-search-path to the nonguix package ASAP.

Note. Once you get past this issues. You will then have problems with
locales. Since the module QT packages assumes you are installing to the
same prefix as qtbase. Which is not feasible with how guix packages
things. For my experimental QT nomad I had some hacks to get around
this, which are not feasible or ideal when creating a package that is a
library and uses qtwebengine. I'm still not sure how to best resolve
this issue. Maybe creating a package that is a union of qtbase and
qtwebengine might help.

Regards,

Mike
Hartmut Goebel Dec. 16, 2019, 3:29 p.m. UTC | #9
Hi,

has anybody tried this patch(es) recently? Some "search-path" issues
have been fixed recently, so maybe some issues are gone now.

I also wonder whether this could be based on qtsvg, too. I can not spot
any differences in the build-system arguments compared to qtsvg.
Mike Rosset Dec. 16, 2019, 4:02 p.m. UTC | #10
Hartmut Goebel <h.goebel@crazy-compilers.com> writes:

> Hi,
>
> has anybody tried this patch(es) recently? Some "search-path" issues
> have been fixed recently, so maybe some issues are gone now.
>
> I also wonder whether this could be based on qtsvg, too. I can not spot
> any differences in the build-system arguments compared to qtsvg.

If I recall correctly I tried inheriting from qtsvg but there was
significant divergence to warrant a custom qt.conf for the locale
hacks.

Why don't I resubmit this patch? I believe I have a more up to date local
version. And based on our other threads a module qtwebengine is more
ideal for guix then the monolithic ones. At least this way I can put a
test case together that demonstrates the locale issues.

Mike
Pierre Neidhardt Dec. 16, 2019, 6:01 p.m. UTC | #11
Please do!

I'll try to test it this week.  Just for fun, to see how long it takes
to build :)
Mike Rosset Jan. 24, 2020, 12:16 a.m. UTC | #12
merged
diff mbox series

Patch

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index afc4d8dc06..d00cc2692a 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -48,6 +48,7 @@ 
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
+  #:use-module (gnu packages gnupg)
   #:use-module (gnu packages gperf)
   #:use-module (gnu packages gstreamer)
   #:use-module (gnu packages gtk)
@@ -55,6 +56,7 @@ 
   #:use-module (gnu packages image)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages maths)
+  #:use-module (gnu packages ninja)
   #:use-module (gnu packages nss)
   #:use-module (gnu packages pciutils)
   #:use-module (gnu packages pcre)
@@ -63,6 +65,7 @@ 
   #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages re2c)
   #:use-module (gnu packages ruby)
   #:use-module (gnu packages sdl)
   #:use-module (gnu packages sqlite)
@@ -2274,3 +2277,133 @@  user-friendly than the default @code{QColorDialog} and several other
 color-related widgets.")
       ;; Includes a license exception for combining with GPL2 code.
       (license license:lgpl3+))))
+
+(define-public qtwebengine
+  (package
+    (name "qtwebengine")
+    (version (package-version qtbase))
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://download.qt.io/official_releases/qt/"
+                       (substring version 0 4)
+                       "/" version "/submodules/"
+                       (string-append name "-everywhere-src-" version)
+                       ".tar.xz"))
+       (sha256
+        (base32
+         "1zmqsdais85cdfh2jh8h4a5jcamp1mzdk3vgqm6xnldqf6nrxd2v"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(
+       ("perl" ,perl)
+       ("python-2" ,python-2)
+       ("pkg-config" ,pkg-config)
+       ("flex" ,flex)
+       ("bison" ,bison)
+       ("ruby" ,ruby)
+       ("ninja" ,ninja)
+       ))
+    (inputs
+     `(
+       ("qtbase" ,qtbase)
+       ("qtdeclarative" ,qtdeclarative)
+       ("libxcb" ,libxcb)
+       ("xcb-util" ,xcb-util)
+       ("libxkbcommon" ,libxkbcommon)
+       ("libx11" ,libx11)
+       ("libxrender" ,libxrender)
+       ("libxi" ,libxi)
+       ;; OpenGL
+       ("mesa" ,mesa)
+       ;; qt web engine
+       ("libgcrypt" ,libgcrypt)
+       ("pciutils" ,pciutils)
+       ("nss" ,nss)
+       ("libxtst" ,libxtst)
+       ("gperf" ,gperf)
+       ("cups-minimal" ,cups-minimal)
+       ("pulseaudio" ,pulseaudio)
+       ("udev" ,eudev)
+       ;; systemd-devel? no systemd on guix
+       ("libcap" ,libcap)
+       ("alsa-lib" ,alsa-lib)
+       ("dbus" ,dbus)
+       ("libxrandr" ,libxrandr)
+       ("libxcomposite" ,libxcomposite)
+       ("libxcursor" ,libxcursor)
+       ("fontconfig" ,fontconfig)
+       ("qtwebchannel" ,qtwebchannel)
+       ("atk" ,atk)
+       ("qtmultimedia" ,qtmultimedia)
+       ("re2c" ,re2c)
+       ))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'configure-qmake
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (qtbase (assoc-ref inputs "qtbase"))
+                    (tmpdir (string-append (getenv "TMPDIR")))
+                    (qmake (string-append tmpdir "/qmake"))
+                    (qt.conf (string-append tmpdir "/qt.conf")))
+               ;; Use qmake with a customized qt.conf to override install
+               ;; paths to $out.
+               (symlink (which "qmake") qmake)
+               (setenv "CC" "gcc")
+               (setenv "PATH" (string-append tmpdir ":" (getenv "PATH")))
+               (with-output-to-file qt.conf
+                 (lambda ()
+                   (format #t "[Paths]
+Prefix=~a
+ArchData=lib/qt5
+Data=share/qt5
+Documentation=share/doc/qt5
+Headers=include/qt5
+Libraries=lib
+LibraryExecutables=lib/qt5/libexec
+Binaries=bin
+Tests=tests
+Plugins=lib/qt5/plugins
+Imports=lib/qt5/imports
+Qml2Imports=lib/qt5/qml
+Translations=share/qt5/translations
+Settings=etc/xdg
+Examples=share/doc/qt5/examples
+HostPrefix=~a
+HostData=lib/qt5
+HostBinaries=bin
+HostLibraries=lib
+
+[EffectiveSourcePaths]
+HostPrefix=~a
+HostData=lib/qt5
+" out out qtbase)))
+               #t)))
+         (replace 'configure
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             ;; Valid QT_BUILD_PARTS variables are:
+             ;; libs tools tests examples demos docs translations
+             (invoke "qmake" "QT_BUILD_PARTS = libs tools")))
+         (add-before 'check 'set-display
+           (lambda _
+             ;; make Qt render "offscreen", required for tests
+             (setenv "QT_QPA_PLATFORM" "offscreen")
+             #t))
+         (add-after 'install-binaries 'install-qt.conf
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (tmpdir (string-append (getenv "TMPDIR")))
+                    (in.conf (string-append tmpdir "/qt.conf"))
+                    (out.conf (string-append out "/lib/qt5/libexec/qt.conf")))
+               (copy-file in.conf out.conf))
+             #t))
+         )))
+    (home-page "https://www.qt.io")
+    (synopsis "Qt5WebEngine")
+    (description "Qt5WebEngine provides support for web
+applications using the Chromium browser project.")
+    (license
+     (package-license qt))))