summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpineapples <guixuser6392@protonmail.com>2021-04-29 15:55:31 +0200
committerJonathan Brielmaier <jonathan.brielmaier@web.de>2021-05-05 22:43:20 +0200
commitc2bc68ce353fec2efb3d00a881937ab6ac9347e1 (patch)
treeb50b979137add1ea1c7e61779bea3318d2a231f2
parentdf3f4242bf720f259c12656a1036d2007e6c41b5 (diff)
nongnu: firefox-wayland: Rewrite to avoid extra build.
* nongnu/packages/mozilla.scm (firefox) [arguments]: use the default value of `--enable-default-toolkit='. The Wayland backend of Firefox is no longer considered experimental and support for it is included in the official binaries. * nongnu/packages/mozilla.scm (firefox-wayland): Re-write the package definition, based upon `ungoogled-chromium-wayland' to avoid re-compiling Firefox in cases when there is a substitute for `firefox'. Signed-off-by: Jonathan Brielmaier <jonathan.brielmaier@web.de>
-rw-r--r--nongnu/packages/mozilla.scm69
1 files changed, 38 insertions, 31 deletions
diff --git a/nongnu/packages/mozilla.scm b/nongnu/packages/mozilla.scm
index 1474173..d0f5ea6 100644
--- a/nongnu/packages/mozilla.scm
+++ b/nongnu/packages/mozilla.scm
@@ -17,6 +17,7 @@
;;; Copyright (C) 2019, 2020 Adrian Malacoda <malacoda@monarch-pass.net>
;;; Copyright © 2020 Jonathan Brielmaier <jonathan.brielmaier@web.de>
;;; Copyright © 2020 Zhu Zihao <all_but_last@163.com>
+;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
;;;
;;; This file is not part of GNU Guix.
;;;
@@ -36,6 +37,7 @@
(define-module (nongnu packages mozilla)
#:use-module (guix build-system gnu)
#:use-module (guix build-system cargo)
+ #:use-module (guix build-system trivial)
#:use-module (guix download)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
@@ -45,6 +47,7 @@
#:use-module (gnu packages assembly)
#:use-module (gnu packages autotools)
#:use-module (gnu packages base)
+ #:use-module (gnu packages bash)
#:use-module (gnu packages compression)
#:use-module (gnu packages crates-io)
#:use-module (gnu packages cups)
@@ -104,7 +107,6 @@
"--with-system-icu"
"--enable-system-ffi"
"--enable-system-pixman"
- "--enable-default-toolkit=cairo-gtk3"
"--enable-jemalloc"
;; see https://bugs.gnu.org/32833
@@ -393,33 +395,38 @@
the official icon and the name \"firefox\".")
(license license:mpl2.0)))
-(define-public firefox/wayland
- (package/inherit firefox
- (name "firefox-wayland")
- (arguments
- (substitute-keyword-arguments (package-arguments firefox)
- ((#:configure-flags flags)
- `(append (list "--enable-default-toolkit=cairo-gtk3-wayland")
- (delete "--enable-default-toolkit=cairo-gtk3" ,flags)))
- ;; We need to set the MOZ_ENABLE_WAYLAND env variable.
- ((#:phases phases)
- `(modify-phases ,phases
- (replace 'wrap-program
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (lib (string-append out "/lib"))
- (ld-libs (map (lambda (x)
- (string-append (assoc-ref inputs x)
- "/lib"))
- '("pulseaudio" "mesa"
- ;; For the integration of native notifications
- "libnotify")))
- (gtk-share (string-append (assoc-ref inputs "gtk+")
- "/share")))
- (wrap-program (car (find-files lib "^firefox$"))
- `("LD_LIBRARY_PATH" prefix ,ld-libs)
- `("XDG_DATA_DIRS" prefix (,gtk-share))
- `("MOZ_ENABLE_WAYLAND" = ("1"))
- `("MOZ_LEGACY_PROFILES" = ("1"))
- `("MOZ_ALLOW_DOWNGRADE" = ("1")))
- #t)))))))))
+ (define-public firefox/wayland
+ (package
+ (inherit firefox)
+ (name "firefox-wayland")
+ (native-inputs '())
+ (inputs
+ `(("bash" ,bash-minimal)
+ ("firefox" ,firefox)))
+ (build-system trivial-build-system)
+ (arguments
+ '(#:modules ((guix build utils))
+ #:builder
+ (begin
+ (use-modules (guix build utils))
+ (let* ((bash (assoc-ref %build-inputs "bash"))
+ (firefox (assoc-ref %build-inputs "firefox"))
+ (out (assoc-ref %outputs "out"))
+ (exe (string-append out "/bin/firefox")))
+ (mkdir-p (dirname exe))
+
+ (call-with-output-file exe
+ (lambda (port)
+ (format port "#!~a
+ MOZ_ENABLE_WAYLAND=1 exec ~a $@"
+ (string-append bash "/bin/bash")
+ (string-append firefox "/bin/firefox"))))
+ (chmod exe #o555)
+
+ ;; Provide the manual and .desktop file.
+ (copy-recursively (string-append firefox "/share")
+ (string-append out "/share"))
+ (substitute* (string-append
+ out "/share/applications/firefox.desktop")
+ ((firefox) out))
+ #t))))))