mirror of
https://gitlab.com/nonguix/nonguix.git
synced 2024-11-29 03:34:11 +01:00
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:
parent
8a545a72d7
commit
b5a8492a79
1 changed files with 238 additions and 247 deletions
|
@ -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,269 +101,259 @@
|
||||||
(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
|
||||||
"--with-system-jpeg"
|
"--with-system-jpeg"
|
||||||
"--with-system-zlib"
|
"--with-system-zlib"
|
||||||
;; "--with-system-png" ;require libpng-apng >= 1.6.35
|
;; "--with-system-png" ;require libpng-apng >= 1.6.35
|
||||||
"--with-system-icu"
|
"--with-system-icu"
|
||||||
"--enable-system-ffi"
|
"--enable-system-ffi"
|
||||||
"--enable-system-pixman"
|
"--enable-system-pixman"
|
||||||
"--enable-jemalloc"
|
"--enable-jemalloc"
|
||||||
|
|
||||||
;; see https://bugs.gnu.org/32833
|
;; see https://bugs.gnu.org/32833
|
||||||
;; "--with-system-nspr"
|
;; "--with-system-nspr"
|
||||||
;; "--with-system-nss"
|
;; "--with-system-nss"
|
||||||
|
|
||||||
,(string-append "--with-clang-path="
|
,(string-append "--with-clang-path="
|
||||||
clang "/bin/clang")
|
clang "/bin/clang")
|
||||||
,(string-append "--with-libclang-path="
|
,(string-append "--with-libclang-path="
|
||||||
clang "/lib")
|
clang "/lib")
|
||||||
,(string-append "--with-wasi-sysroot=" wasi-sysroot "/wasm32-wasi")
|
,(string-append "--with-wasi-sysroot=" wasi-sysroot "/wasm32-wasi")
|
||||||
|
|
||||||
;; Distribution
|
;; Distribution
|
||||||
"--with-distribution-id=org.nonguix"
|
"--with-distribution-id=org.nonguix"
|
||||||
"--disable-official-branding"
|
"--disable-official-branding"
|
||||||
|
|
||||||
;; Features
|
;; Features
|
||||||
"--disable-tests"
|
"--disable-tests"
|
||||||
"--disable-updater"
|
"--disable-updater"
|
||||||
"--enable-pulseaudio"
|
"--enable-pulseaudio"
|
||||||
"--disable-crashreporter"
|
"--disable-crashreporter"
|
||||||
|
|
||||||
;; Build details
|
;; Build details
|
||||||
"--disable-debug"
|
"--disable-debug"
|
||||||
"--enable-rust-simd"
|
"--enable-rust-simd"
|
||||||
"--enable-release"
|
"--enable-release"
|
||||||
"--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")))
|
||||||
(define (write-setting key value)
|
(define (write-setting key value)
|
||||||
(format port "~%pref(\"~a\", ~a);~%"
|
(format port "~%pref(\"~a\", ~a);~%"
|
||||||
key value)
|
key value)
|
||||||
(format #t "fix-preferences: setting value of ~a to ~a~%"
|
(format #t "fix-preferences: setting value of ~a to ~a~%"
|
||||||
key value))
|
key value))
|
||||||
|
|
||||||
;; We should allow Firefox sandbox to read the store directory,
|
;; We should allow Firefox sandbox to read the store directory,
|
||||||
;; because Firefox sandbox have access to /usr on FHS distros.
|
;; because Firefox sandbox have access to /usr on FHS distros.
|
||||||
(write-setting "security.sandbox.content.read_path_whitelist"
|
(write-setting "security.sandbox.content.read_path_whitelist"
|
||||||
(string-append "\"" (%store-directory) "/\""))
|
(string-append "\"" (%store-directory) "/\""))
|
||||||
|
|
||||||
;; 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"))
|
(libavcodec (string-append ffmpeg "/lib/libavcodec.so")))
|
||||||
(libavcodec (string-append ffmpeg "/lib/libavcodec.so")))
|
;; 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 _
|
||||||
(use-modules (guix build cargo-utils))
|
(use-modules (guix build cargo-utils))
|
||||||
(let ((null-hash
|
(let ((null-hash
|
||||||
;; This is the SHA256 output of an empty string.
|
;; This is the SHA256 output of an empty string.
|
||||||
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))
|
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (file)
|
(lambda (file)
|
||||||
(format #t "patch-cargo-checksums: patching checksums in ~a~%"
|
(format #t "patch-cargo-checksums: patching checksums in ~a~%"
|
||||||
file)
|
file)
|
||||||
(substitute* file
|
(substitute* file
|
||||||
(("(checksum = )\".*\"" all name)
|
(("(checksum = )\".*\"" all name)
|
||||||
(string-append name "\"" null-hash "\""))))
|
(string-append name "\"" null-hash "\""))))
|
||||||
(find-files "." "Cargo\\.lock$"))
|
(find-files "." "Cargo\\.lock$"))
|
||||||
(for-each generate-all-checksums
|
(for-each generate-all-checksums
|
||||||
'("build"
|
'("build"
|
||||||
"dom/media"
|
"dom/media"
|
||||||
"dom/webauthn"
|
"dom/webauthn"
|
||||||
"gfx"
|
"gfx"
|
||||||
"intl"
|
"intl"
|
||||||
"js"
|
"js"
|
||||||
"media"
|
"media"
|
||||||
"modules"
|
"modules"
|
||||||
"mozglue/static/rust"
|
"mozglue/static/rust"
|
||||||
"netwerk"
|
"netwerk"
|
||||||
"remote"
|
"remote"
|
||||||
"security/manager/ssl"
|
"security/manager/ssl"
|
||||||
"servo"
|
"servo"
|
||||||
"storage"
|
"storage"
|
||||||
"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\",") ""))
|
(delete 'bootstrap)
|
||||||
#t))
|
(replace 'configure
|
||||||
(delete 'bootstrap)
|
(lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
|
||||||
(replace 'configure
|
(setenv "AUTOCONF" (string-append (assoc-ref inputs "autoconf")
|
||||||
(lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
|
"/bin/autoconf"))
|
||||||
(setenv "AUTOCONF" (string-append (assoc-ref inputs "autoconf")
|
(setenv "SHELL" (which "bash"))
|
||||||
"/bin/autoconf"))
|
(setenv "CONFIG_SHELL" (which "bash"))
|
||||||
(setenv "SHELL" (which "bash"))
|
(setenv "MACH_USE_SYSTEM_PYTHON" "1")
|
||||||
(setenv "CONFIG_SHELL" (which "bash"))
|
|
||||||
(setenv "MACH_USE_SYSTEM_PYTHON" "1")
|
|
||||||
|
|
||||||
;; Use Clang, Clang is 2x faster than GCC
|
;; Use Clang, Clang is 2x faster than GCC
|
||||||
(setenv "AR" "llvm-ar")
|
(setenv "AR" "llvm-ar")
|
||||||
(setenv "NM" "llvm-nm")
|
(setenv "NM" "llvm-nm")
|
||||||
(setenv "CC" "clang")
|
(setenv "CC" "clang")
|
||||||
(setenv "CXX" "clang++")
|
(setenv "CXX" "clang++")
|
||||||
(setenv "WASM_CC"
|
(setenv "WASM_CC"
|
||||||
|
(string-append
|
||||||
|
(assoc-ref inputs "wasm32-wasi-clang-toolchain")
|
||||||
|
"/bin/clang"))
|
||||||
|
(setenv "WASM_CXX"
|
||||||
|
(string-append
|
||||||
|
(assoc-ref inputs "wasm32-wasi-clang-toolchain")
|
||||||
|
"/bin/clang++"))
|
||||||
|
|
||||||
|
(setenv "MOZ_NOSPAM" "1")
|
||||||
|
;; Firefox will write the timestamp to output, which is harmful for
|
||||||
|
;; reproducibility, so change it to a fixed date.
|
||||||
|
(setenv "MOZ_BUILD_DATE" #$%firefox-build-id)
|
||||||
|
|
||||||
|
(setenv "MOZBUILD_STATE_PATH" (getcwd))
|
||||||
|
|
||||||
|
(let* ((mozconfig (string-append (getcwd) "/mozconfig"))
|
||||||
|
(out (assoc-ref outputs "out"))
|
||||||
|
(flags (cons (string-append "--prefix=" out)
|
||||||
|
configure-flags)))
|
||||||
|
(format #t "build directory: ~s~%" (getcwd))
|
||||||
|
(format #t "configure flags: ~s~%" flags)
|
||||||
|
|
||||||
|
(define write-flags
|
||||||
|
(lambda flags
|
||||||
|
(display (string-join
|
||||||
|
(map (cut string-append "ac_add_options " <>)
|
||||||
|
flags)
|
||||||
|
"\n"))
|
||||||
|
(display "\n")))
|
||||||
|
(with-output-to-file mozconfig
|
||||||
|
(lambda ()
|
||||||
|
(apply write-flags flags)
|
||||||
|
;; The following option unsets Telemetry Reporting. With the Addons Fiasco,
|
||||||
|
;; Mozilla was found to be collecting user's data, including saved passwords and
|
||||||
|
;; web form data, without users consent. Mozilla was also found shipping updates
|
||||||
|
;; to systems without the user's knowledge or permission.
|
||||||
|
;; As a result of this, use the following command to permanently disable
|
||||||
|
;; telemetry reporting in Firefox.
|
||||||
|
(display "unset MOZ_TELEMETRY_REPORTING\n")))
|
||||||
|
(setenv "MOZCONFIG" mozconfig))
|
||||||
|
(invoke "./mach" "configure")))
|
||||||
|
(replace 'build
|
||||||
|
(lambda* (#:key (make-flags '()) (parallel-build? #t)
|
||||||
|
#:allow-other-keys)
|
||||||
|
(apply invoke "./mach" "build"
|
||||||
|
;; mach will use parallel build if possible by default
|
||||||
|
`(,@(if parallel-build?
|
||||||
|
'()
|
||||||
|
'("-j1"))
|
||||||
|
,@make-flags))))
|
||||||
|
(add-after 'build 'neutralise-store-references
|
||||||
|
(lambda _
|
||||||
|
;; Mangle the store references to compilers & other build tools in
|
||||||
|
;; about:buildconfig, reducing Firefox's closure by 1 GiB on x86-64.
|
||||||
|
(let* ((build-dir (car (scandir "." (cut string-prefix? "obj-" <>))))
|
||||||
|
(file (string-append build-dir "/dist/bin/chrome/toolkit/content/global/buildconfig.html")))
|
||||||
|
(substitute* file
|
||||||
|
(((format #f "(~a/)([0-9a-df-np-sv-z]{32})"
|
||||||
|
(regexp-quote (%store-directory)))
|
||||||
|
_ store hash)
|
||||||
|
(string-append store
|
||||||
|
(string-take hash 8)
|
||||||
|
"<!-- Guix: not a runtime dependency -->"
|
||||||
|
(string-drop hash 8)))))))
|
||||||
|
(replace 'install
|
||||||
|
(lambda _ (invoke "./mach" "install")))
|
||||||
|
(add-after 'install '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"
|
||||||
|
"udev" ;; For U2F and WebAuthn
|
||||||
|
;; For hardware video acceleration via VA-API
|
||||||
|
"libva"
|
||||||
|
;; 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_LEGACY_PROFILES" = ("1"))
|
||||||
|
`("MOZ_ALLOW_DOWNGRADE" = ("1"))))))
|
||||||
|
(add-after 'wrap-program 'install-desktop-entry
|
||||||
|
(lambda* (#:key outputs #:allow-other-keys)
|
||||||
|
(let* ((desktop-file "taskcluster/docker/firefox-snap/firefox.desktop")
|
||||||
|
(applications (string-append #$output "/share/applications")))
|
||||||
|
(substitute* desktop-file
|
||||||
|
(("^Exec=firefox") (string-append "Exec=" #$output "/bin/firefox"))
|
||||||
|
(("Icon=.*") "Icon=firefox\n")
|
||||||
|
(("NewWindow") "new-window")
|
||||||
|
(("NewPrivateWindow") "new-private-window")
|
||||||
|
(("StartupNotify=true")
|
||||||
|
"StartupNotify=true\nStartupWMClass=Navigator"))
|
||||||
|
(install-file desktop-file applications))))
|
||||||
|
(add-after 'install-desktop-entry 'install-icons
|
||||||
|
(lambda* (#:key outputs #:allow-other-keys)
|
||||||
|
(let ((icon-source-dir
|
||||||
(string-append
|
(string-append
|
||||||
(assoc-ref inputs "wasm32-wasi-clang-toolchain")
|
#$output "/lib/firefox/browser/chrome/icons/default")))
|
||||||
"/bin/clang"))
|
(for-each
|
||||||
(setenv "WASM_CXX"
|
(lambda (size)
|
||||||
(string-append
|
(let ((dest (string-append #$output "/share/icons/hicolor/"
|
||||||
(assoc-ref inputs "wasm32-wasi-clang-toolchain")
|
size "x" size "/apps")))
|
||||||
"/bin/clang++"))
|
(mkdir-p dest)
|
||||||
|
(symlink (string-append icon-source-dir
|
||||||
|
"/default" size ".png")
|
||||||
|
(string-append dest "/firefox.png"))))
|
||||||
|
'("16" "32" "48" "64" "128"))))))
|
||||||
|
|
||||||
(setenv "MOZ_NOSPAM" "1")
|
;; Test will significantly increase build time but with little rewards.
|
||||||
;; Firefox will write the timestamp to output, which is harmful for
|
#:tests? #f
|
||||||
;; reproducibility, so change it to a fixed date.
|
|
||||||
(setenv "MOZ_BUILD_DATE" ,%firefox-build-id)
|
|
||||||
|
|
||||||
(setenv "MOZBUILD_STATE_PATH" (getcwd))
|
;; WARNING: Parallel build will consume lots of memory!
|
||||||
|
;; If you have encountered OOM issue in build phase, try disable it.
|
||||||
|
;; #:parallel-build? #f
|
||||||
|
|
||||||
(let* ((mozconfig (string-append (getcwd) "/mozconfig"))
|
;; Some dynamic lib was determined at runtime, so rpath check may fail.
|
||||||
(out (assoc-ref outputs "out"))
|
#:validate-runpath? #f))
|
||||||
(flags (cons (string-append "--prefix=" out)
|
|
||||||
configure-flags)))
|
|
||||||
(format #t "build directory: ~s~%" (getcwd))
|
|
||||||
(format #t "configure flags: ~s~%" flags)
|
|
||||||
|
|
||||||
(define write-flags
|
|
||||||
(lambda flags
|
|
||||||
(display (string-join
|
|
||||||
(map (cut string-append "ac_add_options " <>)
|
|
||||||
flags)
|
|
||||||
"\n"))
|
|
||||||
(display "\n")))
|
|
||||||
(with-output-to-file mozconfig
|
|
||||||
(lambda ()
|
|
||||||
(apply write-flags flags)
|
|
||||||
;; The following option unsets Telemetry Reporting. With the Addons Fiasco,
|
|
||||||
;; Mozilla was found to be collecting user's data, including saved passwords and
|
|
||||||
;; web form data, without users consent. Mozilla was also found shipping updates
|
|
||||||
;; to systems without the user's knowledge or permission.
|
|
||||||
;; As a result of this, use the following command to permanently disable
|
|
||||||
;; telemetry reporting in Firefox.
|
|
||||||
(display "unset MOZ_TELEMETRY_REPORTING\n")))
|
|
||||||
(setenv "MOZCONFIG" mozconfig))
|
|
||||||
(invoke "./mach" "configure")))
|
|
||||||
(replace 'build
|
|
||||||
(lambda* (#:key (make-flags '()) (parallel-build? #t)
|
|
||||||
#:allow-other-keys)
|
|
||||||
(apply invoke "./mach" "build"
|
|
||||||
;; mach will use parallel build if possible by default
|
|
||||||
`(,@(if parallel-build?
|
|
||||||
'()
|
|
||||||
'("-j1"))
|
|
||||||
,@make-flags))))
|
|
||||||
(add-after 'build 'neutralise-store-references
|
|
||||||
(lambda _
|
|
||||||
;; Mangle the store references to compilers & other build tools in
|
|
||||||
;; about:buildconfig, reducing Firefox's closure by 1 GiB on x86-64.
|
|
||||||
(let* ((build-dir (car (scandir "." (cut string-prefix? "obj-" <>))))
|
|
||||||
(file (string-append build-dir "/dist/bin/chrome/toolkit/content/global/buildconfig.html")))
|
|
||||||
(substitute* file
|
|
||||||
(((format #f "(~a/)([0-9a-df-np-sv-z]{32})"
|
|
||||||
(regexp-quote (%store-directory)))
|
|
||||||
_ store hash)
|
|
||||||
(string-append store
|
|
||||||
(string-take hash 8)
|
|
||||||
"<!-- Guix: not a runtime dependency -->"
|
|
||||||
(string-drop hash 8)))))
|
|
||||||
#t))
|
|
||||||
(replace 'install
|
|
||||||
(lambda _ (invoke "./mach" "install")))
|
|
||||||
(add-after 'install '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"
|
|
||||||
"udev" ;; For U2F and WebAuthn
|
|
||||||
;; For hardware video acceleration via VA-API
|
|
||||||
"libva"
|
|
||||||
;; 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_LEGACY_PROFILES" = ("1"))
|
|
||||||
`("MOZ_ALLOW_DOWNGRADE" = ("1")))
|
|
||||||
#t)))
|
|
||||||
(add-after 'wrap-program 'install-desktop-entry
|
|
||||||
(lambda* (#:key outputs #:allow-other-keys)
|
|
||||||
(let* ((desktop-file "taskcluster/docker/firefox-snap/firefox.desktop")
|
|
||||||
(out (assoc-ref outputs "out"))
|
|
||||||
(applications (string-append out "/share/applications")))
|
|
||||||
(substitute* desktop-file
|
|
||||||
(("^Exec=firefox") (string-append "Exec=" out "/bin/firefox"))
|
|
||||||
(("Icon=.*") "Icon=firefox\n")
|
|
||||||
(("NewWindow") "new-window")
|
|
||||||
(("NewPrivateWindow") "new-private-window")
|
|
||||||
(("StartupNotify=true")
|
|
||||||
"StartupNotify=true\nStartupWMClass=Navigator"))
|
|
||||||
(install-file desktop-file applications))
|
|
||||||
#t))
|
|
||||||
(add-after 'install-desktop-entry 'install-icons
|
|
||||||
(lambda* (#:key outputs #:allow-other-keys)
|
|
||||||
(let* ((out (assoc-ref outputs "out"))
|
|
||||||
(icon-source-dir
|
|
||||||
(string-append
|
|
||||||
out "/lib/firefox/browser/chrome/icons/default")))
|
|
||||||
(for-each
|
|
||||||
(lambda (size)
|
|
||||||
(let ((dest (string-append out "/share/icons/hicolor/"
|
|
||||||
size "x" size "/apps")))
|
|
||||||
(mkdir-p dest)
|
|
||||||
(symlink (string-append icon-source-dir
|
|
||||||
"/default" size ".png")
|
|
||||||
(string-append dest "/firefox.png"))))
|
|
||||||
'("16" "32" "48" "64" "128"))
|
|
||||||
#t))))
|
|
||||||
|
|
||||||
;; Test will significantly increase build time but with little rewards.
|
|
||||||
#:tests? #f
|
|
||||||
|
|
||||||
;; WARNING: Parallel build will consume lots of memory!
|
|
||||||
;; If you have encountered OOM issue in build phase, try disable it.
|
|
||||||
;; #:parallel-build? #f
|
|
||||||
|
|
||||||
;; Some dynamic lib was determined at runtime, so rpath check may fail.
|
|
||||||
#:validate-runpath? #f))
|
|
||||||
(inputs
|
(inputs
|
||||||
`(("bzip2" ,bzip2)
|
`(("bzip2" ,bzip2)
|
||||||
("cairo" ,cairo)
|
("cairo" ,cairo)
|
||||||
|
|
Loading…
Reference in a new issue