mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 05:48:07 -05:00
gnu: qtwebengine: Purge unnecessary bundled software from the source.
* gnu/packages/qt.scm (qtwebengine)[source](modules, snippet): New fields. [inputs]: Add CURL and VALGRIND.
This commit is contained in:
parent
db481636a5
commit
2c7511fb66
1 changed files with 188 additions and 10 deletions
|
@ -11,7 +11,7 @@
|
|||
;;; Copyright © 2018 Nicolas Goaziou <mail@nicolasgoaziou.fr>
|
||||
;;; Copyright © 2018 Hartmut Goebel <h.goebel@crazy-compilers.com>
|
||||
;;; Copyright © 2018 Eric Bavier <bavier@member.fsf.org>
|
||||
;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com>
|
||||
;;; Copyright © 2019, 2020 Marius Bakke <mbakke@fastmail.com>
|
||||
;;; Copyright © 2018 John Soo <jsoo1@asu.edu>
|
||||
;;; Copyright © 2020 Mike Rosset <mike.rosset@gmail.com>
|
||||
;;;
|
||||
|
@ -47,6 +47,7 @@ (define-module (gnu packages qt)
|
|||
#:use-module (gnu packages cmake)
|
||||
#:use-module (gnu packages compression)
|
||||
#:use-module (gnu packages cups)
|
||||
#:use-module (gnu packages curl)
|
||||
#:use-module (gnu packages databases)
|
||||
#:use-module (gnu packages documentation)
|
||||
#:use-module (gnu packages fontutils)
|
||||
|
@ -83,6 +84,7 @@ (define-module (gnu packages qt)
|
|||
#:use-module (gnu packages sqlite)
|
||||
#:use-module (gnu packages telephony)
|
||||
#:use-module (gnu packages tls)
|
||||
#:use-module (gnu packages valgrind)
|
||||
#:use-module (gnu packages video)
|
||||
#:use-module (gnu packages vulkan)
|
||||
#:use-module (gnu packages xdisorg)
|
||||
|
@ -1513,6 +1515,7 @@ (define-public qtspeech
|
|||
(sha256
|
||||
(base32
|
||||
"12l7rycjfa6d9gnnjd6i097pf1qqzjnz9c1jgxhpldvkf0n7pbi7"))))
|
||||
|
||||
(arguments
|
||||
(substitute-keyword-arguments (package-arguments qtsvg)
|
||||
((#:tests? _ #f) #f))) ; TODO: Enable the tests
|
||||
|
@ -1537,15 +1540,188 @@ (define-public qtwebengine
|
|||
(inherit qtsvg)
|
||||
(name "qtwebengine")
|
||||
(version (package-version qtbase))
|
||||
(source (origin
|
||||
(method url-fetch)
|
||||
(uri (string-append "https://download.qt.io/official_releases/qt/"
|
||||
(version-major+minor version) "/" version
|
||||
"/submodules/" name "-everywhere-src-"
|
||||
version ".tar.xz"))
|
||||
(sha256
|
||||
(base32
|
||||
"08c60nh95m98mcqk444axs76xi6m9x0wvdxrzk9c2cxwqdbz59fa"))))
|
||||
(source
|
||||
(origin
|
||||
(method url-fetch)
|
||||
(uri (string-append "https://download.qt.io/official_releases/qt/"
|
||||
(version-major+minor version) "/" version
|
||||
"/submodules/" name "-everywhere-src-"
|
||||
version ".tar.xz"))
|
||||
(sha256
|
||||
(base32 "08c60nh95m98mcqk444axs76xi6m9x0wvdxrzk9c2cxwqdbz59fa"))
|
||||
(modules '((ice-9 ftw)
|
||||
(ice-9 match)
|
||||
(srfi srfi-1)
|
||||
(srfi srfi-26)
|
||||
(guix build utils)))
|
||||
(snippet
|
||||
'(begin
|
||||
(let ((preserved-third-party-files
|
||||
'("base/third_party/dmg_fp"
|
||||
"base/third_party/dynamic_annotations"
|
||||
"base/third_party/icu"
|
||||
"base/third_party/libevent"
|
||||
"base/third_party/nspr"
|
||||
"base/third_party/superfasthash"
|
||||
"base/third_party/symbolize"
|
||||
"base/third_party/xdg_mime"
|
||||
"base/third_party/xdg_user_dirs"
|
||||
"net/third_party/http2"
|
||||
"net/third_party/mozilla_security_manager"
|
||||
"net/third_party/nss"
|
||||
"net/third_party/spdy"
|
||||
"net/third_party/quic"
|
||||
"third_party/abseil-cpp"
|
||||
"third_party/angle"
|
||||
"third_party/angle/src/common/third_party/base"
|
||||
"third_party/angle/src/common/third_party/smhasher"
|
||||
"third_party/angle/src/third_party/compiler"
|
||||
"third_party/blink"
|
||||
"third_party/boringssl"
|
||||
"third_party/boringssl/src/third_party/fiat"
|
||||
"third_party/breakpad"
|
||||
"third_party/brotli"
|
||||
"third_party/ced"
|
||||
"third_party/crc32c"
|
||||
"third_party/ffmpeg"
|
||||
"third_party/googletest"
|
||||
"third_party/hunspell"
|
||||
"third_party/iccjpeg"
|
||||
"third_party/icu"
|
||||
"third_party/inspector_protocol"
|
||||
"third_party/jinja2"
|
||||
"third_party/jstemplate"
|
||||
"third_party/khronos"
|
||||
"third_party/leveldatabase"
|
||||
"third_party/libaddressinput"
|
||||
"third_party/libjingle_xmpp"
|
||||
"third_party/libpng"
|
||||
"third_party/libsrtp"
|
||||
"third_party/libsync"
|
||||
"third_party/libudev"
|
||||
"third_party/libvpx"
|
||||
"third_party/libwebm"
|
||||
"third_party/libwebp"
|
||||
"third_party/libxml"
|
||||
"third_party/libxslt"
|
||||
"third_party/libyuv"
|
||||
"third_party/lss"
|
||||
"third_party/markupsafe"
|
||||
"third_party/mesa"
|
||||
"third_party/metrics_proto"
|
||||
"third_party/modp_b64"
|
||||
"third_party/opus"
|
||||
"third_party/ots"
|
||||
"third_party/ply"
|
||||
"third_party/polymer"
|
||||
"third_party/protobuf"
|
||||
"third_party/pyjson5"
|
||||
"third_party/re2"
|
||||
"third_party/rnnoise"
|
||||
"third_party/skia"
|
||||
"third_party/skia/third_party/gif"
|
||||
"third_party/skia/third_party/skcms"
|
||||
"third_party/smhasher"
|
||||
"third_party/snappy"
|
||||
"third_party/sqlite"
|
||||
"third_party/usrsctp"
|
||||
"third_party/web-animations-js"
|
||||
"third_party/webrtc"
|
||||
"third_party/webrtc_overrides"
|
||||
"third_party/widevine/cdm/widevine_cdm_common.h"
|
||||
"third_party/widevine/cdm/widevine_cdm_version.h"
|
||||
"third_party/woff2"
|
||||
"third_party/yasm"
|
||||
"third_party/zlib"
|
||||
"url/third_party/mozilla"
|
||||
"v8/src/third_party/utf8-decoder"
|
||||
"v8/src/third_party/valgrind"
|
||||
"v8/third_party/antlr4"
|
||||
"v8/third_party/inspector_protocol"))
|
||||
(protected (make-regexp "\\.(gn|gyp)i?$")))
|
||||
(define preserved-club
|
||||
(map (lambda (member)
|
||||
(string-append "./" member))
|
||||
preserved-third-party-files))
|
||||
(define (empty? dir)
|
||||
(equal? (scandir dir) '("." "..")))
|
||||
(define (third-party? file)
|
||||
(string-contains file "third_party/"))
|
||||
(define (useless? file)
|
||||
(any (cute string-suffix? <> file)
|
||||
'(".zip" ".so" ".dll" ".exe" ".jar")))
|
||||
(define (parents child)
|
||||
;; Return all parent directories of CHILD up to and including
|
||||
;; the closest "third_party".
|
||||
(let* ((dirs (match (string-split child #\/)
|
||||
((dirs ... last) dirs)))
|
||||
(closest (list-index (lambda (dir)
|
||||
(string=? "third_party" dir))
|
||||
(reverse dirs)))
|
||||
(delim (- (length dirs) closest)))
|
||||
(fold (lambda (dir prev)
|
||||
(cons (string-append (car prev) "/" dir)
|
||||
prev))
|
||||
(list (string-join (list-head dirs delim) "/"))
|
||||
(list-tail dirs delim))))
|
||||
(define (remove-loudly file)
|
||||
(format #t "deleting ~a...~%" file)
|
||||
(force-output)
|
||||
(delete-file file))
|
||||
(define (delete-unwanted-files child stat flag base level)
|
||||
(match flag
|
||||
((or 'regular 'symlink 'stale-symlink)
|
||||
(when (third-party? child)
|
||||
(unless (or (member child preserved-club)
|
||||
(any (cute member <> preserved-club)
|
||||
(parents child))
|
||||
(regexp-exec protected child))
|
||||
(remove-loudly child)))
|
||||
(when (and (useless? child) (file-exists? child))
|
||||
(remove-loudly child))
|
||||
#t)
|
||||
('directory-processed
|
||||
(when (empty? child)
|
||||
(rmdir child))
|
||||
#t)
|
||||
(_ #t)))
|
||||
|
||||
(with-directory-excursion "src/3rdparty"
|
||||
;; TODO: Try removing "gn" too for future versions of qtwebengine.
|
||||
(delete-file-recursively "ninja")
|
||||
|
||||
(with-directory-excursion "chromium"
|
||||
;; Delete bundled software and binaries that were not explicitly
|
||||
;; preserved above.
|
||||
(nftw "." delete-unwanted-files 'depth 'physical)
|
||||
|
||||
;; Assert that each preserved item is present to catch removals.
|
||||
(for-each (lambda (third-party)
|
||||
(unless (file-exists? third-party)
|
||||
(error (format #f "~s does not exist!~%" third-party))))
|
||||
preserved-club)
|
||||
|
||||
;; Use relative header locations instead of hard coded ones.
|
||||
(substitute*
|
||||
"base/third_party/dynamic_annotations/dynamic_annotations.c"
|
||||
(("base/third_party/valgrind") "valgrind"))
|
||||
(substitute*
|
||||
"third_party/breakpad/breakpad/src/common/linux/libcurl_wrapper.h"
|
||||
(("third_party/curl") "curl"))
|
||||
|
||||
;; Replace Google Analytics bundle with an empty file and hope
|
||||
;; no one notices.
|
||||
(mkdir-p "third_party/analytics")
|
||||
(call-with-output-file
|
||||
"third_party/analytics/google-analytics-bundle.js"
|
||||
(lambda (port)
|
||||
(const #t)))))
|
||||
|
||||
;; Do not enable support for loading the Widevine DRM plugin.
|
||||
(substitute* "src/core/config/common.pri"
|
||||
(("enable_widevine=true")
|
||||
"enable_widevine=false"))
|
||||
#t)))))
|
||||
(build-system gnu-build-system)
|
||||
(native-inputs
|
||||
`(("bison" ,bison)
|
||||
|
@ -1560,6 +1736,7 @@ (define-public qtwebengine
|
|||
`(("alsa-lib" ,alsa-lib)
|
||||
("atk" ,atk)
|
||||
("cups-minimal" ,cups-minimal)
|
||||
("curl" ,curl)
|
||||
("dbus" ,dbus)
|
||||
("ffmpeg" ,ffmpeg)
|
||||
("fontconfig" ,fontconfig)
|
||||
|
@ -1603,6 +1780,7 @@ (define-public qtwebengine
|
|||
("re2" ,re2)
|
||||
("snappy" ,snappy)
|
||||
("udev" ,eudev)
|
||||
("valgrind" ,valgrind)
|
||||
("xcb-util" ,xcb-util)))
|
||||
(arguments
|
||||
(substitute-keyword-arguments (package-arguments qtsvg)
|
||||
|
|
Loading…
Reference in a new issue