b2e0870fea88f1a99dce36403cce76e680835024
[jackhill/guix/guix.git] / gnu / packages / gnuzilla.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
4 ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
6 ;;; Copyright © 2016, 2017, 2018, 2019, 2021 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
8 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
9 ;;; Copyright © 2017, 2018 Nikita <nikita@n0.is>
10 ;;; Copyright © 2017, 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
11 ;;; Copyright © 2018, 2020 Ricardo Wurmus <rekado@elephly.net>
12 ;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com>
13 ;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
14 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
15 ;;; Copyright © 2019, 2020 Adrian Malacoda <malacoda@monarch-pass.net>
16 ;;; Copyright © 2020, 2021, 2022 Jonathan Brielmaier <jonathan.brielmaier@web.de>
17 ;;; Copyright © 2020, 2022 Marius Bakke <marius@gnu.org>
18 ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
19 ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
20 ;;; Copyright © 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
21 ;;; Copyright © 2021 Baptiste Strazzul <bstrazzull@hotmail.fr>
22 ;;;
23 ;;; This file is part of GNU Guix.
24 ;;;
25 ;;; GNU Guix is free software; you can redistribute it and/or modify it
26 ;;; under the terms of the GNU General Public License as published by
27 ;;; the Free Software Foundation; either version 3 of the License, or (at
28 ;;; your option) any later version.
29 ;;;
30 ;;; GNU Guix is distributed in the hope that it will be useful, but
31 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
32 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 ;;; GNU General Public License for more details.
34 ;;;
35 ;;; You should have received a copy of the GNU General Public License
36 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
37
38 (define-module (gnu packages gnuzilla)
39 #:use-module ((srfi srfi-1) #:hide (zip))
40 #:use-module (ice-9 match)
41 #:use-module (gnu packages)
42 #:use-module ((guix licenses) #:prefix license:)
43 #:use-module (guix packages)
44 #:use-module (guix download)
45 #:use-module (guix git-download)
46 #:use-module (guix hg-download)
47 #:use-module (guix gexp)
48 #:use-module (guix store)
49 #:use-module (guix monads)
50 #:use-module (guix utils)
51 #:use-module (guix build-system gnu)
52 #:use-module (guix build-system cargo)
53 #:use-module (guix build-system trivial)
54 #:use-module (gnu packages admin)
55 #:use-module (gnu packages audio)
56 #:use-module (gnu packages autotools)
57 #:use-module (gnu packages m4)
58 #:use-module (gnu packages base)
59 #:use-module (gnu packages bash)
60 #:use-module (gnu packages databases)
61 #:use-module (gnu packages glib)
62 #:use-module (gnu packages gtk)
63 #:use-module (gnu packages gnome)
64 #:use-module (gnu packages libcanberra)
65 #:use-module (gnu packages cups)
66 #:use-module (gnu packages kerberos)
67 #:use-module (gnu packages linux)
68 #:use-module (gnu packages perl)
69 #:use-module (gnu packages pkg-config)
70 #:use-module (gnu packages compression)
71 #:use-module (gnu packages fontutils)
72 #:use-module (gnu packages fonts)
73 #:use-module (gnu packages hunspell)
74 #:use-module (gnu packages libevent)
75 #:use-module (gnu packages image)
76 #:use-module (gnu packages libffi)
77 #:use-module (gnu packages pulseaudio)
78 #:use-module (gnu packages python)
79 #:use-module (gnu packages python-xyz)
80 #:use-module (gnu packages node)
81 #:use-module (gnu packages xorg)
82 #:use-module (gnu packages gl)
83 #:use-module (gnu packages pciutils)
84 #:use-module (gnu packages assembly)
85 #:use-module (gnu packages rust)
86 #:use-module (gnu packages rust-apps)
87 #:use-module (gnu packages llvm)
88 #:use-module (gnu packages nss)
89 #:use-module (gnu packages icu4c)
90 #:use-module (gnu packages video)
91 #:use-module (gnu packages xiph)
92 #:use-module (gnu packages xdisorg)
93 #:use-module (gnu packages readline)
94 #:use-module (gnu packages sqlite))
95
96 (define-public mozjs
97 (package
98 (name "mozjs")
99 (version "102.2.0")
100 (source (origin
101 (method url-fetch)
102 ;; TODO: Switch to IceCat source once available on ftp.gnu.org.
103 (uri (string-append "https://ftp.mozilla.org/pub/firefox"
104 "/releases/" version "esr/source/firefox-"
105 version "esr.source.tar.xz"))
106 (sha256
107 (base32
108 "1zwpgis7py1bf8p88pz3mpai6a02qrdb8ww2fa9kxxdl9b8r2k81"))))
109 (build-system gnu-build-system)
110 (arguments
111 (list
112 #:imported-modules %cargo-utils-modules ;for `generate-all-checksums'
113 #:modules `((guix build cargo-utils)
114 ,@%gnu-build-system-modules)
115 #:test-target "check-jstests"
116 #:configure-flags
117 #~(list
118 ;; Disable debugging symbols to save space.
119 "--disable-debug"
120 "--disable-debug-symbols"
121 ;; This is important because without it gjs will segfault during the
122 ;; configure phase. With jemalloc only the standalone mozjs console
123 ;; will work.
124 "--disable-jemalloc"
125 "--enable-tests"
126 "--enable-hardening"
127 "--enable-optimize"
128 "--enable-release"
129 "--enable-readline"
130 "--enable-shared-js"
131 "--with-system-icu"
132 "--with-system-nspr"
133 "--with-system-zlib"
134 "--with-intl-api")
135 #:phases
136 #~(modify-phases %standard-phases
137 (add-after 'patch-source-shebangs 'patch-cargo-checksums
138 (lambda _
139 (let ((null-hash
140 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))
141 (for-each (lambda (file)
142 (format #t "patching checksums in ~a~%" file)
143 (substitute* file
144 (("^checksum = \".*\"")
145 (string-append "checksum = \"" null-hash "\""))))
146 (find-files "." "Cargo\\.lock$"))
147 (for-each generate-all-checksums
148 '("js" "third_party/rust")))))
149 (replace 'configure
150 (lambda* (#:key configure-flags #:allow-other-keys)
151 ;; The configure script does not accept environment variables as
152 ;; arguments. It also must be run from a different directory,
153 ;; but not the root directory either.
154 (mkdir "run-configure-from-here")
155 (chdir "run-configure-from-here")
156 (setenv "SHELL" (which "sh"))
157 (setenv "CONFIG_SHELL" (which "sh"))
158 (setenv "AUTOCONF" (which "autoconf"))
159 (apply invoke "python" "../configure.py"
160 "--enable-project=js"
161 (string-append "--prefix=" #$output)
162 configure-flags)))
163 (add-before 'check 'adjust-tests
164 (lambda _
165 (with-directory-excursion "../js/src/tests"
166 (substitute* "shell/os.js"
167 ;; FIXME: Why does the killed process have an exit status?
168 ((".*killed process should not have exitStatus.*")
169 ""))
170
171 ;; The test suite expects a lightly patched ICU. Disable tests
172 ;; that do not work with the system version. See
173 ;; "intl/icu-patches" for clues.
174
175 ;; See <https://unicode-org.atlassian.net/browse/ICU-20992> and
176 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=1636984> and
177 ;; related patch for why this is failing.
178 (delete-file "non262/Intl/DateTimeFormat/\
179 fractional-second-digits-append-item.js")
180 ;; FIXME: got "0 \u251CAM/PM: noon\u2524", expected "0 (AM/PM: noon)"
181 (delete-file "non262/Intl/DateTimeFormat/day-period-hour-cycle.js")
182 ;; FIXME: got "en-US-posix", expected "en-US-POSIX".
183 (delete-file "non262/Intl/available-locales-supported.js")
184 ;; FIXME: got "en-US", expected "en-US-POSIX"
185 (delete-file "non262/Intl/available-locales-resolved.js"))))
186 (add-before 'check 'pre-check
187 (lambda _
188 (setenv "JSTESTS_EXTRA_ARGS"
189 (string-join
190 (list
191 ;; Do not run tests marked as "random".
192 "--exclude-random"
193 ;; Exclude web platform tests.
194 "--wpt=disabled"
195 ;; Respect the daemons configured number of jobs.
196 (string-append "--worker-count="
197 (number->string (parallel-job-count)))))))))))
198 (native-inputs
199 (list autoconf
200 llvm ;for llvm-objdump
201 m4
202 perl
203 pkg-config
204 python-wrapper
205 rust
206 `(,rust "cargo")))
207 (inputs
208 (list icu4c-71 readline zlib))
209 (propagated-inputs
210 (list nspr)) ; in the Requires.private field of mozjs-*.pc
211 (home-page
212 "https://spidermonkey.dev/")
213 (synopsis "Mozilla JavaScript engine")
214 (description "SpiderMonkey is Mozilla's JavaScript engine written
215 in C/C++.")
216 (license license:mpl2.0))) ; and others for some files
217
218 (define-public mozjs-91
219 (package
220 (inherit mozjs)
221 (version "91.13.0")
222 (source (origin
223 (method url-fetch)
224 (uri (string-append "https://ftp.mozilla.org/pub/firefox"
225 "/releases/" version "esr/source/firefox-"
226 version "esr.source.tar.xz"))
227 (sha256
228 (base32
229 "0qh7j960wdp5zcfqhkj8ki47spp9i9ms12xx0v0kxvmmw36jpgjk"))))
230 (arguments
231 (substitute-keyword-arguments (package-arguments mozjs)
232 ((#:phases phases)
233 #~(modify-phases #$phases
234 (add-before 'check 'disable-timezone-tests
235 (lambda _
236 (with-directory-excursion "../js/src/tests"
237 ;; FIXME: Assertion failed: got "2021a", expected "2021a3"?
238 (delete-file "non262/Intl/DateTimeFormat/timeZone_version.js")
239 ;; XXX: Delete all tests that test time zone functionality,
240 ;; because the test suite uses /etc/localtime to figure out
241 ;; the offset from the hardware clock, which does not work
242 ;; in the build container. See <tests/non262/Date/shell.js>.
243 (delete-file-recursively "non262/Date")
244 (delete-file
245 "non262/Intl/DateTimeFormat/tz-environment-variable.js"))))))))
246 (inputs (modify-inputs (package-inputs mozjs)
247 (replace "icu4c" icu4c)))))
248
249 (define-public mozjs-78
250 (package
251 (inherit mozjs)
252 (name "mozjs")
253 (version "78.15.0")
254 (source (origin
255 (method url-fetch)
256 (uri (string-append "https://archive.mozilla.org/pub/firefox"
257 "/releases/" version "esr/source/firefox-"
258 version "esr.source.tar.xz"))
259 (sha256
260 (base32
261 "0l91cxdc5v9fps79ckb1kid4gw6v5qng1jd9zvaacwaiv628shx4"))))
262 (build-system gnu-build-system)
263 (arguments
264 (substitute-keyword-arguments (package-arguments mozjs)
265 ((#:phases phases)
266 #~(modify-phases #$phases
267 (replace 'configure
268 (lambda* (#:key configure-flags #:allow-other-keys)
269 ;; The configure script does not accept environment variables as
270 ;; arguments. It also must be run from a different directory,
271 ;; but not the root directory either.
272 (mkdir "run-configure-from-here")
273 (chdir "run-configure-from-here")
274 (setenv "SHELL" (which "sh"))
275 (setenv "CONFIG_SHELL" (which "sh"))
276 (setenv "AUTOCONF" (which "autoconf"))
277 (apply invoke "../js/src/configure"
278 (cons (string-append "--prefix=" #$output)
279 configure-flags))))
280 (replace 'adjust-tests
281 (lambda _
282 (with-directory-excursion "../js/src/tests"
283 ;; The test suite expects a lightly patched ICU 67. Since
284 ;; Guix is about to switch to ICU 68, massage the tests to
285 ;; work with that instead of patching ICU. Try removing this
286 ;; phase for newer versions of mozjs.
287
288 ;; These tests look up locale names and expects to get
289 ;; "GB" instead of "UK".
290 (substitute* "non262/Intl/DisplayNames/language.js"
291 (("Traditionell, GB")
292 "Traditionell, UK"))
293 (substitute* "non262/Intl/DisplayNames/region.js"
294 (("\"GB\": \"GB\"")
295 "\"GB\": \"UK\""))
296
297 ;; XXX: Some localized time formats have changed, and
298 ;; substitution fails for accented characters, even though
299 ;; it works in the REPL(?). Just delete these for now.
300 (delete-file "non262/Intl/Date/toLocaleString_timeZone.js")
301 (delete-file "non262/Intl/Date/toLocaleDateString_timeZone.js")
302
303 ;; Similarly, these get an unexpected "A" suffix when looking
304 ;; up a time in the "ar-MA-u-ca-islamicc" locale, which is
305 ;; tricky to substitute.
306 (delete-file "non262/Intl/DateTimeFormat/format_timeZone.js")
307 (delete-file "non262/Intl/DateTimeFormat/format.js")
308
309 ;; This file compares a generated list of ICU locale names
310 ;; with actual lookups. Some have changed slightly, i.e.
311 ;; daf-Latn-ZZ -> daf-Latn-CI, so drop it for simplicity.
312 (delete-file "non262/Intl/Locale/likely-subtags-generated.js"))))
313 (replace 'pre-check
314 (lambda _
315 (with-directory-excursion "../js/src/tests"
316 (substitute* "shell/os.js"
317 ;; FIXME: Why does the killed process have an exit status?
318 ((".*killed process should not have exitStatus.*")
319 ""))
320
321 ;; XXX: Delete all tests that test time zone functionality,
322 ;; because the test suite uses /etc/localtime to figure out
323 ;; the offset from the hardware clock, which does not work
324 ;; in the build container. See <tests/non262/Date/shell.js>.
325 (delete-file-recursively "non262/Date")
326 (delete-file "non262/Intl/DateTimeFormat/tz-environment-variable.js")
327
328 (setenv "JSTESTS_EXTRA_ARGS"
329 (string-join
330 (list
331 ;; Do not run tests marked as "random".
332 "--exclude-random"
333 ;; Exclude web platform tests.
334 "--wpt=disabled"
335 ;; Respect the daemons configured number of jobs.
336 (string-append "--worker-count="
337 (number->string
338 (parallel-job-count)))))))))))))
339 (native-inputs
340 (list autoconf-2.13
341 automake
342 llvm ;for llvm-objdump
343 perl
344 pkg-config
345 python-3
346 rust
347 `(,rust "cargo")))
348 (inputs
349 (list icu4c readline zlib))))
350
351 (define mozilla-compare-locales
352 (origin
353 (method hg-fetch)
354 (uri (hg-reference
355 (url "https://hg.mozilla.org/l10n/compare-locales/")
356 (changeset "RELEASE_8_1_0")))
357 (file-name "mozilla-compare-locales")
358 (sha256 (base32 "00bpkaqf2ng1nn9ajyb5mli0jq58q5fm2n3yy90jy0hp4q2gbs50"))))
359
360 (define (mozilla-locale locale changeset hash-string)
361 (origin
362 (method hg-fetch)
363 (uri (hg-reference
364 (url (string-append "https://hg.mozilla.org/l10n-central/"
365 locale))
366 (changeset changeset)))
367 (file-name (string-append "mozilla-locale-" locale))
368 (sha256 (base32 hash-string))))
369
370 (define-syntax-rule (mozilla-locales (hash-string changeset locale) ...)
371 (list (mozilla-locale locale changeset hash-string)
372 ...))
373
374 (define all-mozilla-locales
375 (mozilla-locales
376 ;; sha256 changeset locale
377 ;;---------------------------------------------------------------------------
378 ("1s59ihmj8x6z0ssq4xav689jb5azrpdnay8csgjm1b9pw7wmvcli" "a6940ae1a02f" "ach")
379 ("1cqixlk9f8p63jz20wzsvnfb7xa82ba725gzdydlwz2axgp09c26" "4e2c7d1ddbed" "af")
380 ("19r1yhmfxqasyslc8gr9as5w1scscz1xr8iqy9zi4b90fdjzs0ac" "06897e40a7ea" "an")
381 ("0nfknb1p03j9fgmkwlm1mzdyh10g0l33x34ab39kc072apziyv0n" "9272819b09e2" "ar")
382 ("11qqblqfffbmkdr5b6mxzq02i8rj1hjq3iy6xv5i5xxy311b3vpb" "f706d22e6910" "ast")
383 ("0q2p1a437qr2nshdd4934qkv2sblmykiwzir149c8p9m5sjk0dyw" "f5c2a9800add" "az")
384 ("0gxxm3lv18kj0922bw0g897azc4nkrszm5irgwdkgmkbyr97li83" "98ba7d51484f" "be")
385 ("10vrbbaabjns824ndya6c09znm815pak2xpvqgjydl3r5qvacx65" "5c79c77311cd" "bg")
386 ("1il7yyifx5xzj0v2lna315mppl5pk1vi4m9r66hdz1lzc485m1wp" "c80c87ef7193" "bn")
387 ("1p1ig4v9pczzrnnxzr20r61g7xk85k5lgnxhzgn1rx518p85xrkm" "6a1bcb9851b2" "br")
388 ("08q33bk9kdvbyc4ib58bsn2b67ki3d2yzskkf5r2n5zlglblksa2" "939779cb58d6" "bs")
389 ("1bdkywrqah85fh8kfnz163qnc02ffx0a4vlnx5pq1wg9j4f1gznf" "9a45ccf144f1" "ca")
390 ("0hhmp5dzc0rssykl0b2n9h0vfy4svwhxmhpsr3rcfpbg2s0r5h6l" "4f60e18fc248" "ca-valencia")
391 ("18phbl9raqsbys9wa8z0gq0h0pw3b55v6ngn67r4373lfc0s9cxv" "b4ef404c7de8" "cak")
392 ("0147qyw1y97mgqhkb46wblxv61lq2mvvm5n5ihwf49l5cyizi0jg" "f56ef18f05df" "cs")
393 ("08sbhnsxndlsaijnxndc367qcbrzb29m7bpkcawinz9fg6mz3573" "4f9d92f04f5e" "cy")
394 ("09cm5kk1sh2a6ws1fj185jrknhfa6n4bhj7nfnr4lsk339n0kvv9" "902503567e30" "da")
395 ("0r630bki5d4ylicq6lzh6s2mvsq225933szswmm0sap507rj75cm" "6000baf7a412" "de")
396 ("0749qjsfv3rn94rnci3ydgndw27qlr3w3w97kfwma2gmsf3m3r0p" "4a948952d1f4" "dsb")
397 ("0yc64i7mpxhs4qlyyh59i2aiz0vpap0bn8slcsk8b71wd1d7cy5m" "153a16a13733" "el")
398 ("0d4m5ji6ii10yap8y24cxx3fr60ba1jqi10hy3j1cq6ni7hzavga" "7ce17ae529ac" "en-CA")
399 ("12jzqcfbgdhfm8f2gqp15bdnin62li07jwicjc8ynn4cl9a19xiz" "a25d9eea7c23" "en-GB")
400 ("0gbb8hfc5yvjah63mapjxm53wxrf98srbrbg43b9g734zfi4n8y5" "4ed3471dad5d" "eo")
401 ("19lw7zmqx2irjmv5y6r7nncp6nysn06abf10n3dzj5nzgays6sln" "853fe7acb415" "es-AR")
402 ("0rq4pa380b77rkv6dq7sqx8a8i33jk3vs5rgcl8fv7slqvsw23kd" "921b67bf27a5" "es-CL")
403 ("1dyxzab9hln5spch66wmfagfzmfdiaxgpq7qlzvdfg98wkqdj25n" "c9a210ea496c" "es-ES")
404 ("1gwpmfl37wxl7rynqswgj41liljflgxydvljd4zdhk3jzqn605fb" "ddd35183d81c" "es-MX")
405 ("0c3blniddklapifnjbz03f2frw24jjgwgwn6swl5mwm2z0y6wa9f" "82d23ffaa7d3" "et")
406 ("05mq2df6n6fr8m5m2xwl0f6n1q3zgjrnk465ldx1nfr9agrhd36c" "13975626d549" "eu")
407 ("1l1jyqqiy551903j6yzh9ayg1pf26q2hr9h3jj4l51xzp7x4ms2q" "039e1fdb7c71" "fa")
408 ("091l05y9sggxznv0y11b9zy5qf146p0hb5faw4ix7yn5p5kca2f5" "7bd3722d82de" "ff")
409 ("1lllwjvmbl5dx44fcvsqg08fbflkc8dx5as9n6nf4xlkzydx6izm" "39808e88c9d1" "fi")
410 ("10ha955vvyf5vbciricm72kplj9j0s00g2333lmg46jiwi7aviiv" "426d373db6a7" "fr")
411 ("11zdfk8jvdy1k9z1q162cwapplcbz35l3dq4mv45brdin3v0x8kr" "96cd93d18389" "fy-NL")
412 ("1l5xr25gmssyachwmfprlnp2v2xj4b0hp8gxrf7fi5bvv9c2fynb" "de3daf7d3f9d" "ga-IE")
413 ("06h9ijfsn1cgz5fvxxbisk7fvqhgsw99id92575hgyg1p8xb1n69" "f04aea656d9e" "gd")
414 ("19913i5n8yyfhz9j21krlk7wqsyy89vggxc1m1swv94y2ix8rpaj" "1b8cdb87bf69" "gl")
415 ("0k5x31bfl2l0r9b5dkn03frm1gd8n6igai7ch2f1kj0skflynwww" "82df570c4241" "gn")
416 ("03rygnj9xhfvykark7dls117kwhid13ghvrsqiial0vp8m7ymx79" "e2e41d7beaa5" "gu-IN")
417 ("0vyraplj1x7b5im15anhzdaq03k2gqfyybgklrd4f9ry6msh5jhx" "de724e943805" "he")
418 ("1zqps586jrgxpf7xx2l3qw3ch3fr31r9a25y861fpxrpvh7ygw7g" "898598e1a5c6" "hi-IN")
419 ("0czq68l3qdhdc0mgazlrh8x83a6d5qrjwgjv8xvsmmzi7h68ww0l" "2711d1515af0" "hr")
420 ("1wwvrnm38gk2rnw4vmcranh8hk61gjcj9292pck3ckiv6mq7kd4s" "03e02f3d0676" "hsb")
421 ("0yvgdxlbyhhg3lk43hxx9gx66rcm7gaj02zzzx5zni8dhvlk2v6m" "d423ada9dc00" "hu")
422 ("1kjm7bg4990jhfbxwc38r4lqm2fbcxc82nc2d4qkqwikr4aah4b9" "06836af0bd6e" "hy-AM")
423 ("1dla7r3snvagb7m985xxqyi7gl498cr5xsz8msw0zpg6xmi05rlx" "299bd950d538" "ia")
424 ("0w8w9xn93akir7nqcp5iwr3kqvba5gbirg7gmzlzg7mgrhw8pcsa" "dee087477b99" "id")
425 ("10iakv1c1d20ihxg1s7c3zc1zfw18vr2kspcw7bk5k02rmrffgcn" "320095d063ed" "is")
426 ("1xn5pa3rc7l6k2migm3c0dx71q1hk7mjls045xpv9cy8gvirnj94" "4722680fb5bf" "it")
427 ("0va9zfj3wqh1yvbgh3x808yvdyxkg780vazjg887wbxpfk1n6hxa" "cb3cfe294621" "ja")
428 ("0qvjc3fhk6jg2c3g6mymmnslg1rkkxmv9gi3whf2bc5mzfgyc5zw" "7efe92bd7780" "ja-JP-mac")
429 ("0zfiwwz0axbd219ar32c7a6b8h816sf04ajx6jl74s5kyij79y82" "4c1fe3a18da9" "ka")
430 ("1aiik4758r5df76q2a132y5fjdjrsxshjylk7irwsr7yy0c7f63g" "acdf76048aa0" "kab")
431 ("0icxh4sgv6m1yykycb9d9c43k3r6w02f9c6jr04wm8hvqq5icfl5" "9b418ff7936b" "kk")
432 ("1cqlhggf46lr7w399k7qb7a1hc56f32w1dy26i2racpppzza5plc" "9771ada0b5f8" "km")
433 ("0p04irnb7x7y37m6lz388x9dynn8rnk000avpp296barajnhs5i8" "645aa37a2112" "kn")
434 ("1lbc1fxr5i0ccymlsd8axz3633cqggg5k8ak5yqwi704g7kvv9g2" "1cd68952d119" "ko")
435 ("11b55bxg73zqfdn5gy9nn5imab2mv0hxr603whggp7vymllgb7kb" "26bb83959bfe" "lij")
436 ("15jsijm6d26i0105gz0f7sh2yh2v4pmw4j95cwkdrb1d8m935jlz" "b9829891f153" "lt")
437 ("0liwwv13fgyw97nizhsyy53xrbf8jks5ics7qkkxfccawjrg5rlb" "e5f09d03d959" "lv")
438 ("0w420yf3hdnl7dp9mn9ghc20cq79k24fn9adn3syk723ppl6mkb0" "7884845e94f3" "mk")
439 ("13wkr7rgqsv9w3d9w7k8lnxdzgfixsq4bmc27zsyc770l6062ml6" "030db7412202" "mr")
440 ("06nsadcnxx0ssdp67x47dj9crihn1ycgd5mwvn5m7lkb97r4ch9f" "40a7703e875c" "ms")
441 ("0mlnjdzck6dp9p59ajj3sr63r36fn0qi8r9scrqrqcisgfclw9sg" "daca40056531" "my")
442 ("0z1hgx9d5i9w20f9k9azzng1y3lmm5d6hdjkj7rf6r5710bhhzh5" "664bd049e105" "nb-NO")
443 ("1466qvrs13g2iix1k35cknb2pia9b66li2ncvdyqf0jsd92z9k8x" "eaa6ae781ba0" "ne-NP")
444 ("0jgmz2lkzj0aspd9mabygzic6li5s2b25y0r6vjg8mv3jm5pi86j" "5ef8f1c9739e" "nl")
445 ("1m46x0h20vdfbzjxlz0ac43dbaq40xnyldr2yzbf7pk5di9pzxa6" "f08e15466d5d" "nn-NO")
446 ("0r3zvihqh6iya3z1qm7if0m3zfgf81s9qp7x7qc701h2q357wkgf" "6712c0e12ec2" "oc")
447 ("102j89jm28c223yhhkrj76xxj4kmy58hcs2r0jn15xa1qkqv1fdk" "8f36cc819e00" "pa-IN")
448 ("1j9za6s0i46abn8dsrlkpck3qxxw35rhfcg1xs1vp8sc4ckg8qwi" "c3b0c1c02b94" "pl")
449 ("1k9lbsvckpwl4xax8kxp5yxsfkspq2mhqm77jh5nl9aw88dsn55b" "cc32bf9630fe" "pt-BR")
450 ("0f0jyvbn2sa5m66wqdzh4607g4gd0270xq37ipd9ls52b4764bd8" "5478d7242086" "pt-PT")
451 ("19znkkialh1d4np7qcp80xkagrf1j2xah2s1xxzsh854p3d30zs7" "dd934a76fb01" "rm")
452 ("1xn26r8g8zzkb5myfgmnjbk8k4i0brkvbrvnhp7k5nkrnsin25di" "d57ab3dee73d" "ro")
453 ("04rhkxlmpp5pyzw85ldbfkmiigqr2p9y5cbns5dqs6sz1633ccxp" "7aea98f33a20" "ru")
454 ("1zzkkxl7ayxh5gx9snyvp5czflsvi77hp48li613h3c2fii4n9qk" "7c986f4b5044" "sco")
455 ("1219i0ghhqj3s1i0rm68jjkvivh6y40938wav7z4ifck527sq6r1" "bc9e55d4e3ea" "si")
456 ("05i5p3n3a6hgl6rf10yjs4vag7y3rn2jwgxsddcdcqiv6405zn81" "8814afd7f67e" "sk")
457 ("1wcqdbm1py1ldq6cj2g201m715nql79r6szr71jvrxacb711c62a" "20013dc06e96" "sl")
458 ("0g2izkaa4ipwgwyhy77ciyrxxpf4pxzj9mjqvxriy5prmkhm3zjs" "d86d5d2b6eef" "son")
459 ("1cc99m6srjg8698dkc3il70crby0mdv43v3ijwy069k4w50hyjjg" "49bb5fae5d9b" "sq")
460 ("13kfssq4fhq9mb36as6sxiaffl17qyg1wdw8kpz3ilqm86bsjrgl" "d6a0ab79b06f" "sr")
461 ("1wx9snbm0431q97i0q0nv4wbsqcv9nhllwfr88crlp7bfj5w8czw" "4bab04993da3" "sv-SE")
462 ("0laglkfl8ml0ip5vmm3z2q790hgwax9gfqwq3wm68a2nnsyck8fw" "4b3316c4aa48" "szl")
463 ("15pnlic4q7m48y0mc5yh8w5yscjwzx0mmfrbj3f2b9jxxa44nx4h" "48c7aab86db8" "ta")
464 ("16qar5y0wns75ryi8bfv7yln3mjsyn7qi4345zcniz3ydgkczh46" "7bbb3dac8f47" "te")
465 ("112g7x8h0qz16r5faam386x4a0rgwd4zy02d5agmg9m0kbficdfx" "009fd0852454" "th")
466 ("1l80kh9byqxnz5vkz357rb39g4y9sgn9pr0v29ywp6d009img1qg" "dad9caecd7a9" "tl")
467 ("1nalvjlxxsa9wldhhdb93bgfc7dl084xayh7i7mgg93yjgrym93x" "0c48082d37cd" "tr")
468 ("0wkxqcfgsra2ljws28kiwajv73w9aa8drsc4fqlg9krbicnjl2n8" "f6d105faedcc" "trs")
469 ("18jf4ysrfv3635fyxc1vwr970dr2r05bl3h8v599pwp2g7jzyjpm" "e1011388a55e" "uk")
470 ("1ihmksjsz54yii23qda5iv8cxrj9144afy75hzhvfi6m182kj4h8" "c4e927eab511" "ur")
471 ("0d42dhfa2vcw24wsvwf95pw20np0pz8c0is6p4307n981n8s207y" "7063df917cb3" "uz")
472 ("04khnkrg8css55hyna01jqay9c2ppxk5znbx2zj9i25knhvvx1lq" "1753054e6ab8" "vi")
473 ("0fi5kxn78xp7s15svkqlf4748j4pzxh941nm52n6kbbrhyi3qcqn" "93bc595dc32e" "xh")
474 ("0jg676vd37wqgzjnm0yynj7xrvm6fsgdwg296h78wnyc33zc4ads" "edd4e468bc31" "zh-CN")
475 ("1y4wldm3z95mfjlficp994jyqg0lj07wi35b79dy1s8ljy3jilil" "0bad1f7d2b2d" "zh-TW")))
476
477 ;; XXXX: Workaround 'snippet' limitations.
478 (define computed-origin-method (@@ (guix packages) computed-origin-method))
479
480 (define %icecat-version "102.8.0-guix0-preview1")
481 (define %icecat-build-id "20230214000000") ;must be of the form YYYYMMDDhhmmss
482
483 ;; 'icecat-source' is a "computed" origin that generates an IceCat tarball
484 ;; from the corresponding upstream Firefox ESR tarball, using the 'makeicecat'
485 ;; script from the upstream IceCat project.
486 (define icecat-source
487 (let* ((base-version (first (string-split %icecat-version #\-)))
488
489 (major-version (first (string-split base-version #\.)))
490 (minor-version (second (string-split base-version #\.)))
491 (sub-version (third (string-split base-version #\.)))
492
493 (upstream-firefox-version (string-append base-version "esr"))
494 (upstream-firefox-source
495 (origin
496 (method url-fetch)
497 (uri (string-append
498 "https://ftp.mozilla.org/pub/firefox/releases/"
499 upstream-firefox-version "/source/"
500 "firefox-" upstream-firefox-version ".source.tar.xz"))
501 (sha256
502 (base32
503 "0j6afrgfsmd0adbbmffw4p1f2hznpck9d36z3bsjx36f7cjgdy27"))))
504
505 (upstream-icecat-base-version "102.8.0") ; maybe older than base-version
506 ;;(gnuzilla-commit (string-append "v" upstream-icecat-base-version))
507 (gnuzilla-commit "03d9e3db5affe21db077c410ec08c313d6aa280e")
508 (gnuzilla-source
509 (origin
510 (method git-fetch)
511 (uri (git-reference
512 (url "git://git.savannah.gnu.org/gnuzilla.git")
513 (commit gnuzilla-commit)))
514 (file-name (git-file-name "gnuzilla"
515 ;;upstream-icecat-base-version
516 (string-take gnuzilla-commit 8)))
517 (sha256
518 (base32
519 "12id87nsdwm6kra0gm3d3ww8kr0xxb4yllw9wcqmnrlnmspdc1n8"))))
520
521 ;; 'search-patch' returns either a valid file name or #f, so wrap it
522 ;; in 'assume-valid-file-name' to avoid 'local-file' warnings.
523 (makeicecat-patch
524 (local-file (assume-valid-file-name
525 (search-patch "icecat-makeicecat.patch")))))
526
527 (origin
528 (method computed-origin-method)
529 (file-name (string-append "icecat-" %icecat-version ".tar.xz"))
530 (sha256 #f)
531 (uri
532 (delay
533 (with-imported-modules '((guix build utils))
534 #~(begin
535 (use-modules (guix build utils))
536 (let ((firefox-dir
537 (string-append "firefox-" #$base-version))
538 (icecat-dir
539 (string-append "icecat-" #$%icecat-version)))
540
541 (set-path-environment-variable
542 "PATH" '("bin")
543 (list #+python
544 #+(canonical-package bash)
545 #+(canonical-package coreutils)
546 #+(canonical-package findutils)
547 #+(canonical-package patch)
548 #+(canonical-package xz)
549 #+(canonical-package sed)
550 #+(canonical-package grep)
551 #+(canonical-package bzip2)
552 #+(canonical-package gzip)
553 #+(canonical-package tar)))
554
555 (set-path-environment-variable
556 "PYTHONPATH"
557 (list #+(format #f "lib/python~a/site-packages"
558 (version-major+minor
559 (package-version python))))
560 '#+(cons python-jsonschema
561 (map second
562 (package-transitive-propagated-inputs
563 python-jsonschema))))
564
565 ;; Needed by the 'makeicecat' script.
566 (setenv "RENAME_CMD" "rename")
567
568 ;; We copy the gnuzilla source directory because it is
569 ;; read-only in 'gnuzilla-source', and the makeicecat script
570 ;; uses "cp -a" to copy parts of it and assumes that the
571 ;; copies will be writable.
572 (copy-recursively #+gnuzilla-source "/tmp/gnuzilla"
573 #:log (%make-void-port "w"))
574
575 (with-directory-excursion "/tmp/gnuzilla"
576 (make-file-writable "makeicecat")
577 (invoke "patch" "--force" "--no-backup-if-mismatch"
578 "-p1" "--input" #+makeicecat-patch)
579 (patch-shebang "makeicecat")
580 (substitute* "makeicecat"
581 (("^readonly FFMAJOR=(.*)" all ffmajor)
582 (unless (string=? #$major-version
583 (string-trim-both ffmajor))
584 ;; The makeicecat script cannot be expected to work
585 ;; properly on a different version of Firefox, even if
586 ;; no errors occur during execution.
587 (error "makeicecat major version mismatch"))
588 (string-append "readonly FFMAJOR=" #$major-version "\n"))
589 (("^readonly FFMINOR=.*")
590 (string-append "readonly FFMINOR=" #$minor-version "\n"))
591 (("^readonly FFSUB=.*")
592 (string-append "readonly FFSUB=" #$sub-version "\n"))
593 (("^readonly DATADIR=.*")
594 "readonly DATADIR=/tmp/gnuzilla/data\n")
595 (("^readonly SOURCEDIR=.*")
596 (string-append "readonly SOURCEDIR=" icecat-dir "\n"))
597 (("/bin/sed")
598 #+(file-append (canonical-package sed) "/bin/sed"))))
599
600 (format #t "Unpacking upstream firefox tarball...~%")
601 (force-output)
602 (invoke "tar" "xf" #+upstream-firefox-source)
603 (rename-file firefox-dir icecat-dir)
604
605 (with-directory-excursion icecat-dir
606 (format #t "Populating l10n directory...~%")
607 (force-output)
608 (mkdir "l10n")
609 (with-directory-excursion "l10n"
610 (for-each
611 (lambda (locale-dir)
612 (let ((locale
613 (string-drop (basename locale-dir)
614 (+ 32 ; length of hash
615 (string-length "-mozilla-locale-")))))
616 (format #t " ~a~%" locale)
617 (force-output)
618 (copy-recursively locale-dir locale
619 #:log (%make-void-port "w"))
620 (for-each make-file-writable (find-files locale))
621 (with-directory-excursion locale
622 (when (file-exists? ".hgtags")
623 (delete-file ".hgtags"))
624 (mkdir-p "browser/chrome/browser/preferences")
625 (call-with-output-file
626 "browser/chrome/browser/preferences/advanced-scripts.dtd"
627 (lambda (port) #f)))))
628 '#+all-mozilla-locales)
629 (copy-recursively #+mozilla-compare-locales
630 "compare-locales"
631 #:log (%make-void-port "w"))
632 (delete-file "compare-locales/.gitignore")
633 (delete-file "compare-locales/.hgignore")
634 (delete-file "compare-locales/.hgtags")))
635
636 (format #t "Running makeicecat script...~%")
637 (force-output)
638 (invoke "bash" "/tmp/gnuzilla/makeicecat")
639
640 (format #t "Packing IceCat source tarball...~%")
641 (force-output)
642 (setenv "XZ_DEFAULTS" (string-join (%xz-parallel-args)))
643 (invoke "tar" "cfa" #$output
644 ;; Avoid non-determinism in the archive. We set the
645 ;; mtime of files in the archive to early 1980 because
646 ;; the build process fails if the mtime of source
647 ;; files is pre-1980, due to the creation of zip
648 ;; archives.
649 "--mtime=@315619200" ; 1980-01-02 UTC
650 "--owner=root:0"
651 "--group=root:0"
652 "--sort=name"
653 icecat-dir)))))))))
654
655 (define-public icecat
656 (package
657 (name "icecat")
658 (version %icecat-version)
659 (source icecat-source)
660 (build-system gnu-build-system)
661 (inputs
662 (list alsa-lib
663 bzip2
664 cups
665 dbus-glib
666 gdk-pixbuf
667 glib
668 gtk+
669 gtk+-2
670 ;; UNBUNDLE-ME! graphite2
671 cairo
672 pango
673 freetype
674 font-dejavu
675 ;; UNBUNDLE-ME! harfbuzz
676 libcanberra
677 libgnome
678 libjpeg-turbo
679 libpng-apng
680 ;; UNBUNDLE-ME! libogg
681 ;; UNBUNDLE-ME! libtheora ; wants theora-1.2, not yet released
682 ;; UNBUNDLE-ME! libvorbis
683 libxft
684 libevent
685 libxinerama
686 libxscrnsaver
687 libxcomposite
688 libxt
689 libffi
690 ffmpeg
691 libvpx
692 icu4c-71 ; TODO: Change to 'icu4c' when its version is >= 71.
693 pixman
694 pulseaudio
695 mesa
696 pciutils
697 mit-krb5
698 hunspell
699 libnotify
700 ;; See <https://bugs.gnu.org/32833>
701 ;; and related comments in the 'remove-bundled-libraries' phase.
702 ;; UNBUNDLE-ME! nspr
703 ;; UNBUNDLE-ME! nss
704 shared-mime-info
705 sqlite
706 eudev
707 unzip
708 zip
709 zlib))
710 (native-inputs
711 ;; The following patches are specific to the Guix packaging of IceCat,
712 ;; and therefore we prefer to leave them out of 'source', which should be
713 ;; a tarball suitable for compilation on any system that IceCat supports.
714 ;; (Bug fixes and security fixes, however, should go in 'source').
715 (list
716 ;; XXX TODO: Adapt these patches to IceCat 102.
717 ;; ("icecat-avoid-bundled-libraries.patch"
718 ;; ,(search-patch "icecat-avoid-bundled-libraries.patch"))
719 ;; ("icecat-use-system-graphite2+harfbuzz.patch"
720 ;; ,(search-patch "icecat-use-system-graphite2+harfbuzz.patch"))
721 ;; ("icecat-use-system-media-libs.patch"
722 ;; ,(search-patch "icecat-use-system-media-libs.patch"))
723 rust
724 `(,rust "cargo")
725 rust-cbindgen-0.23
726 llvm
727 clang
728 perl
729 node
730 python-wrapper
731 yasm
732 nasm ; XXX FIXME: only needed on x86_64 and i686
733 pkg-config
734 m4
735 which))
736 (arguments
737 (list
738 #:tests? #f ;not worth the cost
739
740 ;; Some dynamic lib was determined at runtime, so rpath check may fail.
741 #:validate-runpath? #f
742
743 #:configure-flags
744 #~(list
745 "--enable-application=browser"
746 "--with-distribution-id=org.gnu"
747 "--enable-geckodriver"
748 ;; Do not require addons in the global app or system directories to
749 ;; be signed by Mozilla.
750 "--with-unsigned-addon-scopes=app,system"
751 "--allow-addon-sideload"
752
753 "--enable-pulseaudio"
754
755 "--disable-tests"
756 "--disable-updater"
757 "--disable-crashreporter"
758 "--disable-eme"
759
760 ;; Building with debugging symbols takes ~5GiB, so disable it.
761 "--disable-debug"
762 "--disable-debug-symbols"
763
764 "--enable-rust-simd"
765 "--enable-release"
766 "--enable-optimize"
767 "--enable-strip"
768 "--disable-elf-hack"
769
770 ;; Clang is needed to build Stylo, Mozilla's new CSS engine. We must
771 ;; specify the clang paths manually, because otherwise the Mozilla
772 ;; build system looks in the directories returned by llvm-config
773 ;; --bindir and llvm-config --libdir, which return paths in the llvm
774 ;; package where clang is not found.
775 (string-append "--with-clang-path="
776 (search-input-file %build-inputs "bin/clang"))
777 (string-append "--with-libclang-path="
778 (dirname (search-input-file %build-inputs
779 "lib/libclang.so")))
780
781 ;; Hack to work around missing "unofficial" branding in icecat.
782 "--enable-official-branding"
783
784 ;; TODO: Add support for wasm sandboxed libraries.
785 "--without-wasm-sandboxed-libraries"
786
787 ;; Avoid bundled libraries.
788 "--with-system-jpeg" ;must be libjpeg-turbo
789 "--with-system-png" ;must be libpng-apng
790 "--with-system-zlib"
791 ;; UNBUNDLE-ME! "--with-system-bz2"
792 ;; UNBUNDLE-ME! "--with-system-libevent"
793 ;; UNBUNDLE-ME! "--with-system-ogg"
794 ;; UNBUNDLE-ME! "--with-system-vorbis"
795 ;; UNBUNDLE-ME! "--with-system-theora" ; wants theora-1.2, not yet released
796 ;; UNBUNDLE-ME! "--with-system-libvpx"
797 "--with-system-icu"
798
799 ;; See <https://bugs.gnu.org/32833>
800 ;; and related comments in the
801 ;; 'remove-bundled-libraries' phase below.
802 ;; UNBUNDLE-ME! "--with-system-nspr"
803 ;; UNBUNDLE-ME! "--with-system-nss"
804
805 ;; UNBUNDLE-ME! "--with-system-harfbuzz"
806 ;; UNBUNDLE-ME! "--with-system-graphite2"
807 "--enable-system-pixman"
808 "--enable-system-ffi"
809 ;; UNBUNDLE-ME! "--enable-system-sqlite"
810 )
811
812 #:imported-modules %cargo-utils-modules ;for `generate-all-checksums'
813
814 #:modules `((ice-9 ftw)
815 (ice-9 match)
816 (srfi srfi-1)
817 (srfi srfi-26)
818 (rnrs bytevectors)
819 (rnrs io ports)
820 (guix elf)
821 (guix build gremlin)
822 ,@%gnu-build-system-modules)
823 #:phases
824 #~(modify-phases %standard-phases
825 (add-after 'unpack 'apply-guix-specific-patches
826 (lambda* (#:key inputs native-inputs #:allow-other-keys)
827 (let ((patch (search-input-file inputs "bin/patch")))
828 (for-each (match-lambda
829 ((label . file)
830 (when (and (string-prefix? "icecat-" label)
831 (string-suffix? ".patch" label))
832 (format #t "applying '~a'...~%" file)
833 (invoke patch "--force" "--no-backup-if-mismatch"
834 "-p1" "--input" file))))
835 (or native-inputs inputs)))))
836 (add-after 'apply-guix-specific-patches 'remove-bundled-libraries
837 (lambda _
838 ;; Remove bundled libraries that we don't use, since they may
839 ;; contain unpatched security flaws, they waste disk space and
840 ;; memory, and may cause confusion.
841 (for-each (lambda (file)
842 (format #t "deleting '~a'...~%" file)
843 (delete-file-recursively file))
844 '( ;; FIXME: Removing the bundled icu breaks configure.
845 ;; * The bundled icu headers are used in some places.
846 ;; * The version number is taken from the bundled copy.
847 ;;"intl/icu"
848 ;;
849 ;; FIXME: A script from the bundled nspr is used.
850 ;;"nsprpub"
851 ;;
852 ;; FIXME: With the update to IceCat 60, using system NSS
853 ;; broke certificate validation. See
854 ;; <https://bugs.gnu.org/32833>. For now, we use
855 ;; the bundled NSPR and NSS. TODO: Investigate,
856 ;; and try to unbundle these libraries again.
857 ;; UNBUNDLE-ME! "security/nss"
858 ;;
859 ;; TODO: Use more system media libraries. See:
860 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
861 ;; * libtheora: esr60 wants v1.2, not yet released.
862 ;; * soundtouch: avoiding the bundled library would
863 ;; result in some loss of functionality. There's
864 ;; also an issue with exception handling
865 ;; configuration. It seems that this is needed in
866 ;; some moz.build:
867 ;; DEFINES['ST_NO_EXCEPTION_HANDLING'] = 1
868 ;; * libopus
869 ;; * speex
870 ;;
871 "modules/freetype2"
872 ;; "media/libjpeg" ; needed for now, because media/libjpeg/moz.build is referenced from config/external/moz.build
873 ;; UNBUNDLE-ME! "modules/zlib"
874 ;; UNBUNDLE-ME! "ipc/chromium/src/third_party/libevent"
875 ;; UNBUNDLE-ME! "media/libvpx"
876 ;; UNBUNDLE-ME! "media/libogg"
877 ;; UNBUNDLE-ME! "media/libvorbis"
878 ;; UNBUNDLE-ME! "media/libtheora" ; wants theora-1.2, not yet released
879 ;; UNBUNDLE-ME! "media/libtremor"
880 ;; UNBUNDLE-ME! "gfx/harfbuzz"
881 ;; UNBUNDLE-ME! "gfx/graphite2"
882 "js/src/ctypes/libffi"
883 ;; UNBUNDLE-ME! "db/sqlite3"
884 ))))
885 (add-after 'remove-bundled-libraries 'fix-ffmpeg-runtime-linker
886 (lambda* (#:key inputs #:allow-other-keys)
887 ;; Arrange to load libavcodec.so by its absolute file name.
888 (substitute* "dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp"
889 (("libavcodec\\.so")
890 (search-input-file inputs "lib/libavcodec.so")))))
891 (add-after 'fix-ffmpeg-runtime-linker 'build-sandbox-whitelist
892 (lambda* (#:key inputs #:allow-other-keys)
893 (define (runpath-of lib)
894 (call-with-input-file lib
895 (compose elf-dynamic-info-runpath
896 elf-dynamic-info
897 parse-elf
898 get-bytevector-all)))
899 (define (runpaths-of-input label)
900 (let* ((dir (string-append (assoc-ref inputs label) "/lib"))
901 (libs (find-files dir "\\.so$")))
902 (append-map runpath-of libs)))
903 ;; Populate the sandbox read-path whitelist as needed by ffmpeg.
904 (let* ((whitelist
905 (map (cut string-append <> "/")
906 (delete-duplicates
907 `(,(string-append (assoc-ref inputs "shared-mime-info")
908 "/share/mime")
909 ,(string-append (assoc-ref inputs "font-dejavu")
910 "/share/fonts")
911 "/run/current-system/profile/share/fonts"
912 ,@(append-map runpaths-of-input
913 '("mesa" "ffmpeg"))))))
914 (whitelist-string (string-join whitelist ","))
915 (port (open-file "browser/app/profile/icecat.js" "a")))
916 (format #t "setting 'security.sandbox.content.read_path_whitelist' to '~a'~%"
917 whitelist-string)
918 (format port "~%pref(\"security.sandbox.content.read_path_whitelist\", ~S);~%"
919 whitelist-string)
920 (close-output-port port))))
921 (add-after 'patch-source-shebangs 'patch-cargo-checksums
922 (lambda _
923 (use-modules (guix build cargo-utils))
924 (let ((null-hash "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))
925 (for-each (lambda (file)
926 (format #t "patching checksums in ~a~%" file)
927 (substitute* file
928 (("^checksum = \".*\"")
929 (string-append "checksum = \"" null-hash "\""))))
930 (find-files "." "Cargo.lock$"))
931 (for-each generate-all-checksums
932 '("services"
933 "js"
934 "third_party/rust"
935 "dom/media"
936 "dom/webauthn"
937 "toolkit"
938 "gfx"
939 "storage"
940 "modules"
941 "xpcom/rust"
942 "media"
943 "mozglue/static/rust"
944 "netwerk"
945 "remote"
946 "intl"
947 "servo"
948 "security/manager/ssl"
949 "build")))))
950 (add-after 'patch-cargo-checksums 'remove-cargo-frozen-flag
951 (lambda _
952 ;; Remove --frozen flag from cargo invokation, otherwise it'll
953 ;; complain that it's not able to change Cargo.lock.
954 ;; https://bugzilla.mozilla.org/show_bug.cgi?id=1726373
955 (substitute* "build/RunCbindgen.py"
956 (("\"--frozen\",") ""))))
957 (delete 'bootstrap)
958 (replace 'configure
959 ;; configure does not work followed by both "SHELL=..." and
960 ;; "CONFIG_SHELL=..."; set environment variables instead
961 (lambda* (#:key outputs configure-flags #:allow-other-keys)
962 (let* ((bash (which "bash"))
963 (abs-srcdir (getcwd))
964 (flags `(,(string-append "--prefix=" #$output)
965 ,(string-append "--with-l10n-base="
966 abs-srcdir "/l10n")
967 ,@configure-flags)))
968 (setenv "SHELL" bash)
969 (setenv "CONFIG_SHELL" bash)
970
971 (setenv "AR" "llvm-ar")
972 (setenv "NM" "llvm-nm")
973 (setenv "CC" "clang")
974 (setenv "CXX" "clang++")
975 (setenv "LDFLAGS" (string-append "-Wl,-rpath="
976 #$output "/lib/icecat"))
977
978 (setenv "MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE" "system")
979 (setenv "MOZ_BUILD_DATE" #$%icecat-build-id) ; avoid timestamp
980
981 ;; XXX TODO: Fix this to work on systems other than x86_64-linux.
982 (setenv "GUIX_PYTHONPATH"
983 (string-append (getcwd)
984 "/obj-x86_64-pc-linux-gnu/_virtualenvs/build"))
985
986 (mkdir ".mozbuild")
987 (setenv "MOZBUILD_STATE_PATH"
988 (string-append (getcwd) "/.mozbuild"))
989
990 (format #t "build directory: ~s~%" (getcwd))
991 (format #t "configure flags: ~s~%" flags)
992
993 (call-with-output-file "mozconfig"
994 (lambda (port)
995 (for-each (lambda (flag)
996 (format port "ac_add_options ~a\n" flag))
997 flags)))
998
999 (invoke "./mach" "configure"))))
1000 (replace 'build
1001 (lambda* (#:key (make-flags '()) (parallel-build? #t)
1002 #:allow-other-keys)
1003 (apply invoke "./mach" "build"
1004 ;; mach will use parallel build if possible by default
1005 `(,@(if parallel-build?
1006 '()
1007 '("-j1"))
1008 ,@make-flags))))
1009 (add-after 'build 'neutralise-store-references
1010 (lambda _
1011 ;; Mangle the store references to compilers & other build tools in
1012 ;; about:buildconfig, reducing IceCat's closure by 1 GiB on x86-64.
1013 (let* ((obj-dir (match (scandir "." (cut string-prefix? "obj-" <>))
1014 ((dir) dir)))
1015 (file (string-append
1016 obj-dir
1017 "/dist/bin/chrome/toolkit/content/global/buildconfig.html")))
1018 (substitute* file
1019 (("[0-9a-df-np-sv-z]{32}" hash)
1020 (string-append (string-take hash 8)
1021 "<!-- Guix: not a runtime dependency -->"
1022 (string-drop hash 8)))))))
1023 (replace 'install
1024 (lambda* (#:key outputs #:allow-other-keys)
1025 (invoke "./mach" "install")
1026 ;; The geckodriver binary is not installed by the above, for some
1027 ;; reason. Use 'find-files' to avoid having to deal with the
1028 ;; system/architecture-specific file name.
1029 (install-file (first (find-files "." "geckodriver"))
1030 (string-append #$output "/bin"))))
1031 (add-after 'install 'wrap-program
1032 (lambda* (#:key inputs #:allow-other-keys)
1033 (let* ((lib (string-append #$output "/lib"))
1034 (gtk #$(this-package-input "gtk+"))
1035 (gtk-share (string-append gtk "/share"))
1036 (ld-libs '#$(map (lambda (label)
1037 (file-append (this-package-input label) "/lib"))
1038 '("libpng-apng"
1039 "libxscrnsaver"
1040 "mesa"
1041 "pciutils"
1042 "mit-krb5"
1043 "eudev"
1044 "pulseaudio"
1045 ;; For the integration of native notifications
1046 "libnotify"))))
1047 (wrap-program (car (find-files lib "^icecat$"))
1048 `("XDG_DATA_DIRS" prefix (,gtk-share))
1049 ;; The following line is commented out because the icecat
1050 ;; package on guix has been observed to be unstable when
1051 ;; using wayland, and the bundled extensions stop working.
1052 ;; `("MOZ_ENABLE_WAYLAND" = ("1"))
1053 `("LD_LIBRARY_PATH" prefix ,ld-libs)))))
1054 (add-after 'wrap-program 'install-desktop-entry
1055 (lambda _
1056 ;; Install the '.desktop' file.
1057 (let* ((desktop-file "taskcluster/docker/icecat-snap/icecat.desktop")
1058 (applications (string-append #$output "/share/applications")))
1059 (substitute* desktop-file
1060 (("^Exec=icecat") (string-append "Exec=" #$output "/bin/icecat"))
1061 (("IceCat") "GNU IceCat")
1062 (("Icon=.*") "Icon=icecat\n")
1063 (("NewWindow") "new-window")
1064 (("NewPrivateWindow") "new-private-window")
1065 (("StartupNotify=true")
1066 "StartupNotify=true\nStartupWMClass=Navigator"))
1067 (install-file desktop-file applications))))
1068 (add-after 'install-desktop-entry 'install-icons
1069 (lambda _
1070 (with-directory-excursion "browser/branding/official"
1071 (for-each
1072 (lambda (file)
1073 (let* ((size (string-filter char-numeric? file))
1074 (icons (string-append #$output "/share/icons/hicolor/"
1075 size "x" size "/apps")))
1076 (mkdir-p icons)
1077 (copy-file file (string-append icons "/icecat.png"))))
1078 '("default16.png" "default22.png" "default24.png"
1079 "default32.png" "default48.png" "content/icon64.png"
1080 "mozicon128.png" "default256.png"))))))))
1081 (home-page "https://www.gnu.org/software/gnuzilla/")
1082 (synopsis "Entirely free browser derived from Mozilla Firefox")
1083 (description
1084 "IceCat is the GNU version of the Firefox browser. It is entirely free
1085 software, which does not recommend non-free plugins and addons. It also
1086 features built-in privacy-protecting features. This package also includes the
1087 @command{geckodriver} command, which can be useful for automated web
1088 testing.
1089
1090 WARNING: IceCat 102 has not yet been released by the upstream IceCat project.
1091 This is a preview release, and does not currently meet the privacy-respecting
1092 standards of the IceCat project.")
1093 (license license:mpl2.0) ;and others, see toolkit/content/license.html
1094 (properties
1095 `((ftp-directory . "/gnu/gnuzilla")
1096 (cpe-name . "firefox_esr")
1097 (cpe-version . ,(first (string-split version #\-)))))))
1098
1099 (define %icedove-build-id "20230207000000") ;must be of the form YYYYMMDDhhmmss
1100 (define %icedove-version "102.7.2")
1101
1102 ;; Provides the "comm" folder which is inserted into the icecat source.
1103 ;; Avoids the duplication of Icecat's source tarball.
1104 (define thunderbird-source
1105 (origin
1106 (method hg-fetch)
1107 (uri (hg-reference
1108 (url "https://hg.mozilla.org/releases/comm-esr102")
1109 (changeset "0f6deed0752b618055c34e06c268af3da9d1548d")))
1110 (file-name (string-append "thunderbird-" %icedove-version "-checkout"))
1111 (sha256
1112 (base32
1113 "071q0pcfvfpzx741ly1sl8anlmzx02h17w4ylfnrkwrpaclq3p6p"))))
1114
1115 (define-public icedove
1116 (package
1117 (name "icedove")
1118 (version %icedove-version)
1119 (source icecat-source)
1120 (properties
1121 `((cpe-name . "thunderbird_esr")))
1122 (build-system gnu-build-system)
1123 (arguments
1124 (list
1125 #:tests? #f ;no check target
1126 #:imported-modules %cargo-utils-modules ;for `generate-all-checksums'
1127 #:modules `((guix build utils) ;find-files
1128 (sxml simple)
1129 (ice-9 regex)
1130 ,@%gnu-build-system-modules)
1131 #:phases
1132 #~(modify-phases %standard-phases
1133 (add-after 'unpack 'prepare-thunderbird-sources
1134 (lambda _
1135 (mkdir "comm")
1136 (copy-recursively #$thunderbird-source "comm")
1137 (delete-file "sourcestamp.txt")))
1138 (add-after 'patch-source-shebangs 'patch-cargo-checksums
1139 (lambda _
1140 (use-modules (guix build cargo-utils))
1141 (let ((null-hash "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934\
1142 ca495991b7852b855"))
1143 (for-each (lambda (file)
1144 (format #t "patching checksums in ~a~%" file)
1145 (substitute* file
1146 (("^checksum = \".*\"")
1147 (string-append "checksum = \"" null-hash "\""))))
1148 (find-files "." "Cargo.lock$"))
1149 (for-each generate-all-checksums
1150 '("third_party/rust"
1151 "toolkit/library/rust")))))
1152 (add-after 'patch-cargo-checksums 'remove-cargo-frozen-flag
1153 (lambda _
1154 ;; Remove --frozen flag from cargo invokation, otherwise it'll
1155 ;; complain that it's not able to change Cargo.lock.
1156 ;; https://bugzilla.mozilla.org/show_bug.cgi?id=1726373
1157 (substitute* "build/RunCbindgen.py"
1158 (("\"--frozen\",") ""))))
1159 ;; Fixes issue where each installation directory generates its own
1160 ;; profile (see:
1161 ;; https://trac.torproject.org/projects/tor/ticket/31457).
1162 (add-after 'patch-source-shebangs 'fix-profile-setting
1163 (lambda _
1164 (substitute* "comm/mail/moz.configure"
1165 (("MOZ_DEDICATED_PROFILES, True")
1166 "MOZ_DEDICATED_PROFILES, False"))))
1167 (add-after 'prepare-thunderbird-sources 'rename-to-icedove
1168 (lambda _
1169 (substitute* "comm/mail/confvars.sh"
1170 (("MOZ_APP_NAME=thunderbird")
1171 "MOZ_APP_NAME=icedove")
1172 (("MOZ_UPDATER=1")
1173 "MOZ_UPDATER=0"))
1174 ;; Remove branding to comply with Mozilla's trademark policy
1175 (with-directory-excursion "comm/mail/branding/nightly"
1176 (delete-file "content/about-wordmark.svg")
1177 (call-with-output-file "content/about-wordmark.svg"
1178 (lambda (port)
1179 (sxml->xml '(svg (@ (xmlns "http://www.w3.org/2000/svg")
1180 (viewBox "0 0 789.1 90.78")
1181 (width "333")
1182 (height "48")
1183 (fill "#fff"))
1184 (text (@ (x "400") (y "70")
1185 (text-anchor "middle")
1186 (font-size "90"))
1187 "Icedove Daily"))
1188 port)))
1189 (substitute* '("locales/en-US/brand.properties"
1190 "locales/en-US/brand.ftl"
1191 "locales/en-US/brand.dtd"
1192 "configure.sh")
1193 (("Thunderbird") "Icedove")
1194 (("mozilla.org") "guix.gnu.org")))
1195 ;; Remove other mentions of Thunderbird in user-visible text.
1196 (with-directory-excursion "comm/mail/base/content"
1197 (substitute* '("overrides/app-license-name.html")
1198 (("Thunderbird") "Icedove")))
1199 (with-directory-excursion "comm/mail/components/"
1200 (substitute* '("MailGlue.jsm"
1201 "extensions/schemas/addressBook.json"
1202 "extensions/schemas/tabs.json"
1203 "extensions/schemas/cloudFile.json"
1204 "extensions/schemas/chrome_settings_overrides.json"
1205 "extensions/schemas/windows.json"
1206 "extensions/parent/ext-mail.js"
1207 "im/messages/mail/Info.plist"
1208 "enterprisepolicies/moz.build"
1209 "enterprisepolicies/helpers/moz.build"
1210 "enterprisepolicies/schemas/moz.build")
1211 (("Thunderbird") "Icedove")))
1212 (substitute* '("comm/mailnews/base/prefs/content/accountUtils.js"
1213 "comm/mail/base/content/customizeToolbar.js"
1214 "comm/suite/components/customizeToolbar.js")
1215 (("AppConstants.MOZ_APP_NAME (.)= \"thunderbird" _ e)
1216 (format #f "AppConstants.MOZ_APP_NAME ~a= \"icedove" e)))
1217
1218 ;; Override addon URLs and settings
1219 (substitute* "comm/mail/app/profile/all-thunderbird.js"
1220 (("(pref\\(\"extensions.webservice.discoverURL\").*" _ m)
1221 (string-append m ", \"https://directory.fsf.org/wiki/Icedove\");"))
1222 (("(pref\\(\"extensions.getAddons.search.url\").*" _ m)
1223 (string-append m ", \"https://guix.gnu.org/packages\");"))
1224 (("(pref\\(\"extensions.update.enabled\").*" _ m)
1225 (string-append m ", false);"))
1226 (("(pref\\(\"extensions.systemAddon.update.enabled\").*" _ m)
1227 (string-append m ", false);"))
1228 (("(pref\\(\"lightweightThemes.update.enabled\").*" _ m)
1229 (string-append m ", false);")))))
1230 (add-after 'build 'neutralize-store-references
1231 (lambda _
1232 ;; Mangle the store references to compilers & other build tools in
1233 ;; about:buildconfig, reducing Icedove's closure significant.
1234 ;; The resulting files are saved in lib/thunderbird/omni.ja
1235 (substitute*
1236 ;; Use find because the path "obj-x86_64-pc-linux-gnu" contains
1237 ;; the architecture and the system -> more complicated.
1238 (find-files "." "buildconfig.html")
1239 (((format #f "(~a/)([0-9a-df-np-sv-z]{32})"
1240 (regexp-quote (%store-directory)))
1241 _ store hash)
1242 (string-append store
1243 (string-take hash 8)
1244 "<!-- Guix: not a runtime dependency -->"
1245 (string-drop hash 8))))))
1246 (delete 'bootstrap)
1247 (replace 'configure
1248 (lambda* (#:key native-inputs inputs configure-flags
1249 #:allow-other-keys)
1250 (let* ((bash (which "bash"))
1251 (abs-srcdir (getcwd))
1252 (srcdir (string-append "../" (basename abs-srcdir)))
1253 (flags `(,(string-append "--prefix=" #$output)
1254 ,@configure-flags))
1255 (mozconfig (string-append (getcwd) "/.mozconfig")))
1256 (setenv "SHELL" bash)
1257 (setenv "CONFIG_SHELL" bash)
1258 (setenv "QA_CONFIGURE_OPTIONS" ".*")
1259 (setenv "MOZBUILD_STATE_PATH"
1260 (string-append (getcwd) "/mach_state"))
1261 (setenv "MOZCONFIG"
1262 (string-append (getcwd) "/.mozconfig"))
1263
1264 (setenv "AR" "llvm-ar")
1265 (setenv "NM" "llvm-nm")
1266 (setenv "CC" "clang")
1267 (setenv "CXX" "clang++")
1268
1269 (setenv "MOZ_NOSPAM" "1")
1270 (setenv "MACH_USE_SYSTEM_PYTHON" "1")
1271 (setenv "PYTHON"
1272 (search-input-file inputs "/bin/python"))
1273 (setenv "MOZ_BUILD_DATE" #$%icedove-build-id) ; avoid timestamp
1274 (setenv "MOZ_APP_NAME" "icedove")
1275 (setenv "LDFLAGS" (string-append "-Wl,-rpath=" #$output
1276 "/lib/icedove"))
1277 (mkdir-p (string-append (getcwd) "/builddir"))
1278 (with-output-to-file mozconfig
1279 (lambda ()
1280 (display
1281 (string-append
1282 "ac_add_options --disable-crashreporter\n"
1283 "ac_add_options --disable-debug\n"
1284 "ac_add_options --disable-debug-symbols\n"
1285 "ac_add_options --disable-elf-hack\n"
1286 "ac_add_options --disable-jit\n"
1287 "ac_add_options --disable-necko-wifi\n"
1288 "ac_add_options --disable-official-branding\n"
1289 "ac_add_options --disable-tests\n"
1290 "ac_add_options --disable-updater\n"
1291 "ac_add_options --disable-webrtc\n"
1292 "ac_add_options --enable-application=comm/mail\n"
1293 "ac_add_options --enable-default-toolkit=\"cairo-gtk3\"\n"
1294 "ac_add_options --enable-optimize\n"
1295 "ac_add_options --enable-pulseaudio\n"
1296 "ac_add_options --enable-release\n"
1297 "ac_add_options --enable-strip\n"
1298 "ac_add_options --enable-system-ffi\n"
1299 "ac_add_options --enable-system-pixman\n"
1300 "ac_add_options --prefix=" #$output "\n"
1301 "ac_add_options --with-clang-path="
1302 (search-input-file (or native-inputs inputs)
1303 "bin/clang") "\n"
1304 "ac_add_options --with-distribution-id=org.gnu\n"
1305 "ac_add_options --with-libclang-path="
1306 #$(this-package-native-input "clang") "/lib\n"
1307 "ac_add_options --with-system-bz2\n"
1308 "ac_add_options --with-system-icu\n"
1309 "ac_add_options --with-system-jpeg\n"
1310 "ac_add_options --with-system-libevent\n"
1311 "ac_add_options --with-system-nspr\n"
1312 "ac_add_options --with-system-nss\n"
1313 "ac_add_options --with-system-zlib\n"
1314 "ac_add_options --without-wasm-sandboxed-libraries\n"
1315 "mk_add_options MOZ_MAKE_FLAGS=-j"
1316 (number->string (parallel-job-count)) "\n"))))
1317 (display (getcwd))
1318 (newline)
1319 (display "mach configure")
1320 (invoke "./mach" "configure"))))
1321 (replace 'build
1322 (lambda _ (invoke "./mach" "build")))
1323 (replace 'install
1324 (lambda _ (invoke "./mach" "install")))
1325 ;; Thunderbird doesn't provide any .desktop file.
1326 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1637575
1327 (add-after 'install 'install-desktop-file
1328 (lambda _
1329 (let ((apps (string-append #$output "/share/applications")))
1330 (mkdir-p apps)
1331 (with-output-to-file (string-append apps "/icedove.desktop")
1332 (lambda _
1333 (format #t
1334 "[Desktop Entry]~@
1335 Name=Icedove~@
1336 Exec=~a/bin/icedove~@
1337 Icon=icedove~@
1338 GenericName=Mail/News Client~@
1339 Categories=Network;Email;~@
1340 Terminal=false~@
1341 StartupNotify=true~@
1342 MimeType=x-scheme-handler/mailto;~@
1343 Type=Application~@
1344 Actions=ComposeMessage;~@
1345 [Desktop Action ComposeMessage]~@
1346 Name=Write new message~@
1347 Exec=~@*~a/bin/icedove -compose~%"
1348 #$output))))))
1349 (add-after 'install-desktop-file 'install-icons
1350 (lambda _
1351 (with-directory-excursion "browser/branding/official"
1352 (for-each
1353 (lambda (file)
1354 (let* ((size (string-filter char-numeric? file))
1355 (icons (string-append #$output "/share/icons/hicolor/"
1356 size "x" size "/apps")))
1357 (mkdir-p icons)
1358 (copy-file file (string-append icons "/icedove.png"))))
1359 '("default16.png" "default22.png" "default24.png"
1360 "default32.png" "default48.png" "content/icon64.png"
1361 "mozicon128.png" "default256.png")))))
1362 (add-after 'install 'wrap-program
1363 (lambda* (#:key inputs #:allow-other-keys)
1364 (let* ((lib (string-append #$output "/lib"))
1365 (gtk #$(this-package-input "gtk+"))
1366 (gtk-share (string-append gtk "/share"))
1367 (pulseaudio #$(this-package-input "pulseaudio"))
1368 (pulseaudio-lib (string-append pulseaudio "/lib"))
1369 (eudev #$(this-package-input "eudev"))
1370 (eudev-lib (string-append eudev "/lib")))
1371 (wrap-program (car (find-files lib "^icedove$"))
1372 `("XDG_DATA_DIRS" prefix (,gtk-share))
1373 `("LD_LIBRARY_PATH" prefix (,pulseaudio-lib ,eudev-lib)))))))))
1374 (inputs
1375 (list alsa-lib
1376 bzip2
1377 cairo
1378 cups
1379 dbus-glib
1380 ffmpeg
1381 freetype
1382 gdk-pixbuf
1383 glib
1384 gtk+
1385 gtk+-2
1386 hunspell
1387 icu4c-71
1388 libcanberra
1389 libevent
1390 libffi
1391 libgnome
1392 libjpeg-turbo
1393 libpng-apng
1394 libvpx
1395 libxcomposite
1396 libxft
1397 libxinerama
1398 libxscrnsaver
1399 libxt
1400 mesa
1401 mit-krb5
1402 nss-next
1403 pango
1404 pixman
1405 pulseaudio
1406 sqlite
1407 startup-notification
1408 eudev
1409 unzip
1410 zip
1411 zlib))
1412 (native-inputs
1413 (list `(,rust "cargo")
1414 clang
1415 llvm
1416 m4
1417 nasm
1418 node
1419 perl
1420 pkg-config
1421 python-wrapper
1422 rust
1423 rust-cbindgen-0.23
1424 which
1425 yasm))
1426 (home-page "https://www.thunderbird.net")
1427 (synopsis "Rebranded Mozilla Thunderbird email client")
1428 (description
1429 "This package provides an email client built based on Mozilla
1430 Thunderbird. It supports email, news feeds, chat, calendar and contacts.")
1431 (license license:mpl2.0)))
1432
1433 (define-public icedove/wayland
1434 (package
1435 (inherit icedove)
1436 (name "icedove-wayland")
1437 (build-system trivial-build-system)
1438 (arguments
1439 (list
1440 #:modules '((guix build utils))
1441 #:builder
1442 #~(begin
1443 (use-modules (guix build utils))
1444 (let* ((exe (string-append #$output "/bin/icedove")))
1445 (mkdir-p (dirname exe))
1446 (call-with-output-file exe
1447 (lambda (port)
1448 (format port "#!~a
1449 MOZ_ENABLE_WAYLAND=1 exec ~a $@"
1450 #$(file-append bash-minimal "/bin/bash")
1451 #$(file-append icedove "/bin/icedove"))))
1452 (chmod exe #o555)
1453 ;; Provide the manual and .desktop file.
1454 (copy-recursively (string-append #$icedove "/share")
1455 (string-append #$output "/share"))
1456 (substitute* (string-append #$output
1457 "/share/applications/icedove.desktop")
1458 ((#$icedove) #$output))))))
1459 (native-inputs '())
1460 (inputs '())))
1461
1462 (define-public firefox-decrypt
1463 (package
1464 (name "firefox-decrypt")
1465 (version "0.7.0")
1466 (source (origin
1467 (method git-fetch)
1468 (uri (git-reference
1469 (url "https://github.com/Unode/firefox_decrypt")
1470 (commit version)))
1471 (file-name (git-file-name name version))
1472 (sha256
1473 (base32
1474 "17yyyxp47z4m8hnflcq34rc1y871515kr3f1y42j1l0yx3g0il07"))))
1475 (build-system trivial-build-system)
1476 (inputs
1477 (list nss python))
1478 (arguments
1479 `(#:modules ((guix build utils))
1480 #:builder
1481 (begin
1482 (use-modules (guix build utils))
1483 (setenv "PATH"
1484 (string-append
1485 (assoc-ref %build-inputs "python") "/bin"))
1486 (copy-file (string-append (assoc-ref %build-inputs "source")
1487 "/firefox_decrypt.py")
1488 "firefox_decrypt.py")
1489 (substitute* "firefox_decrypt.py"
1490 (("/usr/bin/env python") (which "python3"))
1491 (("libnss3.so") (string-append (assoc-ref %build-inputs "nss")
1492 "/lib/nss/libnss3.so")))
1493 (install-file "firefox_decrypt.py" (string-append %output "/bin"))
1494 #t)))
1495 (home-page "https://github.com/Unode/firefox_decrypt/")
1496 (synopsis "Tool to extract passwords from Mozilla profiles")
1497 (description "Firefox Decrypt is a tool to extract passwords from
1498 Mozilla (Firefox, Waterfox, Thunderbird, SeaMonkey) profiles.")
1499 (license license:gpl3+)))
1500
1501 (define-public lz4json
1502 (package
1503 (name "lz4json")
1504 (version "2")
1505 (source
1506 (origin
1507 (method git-fetch)
1508 (uri
1509 (git-reference
1510 (url "https://github.com/andikleen/lz4json")
1511 (commit (string-append "v" version))))
1512 (file-name (git-file-name name version))
1513 (sha256
1514 (base32 "1xxn8yzr6j8j6prmbj6mxspdczigarfiv3vlm9k70yxmky65ijh3"))))
1515 (build-system gnu-build-system)
1516 (native-inputs (list pkg-config))
1517 (inputs (list lz4))
1518 (arguments
1519 `(#:tests? #f ; no check target
1520 #:phases
1521 (modify-phases %standard-phases
1522 (delete 'configure) ; no configure script
1523 (replace 'install ; no install target
1524 (lambda* (#:key outputs #:allow-other-keys)
1525 (let* ((out (assoc-ref outputs "out"))
1526 (bin (string-append out "/bin"))
1527 (man (string-append out "/share/man/man1")))
1528 (install-file "lz4jsoncat" bin)
1529 (install-file "lz4jsoncat.1" man)))))
1530 #:make-flags `(,(string-append "CC=" ,(cc-for-target)))))
1531 (home-page "https://github.com/andikleen/lz4json")
1532 (synopsis "C decompress tool for mozilla lz4json format")
1533 (description
1534 "@code{lz4json} is a little utility to unpack lz4json files as generated
1535 by Firefox's bookmark backups and session restore. This is a different format
1536 from what the normal lz4 utility expects. The data is dumped to stdout.")
1537 (license license:bsd-2)))