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