nongnu: firefox: Use Gexp.

* nongnu/packages/mozilla.scm (firefox)[arguments]: Use Gexp to remove uses of
%BUILD-INPUTS and output references.  Also remove trailing #t.

Signed-off-by: Jonathan Brielmaier <jonathan.brielmaier@web.de>
This commit is contained in:
Ricardo Wurmus 2022-02-13 18:04:22 +01:00 committed by Jonathan Brielmaier
parent 8a545a72d7
commit b5a8492a79
No known key found for this signature in database
GPG key ID: ECFC83988B4E4B9F

View file

@ -9,7 +9,7 @@
;;; Copyright © 2017, 2018 Nikita <nikita@n0.is> ;;; Copyright © 2017, 2018 Nikita <nikita@n0.is>
;;; Copyright © 2017, 2018 ng0 <gillmann@infotropique.org> ;;; Copyright © 2017, 2018 ng0 <gillmann@infotropique.org>
;;; Copyright © 2017, 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr> ;;; Copyright © 2017, 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018, 2020 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2018, 2020, 2022 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com> ;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com>
;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com> ;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net> ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
@ -42,6 +42,7 @@
#:use-module (guix build-system trivial) #:use-module (guix build-system trivial)
#:use-module (guix download) #:use-module (guix download)
#:use-module ((guix licenses) #:prefix license:) #:use-module ((guix licenses) #:prefix license:)
#:use-module (guix gexp)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix utils) #:use-module (guix utils)
@ -100,10 +101,10 @@
(base32 "0a6z94kwgycgis4mgl13dh52kw7zmsya2qpxhcrh6b8j8z5pv2kc")))) (base32 "0a6z94kwgycgis4mgl13dh52kw7zmsya2qpxhcrh6b8j8z5pv2kc"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
`(#:configure-flags (list
(let ((clang (assoc-ref %build-inputs "clang")) #:configure-flags
(wasi-sysroot (assoc-ref %build-inputs #~(let ((clang #$(this-package-native-input "clang"))
"wasm32-wasi-clang-toolchain"))) (wasi-sysroot #$(this-package-native-input "wasm32-wasi-clang-toolchain")))
`("--enable-application=browser" `("--enable-application=browser"
;; Configuration ;; Configuration
@ -142,13 +143,13 @@
"--enable-optimize" "--enable-optimize"
"--enable-strip" "--enable-strip"
"--disable-elf-hack")) "--disable-elf-hack"))
#:imported-modules ,%cargo-utils-modules #:imported-modules %cargo-utils-modules
#:modules ((ice-9 regex) #:modules `((ice-9 regex)
(ice-9 ftw) (ice-9 ftw)
(srfi srfi-26) (srfi srfi-26)
,@%gnu-build-system-modules) ,@%gnu-build-system-modules)
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'unpack 'fix-preferences (add-after 'unpack 'fix-preferences
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(let ((port (open-file "browser/app/profile/firefox.js" "a"))) (let ((port (open-file "browser/app/profile/firefox.js" "a")))
@ -165,8 +166,7 @@
;; XDG settings should be managed by Guix. ;; XDG settings should be managed by Guix.
(write-setting "browser.shell.checkDefaultBrowser" "false") (write-setting "browser.shell.checkDefaultBrowser" "false")
(close-port port)) (close-port port))))
#t))
(add-after 'fix-preferences 'fix-ffmpeg-runtime-linker (add-after 'fix-preferences 'fix-ffmpeg-runtime-linker
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(let* ((ffmpeg (assoc-ref inputs "ffmpeg")) (let* ((ffmpeg (assoc-ref inputs "ffmpeg"))
@ -174,8 +174,7 @@
;; Arrange to load libavcodec.so by its absolute file name. ;; Arrange to load libavcodec.so by its absolute file name.
(substitute* "dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp" (substitute* "dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp"
(("libavcodec\\.so") (("libavcodec\\.so")
libavcodec)) libavcodec)))))
#t)))
(add-after 'patch-source-shebangs 'patch-cargo-checksums (add-after 'patch-source-shebangs 'patch-cargo-checksums
(lambda _ (lambda _
@ -209,16 +208,14 @@
"third_party/rust" "third_party/rust"
"toolkit" "toolkit"
"xpcom/rust" "xpcom/rust"
"services")) "services")))))
#t)))
(add-after 'patch-cargo-checksums 'remove-cargo-frozen-flag (add-after 'patch-cargo-checksums 'remove-cargo-frozen-flag
(lambda _ (lambda _
;; Remove --frozen flag from cargo invokation, otherwise it'll ;; Remove --frozen flag from cargo invokation, otherwise it'll
;; complain that it's not able to change Cargo.lock. ;; complain that it's not able to change Cargo.lock.
;; https://bugzilla.mozilla.org/show_bug.cgi?id=1726373 ;; https://bugzilla.mozilla.org/show_bug.cgi?id=1726373
(substitute* "build/RunCbindgen.py" (substitute* "build/RunCbindgen.py"
(("\"--frozen\",") "")) (("\"--frozen\",") ""))))
#t))
(delete 'bootstrap) (delete 'bootstrap)
(replace 'configure (replace 'configure
(lambda* (#:key inputs outputs configure-flags #:allow-other-keys) (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
@ -245,7 +242,7 @@
(setenv "MOZ_NOSPAM" "1") (setenv "MOZ_NOSPAM" "1")
;; Firefox will write the timestamp to output, which is harmful for ;; Firefox will write the timestamp to output, which is harmful for
;; reproducibility, so change it to a fixed date. ;; reproducibility, so change it to a fixed date.
(setenv "MOZ_BUILD_DATE" ,%firefox-build-id) (setenv "MOZ_BUILD_DATE" #$%firefox-build-id)
(setenv "MOZBUILD_STATE_PATH" (getcwd)) (setenv "MOZBUILD_STATE_PATH" (getcwd))
@ -297,8 +294,7 @@
(string-append store (string-append store
(string-take hash 8) (string-take hash 8)
"<!-- Guix: not a runtime dependency -->" "<!-- Guix: not a runtime dependency -->"
(string-drop hash 8))))) (string-drop hash 8)))))))
#t))
(replace 'install (replace 'install
(lambda _ (invoke "./mach" "install"))) (lambda _ (invoke "./mach" "install")))
(add-after 'install 'wrap-program (add-after 'install 'wrap-program
@ -321,38 +317,33 @@
`("LD_LIBRARY_PATH" prefix ,ld-libs) `("LD_LIBRARY_PATH" prefix ,ld-libs)
`("XDG_DATA_DIRS" prefix (,gtk-share)) `("XDG_DATA_DIRS" prefix (,gtk-share))
`("MOZ_LEGACY_PROFILES" = ("1")) `("MOZ_LEGACY_PROFILES" = ("1"))
`("MOZ_ALLOW_DOWNGRADE" = ("1"))) `("MOZ_ALLOW_DOWNGRADE" = ("1"))))))
#t)))
(add-after 'wrap-program 'install-desktop-entry (add-after 'wrap-program 'install-desktop-entry
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(let* ((desktop-file "taskcluster/docker/firefox-snap/firefox.desktop") (let* ((desktop-file "taskcluster/docker/firefox-snap/firefox.desktop")
(out (assoc-ref outputs "out")) (applications (string-append #$output "/share/applications")))
(applications (string-append out "/share/applications")))
(substitute* desktop-file (substitute* desktop-file
(("^Exec=firefox") (string-append "Exec=" out "/bin/firefox")) (("^Exec=firefox") (string-append "Exec=" #$output "/bin/firefox"))
(("Icon=.*") "Icon=firefox\n") (("Icon=.*") "Icon=firefox\n")
(("NewWindow") "new-window") (("NewWindow") "new-window")
(("NewPrivateWindow") "new-private-window") (("NewPrivateWindow") "new-private-window")
(("StartupNotify=true") (("StartupNotify=true")
"StartupNotify=true\nStartupWMClass=Navigator")) "StartupNotify=true\nStartupWMClass=Navigator"))
(install-file desktop-file applications)) (install-file desktop-file applications))))
#t))
(add-after 'install-desktop-entry 'install-icons (add-after 'install-desktop-entry 'install-icons
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let ((icon-source-dir
(icon-source-dir
(string-append (string-append
out "/lib/firefox/browser/chrome/icons/default"))) #$output "/lib/firefox/browser/chrome/icons/default")))
(for-each (for-each
(lambda (size) (lambda (size)
(let ((dest (string-append out "/share/icons/hicolor/" (let ((dest (string-append #$output "/share/icons/hicolor/"
size "x" size "/apps"))) size "x" size "/apps")))
(mkdir-p dest) (mkdir-p dest)
(symlink (string-append icon-source-dir (symlink (string-append icon-source-dir
"/default" size ".png") "/default" size ".png")
(string-append dest "/firefox.png")))) (string-append dest "/firefox.png"))))
'("16" "32" "48" "64" "128")) '("16" "32" "48" "64" "128"))))))
#t))))
;; Test will significantly increase build time but with little rewards. ;; Test will significantly increase build time but with little rewards.
#:tests? #f #:tests? #f