projects/guix·blob ruby-team · refs

709 lines · 30.0 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013, 2015, 2024 Andreas Enge <[email protected]>
3;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <[email protected]>
4;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Mark H Weaver <[email protected]>
5;;; Copyright © 2015 Sou Bunnbu <[email protected]>
6;;; Copyright © 2016, 2017, 2018, 2019 Efraim Flashner <[email protected]>
7;;; Copyright © 2016 Alex Griffin <[email protected]>
8;;; Copyright © 2017, 2025 Clément Lassieur <[email protected]>
9;;; Copyright © 2017, 2018 Nikita <[email protected]>
10;;; Copyright © 2017, 2018 ng0 <[email protected]>
11;;; Copyright © 2017, 2018, 2020 Tobias Geerinckx-Rice <[email protected]>
12;;; Copyright © 2018, 2020, 2022 Ricardo Wurmus <[email protected]>
13;;; Copyright © 2019 Ivan Petkov <[email protected]>
14;;; Copyright © 2020 Oleg Pykhalov <[email protected]>
15;;; Copyright © 2020 Jakub Kądziołka <[email protected]>
16;;; Copyright © 2019, 2020 Adrian Malacoda <[email protected]>
17;;; Copyright © 2020-2023 Jonathan Brielmaier <[email protected]>
18;;; Copyright © 2020 Zhu Zihao <[email protected]>
19;;; Copyright © 2021 pineapples <[email protected]>
20;;; Copyright © 2021 Brice Waegeneire <[email protected]>
21;;; Copyright © 2021, 2022, 2023 John Kehayias <[email protected]>
22;;; Copyright © 2022 Pierre Langlois <[email protected]>
23;;; Copyright © 2023 Tomas Volf <[email protected]>
24;;; Copyright © 2023, 2024, 2025 Ian Eure <[email protected]>
25;;; Copyright © 2024 Remco van 't Veer <[email protected]>
26;;; Copyright © 2024 Ashvith Shetty <[email protected]>
27;;; Copyright © 2025, 2026 Untrusem <[email protected]>
28;;;
29;;; This file is part of GNU Guix.
30;;;
31;;; GNU Guix is free software; you can redistribute it and/or modify it
32;;; under the terms of the GNU General Public License as published by
33;;; the Free Software Foundation; either version 3 of the License, or (at
34;;; your option) any later version.
35;;;
36;;; GNU Guix is distributed in the hope that it will be useful, but
37;;; WITHOUT ANY WARRANTY; without even the implied warranty of
38;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39;;; GNU General Public License for more details.
40;;;
41;;; You should have received a copy of the GNU General Public License
42;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
43
44(define-module (gnu packages librewolf)
45 #:use-module ((srfi srfi-1) #:hide (zip))
46 #:use-module (guix build-system gnu)
47 #:use-module (guix build-system cargo)
48 #:use-module (guix build-system trivial)
49 #:use-module (guix download)
50 #:use-module (guix git-download)
51 #:use-module ((guix licenses) #:prefix license:)
52 #:use-module (guix gexp)
53 #:use-module (guix packages)
54 #:use-module (guix utils)
55 #:use-module ((guix build utils) #:select (alist-replace))
56
57 #:use-module (gnu packages)
58 #:use-module (gnu packages assembly)
59 #:use-module (gnu packages autotools)
60 #:use-module (gnu packages base)
61 #:use-module (gnu packages bash)
62 #:use-module (gnu packages compression)
63 #:use-module (gnu packages cups)
64 #:use-module (gnu packages fontutils)
65 #:use-module (gnu packages gl)
66 #:use-module (gnu packages glib)
67 #:use-module (gnu packages gnome)
68 #:use-module (gnu packages gnuzilla)
69 #:use-module (gnu packages gtk)
70 #:use-module (gnu packages hunspell)
71 #:use-module (gnu packages icu4c)
72 #:use-module (gnu packages image)
73 #:use-module (gnu packages jemalloc)
74 #:use-module (gnu packages kerberos)
75 #:use-module (gnu packages libcanberra)
76 #:use-module (gnu packages libevent)
77 #:use-module (gnu packages libffi)
78 #:use-module (gnu packages linux)
79 #:use-module (gnu packages llvm)
80 #:use-module (gnu packages m4)
81 #:use-module (gnu packages node)
82 #:use-module (gnu packages nss)
83 #:use-module (gnu packages pciutils)
84 #:use-module (gnu packages perl)
85 #:use-module (gnu packages pkg-config)
86 #:use-module (gnu packages pulseaudio)
87 #:use-module (gnu packages python)
88 #:use-module (gnu packages python-xyz)
89 #:use-module (gnu packages rust)
90 #:use-module (gnu packages rust-apps)
91 #:use-module (gnu packages speech)
92 #:use-module (gnu packages sqlite)
93 #:use-module (gnu packages video)
94 #:use-module (gnu packages xdisorg)
95 #:use-module (gnu packages xorg))
96
97(define (firefox-source-origin version hash)
98 (origin
99 (method url-fetch)
100 (uri (string-append
101 "https://ftp.mozilla.org/pub/firefox/releases/"
102 version "/source/" "firefox-" version
103 ".source.tar.xz"))
104 (sha256 (base32 hash))))
105
106(define (librewolf-source-origin version hash)
107 (origin
108 (method git-fetch)
109 (uri (git-reference
110 (url "https://librewolf.dev/librewolf/source.git")
111 (commit version)
112 (recursive? #t)))
113 (file-name (git-file-name "librewolf-source" version))
114 (patches (search-patches "librewolf-neuter-locale-download.patch"))
115 (sha256 (base32 hash))))
116
117(define computed-origin-method (@@ (guix packages) computed-origin-method))
118
119(define firefox-l10n
120 ;; Match this commit to the upstream tarball. The hash is in
121 ;; firefox-NNN.0/browser/locales/l10n-changesets.json
122 ;; The hash repeasts for every language, but should be the same for
123 ;; everything.
124 ;;
125 ;; ex:
126 ;; tar xf /gnu/store/...-firefox-123.4.source.tar.xz --wildcards -O \
127 ;; firefox-*/browser/locales/l10n-changesets.json \
128 ;; | grep revision | sort | uniq
129 (let ((commit "25feb12abf0f49b24210a9a6b76dcd4bca9d05bb"))
130 (origin
131 (method git-fetch)
132 (uri (git-reference
133 (url "https://github.com/mozilla-l10n/firefox-l10n.git")
134 (commit commit)))
135 (file-name (git-file-name "firefox-l10n" commit))
136 (sha256 (base32 "11g5k7frjmkrg2qvhf33a27dz5pj0hi5m0bnvarc83qdwdxh3s8d")))))
137
138(define* (make-librewolf-source #:key version firefox-hash librewolf-hash l10n)
139 (let* ((ff-src (firefox-source-origin
140 (car (string-split version #\-))
141 firefox-hash))
142 (lw-src (librewolf-source-origin
143 version
144 librewolf-hash)))
145
146 (origin
147 (method computed-origin-method)
148 (file-name (string-append "librewolf-" version ".source.tar.gz"))
149 (sha256 #f)
150 (uri
151 (delay
152 (with-imported-modules '((guix build utils))
153 #~(begin
154 (use-modules (guix build utils))
155 (set-path-environment-variable
156 "PATH" '("bin")
157 (list #+python
158 #+(canonical-package bash)
159 #+(canonical-package gnu-make)
160 #+(canonical-package coreutils)
161 #+(canonical-package findutils)
162 #+(canonical-package patch)
163 #+(canonical-package xz)
164 #+(canonical-package sed)
165 #+(canonical-package grep)
166 #+(canonical-package pigz)
167 #+(canonical-package tar)))
168 (set-path-environment-variable
169 "PYTHONPATH"
170 (list #+(format #f "lib/python~a/site-packages"
171 (version-major+minor
172 (package-version python))))
173 '#+(cons python-jsonschema
174 (map second
175 (package-transitive-propagated-inputs
176 python-jsonschema))))
177
178 ;; Copy LibreWolf source into the build directory and make
179 ;; everything writable.
180 (copy-recursively #+lw-src ".")
181 (for-each make-file-writable (find-files "."))
182
183 ;; Patch Makefile to use the upstream source instead of
184 ;; downloading.
185 (substitute* '("Makefile")
186 (("^(ff_source_tarball *:= *).*" _ var)
187 (string-append var #+ff-src)))
188
189 ;; Neuter GPG signing of the tarball.
190 (substitute* '("Makefile")
191 (("if [ -f pk.asc ].*") ""))
192
193 ;; Stage locales.
194 (begin
195 (substitute* "scripts/librewolf-patches.py"
196 (("l10n_dir = Path(\"..\", \"l10n\")")
197 (string-append
198 "l10n_dir = \"" #+l10n "\""))))
199
200 ;; Run the build script
201 (invoke "make" "all")
202 (copy-file (string-append "librewolf-" #$version
203 ".source.tar.gz")
204 #$output)))))
205 (patches
206 (search-patches
207 "librewolf-compare-paths.patch"
208 "librewolf-use-system-wide-dir.patch"
209 "librewolf-add-store-to-rdd-allowlist.patch"))
210 ;; Slim down the tarball by removing unbundled libraries and 75 Mo (800+
211 ;; Mo uncompressed) of unused tests.
212 ;; TODO: Unbundle security/nss and media/libpng.
213 (modules '((guix build utils)))
214 (snippet
215 #~(for-each delete-file-recursively
216 '("testing/web-platform"
217 "gfx/cairo/libpixman"
218 "js/src/ctypes/libffi"
219 "ipc/chromium/src/third_party/libevent"
220 "media/libvpx"
221 "docs/nspr"
222 "media/libwebp"
223 "modules/zlib"))))))
224
225;; Needed for the .desktop.in file used in librewolf's 'install-desktop-entry
226(define librewolf-bsys6
227 (let ((commit "274e39ee40592f8bc6ca5d4ee699ec74aeeab983"))
228 (origin
229 (method git-fetch)
230 (uri (git-reference
231 (url "https://librewolf.dev/librewolf/bsys6.git")
232 (commit commit)))
233 (file-name (git-file-name "librewolf-bsys6" commit))
234 (sha256 (base32 "15a2j1r5xrxvb9vr55138canwaj44nswzsfjsvsjspwnirgrn91z")))))
235
236;;; Define the versions of rust needed to build Firefox, trying to match
237;;; upstream. See table at [0], `Uses' column for the specific version.
238;;; Using `rust' will likely lead to a newer version then listed in the table,
239;;; but since in Guix only the latest packaged Rust is officially supported,
240;;; it is a tradeoff worth making.
241;;; 0: https://firefox-source-docs.mozilla.org/writing-rust-code/update-policy.html
242(define rust-librewolf rust-1.94)
243
244;; Update this id with every update to its release date.
245;; It's used for cache validation and therefore can lead to strange bugs.
246;; ex: date '+%Y%m%d%H%M%S'
247;; or: (format-time-string "%Y%m%d%H%M%S")
248(define %librewolf-build-id "20260818200615")
249
250(define-public librewolf
251 (package
252 (name "librewolf")
253 (version "154.0-2")
254 (source
255 (make-librewolf-source
256 #:version version
257 #:firefox-hash "16mrk2s6rbdfarq5ixk67kh893srbghsxp10dn5gfq4ad2rwbkin"
258 #:librewolf-hash "1klhkgjx637r38y9d8igjy8hlhgvh5kk2arx817yyi3s773gif97"
259 #:l10n firefox-l10n))
260 (build-system gnu-build-system)
261 (arguments
262 (list
263 #:configure-flags
264 #~(let ((clang #$(this-package-native-input "clang")))
265 ;; Configuration.
266 `("--enable-jemalloc"
267 "--enable-system-pixman"
268 "--with-system-ffi"
269 "--with-system-icu"
270 "--with-system-jpeg"
271 "--with-system-libevent"
272 "--with-system-libvpx"
273 "--with-system-nspr"
274 "--with-system-nss"
275 "--with-system-png"
276 "--with-system-webp"
277 "--with-system-zlib"
278 "--without-wasm-sandboxed-libraries"
279
280 ,(string-append "--with-clang-path=" clang
281 "/bin/clang")
282 ,(string-append "--with-libclang-path=" clang
283 "/lib")
284
285 ;; Distribution
286 "--with-distribution-id=org.guix"
287
288 ;; Features
289 "--enable-pulseaudio"
290
291 ;; switch only available on x86, whereas EME is not supported on
292 ;; other targets
293 ,@(if #$(target-x86?) '("--disable-eme") '())
294
295 ;; Build details
296 "--disable-elf-hack"
297 "--enable-strip"
298 ;; Don't attempt to download toolchains. Upstream enables this,
299 ;; adding the flag ensures we don't use network in the build
300 ;; environment.
301 "--disable-bootstrap"))
302 #:imported-modules %cargo-utils-modules
303 #:modules `((ice-9 regex)
304 (ice-9 string-fun)
305 (ice-9 ftw)
306 (srfi srfi-1)
307 (srfi srfi-26)
308 (rnrs bytevectors)
309 (rnrs io ports)
310 (guix elf)
311 (guix build gremlin)
312 ,@%default-gnu-imported-modules)
313 #:phases
314 #~(modify-phases %standard-phases
315 (add-after 'unpack 'fix-ffmpeg-runtime-linker
316 (lambda* (#:key inputs #:allow-other-keys)
317 (let* ((ffmpeg (assoc-ref inputs "ffmpeg"))
318 (libavcodec (string-append ffmpeg
319 "/lib/libavcodec.so")))
320 ;; Arrange to load libavcodec.so by its absolute file name.
321 (substitute*
322 "dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp"
323 (("libavcodec\\.so")
324 libavcodec)))))
325 (add-after 'unpack 'neuter-genai
326 (lambda* _
327 ;; Lock the preferences so they can't be enabled.
328 (substitute* "lw/librewolf.cfg"
329 (("defaultPref\\(\"browser\\.ml\\.")
330 "lockPref(\"browser.ml."))))
331 (add-after 'unpack 'expand-extension-scope
332 (lambda* _
333 ;; Required for Guix packaged extensions
334 ;; SCOPE_PROFILE=1, SCOPE_APPLICATION=4, SCOPE_SYSTEM=8
335 ;; Default is 5.
336 (substitute* "lw/librewolf.cfg"
337 (("defaultPref\\(\"extensions.enabledScopes\", 5\\)")
338 "defaultPref(\"extensions.enabledScopes\", 13)"))))
339 (add-after 'unpack 'use-mozzarella
340 (lambda _
341 (substitute*
342 "toolkit/locales/en-US/toolkit/about/aboutAddons.ftl"
343 (("addons.mozilla.org")
344 "gnuzilla.gnu.org"))
345 (call-with-port (open-file "lw/librewolf.cfg" "a")
346 (lambda (port)
347 ;; Add-ons panel (see settings.js in Icecat source).
348 (for-each
349 (lambda (pref)
350 (format port
351 "defaultPref(~s, ~s);~%"
352 (car pref)
353 (cdr pref)))
354 `(("extensions.getAddons.search.browseURL"
355 ,(string-append
356 "https://gnuzilla.gnu.org/"
357 "search.php?q=%TERMS%"))
358 ("extensions.getAddons.get.url" .
359 "https://gnuzilla.gnu.org")
360 ("extensions.getAddons.link.url" .
361 "https://gnuzilla.gnu.org")
362 ("extensions.getAddons.discovery.api_url" .
363 "https://gnuzilla.gnu.org")
364 ("extensions.getAddons.langpacks.url" .
365 "https://gnuzilla.gnu.org")
366 ("lightweightThemes.getMoreURL" .
367 "https://gnuzilla.gnu.org")))))))
368 (add-after 'patch-source-shebangs 'patch-cargo-checksums
369 (lambda _
370 (use-modules (guix build cargo-utils))
371 (let ((null-hash
372 ;; This is the SHA256 output of an empty string.
373 (string-append
374 "e3b0c44298fc1c149afbf4c8996fb924"
375 "27ae41e4649b934ca495991b7852b855")))
376 (for-each
377 (lambda (file)
378 (format #t
379 "patch-cargo-checksums: patching checksums in ~a~%"
380 file)
381 (substitute* file
382 (("(checksum = )\".*\"" all name)
383 (string-append name "\"" null-hash
384 "\""))))
385 (find-files "." "Cargo\\.lock$"))
386 (for-each generate-all-checksums
387 '("build"
388 "dom/media"
389 "dom/webauthn"
390 "gfx"
391 "intl"
392 "js"
393 "media"
394 "modules"
395 "mozglue/static/rust"
396 "netwerk"
397 "remote"
398 "security/manager/ssl"
399 "servo"
400 "storage"
401 "third_party/rust"
402 "toolkit"
403 "xpcom/rust"
404 "services")))))
405 (add-after 'patch-cargo-checksums 'remove-cargo-frozen-flag
406 (lambda _
407 ;; Remove --frozen flag from cargo invocation, otherwise it'll
408 ;; complain that it's not able to change Cargo.lock.
409 ;; https://bugzilla.mozilla.org/show_bug.cgi?id=1726373
410 (substitute* "build/RunCbindgen.py"
411 (("args.append\\(\"--frozen\"\\)") "pass"))))
412 (delete 'bootstrap)
413 (add-before 'configure 'patch-SpeechDispatcherService.cpp
414 (lambda _
415 (let* ((lib "libspeechd.so.2")
416 (file (string-append
417 "dom/media/webspeech/synth/"
418 "speechd/SpeechDispatcherService.cpp"))
419 (old-content (call-with-input-file file
420 get-string-all)))
421 (substitute
422 file
423 `((,(format #f "~s" lib) unquote
424 (lambda (line _)
425 (string-replace-substring
426 line lib
427 (string-append #$speech-dispatcher
428 "/lib/" lib))))))
429 (if (string=? old-content
430 (call-with-input-file file
431 get-string-all))
432 (error
433 "substitute did nothing, phase requires an update")))))
434 (add-before 'configure 'set-build-id
435 ;; Build will write the timestamp to output, which is harmful
436 ;; for reproducibility, so change it to a fixed date. Use a
437 ;; separate phase for easier modification with inherit.
438 (lambda _
439 (setenv "MOZ_BUILD_DATE"
440 #$%librewolf-build-id)))
441 (replace 'configure
442 (lambda* (#:key inputs outputs configure-flags
443 #:allow-other-keys)
444 (setenv "AUTOCONF"
445 (string-append (assoc-ref inputs "autoconf")
446 "/bin/autoconf"))
447 (setenv "SHELL"
448 (which "bash"))
449 (setenv "CONFIG_SHELL"
450 (which "bash"))
451 (setenv "MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE"
452 "system")
453 (setenv "LANG" "en_US.utf8")
454 ;; This should use the host info probably (does it
455 ;; build on non-x86_64 though?)
456 (setenv "GUIX_PYTHONPATH"
457 (string-append
458 (getcwd)
459 "/obj-x86_64-pc-linux-gnu/_virtualenvs/build"))
460
461 ;; Use Clang, Clang is 2x faster than GCC
462 (setenv "AR" "llvm-ar")
463 (setenv "NM" "llvm-nm")
464 (setenv "CC" "clang")
465 (setenv "CXX" "clang++")
466 (setenv "MOZ_NOSPAM" "1")
467 (setenv "MOZ_APP_REMOTINGNAME" "LibreWolf")
468 (setenv "MOZ_APP_NAME" "librewolf")
469
470 (setenv "MOZBUILD_STATE_PATH"
471 (getcwd))
472
473 (let* ((mozconfig (string-append (getcwd) "/mozconfig"))
474 (out (assoc-ref outputs "out"))
475 (flags (cons (string-append "--prefix=" out)
476 configure-flags)))
477 (format #t "build directory: ~s~%"
478 (getcwd))
479 (format #t "configure flags: ~s~%" flags)
480
481 (call-with-port (open-file mozconfig "a")
482 (lambda (port)
483 (format port "~%## Guix-specific options ##~%~%")
484 (for-each
485 (lambda (flag) (format port "ac_add_options ~a\n" flag))
486 flags)
487 (display "\n" port)))
488 (setenv "MOZCONFIG" mozconfig))
489 (invoke "./mach" "configure")))
490 (replace 'build
491 (lambda* (#:key (make-flags '())
492 (parallel-build? #t) #:allow-other-keys)
493 (apply invoke "./mach" "build"
494 ;; mach will use parallel build if possible by default
495 (string-append
496 "-j" (if parallel-build?
497 (number->string (parallel-job-count))
498 "1"))
499 make-flags)))
500 (add-after 'build 'neutralise-store-references
501 (lambda _
502 ;; Mangle the store references to compilers &
503 ;; other build tools in about:buildconfig,
504 ;; reducing the package's closure by 1 GiB on
505 ;; x86-64.
506 (let* ((build-dir (car (scandir "."
507 (cut string-prefix?
508 "obj-" <>))))
509 (file (string-append build-dir
510 "/dist/bin/chrome/toolkit/"
511 "content/global/buildconfig.html")))
512 (substitute* file
513 (((format #f "(~a/)([0-9a-df-np-sv-z]{32})"
514 (regexp-quote (%store-directory)))
515 _ store hash)
516 (string-append store
517 (string-take hash 8)
518 "<!-- Guix: not a runtime dependency -->"
519 (string-drop hash 8)))))))
520 (replace 'install
521 (lambda _
522 (invoke "./mach" "install")))
523 (add-after 'install 'remove-duplicate-bin
524 (lambda* (#:key outputs #:allow-other-keys)
525 (delete-file (string-append #$output
526 "/lib/librewolf/librewolf-bin"))))
527 (add-after 'install 'wrap-glxtest
528 ;; glxtest uses dlopen() to load mesa and pci
529 ;; libs, wrap it to set LD_LIBRARY_PATH.
530 (lambda* (#:key inputs outputs #:allow-other-keys)
531 (let* ((out (assoc-ref outputs "out"))
532 (lib (string-append out "/lib"))
533 (libs (map
534 (lambda (lib-name)
535 (string-append (assoc-ref inputs
536 lib-name)
537 "/lib"))
538 '("mesa" "pciutils"))))
539 (wrap-program (car (find-files lib "^glxtest$"))
540 `("LD_LIBRARY_PATH" prefix ,libs)))))
541 (add-after 'install 'wrap-program
542 (lambda* (#:key inputs outputs #:allow-other-keys)
543 ;; The following two functions are from Guix's icecat package in
544 ;; (gnu packages gnuzilla). See commit
545 ;; b7a0935420ee630a29b7e5ac73a32ba1eb24f00b.
546 (define (runpath-of lib)
547 (call-with-input-file lib
548 (compose elf-dynamic-info-runpath elf-dynamic-info
549 parse-elf get-bytevector-all)))
550 (define (runpaths-of-input label)
551 (let* ((dir (string-append (assoc-ref inputs label)
552 "/lib"))
553 (libs (find-files dir "\\.so$")))
554 (append-map runpath-of libs)))
555 (let* ((out (assoc-ref outputs "out"))
556 (lib (string-append out "/lib"))
557 (libs (map
558 (lambda (lib-name)
559 (string-append (assoc-ref inputs
560 lib-name)
561 "/lib"))
562 '("eudev" ; For U2F and WebAuthn
563 "libnotify"
564 "libpng-apng"
565 "libva"
566 "mesa"
567 "pipewire" ; For sharing on Wayland
568 "pulseaudio"
569 "libpciaccess")))
570
571 (gtk-share (string-append (assoc-ref inputs
572 "gtk+")
573 "/share")))
574 (wrap-program (car (find-files lib "^librewolf$"))
575 `("LD_LIBRARY_PATH" prefix ,libs)
576 `("XDG_DATA_DIRS" prefix
577 (,gtk-share))
578 `("MOZ_LEGACY_PROFILES" =
579 ("1"))
580 `("MOZ_ALLOW_DOWNGRADE" =
581 ("1"))))))
582 (add-after 'wrap-program 'install-desktop-entry
583 (lambda* (#:key inputs outputs #:allow-other-keys)
584 (let* ((desktop-file-name "librewolf.desktop")
585 (desktop-file-template
586 (search-input-file inputs "assets/linux.librewolf.desktop.in"))
587 (applications (string-append #$output
588 "/share/applications")))
589 (copy-file desktop-file-template desktop-file-name)
590 (substitute* desktop-file-name
591 (("MYDIR/librewolf")
592 (string-append #$output "/bin/librewolf"))
593 (("^Icon=librewolf")
594 (string-append "Icon="
595 #$output
596 "/share/icons/hicolor/128x128/apps/librewolf.png")))
597 (install-file desktop-file-name applications))))
598 (add-after 'install-desktop-entry 'install-icons
599 (lambda* (#:key outputs #:allow-other-keys)
600 (let ((icon-source-dir (string-append #$output
601 "/lib/librewolf/browser/"
602 "chrome/icons/default")))
603 (for-each (lambda (size)
604 (let ((dest (string-append #$output
605 "/share/icons/hicolor/"
606 size
607 "x"
608 size
609 "/apps")))
610 (mkdir-p dest)
611 (symlink (string-append icon-source-dir
612 "/default" size ".png")
613 (string-append dest
614 "/librewolf.png"))))
615 '("16" "32" "48" "64" "128")))))
616 ;; Make sure ICECAT_SYSTEM_DIR is set to avoid issues with Native
617 ;; Messaging and non-guix add-ons.
618 (add-after 'install-icons 'mkdir-lib-icecat
619 (lambda _
620 (mkdir-p (string-append #$output "/lib/icecat")))))
621
622 ;; Test will significantly increase build time but with little rewards.
623 #:tests? #f
624
625 ;; WARNING: Parallel build will consume lots of memory!
626 ;; If you have encountered OOM issue in build phase, try disable it.
627 #:parallel-build? #t
628
629 ;; Some dynamic lib was determined at runtime, so rpath check may fail.
630 #:validate-runpath? #f))
631 (inputs (list bash-minimal
632 bzip2
633 cairo
634 cups
635 dbus-glib
636 freetype
637 ffmpeg-6
638 gdk-pixbuf
639 glib
640 gtk+
641 gtk+-2
642 hunspell
643 icu4c-78
644 jemalloc
645 libcanberra
646 libevent
647 libffi
648 libgnome
649 libjpeg-turbo
650 libnotify
651 libpciaccess
652 libpng-apng-next
653 libva
654 libvpx
655 libwebp
656 libxcomposite
657 libxft
658 libxinerama
659 libxscrnsaver
660 libxt
661 mesa
662 mit-krb5
663 nspr
664 nss-rapid
665 pango
666 pciutils
667 pipewire
668 pixman
669 pulseaudio
670 speech-dispatcher
671 sqlite
672 startup-notification
673 eudev
674 unzip
675 zip
676 zlib))
677 (native-inputs
678 (list
679 alsa-lib
680 autoconf-2.13
681 clang-21
682 librewolf-bsys6
683 llvm-21
684 m4
685 nasm
686 node-lts
687 perl
688 pkg-config
689 python
690 rust-cbindgen-0.29
691 rust-librewolf
692 `(,rust-librewolf "cargo")
693 which
694 yasm))
695 (native-search-paths
696 (list (search-path-specification
697 (variable "ICECAT_SYSTEM_DIR")
698 (separator #f) ;single entry
699 (files '("lib/icecat")))))
700 (home-page "https://librewolf.net/")
701 (synopsis
702 "Custom version of Firefox, focused on privacy, security and freedom")
703 (description
704 "LibreWolf is designed to increase protection against tracking and
705fingerprinting techniques, while also including a few security improvements.
706This is achieved through our privacy and security oriented settings and
707patches. LibreWolf also aims to remove all the telemetry, data collection and
708annoyances, as well as disabling anti-freedom features like DRM.")
709 (license license:mpl2.0)))