diff mbox series

[bug#35866] gnu: Add qtwebengine.

Message ID 20191218203223.22861-1-mike.rosset@gmail.com
State Accepted
Headers show
Series [bug#35866] gnu: Add qtwebengine. | expand

Commit Message

Mike Rosset Dec. 18, 2019, 8:32 p.m. UTC
* gnu/packages/qt.scm (qtwebengine): New variable.

This is a new qtwebengine patch with working locales.

qtwebengine now inherits qtsvg

This also uses substitute-keyword-arguments to only replace configure phase.
---
 gnu/packages/qt.scm | 129 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 129 insertions(+)

Comments

Pierre Neidhardt Dec. 19, 2019, 6:29 p.m. UTC | #1
Looking good!

Comments below:

> qtwebengine now inherits qtsvg
>
> This also uses substitute-keyword-arguments to only replace configure phase.

I think those 2 lines can be omitted or maybe rephrased.  We didn't have
qtwebengine before, so you'd need to explain what's up with qtsvg, why
it was problematic to use it.

> +(define-public qtwebengine
> +  (package (inherit qtsvg)
> +    (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)

Use (version-major+minor ...) or similar.

> +                       "/" version "/submodules/"
> +                       (string-append name "-everywhere-src-" version)
> +                       ".tar.xz"))
> +       (sha256
> +        (base32
> +         "08c60nh95m98mcqk444axs76xi6m9x0wvdxrzk9c2cxwqdbz59fa"))))
> +    (build-system gnu-build-system)
> +    (native-inputs
> +     `(("bison" ,bison)
> +       ("flex" ,flex)
> +       ("gperf" ,gperf)
> +       ("ninja" ,ninja)
> +       ("perl" ,perl)
> +       ("pkg-config" ,pkg-config)
> +       ("python-2" ,python-2)
> +       ("ruby" ,ruby)
> +       ))

Dangling parentheses.

> +    (inputs
> +     `(("alsa-lib" ,alsa-lib)
> +       ("atk" ,atk)
> +       ("cups-minimal" ,cups-minimal)
> +       ("dbus" ,dbus)
> +       ("ffmpeg" ,ffmpeg)
> +       ("fontconfig" ,fontconfig)
> +       ("harbuzz" ,harfbuzz)
> +       ("icu4c" ,icu4c)
> +       ("jsoncpp" ,jsoncpp)
> +       ("lcms" ,lcms)
> +       ("libcap" ,libcap)
> +       ("libevent" ,libevent)
> +       ("libgcrypt" ,libgcrypt)
> +       ("libjpeg" ,libjpeg-turbo)
> +       ;; libsrtp not found by qmake. seems to not have config.tests?
> +       ("libsrtp" ,libsrtp)

What does it entail?  Is libsrtp ignored then?
If there is a problem, please add a "FIXME:" comment or similar.

> +       ;; FIXME: error: ?struct vpx_svc_ref_frame_config? has no member named ?frame_flags?
> +       ;; ("libvpx" ,libvpx)
> +       ("libwebp" ,libwebp)
> +       ("libx11" ,libx11)
> +       ("libxcb" ,libxcb)
> +       ("libxcomposite" ,libxcomposite)
> +       ("libxcursor" ,libxcursor)
> +       ("libxi" ,libxi)
> +       ("libxkbcommon" ,libxkbcommon)
> +       ;; libxml not found due to icu not enabled in libxml?

You mean libxml2?
Is it ignored then?
Same as above, prefix with a FIXME if needed.

> +       ("libxml2" ,libxml2)
> +       ("libxrandr" ,libxrandr)
> +       ("libxrender" ,libxrender)
> +       ("libxslt" ,libxslt)
> +       ("libxtst" ,libxtst)
> +       ("mesa" ,mesa)
> +       ("minizip" ,minizip)
> +       ("nss" ,nss)
> +       ("opus" ,opus)
> +       ("pciutils" ,pciutils)
> +       ("protobuf" ,protobuf)
> +       ;; ("pulseaudio" ,pulseaudio)

Please explain why you left pulseaudio commented out.

> +       ("qtbase" ,qtbase)
> +       ("qtdeclarative" ,qtdeclarative)
> +       ("qtmultimedia" ,qtmultimedia)
> +       ("qtwebchannel" ,qtwebchannel)
> +       ("re2" ,re2)
> +       ("snappy" ,snappy)
> +       ("udev" ,eudev)
> +       ("xcb-util" ,xcb-util)))
> +    (arguments
> +     (substitute-keyword-arguments (package-arguments qtsvg)
> +       ((#:phases phases)
> +        `(modify-phases ,phases
> +           (replace 'configure
> +             (lambda* (#:key inputs outputs #:allow-other-keys)
> +               ;; Avoids potential race conditions
> +               (setenv "PYTHONDONTWRITEBYTECODE" "1")
> +               ;; Make build output less verbose
> +               (setenv "NINJAFLAGS" "-k1")
> +               ;; Use this output translations not qtbase

This comment is not very clear, maybe it could be rephrased, e.g.

"Replace the qtbase translations with those from qtwebengine.

> +               (substitute* "src/core/web_engine_library_info.cpp"
> +                 (("QLibraryInfo::location\\(QLibraryInfo::TranslationsPath\\)")
> +                  (format #f "QLatin1String(\"~a\")" (string-append (assoc-ref outputs "out") "/share/qt5/translations")))
> +                 (("QLibraryInfo::location\\(QLibraryInfo::DataPath\\)")
> +                  (format #f "QLatin1String(\"~a\")" (string-append (assoc-ref outputs "out") "/share/qt5"))))
> +               ;; Substitute full dynamic path for nss
> +               (substitute* "src/3rdparty/chromium/crypto/nss_util.cc"
> +                 (("libnssckbi.so")
> +                  (string-append (assoc-ref inputs "nss") "/lib/nss/libnssckbi.so")))
> +               ;; Substitute full dynamic path for udev
> +               (substitute* "src/3rdparty/chromium/device/udev_linux/udev1_loader.cc"
> +                 (("libudev.so.1")
> +                  (string-append (assoc-ref inputs "udev") "/lib/libudev.so.1")))
> +               ;; Valid QT_BUILD_PARTS variables are:
> +               ;; libs tools tests examples demos docs translations
> +               (invoke "qmake" "QT_BUILD_PARTS = libs tools" "--"
> +                       "--webengine-printing-and-pdf=no"
> +                       "--webengine-ffmpeg=system"
> +                       "--webengine-icu=system"
> +                       "--webengine-pepper-plugins=no")))))
> +       ((#:tests? _ #f) #f)))

No tests?

> +    (native-search-paths
> +     (list (search-path-specification
> +            (file-type 'regular)
> +            (separator #f)
> +            (variable "QTWEBENGINEPROCESS_PATH")
> +            (files '("lib/qt5/libexec/QtWebEngineProcess")))))
> +    (home-page "https://www.qt.io")
> +    (synopsis "Qt WebEngine Module")

Probably no capital for "module."

Great work, thanks again!
Ricardo Wurmus Dec. 19, 2019, 8:19 p.m. UTC | #2
Hi Mike,

> * gnu/packages/qt.scm (qtwebengine): New variable.
>
> This is a new qtwebengine patch with working locales.

Thank you very much for working on this!  This doesn’t look like an easy
package.

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

Does this include the unmodified Chromium source code?  We need to
ensure that the variant we are distributing here does not contain any
misfeatures that Chromium is known for (e.g. DRM support) and that only
free software is included.

Marius and others previously worked very hard on making sure that the
ungoogled-chromium package complied with our expectations for Chromium.
I wonder what work needs to be done on the sources included in this
package to accomplish the same goal.

Did you happen to investigate this?

--
Ricardo
Mike Rosset Dec. 20, 2019, 12:02 a.m. UTC | #3
Ricardo Wurmus <rekado@elephly.net> writes:

>> +    (description "Qt5WebEngine provides support for web
>> +applications using the Chromium browser project.")
>
> Does this include the unmodified Chromium source code?  We need to
> ensure that the variant we are distributing here does not contain any
> misfeatures that Chromium is known for (e.g. DRM support) and that only
> free software is included.

The chromium source is modified to remove google services etc. quoting
from https://wiki.qt.io/QtWebEngine.

- Binary files are stripped out
- Auxiliary services that talk to Google platforms are stripped out
- The codebase is modularized to allow use of system libraries like OpenSSL

There is also a rebase patch process to allow upgrading to the current
chromium.

> Marius and others previously worked very hard on making sure that the
> ungoogled-chromium package complied with our expectations for Chromium.
> I wonder what work needs to be done on the sources included in this
> package to accomplish the same goal.
>
> Did you happen to investigate this?

It was proposed that maybe the ungoogled-chrome sources/changes could be
used. But to me it seems to Qt is already doing the right thing
here. I'm just not confident with the size of this code base, and with
the QT specific front end. the ungoogled sources could be dropped in and
expected to work.
diff mbox series

Patch

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index c0d652a407..12028fd64c 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -52,30 +52,40 @@ 
   #:use-module (gnu packages flex)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gcc)
+  #:use-module (gnu packages ghostscript)
   #: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)
   #:use-module (gnu packages icu4c)
   #:use-module (gnu packages image)
+  #:use-module (gnu packages libevent)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages llvm)
   #: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)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages pulseaudio)
+  #:use-module (gnu packages protobuf)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages regex)
   #:use-module (gnu packages ruby)
   #:use-module (gnu packages sdl)
+  #:use-module (gnu packages serialization)
   #:use-module (gnu packages sqlite)
+  #:use-module (gnu packages telephony)
   #:use-module (gnu packages tls)
+  #:use-module (gnu packages video)
   #:use-module (gnu packages vulkan)
   #:use-module (gnu packages xdisorg)
+  #:use-module (gnu packages xiph)
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages xml)
   #:use-module (srfi srfi-1))
@@ -2020,6 +2030,125 @@  time Web content can be enhanced with native controls.")
 
     (license license:lgpl2.1+)))
 
+(define-public qtwebengine
+  (package (inherit qtsvg)
+    (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
+         "08c60nh95m98mcqk444axs76xi6m9x0wvdxrzk9c2cxwqdbz59fa"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("bison" ,bison)
+       ("flex" ,flex)
+       ("gperf" ,gperf)
+       ("ninja" ,ninja)
+       ("perl" ,perl)
+       ("pkg-config" ,pkg-config)
+       ("python-2" ,python-2)
+       ("ruby" ,ruby)
+       ))
+    (inputs
+     `(("alsa-lib" ,alsa-lib)
+       ("atk" ,atk)
+       ("cups-minimal" ,cups-minimal)
+       ("dbus" ,dbus)
+       ("ffmpeg" ,ffmpeg)
+       ("fontconfig" ,fontconfig)
+       ("harbuzz" ,harfbuzz)
+       ("icu4c" ,icu4c)
+       ("jsoncpp" ,jsoncpp)
+       ("lcms" ,lcms)
+       ("libcap" ,libcap)
+       ("libevent" ,libevent)
+       ("libgcrypt" ,libgcrypt)
+       ("libjpeg" ,libjpeg-turbo)
+       ;; libsrtp not found by qmake. seems to not have config.tests?
+       ("libsrtp" ,libsrtp)
+       ;; FIXME: error: ?struct vpx_svc_ref_frame_config? has no member named ?frame_flags?
+       ;; ("libvpx" ,libvpx)
+       ("libwebp" ,libwebp)
+       ("libx11" ,libx11)
+       ("libxcb" ,libxcb)
+       ("libxcomposite" ,libxcomposite)
+       ("libxcursor" ,libxcursor)
+       ("libxi" ,libxi)
+       ("libxkbcommon" ,libxkbcommon)
+       ;; libxml not found due to icu not enabled in libxml?
+       ("libxml2" ,libxml2)
+       ("libxrandr" ,libxrandr)
+       ("libxrender" ,libxrender)
+       ("libxslt" ,libxslt)
+       ("libxtst" ,libxtst)
+       ("mesa" ,mesa)
+       ("minizip" ,minizip)
+       ("nss" ,nss)
+       ("opus" ,opus)
+       ("pciutils" ,pciutils)
+       ("protobuf" ,protobuf)
+       ;; ("pulseaudio" ,pulseaudio)
+       ("qtbase" ,qtbase)
+       ("qtdeclarative" ,qtdeclarative)
+       ("qtmultimedia" ,qtmultimedia)
+       ("qtwebchannel" ,qtwebchannel)
+       ("re2" ,re2)
+       ("snappy" ,snappy)
+       ("udev" ,eudev)
+       ("xcb-util" ,xcb-util)))
+    (arguments
+     (substitute-keyword-arguments (package-arguments qtsvg)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (replace 'configure
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               ;; Avoids potential race conditions
+               (setenv "PYTHONDONTWRITEBYTECODE" "1")
+               ;; Make build output less verbose
+               (setenv "NINJAFLAGS" "-k1")
+               ;; Use this output translations not qtbase
+               (substitute* "src/core/web_engine_library_info.cpp"
+                 (("QLibraryInfo::location\\(QLibraryInfo::TranslationsPath\\)")
+                  (format #f "QLatin1String(\"~a\")" (string-append (assoc-ref outputs "out") "/share/qt5/translations")))
+                 (("QLibraryInfo::location\\(QLibraryInfo::DataPath\\)")
+                  (format #f "QLatin1String(\"~a\")" (string-append (assoc-ref outputs "out") "/share/qt5"))))
+               ;; Substitute full dynamic path for nss
+               (substitute* "src/3rdparty/chromium/crypto/nss_util.cc"
+                 (("libnssckbi.so")
+                  (string-append (assoc-ref inputs "nss") "/lib/nss/libnssckbi.so")))
+               ;; Substitute full dynamic path for udev
+               (substitute* "src/3rdparty/chromium/device/udev_linux/udev1_loader.cc"
+                 (("libudev.so.1")
+                  (string-append (assoc-ref inputs "udev") "/lib/libudev.so.1")))
+               ;; Valid QT_BUILD_PARTS variables are:
+               ;; libs tools tests examples demos docs translations
+               (invoke "qmake" "QT_BUILD_PARTS = libs tools" "--"
+                       "--webengine-printing-and-pdf=no"
+                       "--webengine-ffmpeg=system"
+                       "--webengine-icu=system"
+                       "--webengine-pepper-plugins=no")))))
+       ((#:tests? _ #f) #f)))
+    (native-search-paths
+     (list (search-path-specification
+            (file-type 'regular)
+            (separator #f)
+            (variable "QTWEBENGINEPROCESS_PATH")
+            (files '("lib/qt5/libexec/QtWebEngineProcess")))))
+    (home-page "https://www.qt.io")
+    (synopsis "Qt WebEngine Module")
+    (description "Qt5WebEngine provides support for web
+applications using the Chromium browser project.")
+    (license
+     (package-license qt))))
+
 (define-public dotherside
   (package
     (name "dotherside")