mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
gnu: librewolf: Shorten line length.
* gnu/packages/librewolf.scm (librewolf): Shorten line length. Change-Id: I27eea08401b16b56e29b61c5dc6f87f7517b87d4
This commit is contained in:
parent
0b7c8ee635
commit
d52ca2c579
1 changed files with 374 additions and 368 deletions
|
@ -283,383 +283,389 @@
|
||||||
(guix elf)
|
(guix elf)
|
||||||
(guix build gremlin)
|
(guix build gremlin)
|
||||||
,@%default-gnu-imported-modules)
|
,@%default-gnu-imported-modules)
|
||||||
#:phases #~(modify-phases %standard-phases
|
#:phases
|
||||||
(add-after 'unpack 'fix-preferences
|
#~(modify-phases %standard-phases
|
||||||
(lambda* (#:key inputs #:allow-other-keys)
|
(add-after 'unpack 'fix-preferences
|
||||||
(let ((port (open-file "browser/app/profile/firefox.js"
|
(lambda* (#:key inputs #:allow-other-keys)
|
||||||
"a")))
|
(let ((port (open-file "browser/app/profile/firefox.js"
|
||||||
(define (write-setting key value)
|
"a")))
|
||||||
(format port "~%pref(\"~a\", ~a);~%" key value)
|
(define (write-setting key value)
|
||||||
(format #t
|
(format port "~%pref(\"~a\", ~a);~%" key value)
|
||||||
"fix-preferences: setting value of ~a to ~a~%" key
|
(format #t
|
||||||
value))
|
"fix-preferences: setting value of ~a to ~a~%" key
|
||||||
|
value))
|
||||||
|
|
||||||
;; We should allow the sandbox to read the store directory,
|
;; We should allow the sandbox to read the store directory,
|
||||||
;; because the sandbox has access to /usr on FHS distros.
|
;; because the sandbox has access to /usr on FHS distros.
|
||||||
(write-setting
|
(write-setting
|
||||||
"security.sandbox.content.read_path_whitelist"
|
"security.sandbox.content.read_path_whitelist"
|
||||||
(string-append "\""
|
(string-append "\""
|
||||||
(%store-directory) "/\""))
|
(%store-directory) "/\""))
|
||||||
|
|
||||||
;; XDG settings should be managed by Guix.
|
;; XDG settings should be managed by Guix.
|
||||||
(write-setting "browser.shell.checkDefaultBrowser"
|
(write-setting "browser.shell.checkDefaultBrowser"
|
||||||
"false")
|
"false")
|
||||||
(close-port port))))
|
(close-port port))))
|
||||||
(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
|
(libavcodec (string-append ffmpeg
|
||||||
"/lib/libavcodec.so")))
|
"/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*
|
||||||
(("libavcodec\\.so")
|
"dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp"
|
||||||
libavcodec)))))
|
(("libavcodec\\.so")
|
||||||
(add-after 'unpack 'neuter-genai
|
libavcodec)))))
|
||||||
(lambda* _
|
(add-after 'unpack 'neuter-genai
|
||||||
;; Lock the preferences so they can't be enabled.
|
(lambda* _
|
||||||
(substitute* "lw/librewolf.cfg"
|
;; Lock the preferences so they can't be enabled.
|
||||||
(("defaultPref\\(\"browser\\.ml\\.")
|
(substitute* "lw/librewolf.cfg"
|
||||||
"lockPref(\"browser.ml."))))
|
(("defaultPref\\(\"browser\\.ml\\.")
|
||||||
(add-after 'patch-source-shebangs 'patch-cargo-checksums
|
"lockPref(\"browser.ml."))))
|
||||||
(lambda _
|
(add-after 'patch-source-shebangs 'patch-cargo-checksums
|
||||||
(use-modules (guix build cargo-utils))
|
(lambda _
|
||||||
(let ((null-hash
|
(use-modules (guix build cargo-utils))
|
||||||
;; This is the SHA256 output of an empty string.
|
(let ((null-hash
|
||||||
(string-append
|
;; This is the SHA256 output of an empty string.
|
||||||
"e3b0c44298fc1c149afbf4c8996fb924"
|
(string-append
|
||||||
"27ae41e4649b934ca495991b7852b855")))
|
"e3b0c44298fc1c149afbf4c8996fb924"
|
||||||
(for-each (lambda (file)
|
"27ae41e4649b934ca495991b7852b855")))
|
||||||
(format #t
|
(for-each
|
||||||
"patch-cargo-checksums: patching checksums in ~a~%"
|
(lambda (file)
|
||||||
file)
|
(format #t
|
||||||
(substitute* file
|
"patch-cargo-checksums: patching checksums in ~a~%"
|
||||||
(("(checksum = )\".*\"" all name)
|
file)
|
||||||
(string-append name "\"" null-hash
|
(substitute* file
|
||||||
"\""))))
|
(("(checksum = )\".*\"" all name)
|
||||||
(find-files "." "Cargo\\.lock$"))
|
(string-append name "\"" null-hash
|
||||||
(for-each generate-all-checksums
|
"\""))))
|
||||||
'("build"
|
(find-files "." "Cargo\\.lock$"))
|
||||||
"dom/media"
|
(for-each generate-all-checksums
|
||||||
"dom/webauthn"
|
'("build"
|
||||||
"gfx"
|
"dom/media"
|
||||||
"intl"
|
"dom/webauthn"
|
||||||
"js"
|
"gfx"
|
||||||
"media"
|
"intl"
|
||||||
"modules"
|
"js"
|
||||||
"mozglue/static/rust"
|
"media"
|
||||||
"netwerk"
|
"modules"
|
||||||
"remote"
|
"mozglue/static/rust"
|
||||||
"security/manager/ssl"
|
"netwerk"
|
||||||
"servo"
|
"remote"
|
||||||
"storage"
|
"security/manager/ssl"
|
||||||
"third_party/rust"
|
"servo"
|
||||||
"toolkit"
|
"storage"
|
||||||
"xpcom/rust"
|
"third_party/rust"
|
||||||
"services")))))
|
"toolkit"
|
||||||
(add-after 'patch-cargo-checksums 'remove-cargo-frozen-flag
|
"xpcom/rust"
|
||||||
(lambda _
|
"services")))))
|
||||||
;; Remove --frozen flag from cargo invocation, otherwise it'll
|
(add-after 'patch-cargo-checksums 'remove-cargo-frozen-flag
|
||||||
;; complain that it's not able to change Cargo.lock.
|
(lambda _
|
||||||
;; https://bugzilla.mozilla.org/show_bug.cgi?id=1726373
|
;; Remove --frozen flag from cargo invocation, otherwise it'll
|
||||||
(substitute* "build/RunCbindgen.py"
|
;; complain that it's not able to change Cargo.lock.
|
||||||
(("args.append\\(\"--frozen\"\\)") "pass"))))
|
;; https://bugzilla.mozilla.org/show_bug.cgi?id=1726373
|
||||||
(delete 'bootstrap)
|
(substitute* "build/RunCbindgen.py"
|
||||||
(add-before 'configure 'patch-SpeechDispatcherService.cpp
|
(("args.append\\(\"--frozen\"\\)") "pass"))))
|
||||||
(lambda _
|
(delete 'bootstrap)
|
||||||
(let* ((lib "libspeechd.so.2")
|
(add-before 'configure 'patch-SpeechDispatcherService.cpp
|
||||||
(file (string-append
|
(lambda _
|
||||||
"dom/media/webspeech/synth/"
|
(let* ((lib "libspeechd.so.2")
|
||||||
"speechd/SpeechDispatcherService.cpp"))
|
(file (string-append
|
||||||
(old-content (call-with-input-file file
|
"dom/media/webspeech/synth/"
|
||||||
get-string-all)))
|
"speechd/SpeechDispatcherService.cpp"))
|
||||||
(substitute
|
(old-content (call-with-input-file file
|
||||||
file
|
get-string-all)))
|
||||||
`((,(format #f "~s" lib) unquote
|
(substitute
|
||||||
(lambda (line _)
|
file
|
||||||
(string-replace-substring
|
`((,(format #f "~s" lib) unquote
|
||||||
line lib
|
(lambda (line _)
|
||||||
(string-append #$speech-dispatcher
|
(string-replace-substring
|
||||||
"/lib/" lib))))))
|
line lib
|
||||||
(if (string=? old-content
|
(string-append #$speech-dispatcher
|
||||||
(call-with-input-file file
|
"/lib/" lib))))))
|
||||||
get-string-all))
|
(if (string=? old-content
|
||||||
(error
|
(call-with-input-file file
|
||||||
"substitute did nothing, phase requires an update")))))
|
get-string-all))
|
||||||
(add-before 'configure 'set-build-id
|
(error
|
||||||
;; Build will write the timestamp to output, which is harmful
|
"substitute did nothing, phase requires an update")))))
|
||||||
;; for reproducibility, so change it to a fixed date. Use a
|
(add-before 'configure 'set-build-id
|
||||||
;; separate phase for easier modification with inherit.
|
;; Build will write the timestamp to output, which is harmful
|
||||||
(lambda _
|
;; for reproducibility, so change it to a fixed date. Use a
|
||||||
(setenv "MOZ_BUILD_DATE"
|
;; separate phase for easier modification with inherit.
|
||||||
#$%librewolf-build-id)))
|
(lambda _
|
||||||
;; https://bugzilla.mozilla.org/show_bug.cgi?id=1927380
|
(setenv "MOZ_BUILD_DATE"
|
||||||
(add-before 'configure 'patch-icu-lookup
|
#$%librewolf-build-id)))
|
||||||
(lambda _
|
;; https://bugzilla.mozilla.org/show_bug.cgi?id=1927380
|
||||||
(let* ((file "js/moz.configure")
|
(add-before 'configure 'patch-icu-lookup
|
||||||
(old-content (call-with-input-file file get-string-all)))
|
(lambda _
|
||||||
(substitute* file
|
(let* ((file "js/moz.configure")
|
||||||
(("icu-i18n >= 76.1" all)
|
(old-content (call-with-input-file file get-string-all)))
|
||||||
(string-append all ", icu-uc >= 76.1")))
|
(substitute* file
|
||||||
(if (string=? old-content
|
(("icu-i18n >= 76.1" all)
|
||||||
(pk (call-with-input-file file get-string-all)))
|
(string-append all ", icu-uc >= 76.1")))
|
||||||
(error "substitute did nothing, phase requires an update")))))
|
(if (string=? old-content
|
||||||
(replace 'configure
|
(pk (call-with-input-file file get-string-all)))
|
||||||
(lambda* (#:key inputs outputs configure-flags
|
(error
|
||||||
#:allow-other-keys)
|
"substitute did nothing, phase requires an update")))))
|
||||||
(setenv "AUTOCONF"
|
(replace 'configure
|
||||||
(string-append (assoc-ref inputs "autoconf")
|
(lambda* (#:key inputs outputs configure-flags
|
||||||
"/bin/autoconf"))
|
#:allow-other-keys)
|
||||||
(setenv "SHELL"
|
(setenv "AUTOCONF"
|
||||||
(which "bash"))
|
(string-append (assoc-ref inputs "autoconf")
|
||||||
(setenv "CONFIG_SHELL"
|
"/bin/autoconf"))
|
||||||
(which "bash"))
|
(setenv "SHELL"
|
||||||
(setenv "MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE"
|
(which "bash"))
|
||||||
"system")
|
(setenv "CONFIG_SHELL"
|
||||||
(setenv "LANG" "en_US.utf8")
|
(which "bash"))
|
||||||
;; This should use the host info probably (does it
|
(setenv "MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE"
|
||||||
;; build on non-x86_64 though?)
|
"system")
|
||||||
(setenv "GUIX_PYTHONPATH"
|
(setenv "LANG" "en_US.utf8")
|
||||||
(string-append (getcwd)
|
;; This should use the host info probably (does it
|
||||||
"/obj-x86_64-pc-linux-gnu/_virtualenvs/build"))
|
;; build on non-x86_64 though?)
|
||||||
|
(setenv "GUIX_PYTHONPATH"
|
||||||
|
(string-append
|
||||||
|
(getcwd)
|
||||||
|
"/obj-x86_64-pc-linux-gnu/_virtualenvs/build"))
|
||||||
|
|
||||||
;; 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 "MOZ_NOSPAM" "1")
|
(setenv "MOZ_NOSPAM" "1")
|
||||||
(setenv "MOZ_APP_REMOTINGNAME" "LibreWolf")
|
(setenv "MOZ_APP_REMOTINGNAME" "LibreWolf")
|
||||||
(setenv "MOZ_APP_NAME" "librewolf")
|
(setenv "MOZ_APP_NAME" "librewolf")
|
||||||
|
|
||||||
(setenv "MOZBUILD_STATE_PATH"
|
(setenv "MOZBUILD_STATE_PATH"
|
||||||
(getcwd))
|
(getcwd))
|
||||||
|
|
||||||
(let* ((mozconfig (string-append (getcwd) "/mozconfig"))
|
(let* ((mozconfig (string-append (getcwd) "/mozconfig"))
|
||||||
(out (assoc-ref outputs "out"))
|
(out (assoc-ref outputs "out"))
|
||||||
(flags (cons (string-append "--prefix=" out)
|
(flags (cons (string-append "--prefix=" out)
|
||||||
configure-flags)))
|
configure-flags)))
|
||||||
(format #t "build directory: ~s~%"
|
(format #t "build directory: ~s~%"
|
||||||
(getcwd))
|
(getcwd))
|
||||||
(format #t "configure flags: ~s~%" flags)
|
(format #t "configure flags: ~s~%" flags)
|
||||||
|
|
||||||
(define write-flags
|
(define write-flags
|
||||||
(lambda flags
|
(lambda flags
|
||||||
(display (string-join (map (cut string-append
|
(display (string-join (map (cut string-append
|
||||||
"ac_add_options " <>)
|
"ac_add_options " <>)
|
||||||
flags) "\n"))
|
flags) "\n"))
|
||||||
(display "\n")))
|
(display "\n")))
|
||||||
(with-output-to-file mozconfig
|
(with-output-to-file mozconfig
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(apply write-flags flags)
|
(apply write-flags flags)
|
||||||
;; The following option unsets Telemetry
|
;; The following option unsets Telemetry
|
||||||
;; Reporting. With the Addons Fiasco,
|
;; Reporting. With the Addons Fiasco,
|
||||||
;; Mozilla was found to be collecting
|
;; Mozilla was found to be collecting
|
||||||
;; user's data, including saved passwords
|
;; user's data, including saved passwords
|
||||||
;; and web form data, without users
|
;; and web form data, without users
|
||||||
;; consent. Mozilla was also found
|
;; consent. Mozilla was also found
|
||||||
;; shipping updates to systems without
|
;; shipping updates to systems without
|
||||||
;; the user's knowledge or permission.
|
;; the user's knowledge or permission.
|
||||||
;; As a result of this, use the following
|
;; As a result of this, use the following
|
||||||
;; command to permanently disable
|
;; command to permanently disable
|
||||||
;; telemetry reporting.
|
;; telemetry reporting.
|
||||||
(display "unset MOZ_TELEMETRY_REPORTING\n")
|
(display "unset MOZ_TELEMETRY_REPORTING\n")
|
||||||
(display "mk_add_options MOZ_CRASHREPORTER=0\n")
|
(display "mk_add_options MOZ_CRASHREPORTER=0\n")
|
||||||
(display "mk_add_options MOZ_DATA_REPORTING=0\n")
|
(display "mk_add_options MOZ_DATA_REPORTING=0\n")
|
||||||
(display
|
(display
|
||||||
"mk_add_options MOZ_SERVICES_HEALTHREPORT=0")
|
"mk_add_options MOZ_SERVICES_HEALTHREPORT=0")
|
||||||
(display
|
(display
|
||||||
"mk_add_options MOZ_TELEMETRY_REPORTING=0")))
|
"mk_add_options MOZ_TELEMETRY_REPORTING=0")))
|
||||||
(setenv "MOZCONFIG" mozconfig))
|
(setenv "MOZCONFIG" mozconfig))
|
||||||
(invoke "./mach" "configure")))
|
(invoke "./mach" "configure")))
|
||||||
(add-before 'build 'fix-addons-placeholder
|
(add-before 'build 'fix-addons-placeholder
|
||||||
(lambda _
|
(lambda _
|
||||||
(substitute* "toolkit/locales/en-US/toolkit/about/aboutAddons.ftl"
|
(substitute*
|
||||||
(("addons.mozilla.org")
|
"toolkit/locales/en-US/toolkit/about/aboutAddons.ftl"
|
||||||
"gnuzilla.gnu.org"))))
|
(("addons.mozilla.org")
|
||||||
(replace 'build
|
"gnuzilla.gnu.org"))))
|
||||||
(lambda* (#:key (make-flags '())
|
(replace 'build
|
||||||
(parallel-build? #t) #:allow-other-keys)
|
(lambda* (#:key (make-flags '())
|
||||||
(apply invoke "./mach" "build"
|
(parallel-build? #t) #:allow-other-keys)
|
||||||
;; mach will use parallel build if possible by default
|
(apply invoke "./mach" "build"
|
||||||
`(,@(if parallel-build?
|
;; mach will use parallel build if possible by default
|
||||||
`(,(string-append
|
`(,@(if parallel-build?
|
||||||
"-j" (number->string (parallel-job-count))))
|
`(,(string-append
|
||||||
'("-j1"))
|
"-j" (number->string (parallel-job-count))))
|
||||||
,@make-flags))))
|
'("-j1"))
|
||||||
(add-after 'build 'neutralise-store-references
|
,@make-flags))))
|
||||||
(lambda _
|
(add-after 'build 'neutralise-store-references
|
||||||
;; Mangle the store references to compilers &
|
(lambda _
|
||||||
;; other build tools in about:buildconfig,
|
;; Mangle the store references to compilers &
|
||||||
;; reducing the package's closure by 1 GiB on
|
;; other build tools in about:buildconfig,
|
||||||
;; x86-64.
|
;; reducing the package's closure by 1 GiB on
|
||||||
(let* ((build-dir (car (scandir "."
|
;; x86-64.
|
||||||
(cut string-prefix?
|
(let* ((build-dir (car (scandir "."
|
||||||
"obj-" <>))))
|
(cut string-prefix?
|
||||||
(file (string-append build-dir
|
"obj-" <>))))
|
||||||
"/dist/bin/chrome/toolkit/"
|
(file (string-append build-dir
|
||||||
"content/global/buildconfig.html")))
|
"/dist/bin/chrome/toolkit/"
|
||||||
(substitute* file
|
"content/global/buildconfig.html")))
|
||||||
(((format #f "(~a/)([0-9a-df-np-sv-z]{32})"
|
(substitute* file
|
||||||
(regexp-quote (%store-directory)))
|
(((format #f "(~a/)([0-9a-df-np-sv-z]{32})"
|
||||||
_ store hash)
|
(regexp-quote (%store-directory)))
|
||||||
(string-append store
|
_ store hash)
|
||||||
(string-take hash 8)
|
(string-append store
|
||||||
"<!-- Guix: not a runtime dependency -->"
|
(string-take hash 8)
|
||||||
(string-drop hash 8)))))))
|
"<!-- Guix: not a runtime dependency -->"
|
||||||
(replace 'install
|
(string-drop hash 8)))))))
|
||||||
(lambda _
|
(replace 'install
|
||||||
(invoke "./mach" "install")))
|
(lambda _
|
||||||
(add-after 'install 'remove-duplicate-bin
|
(invoke "./mach" "install")))
|
||||||
(lambda* (#:key outputs #:allow-other-keys)
|
(add-after 'install 'remove-duplicate-bin
|
||||||
(delete-file (string-append #$output
|
(lambda* (#:key outputs #:allow-other-keys)
|
||||||
"/lib/librewolf/librewolf-bin"))))
|
(delete-file (string-append #$output
|
||||||
(add-after 'install 'wrap-glxtest
|
"/lib/librewolf/librewolf-bin"))))
|
||||||
;; glxtest uses dlopen() to load mesa and pci
|
(add-after 'install 'wrap-glxtest
|
||||||
;; libs, wrap it to set LD_LIBRARY_PATH.
|
;; glxtest uses dlopen() to load mesa and pci
|
||||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
;; libs, wrap it to set LD_LIBRARY_PATH.
|
||||||
(let* ((out (assoc-ref outputs "out"))
|
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||||
(lib (string-append out "/lib"))
|
(let* ((out (assoc-ref outputs "out"))
|
||||||
(libs (map
|
(lib (string-append out "/lib"))
|
||||||
(lambda (lib-name)
|
(libs (map
|
||||||
(string-append (assoc-ref inputs
|
(lambda (lib-name)
|
||||||
lib-name)
|
(string-append (assoc-ref inputs
|
||||||
"/lib"))
|
lib-name)
|
||||||
'("mesa" "pciutils"))))
|
"/lib"))
|
||||||
(wrap-program (car (find-files lib "^glxtest$"))
|
'("mesa" "pciutils"))))
|
||||||
`("LD_LIBRARY_PATH" prefix ,libs)))))
|
(wrap-program (car (find-files lib "^glxtest$"))
|
||||||
(add-after 'install 'patch-config
|
`("LD_LIBRARY_PATH" prefix ,libs)))))
|
||||||
(lambda* (#:key inputs #:allow-other-keys)
|
(add-after 'install 'patch-config
|
||||||
(let ((lib (string-append #$output "/lib/librewolf"))
|
(lambda* (#:key inputs #:allow-other-keys)
|
||||||
(config-file "librewolf.cfg"))
|
(let ((lib (string-append #$output "/lib/librewolf"))
|
||||||
|
(config-file "librewolf.cfg"))
|
||||||
|
|
||||||
;; Required for Guix packaged extensions
|
;; Required for Guix packaged extensions
|
||||||
;; SCOPE_PROFILE=1, SCOPE_APPLICATION=4, SCOPE_SYSTEM=8
|
;; SCOPE_PROFILE=1, SCOPE_APPLICATION=4, SCOPE_SYSTEM=8
|
||||||
;; Default is 5.
|
;; Default is 5.
|
||||||
(substitute* (in-vicinity lib config-file)
|
(substitute* (in-vicinity lib config-file)
|
||||||
(("defaultPref\\(\"extensions.enabledScopes\", 5\\)")
|
(("defaultPref\\(\"extensions.enabledScopes\", 5\\)")
|
||||||
"defaultPref(\"extensions.enabledScopes\", 13)"))
|
"defaultPref(\"extensions.enabledScopes\", 13)"))
|
||||||
;; Use Mozzarella addons repo.
|
;; Use Mozzarella addons repo.
|
||||||
(call-with-port
|
(call-with-port
|
||||||
(open-file
|
(open-file
|
||||||
(in-vicinity lib config-file)
|
(in-vicinity lib config-file)
|
||||||
"a")
|
"a")
|
||||||
(lambda (port)
|
(lambda (port)
|
||||||
;; Add-ons panel (see settings.js in Icecat source).
|
;; Add-ons panel (see settings.js in Icecat source).
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (pref)
|
(lambda (pref)
|
||||||
(format port
|
(format port
|
||||||
"defaultPref(~s, ~s);~%"
|
"defaultPref(~s, ~s);~%"
|
||||||
(car pref)
|
(car pref)
|
||||||
(cdr pref)))
|
(cdr pref)))
|
||||||
`(("extensions.getAddons.search.browseURL"
|
`(("extensions.getAddons.search.browseURL"
|
||||||
,(string-append
|
,(string-append
|
||||||
"https://gnuzilla.gnu.org/mozzarella/"
|
"https://gnuzilla.gnu.org/mozzarella/"
|
||||||
"search.php?q=%TERMS%"))
|
"search.php?q=%TERMS%"))
|
||||||
("extensions.getAddons.get.url" .
|
("extensions.getAddons.get.url" .
|
||||||
"https://gnuzilla.gnu.org/mozzarella")
|
"https://gnuzilla.gnu.org/mozzarella")
|
||||||
("extensions.getAddons.link.url" .
|
("extensions.getAddons.link.url" .
|
||||||
"https://gnuzilla.gnu.org/mozzarella")
|
"https://gnuzilla.gnu.org/mozzarella")
|
||||||
("extensions.getAddons.discovery.api_url" .
|
("extensions.getAddons.discovery.api_url" .
|
||||||
"https://gnuzilla.gnu.org/mozzarella")
|
"https://gnuzilla.gnu.org/mozzarella")
|
||||||
("extensions.getAddons.langpacks.url" .
|
("extensions.getAddons.langpacks.url" .
|
||||||
"https://gnuzilla.gnu.org/mozzarella")
|
"https://gnuzilla.gnu.org/mozzarella")
|
||||||
("lightweightThemes.getMoreURL" .
|
("lightweightThemes.getMoreURL" .
|
||||||
"https://gnuzilla.gnu.org/mozzarella"))))))))
|
"https://gnuzilla.gnu.org/mozzarella"))))))))
|
||||||
(add-after 'install 'wrap-program
|
(add-after 'install 'wrap-program
|
||||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||||
;; The following two functions are from Guix's icecat package in
|
;; The following two functions are from Guix's icecat package in
|
||||||
;; (gnu packages gnuzilla). See commit
|
;; (gnu packages gnuzilla). See commit
|
||||||
;; b7a0935420ee630a29b7e5ac73a32ba1eb24f00b.
|
;; b7a0935420ee630a29b7e5ac73a32ba1eb24f00b.
|
||||||
(define (runpath-of lib)
|
(define (runpath-of lib)
|
||||||
(call-with-input-file lib
|
(call-with-input-file lib
|
||||||
(compose elf-dynamic-info-runpath elf-dynamic-info
|
(compose elf-dynamic-info-runpath elf-dynamic-info
|
||||||
parse-elf get-bytevector-all)))
|
parse-elf get-bytevector-all)))
|
||||||
(define (runpaths-of-input label)
|
(define (runpaths-of-input label)
|
||||||
(let* ((dir (string-append (assoc-ref inputs label)
|
(let* ((dir (string-append (assoc-ref inputs label)
|
||||||
"/lib"))
|
"/lib"))
|
||||||
(libs (find-files dir "\\.so$")))
|
(libs (find-files dir "\\.so$")))
|
||||||
(append-map runpath-of libs)))
|
(append-map runpath-of libs)))
|
||||||
(let* ((out (assoc-ref outputs "out"))
|
(let* ((out (assoc-ref outputs "out"))
|
||||||
(lib (string-append out "/lib"))
|
(lib (string-append out "/lib"))
|
||||||
(libs (map
|
(libs (map
|
||||||
(lambda (lib-name)
|
(lambda (lib-name)
|
||||||
(string-append (assoc-ref inputs
|
(string-append (assoc-ref inputs
|
||||||
lib-name)
|
lib-name)
|
||||||
"/lib"))
|
"/lib"))
|
||||||
'("eudev" ; For U2F and WebAuthn
|
'("eudev" ; For U2F and WebAuthn
|
||||||
"libnotify"
|
"libnotify"
|
||||||
"libpng-apng"
|
"libpng-apng"
|
||||||
"libva"
|
"libva"
|
||||||
"mesa"
|
"mesa"
|
||||||
"pipewire" ; For sharing on Wayland
|
"pipewire" ; For sharing on Wayland
|
||||||
"pulseaudio")))
|
"pulseaudio")))
|
||||||
|
|
||||||
;; VA-API is run in the RDD (Remote Data Decoder) sandbox
|
;; VA-API is run in the RDD (Remote Data Decoder) sandbox
|
||||||
;; and must be explicitly given access to files it needs.
|
;; and must be explicitly given access to files it needs.
|
||||||
;; Rather than adding the whole store (as Nix had
|
;; Rather than adding the whole store (as Nix had
|
||||||
;; upstream do, see
|
;; upstream do, see
|
||||||
;; <https://github.com/NixOS/nixpkgs/pull/165964> and
|
;; <https://github.com/NixOS/nixpkgs/pull/165964> and
|
||||||
;; linked upstream patches), we can just follow the
|
;; linked upstream patches), we can just follow the
|
||||||
;; runpaths of the needed libraries to add everything to
|
;; runpaths of the needed libraries to add everything to
|
||||||
;; LD_LIBRARY_PATH. These will then be accessible in the
|
;; LD_LIBRARY_PATH. These will then be accessible in the
|
||||||
;; RDD sandbox.
|
;; RDD sandbox.
|
||||||
(rdd-whitelist
|
(rdd-whitelist
|
||||||
(map (cut string-append <> "/")
|
(map (cut string-append <> "/")
|
||||||
(delete-duplicates
|
(delete-duplicates
|
||||||
(append-map runpaths-of-input
|
(append-map runpaths-of-input
|
||||||
'("mesa"
|
'("mesa"
|
||||||
"ffmpeg")))))
|
"ffmpeg")))))
|
||||||
(gtk-share (string-append (assoc-ref inputs
|
(gtk-share (string-append (assoc-ref inputs
|
||||||
"gtk+")
|
"gtk+")
|
||||||
"/share")))
|
"/share")))
|
||||||
(wrap-program (car (find-files lib "^librewolf$"))
|
(wrap-program (car (find-files lib "^librewolf$"))
|
||||||
`("LD_LIBRARY_PATH" prefix
|
`("LD_LIBRARY_PATH" prefix
|
||||||
(,@libs ,@rdd-whitelist))
|
(,@libs ,@rdd-whitelist))
|
||||||
`("XDG_DATA_DIRS" prefix
|
`("XDG_DATA_DIRS" prefix
|
||||||
(,gtk-share))
|
(,gtk-share))
|
||||||
`("MOZ_LEGACY_PROFILES" =
|
`("MOZ_LEGACY_PROFILES" =
|
||||||
("1"))
|
("1"))
|
||||||
`("MOZ_ALLOW_DOWNGRADE" =
|
`("MOZ_ALLOW_DOWNGRADE" =
|
||||||
("1"))))))
|
("1"))))))
|
||||||
(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
|
(let* ((desktop-file
|
||||||
"toolkit/mozapps/installer/linux/rpm/mozilla.desktop")
|
"toolkit/mozapps/installer/linux/rpm/mozilla.desktop")
|
||||||
(applications (string-append #$output
|
(applications (string-append #$output
|
||||||
"/share/applications")))
|
"/share/applications")))
|
||||||
(substitute* desktop-file
|
(substitute* desktop-file
|
||||||
(("^Exec=@MOZ_APP_NAME@")
|
(("^Exec=@MOZ_APP_NAME@")
|
||||||
(string-append "Exec="
|
(string-append "Exec="
|
||||||
#$output "/bin/librewolf %u"))
|
#$output "/bin/librewolf %u"))
|
||||||
(("@MOZ_APP_DISPLAYNAME@")
|
(("@MOZ_APP_DISPLAYNAME@")
|
||||||
"LibreWolf")
|
"LibreWolf")
|
||||||
(("@MOZ_APP_REMOTINGNAME@")
|
(("@MOZ_APP_REMOTINGNAME@")
|
||||||
"LibreWolf")
|
"LibreWolf")
|
||||||
(("^Icon=@MOZ_APP_NAME@")
|
(("^Icon=@MOZ_APP_NAME@")
|
||||||
(string-append "Icon="
|
(string-append "Icon="
|
||||||
#$output
|
#$output
|
||||||
"/share/icons/hicolor/128x128/apps/librewolf.png")))
|
"/share/icons/hicolor/128x128/apps/librewolf.png")))
|
||||||
|
|
||||||
(copy-file desktop-file "librewolf.desktop")
|
(copy-file desktop-file "librewolf.desktop")
|
||||||
(install-file "librewolf.desktop" applications))))
|
(install-file "librewolf.desktop" applications))))
|
||||||
(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 ((icon-source-dir (string-append #$output
|
(let ((icon-source-dir (string-append #$output
|
||||||
"/lib/librewolf/browser/"
|
"/lib/librewolf/browser/"
|
||||||
"chrome/icons/default")))
|
"chrome/icons/default")))
|
||||||
(for-each (lambda (size)
|
(for-each (lambda (size)
|
||||||
(let ((dest (string-append #$output
|
(let ((dest (string-append #$output
|
||||||
"/share/icons/hicolor/"
|
"/share/icons/hicolor/"
|
||||||
size
|
size
|
||||||
"x"
|
"x"
|
||||||
size
|
size
|
||||||
"/apps")))
|
"/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
|
(string-append dest
|
||||||
"/librewolf.png"))))
|
"/librewolf.png"))))
|
||||||
'("16" "32" "48" "64" "128"))))))
|
'("16" "32" "48" "64" "128"))))))
|
||||||
|
|
||||||
;; Test will significantly increase build time but with little rewards.
|
;; Test will significantly increase build time but with little rewards.
|
||||||
#:tests? #f
|
#:tests? #f
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue