gnu: icedove: Update to 78.13.0.
[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 Ludovic Courtès <ludo@gnu.org>
4 ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 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 Jonathan Brielmaier <jonathan.brielmaier@web.de>
17 ;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
18 ;;;
19 ;;; This file is part of GNU Guix.
20 ;;;
21 ;;; GNU Guix is free software; you can redistribute it and/or modify it
22 ;;; under the terms of the GNU General Public License as published by
23 ;;; the Free Software Foundation; either version 3 of the License, or (at
24 ;;; your option) any later version.
25 ;;;
26 ;;; GNU Guix is distributed in the hope that it will be useful, but
27 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
28 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 ;;; GNU General Public License for more details.
30 ;;;
31 ;;; You should have received a copy of the GNU General Public License
32 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
33
34 (define-module (gnu packages gnuzilla)
35 #:use-module ((srfi srfi-1) #:hide (zip))
36 #:use-module (ice-9 match)
37 #:use-module (gnu packages)
38 #:use-module ((guix licenses) #:prefix license:)
39 #:use-module (guix packages)
40 #:use-module (guix download)
41 #:use-module (guix git-download)
42 #:use-module (guix hg-download)
43 #:use-module (guix gexp)
44 #:use-module (guix store)
45 #:use-module (guix monads)
46 #:use-module (guix utils)
47 #:use-module (guix build-system gnu)
48 #:use-module (guix build-system cargo)
49 #:use-module (guix build-system trivial)
50 #:use-module (gnu packages admin)
51 #:use-module (gnu packages audio)
52 #:use-module (gnu packages autotools)
53 #:use-module (gnu packages base)
54 #:use-module (gnu packages bash)
55 #:use-module (gnu packages databases)
56 #:use-module (gnu packages glib)
57 #:use-module (gnu packages gtk)
58 #:use-module (gnu packages gnome)
59 #:use-module (gnu packages libcanberra)
60 #:use-module (gnu packages cups)
61 #:use-module (gnu packages kerberos)
62 #:use-module (gnu packages linux)
63 #:use-module (gnu packages perl)
64 #:use-module (gnu packages pkg-config)
65 #:use-module (gnu packages compression)
66 #:use-module (gnu packages fontutils)
67 #:use-module (gnu packages libevent)
68 #:use-module (gnu packages libreoffice) ;for hunspell
69 #:use-module (gnu packages image)
70 #:use-module (gnu packages libffi)
71 #:use-module (gnu packages pulseaudio)
72 #:use-module (gnu packages python)
73 #:use-module (gnu packages python-xyz)
74 #:use-module (gnu packages node)
75 #:use-module (gnu packages xorg)
76 #:use-module (gnu packages gl)
77 #:use-module (gnu packages assembly)
78 #:use-module (gnu packages rust)
79 #:use-module (gnu packages rust-apps)
80 #:use-module (gnu packages llvm)
81 #:use-module (gnu packages nss)
82 #:use-module (gnu packages icu4c)
83 #:use-module (gnu packages video)
84 #:use-module (gnu packages xiph)
85 #:use-module (gnu packages xdisorg)
86 #:use-module (gnu packages readline)
87 #:use-module (gnu packages sqlite))
88
89 (define-public mozjs
90 (package
91 (name "mozjs")
92 (version "17.0.0")
93 (source (origin
94 (method url-fetch)
95 (uri (string-append
96 "https://ftp.mozilla.org/pub/mozilla.org/js/"
97 name version ".tar.gz"))
98 (sha256
99 (base32
100 "1fig2wf4f10v43mqx67y68z6h77sy900d1w0pz9qarrqx57rc7ij"))
101 (patches (search-patches "mozjs17-aarch64-support.patch"))
102 (modules '((guix build utils)))
103 (snippet
104 ;; Fix incompatibility with Perl 5.22+.
105 '(begin
106 (substitute* '("js/src/config/milestone.pl")
107 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE"))
108 #t))))
109 (build-system gnu-build-system)
110 (native-inputs
111 `(("perl" ,perl)
112 ("pkg-config" ,pkg-config)
113 ("python" ,python-2)))
114 (propagated-inputs
115 `(("nspr" ,nspr))) ; in the Requires.private field of mozjs-17.0.pc
116 (inputs
117 `(("zlib" ,zlib)))
118 (arguments
119 `(;; XXX: parallel build fails, lacking:
120 ;; mkdir -p "system_wrapper_js/"
121 #:parallel-build? #f
122 #:make-flags '("CXXFLAGS=-fpermissive")
123 #:phases
124 (modify-phases %standard-phases
125 (add-after 'unpack 'delete-timedout-test
126 ;; This test times out on slower hardware.
127 (lambda _
128 (delete-file "js/src/jit-test/tests/basic/bug698584.js")
129 #t))
130 (add-before 'configure 'chdir
131 (lambda _
132 (chdir "js/src")
133 #t))
134 (replace 'configure
135 ;; configure fails if it is followed by SHELL and CONFIG_SHELL
136 (lambda* (#:key outputs #:allow-other-keys)
137 (let ((out (assoc-ref outputs "out")))
138 (setenv "SHELL" (which "sh"))
139 (setenv "CONFIG_SHELL" (which "sh"))
140 (invoke "./configure" (string-append "--prefix=" out)
141 ,@(if (string=? "aarch64-linux"
142 (%current-system))
143 '("--host=aarch64-unknown-linux-gnu")
144 '()))))))))
145 (home-page
146 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey")
147 (synopsis "Mozilla javascript engine")
148 (description "SpiderMonkey is Mozilla's JavaScript engine written
149 in C/C++.")
150 (license license:mpl2.0))) ; and others for some files
151
152 (define-public mozjs-24
153 (package (inherit mozjs)
154 (name "mozjs")
155 (version "24.2.0")
156 (source (origin
157 (method url-fetch)
158 (uri (string-append
159 "https://ftp.mozilla.org/pub/mozilla.org/js/"
160 name "-" version ".tar.bz2"))
161 (sha256
162 (base32
163 "1n1phk8r3l8icqrrap4czplnylawa0ddc2cc4cgdz46x3lrkybz6"))
164 (modules '((guix build utils)))
165 (patches (search-patches "mozjs24-aarch64-support.patch"))
166 (snippet
167 ;; Fix incompatibility with Perl 5.22+.
168 '(begin
169 (substitute* '("js/src/config/milestone.pl")
170 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE"))
171 #t))))
172 (arguments
173 (substitute-keyword-arguments (package-arguments mozjs)
174 ((#:phases phases)
175 `(modify-phases ,phases
176 (replace 'configure
177 (lambda* (#:key outputs #:allow-other-keys)
178 (let ((out (assoc-ref outputs "out")))
179 ;; configure fails if it is followed by SHELL and CONFIG_SHELL
180 (setenv "SHELL" (which "sh"))
181 (setenv "CONFIG_SHELL" (which "sh"))
182 (invoke "./configure"
183 (string-append "--prefix=" out)
184 "--with-system-nspr"
185 "--enable-system-ffi"
186 "--enable-threadsafe"
187 ,@(if (string=? "aarch64-linux"
188 (%current-system))
189 '("--host=aarch64-unknown-linux-gnu")
190 '())))))))))
191 (inputs
192 `(("libffi" ,libffi)
193 ("zlib" ,zlib)))))
194
195 (define-public mozjs-38
196 (package
197 (inherit mozjs)
198 (name "mozjs")
199 (version "38.2.1.rc0")
200 (source (origin
201 (method url-fetch)
202 (uri (string-append
203 "https://anduin.linuxfromscratch.org/BLFS/mozjs/"
204 name "-" version ".tar.bz2"))
205 (sha256
206 (base32
207 "0p4bmbpgkfsj54xschcny0a118jdrdgg0q29rwxigg3lh5slr681"))
208 (patches
209 (search-patches
210 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1269317 for
211 ;; GCC 6 compatibility.
212
213 "mozjs38-version-detection.patch" ; for 0ad
214 "mozjs38-tracelogger.patch"
215
216 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1339931.
217 "mozjs38-pkg-config-version.patch"
218 "mozjs38-shell-version.patch"))
219 (modules '((guix build utils)))
220 (snippet
221 '(begin
222 ;; Fix incompatibility with sed 4.4.
223 (substitute* "js/src/configure"
224 (("\\^\\[:space:\\]") "^[[:space:]]"))
225
226 ;; The headers are symlinks to files that are in /tmp, so they
227 ;; end up broken. Copy them instead.
228 (substitute*
229 "python/mozbuild/mozbuild/backend/recursivemake.py"
230 (("\\['dist_include'\\].add_symlink")
231 "['dist_include'].add_copy"))
232
233 ;; Remove bundled libraries.
234 (for-each delete-file-recursively
235 '("intl"
236 "js/src/ctypes/libffi"
237 "js/src/ctypes/libffi-patches"
238 "modules/zlib"))
239 #t))))
240 (arguments
241 `(;; XXX: parallel build fails, lacking:
242 ;; mkdir -p "system_wrapper_js/"
243 #:parallel-build? #f
244 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1008470.
245 #:tests? #f
246 #:phases
247 (modify-phases %standard-phases
248 (replace 'configure
249 (lambda* (#:key outputs #:allow-other-keys)
250 (let ((out (assoc-ref outputs "out")))
251 (chdir "js/src")
252 (setenv "SHELL" (which "sh"))
253 (setenv "CONFIG_SHELL" (which "sh"))
254 (invoke "./configure"
255 (string-append "--prefix=" out)
256 "--enable-ctypes"
257 "--enable-gcgenerational"
258 "--enable-optimize"
259 "--enable-pie"
260 "--enable-readline"
261 "--enable-shared-js"
262 "--enable-system-ffi"
263 "--enable-threadsafe"
264 "--enable-xterm-updates"
265 "--with-system-icu"
266 "--with-system-nspr"
267 "--with-system-zlib"
268
269 ;; Intl API requires bundled ICU.
270 "--without-intl-api")))))))
271 (native-inputs
272 `(("perl" ,perl)
273 ("pkg-config" ,pkg-config)
274 ("python-2" ,python-2)))
275 (inputs
276 `(("libffi" ,libffi)
277 ("readline" ,readline)
278 ("icu4c" ,icu4c)
279 ("zlib" ,zlib)))))
280
281 (define-public mozjs-52
282 ;; No releases yet at <https://archive.mozilla.org/pub/spidermonkey/releases/>.
283 ;; While we could take a snapshot of the complete mozilla-esr52 repository at
284 ;; <https://treeherder.mozilla.org/#/jobs?repo=mozilla-esr52&filter-searchStr=sm-tc>,
285 ;; we take the Debian version instead, because it is easier to work with.
286 (let ((commit "6507e63cc416fd7a3269e390efe712f8b56f374a")
287 (revision "1"))
288 (package (inherit mozjs-38)
289 (version (git-version "52.0" revision commit))
290 (source (origin
291 (method git-fetch)
292 (uri (git-reference
293 (url "https://salsa.debian.org/gnome-team/mozjs52.git")
294 (commit commit)))
295 (file-name (git-file-name "mozjs" version))
296 (sha256
297 (base32
298 "1ny0s53r8wn4byys87h784xrq1xg767akmfm6gqrbvrz57mlm3q2"))))
299 (arguments
300 `(#:tests? #f ; depends on repository metadata
301 #:configure-flags
302 '("--enable-ctypes"
303 "--enable-optimize"
304 "--enable-pie"
305 "--enable-readline"
306 "--enable-shared-js"
307 "--enable-system-ffi"
308 "--with-system-icu"
309 "--with-system-nspr"
310 "--with-system-zlib"
311
312 ;; Intl API requires bundled ICU.
313 "--without-intl-api"
314
315 ;; Without this gnome-shell will crash at runtime.
316 "--disable-jemalloc")
317 #:phases
318 (modify-phases %standard-phases
319 (add-after 'unpack 'patch-and-chdir
320 (lambda* (#:key inputs #:allow-other-keys)
321 ;; This patch prevents a segfault when executing JS_Init().
322 ;; The build does not fail without this patch, but the
323 ;; configure phase of the gjs package would fail.
324 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1176787
325 (make-file-writable "js/src/old-configure.in")
326 (make-file-writable "js/src/old-configure")
327 (make-file-writable "mozglue/build/moz.build")
328 (invoke "patch" "-p1" "--force"
329 "--input" "debian/patches/disable-mozglue.patch")
330 (invoke "touch" "js/src/configure")
331 (chdir "js/src")
332 #t))
333 (replace 'configure
334 (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
335 ;; The configure script does not accept environment variables
336 ;; as arguments.
337 (let ((out (assoc-ref outputs "out")))
338 (setenv "SHELL" (which "sh"))
339 (setenv "CONFIG_SHELL" (which "sh"))
340 (setenv "AUTOCONF" (string-append (assoc-ref inputs "autoconf")
341 "/bin/autoconf"))
342 (apply invoke "./configure"
343 (cons (string-append "--prefix=" out)
344 configure-flags))))))))
345 (native-inputs
346 `(("autoconf" ,autoconf-2.13)
347 ("automake" ,automake)
348 ,@(package-native-inputs mozjs-38))))))
349
350 (define-public mozjs-60
351 ;; No releases yet at <https://archive.mozilla.org/pub/spidermonkey/releases/>.
352 ;; While we could take a snapshot of the complete mozilla-esr60 repository at
353 ;; <https://treeherder.mozilla.org/#/jobs?repo=mozilla-esr60&filter-searchStr=sm-tc>,
354 ;; we take the Debian version instead, because it is easier to work with.
355 (package
356 (inherit mozjs-38)
357 (version "60.2.3-2")
358 (source (origin
359 (method git-fetch)
360 (uri (git-reference
361 (url "https://salsa.debian.org/gnome-team/mozjs60.git")
362 (commit (string-append "debian/" version))))
363 (file-name (git-file-name "mozjs" version))
364 (sha256
365 (base32
366 "091w050rwzrdcbgyi934k2viyccmlqxrp13sm2mql71mabb5dai6"))))
367 (arguments
368 `(#:tests? #f ; FIXME: all tests pass, but then the check phase fails anyway.
369 #:test-target "check-jstests"
370 #:configure-flags
371 '("--enable-ctypes"
372 "--enable-optimize"
373 "--enable-pie"
374 "--enable-readline"
375 "--enable-shared-js"
376 "--enable-system-ffi"
377 "--with-system-nspr"
378 "--with-system-zlib"
379 "--with-system-icu"
380 "--with-intl-api"
381 ;; This is important because without it gjs will segfault during the
382 ;; configure phase. With jemalloc only the standalone mozjs console
383 ;; will work.
384 "--disable-jemalloc")
385 #:phases
386 (modify-phases %standard-phases
387 (replace 'configure
388 (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
389 ;; The configure script does not accept environment variables as
390 ;; arguments. It also must be run from a different directory,
391 ;; but not the root directory either.
392 (let ((out (assoc-ref outputs "out")))
393 (mkdir "run-configure-from-here")
394 (chdir "run-configure-from-here")
395 (setenv "SHELL" (which "sh"))
396 (setenv "CONFIG_SHELL" (which "sh"))
397 (setenv "AUTOCONF" (string-append (assoc-ref inputs "autoconf")
398 "/bin/autoconf"))
399 (apply invoke "../js/src/configure"
400 (cons (string-append "--prefix=" out)
401 configure-flags))
402 #t)))
403 (add-after 'unpack 'disable-broken-tests
404 (lambda _
405 ;; This test assumes that /bin exists and contains certain
406 ;; executables.
407 (delete-file "js/src/tests/shell/os.js")
408 #t)))))
409 (native-inputs
410 `(("autoconf" ,autoconf)
411 ("automake" ,automake)
412 ("which" ,which)
413 ("perl" ,perl)
414 ("pkg-config" ,pkg-config)
415 ("python" ,python-2)))))
416
417 (define-public mozjs-78
418 (package
419 (inherit mozjs-60)
420 (version "78.5.0")
421 (source (origin
422 (method url-fetch)
423 ;; TODO: Switch to IceCat source once available on ftp.gnu.org.
424 (uri (string-append "https://archive.mozilla.org/pub/firefox"
425 "/releases/" version "esr/source/firefox-"
426 version "esr.source.tar.xz"))
427 (sha256
428 (base32
429 "1442yjmwz69hkfcvh8kkb60jf4c9ms0pac04nc3xw2da13v4zxai"))))
430 (arguments
431 `(#:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums'
432 #:modules ((guix build cargo-utils)
433 ,@%gnu-build-system-modules)
434 #:test-target "check-jstests"
435 #:configure-flags
436 '(;; Disable debugging symbols to save space.
437 "--disable-debug"
438 "--disable-debug-symbols"
439 ;; This is important because without it gjs will segfault during the
440 ;; configure phase. With jemalloc only the standalone mozjs console
441 ;; will work.
442 "--disable-jemalloc"
443 "--enable-tests"
444 "--enable-hardening"
445 "--enable-optimize"
446 "--enable-release"
447 "--enable-rust-simd"
448 "--enable-readline"
449 "--enable-shared-js"
450 "--with-system-icu"
451 "--with-system-nspr"
452 "--with-system-zlib"
453 "--with-intl-api")
454 #:phases
455 (modify-phases %standard-phases
456 (add-after 'patch-source-shebangs 'patch-cargo-checksums
457 (lambda _
458 (let ((null-hash
459 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))
460 (for-each (lambda (file)
461 (format #t "patching checksums in ~a~%" file)
462 (substitute* file
463 (("^checksum = \".*\"")
464 (string-append "checksum = \"" null-hash "\""))))
465 (find-files "." "Cargo\\.lock$"))
466 (for-each generate-all-checksums
467 '("js" "third_party/rust"))
468 #t)))
469 (replace 'configure
470 (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
471 ;; The configure script does not accept environment variables as
472 ;; arguments. It also must be run from a different directory,
473 ;; but not the root directory either.
474 (let ((out (assoc-ref outputs "out")))
475 (mkdir "run-configure-from-here")
476 (chdir "run-configure-from-here")
477 (setenv "SHELL" (which "sh"))
478 (setenv "CONFIG_SHELL" (which "sh"))
479 (setenv "AUTOCONF" (string-append (assoc-ref inputs "autoconf")
480 "/bin/autoconf"))
481 (apply invoke "../js/src/configure"
482 (cons (string-append "--prefix=" out)
483 configure-flags))
484 #t)))
485 (add-after 'unpack 'adjust-for-icu-68
486 (lambda _
487 (with-directory-excursion "js/src/tests"
488 ;; The test suite expects a lightly patched ICU 67. Since
489 ;; Guix is about to switch to ICU 68, massage the tests to
490 ;; work with that instead of patching ICU. Try removing this
491 ;; phase for newer versions of mozjs.
492
493 ;; These tests look up locale names and expects to get
494 ;; "GB" instead of "UK".
495 (substitute* "non262/Intl/DisplayNames/language.js"
496 (("Traditionell, GB")
497 "Traditionell, UK"))
498 (substitute* "non262/Intl/DisplayNames/region.js"
499 (("\"GB\": \"GB\"")
500 "\"GB\": \"UK\""))
501
502 ;; XXX: Some localized time formats have changed, and
503 ;; substitution fails for accented characters, even though
504 ;; it works in the REPL(?). Just delete these for now.
505 (delete-file "non262/Intl/Date/toLocaleString_timeZone.js")
506 (delete-file "non262/Intl/Date/toLocaleDateString_timeZone.js")
507
508 ;; Similarly, these get an unexpected "A" suffix when looking
509 ;; up a time in the "ar-MA-u-ca-islamicc" locale, which is
510 ;; tricky to substitute.
511 (delete-file "non262/Intl/DateTimeFormat/format_timeZone.js")
512 (delete-file "non262/Intl/DateTimeFormat/format.js")
513
514 ;; This file compares a generated list of ICU locale names
515 ;; with actual lookups. Some have changed slightly, i.e.
516 ;; daf-Latn-ZZ -> daf-Latn-CI, so drop it for simplicity.
517 (delete-file "non262/Intl/Locale/likely-subtags-generated.js"))
518
519 #t))
520 (add-before 'check 'pre-check
521 (lambda _
522 (with-directory-excursion "../js/src/tests"
523 (substitute* "shell/os.js"
524 ;; FIXME: Why does the killed process have an exit status?
525 ((".*killed process should not have exitStatus.*")
526 ""))
527
528 ;; XXX: Delete all tests that test time zone functionality,
529 ;; because the test suite uses /etc/localtime to figure out
530 ;; the offset from the hardware clock, which does not work
531 ;; in the build container. See <tests/non262/Date/shell.js>.
532 (delete-file-recursively "non262/Date")
533 (delete-file "non262/Intl/DateTimeFormat/tz-environment-variable.js")
534
535 (setenv "JSTESTS_EXTRA_ARGS"
536 (string-join
537 (list
538 ;; Do not run tests marked as "random".
539 "--exclude-random"
540 ;; Exclude web platform tests.
541 "--wpt=disabled"
542 ;; Respect the daemons configured number of jobs.
543 (string-append "--worker-count="
544 (number->string (parallel-job-count)))))))
545 #t)))))
546 (native-inputs
547 `(("autoconf" ,autoconf-2.13)
548 ("automake" ,automake)
549 ("llvm" ,llvm) ;for llvm-objdump
550 ("perl" ,perl)
551 ("pkg-config" ,pkg-config)
552 ("python" ,python-3)
553 ("rust" ,rust)
554 ("cargo" ,rust "cargo")))
555 (inputs
556 `(("icu4c" ,icu4c-68)
557 ("readline" ,readline)
558 ("zlib" ,zlib)))))
559
560 (define mozilla-compare-locales
561 (origin
562 (method hg-fetch)
563 (uri (hg-reference
564 (url "https://hg.mozilla.org/l10n/compare-locales/")
565 (changeset "RELEASE_8_0_0")))
566 (file-name "mozilla-compare-locales")
567 (sha256 (base32 "0052wq92sg4i776x407b5838jx9h3phl9xy69m2q34f31n3gdyk2"))))
568
569 (define (mozilla-locale locale changeset hash-string)
570 (origin
571 (method hg-fetch)
572 (uri (hg-reference
573 (url (string-append "https://hg.mozilla.org/l10n-central/"
574 locale))
575 (changeset changeset)))
576 (file-name (string-append "mozilla-locale-" locale))
577 (sha256 (base32 hash-string))))
578
579 (define-syntax-rule (mozilla-locales (hash-string changeset locale) ...)
580 (list (mozilla-locale locale changeset hash-string)
581 ...))
582
583 (define all-mozilla-locales
584 (mozilla-locales
585 ;; sha256 changeset locale
586 ;;---------------------------------------------------------------------------
587 ("1q1p7nl97478hkf1msbbcdh98k6fn87xwqihbw8np00ll5gk9k4v" "97cf3c155484" "ach")
588 ("0sajpblp639l448xywx7xlybjr5dm0rfrzx511a8pa9wn7dma4mf" "46929b4dda4e" "af")
589 ("04s756aaf1yyli1dn1vfdjymgyjs1pz2n7jvz76j27x4nzdgss7l" "96ffd2b04ba3" "an")
590 ("16nw7slm7irsnjf81r6zl273kbzri8sdbimzgzxwm0vh6xr61rgs" "1c4231166ddf" "ar")
591 ("0i0qrj4j8zjv55cisbmr21dp8mz933hc9wkpn3abz5k5pn84gpry" "bc4384b8be78" "ast")
592 ("1r77mmwg9x1jfa7g5lqa31rgyfrnix1zj80ibn5rq9gyhhsdrwbd" "dd56aead51fa" "az")
593 ("1kzjpy5bnvps8di72ksynhbhc9bpw1ml6hvphm74z8dz55ai4c18" "9d2bff64ddfb" "be")
594 ("1fygvjgph3siknfm7l0fh9y4ava72z1rxkip1zgmcdgq7jz8wzpf" "3808f4fe4db6" "bg")
595 ("1x9nlqia441xh04rhkmkw6qrgpwnyqw0grrf5n2qw96939wnmgl7" "5ca8752ed8df" "bn")
596 ("18yyxqzab44bgqx7h052d5nxyhv0l5bidgr16z1b3ak2crsfyx9q" "4c5d30ca9bf2" "br")
597 ("11bschjz7pgsm4r1qan5l4s3nkzm5jb0kivpp186wd1xsjci5bjb" "cf2478a7eae1" "bs")
598 ("12bak64nl6qi092l55xv330vh38mfsicrrf4wi693nn7zqb3mbpw" "4aa2cc349211" "ca")
599 ("0p97d7pnxqs971rr5c57i6cw3mx1mp3iasa0xdmdk0zpz9pjd3s4" "806914072144" "ca-valencia")
600 ("1rligf98h9r16mw3r3n5jalzi74xn2dnh6hkiixp7s2bvhjicwa4" "db2163383129" "cak")
601 ("18y5j8ljh72mj2nbx0m64mi3fyjbwyx992i004sv3zvs4d4z18w4" "d1d09eedddde" "cs")
602 ("12i4m9q6f8sl8arm8ja4gs4sl9m59p3kddlqi68srpz9mk66rqxz" "1caf58c64227" "cy")
603 ("16wacsd23zd4j0yi6vbj033wylia8hlpswx949x5hy1h9817j4vn" "9ef3b56aa243" "da")
604 ("1ddxnqpfi1wnciwmzkvvjinb51h22bg70r0dn7db17q64p4271rk" "a050b0eaec0a" "de")
605 ("0gw5h52rw3bc2lwffnv845sjwwj22gmabchmpa1rw2y6087dc7zk" "613135cb0759" "dsb")
606 ("0v17da37w1kbs73i6xql4c9xng6rfachyylpy3w8hpibpvi7i30n" "903db7c76b31" "el")
607 ("0ky1nj4kp070nriw0igsa64l39plcv2365zl8lqpbydyp6clwc3m" "6bb74673e9aa" "en-CA")
608 ("15jck6si2l4h5lrs8zjx56y97p70njpi26nnq6xfmvj1dk5qb4g2" "c06bd83a9295" "en-GB")
609 ("1gc400n8j8qk70vdw7fkf4m9yviia35cmj6361pxnyvsjrgm4qvm" "ae0fda5114c4" "eo")
610 ("0y01lahdrd3krsh6nrr3iw36r2x4advh5qw54vf92w11l3aiyvfz" "0c294dc9ce40" "es-AR")
611 ("16jjbsfa62dxk36ccziv7nmh26c1s0b05960in6zs5nnfrv4yh35" "7c30b2981fb4" "es-CL")
612 ("0qh8c8f8dsv1v56n1mcpn84l39bpnqfl8v8iacq12zh322srr549" "ad1444f4f833" "es-ES")
613 ("1vh3hm5r4ch6mk3ymbk12b9rppwc75fmbi0i7cml82kxsi77bzw5" "0a26cdb23536" "es-MX")
614 ("159l92jxx48lgba1g8ig3mdzhwsf3jpg3nx1g9blq4majk5hqr6q" "65a38a830795" "et")
615 ("1ha8y1wbgb66dqm26x1q2xwygy7bblkjz40y9vh5d2qlpr3fn0av" "21e0930b221d" "eu")
616 ("0rq4pcw6klm0bbljm1wdfvna8bpa35cm47hh2s63i2xdax4scahf" "5a4bb020cf09" "fa")
617 ("1py2594gsvpgrxnplz278ffb7grsf384kzjskrl1zyps0jw8fb1x" "4a4f712cd4aa" "ff")
618 ("1dyd55ngsglp1w2gh0yaacwb0vsq23gdvnj76f2x6g39h1li9s0z" "9c51cd915e2b" "fi")
619 ("0kimwivpq6pr63jh1k9fszsv8bi8vns3scg76mmnvbhh2ca8q7wj" "4f9e24a696ee" "fr")
620 ("1sbbnnp12lgy5qan2kix02942830b1969bd7jxrv7piwqfch9i06" "9e21a0eeb5b1" "fy-NL")
621 ("0dsvvyfrzkx5h44gqgdci7arb8h4lq48w20cnr8fc7j17grvnkzz" "999a995bc09d" "ga-IE")
622 ("1487msbsgrfzmyijhf6a4wbqdjpd7b7ki9nwrjjjjlnbw0h0ljpb" "6a9ddcab3240" "gd")
623 ("1kzc4fwr18kgisdzba2acj1ag8mxbifqpk5p30jv68nmvqfsvl8d" "51eb5e352db9" "gl")
624 ("13gy3wn44kcxr7j3sbl69fp415875f4vb0gm91hx0fysqlvryhcs" "b9de1ffe3224" "gn")
625 ("0w5nvzpjn5vr35c1852rlff581vpy71nc096cz125852kyqkzkc3" "5b3307475ada" "gu-IN")
626 ("1ycakc4qpy9vcy50j3ricryjfnjr9v3a5ijj6bbfl4y6aks157fy" "c742df968ffd" "he")
627 ("1b2jf83c500wm5wcdnijq0b7y4m8n6271smq8pygahn5nq17f0gq" "1a3039a52b8a" "hi-IN")
628 ("19bbw8ix5m83cf4yarcmjl7jqa8xfabwqnh3nj6vi52rwvn7whk5" "8dc50e269ef3" "hr")
629 ("12rrsvgg6bb2h8fhni7jbx8pv983q8ym5fhfjim957n9q2yp5db6" "67e40f48dec7" "hsb")
630 ("0apyh713p3hrlj8041xwblcssahbmsqp9v9hbmb50ayf4z850kr1" "40073a597b1b" "hu")
631 ("0q0r076lq250d3vmnz9d92wj137c2v8i362c2avmkgp5zr3mcl0z" "2ea33335afdb" "hy-AM")
632 ("0qza33gdc1i9259dwd2f7vd78s0a6rg34aqdkhcn7f2l6ybw6xd6" "930041db15eb" "ia")
633 ("1211h0gp7gianh3qf76w04gfzk4n2bnyc9i8dviyz0vh4cjbx11m" "08811a49b41c" "id")
634 ("12lcr841g1j7453s7gb51vrvxmshx4ha3h1jx4vh8wr891xv8l6a" "2f7a8d31e0ba" "is")
635 ("1x585g0r2kcv0d3phnxx85bk5g0pi1yl0hwp4idv19yc9hslr04s" "188357cc04b4" "it")
636 ("09v35g9v7j6x0p1hggydm3a1rmq2fh4z7g1l88z3w5k6wq2nhj1b" "45cee0ba4771" "ja")
637 ("0prs3vycfvvaffjigdgyxiq41ak2rc34lnan5a6cwdqjgy7z450s" "d60a19d9bf17" "ja-JP-mac")
638 ("1nskzm8rgczrbgcxlzzq5zqdfd456ad0cylq27nf0wjiyq6kjzcm" "00cb00e78672" "ka")
639 ("0g6zznmhiam172nm7g2qzfpk415mna8kiihm73z2sdns64xb3ymg" "77a293a4bced" "kab")
640 ("17dld9lrym7rpvpvnkssivp4wx1f11zpk86wczbq1h52qgd70p55" "2c9b33a56d5d" "kk")
641 ("1nlzl8930c8ql3yq425wyqlxvq8arrjv20xpm5g7yfxd54av89ac" "9cddd42af05c" "km")
642 ("07hkrcdksvrqk816yimd036dlw15nc4sjk4gmw16ywbp093v0mqq" "e0c2969a8398" "kn")
643 ("08aqggvk3qbv5bzks9i1iba9akhkpm01d2c9k0zf41mpr2r5yfg2" "827567d0dafc" "ko")
644 ("0vagaiwy80bs1k3gkacshlzb5zchkcshx0ypwirvayc63sw4yl8l" "694b2a24e868" "lij")
645 ("1r43kp1kzahrbza0hiyavqplk9h08pzsb6rpjy79jr6l1iqb89sy" "d6728db7e060" "lt")
646 ("0sq2wbsj79xl7fi454k6q5xdhxyck1whjz315rv37vphqpx86b9b" "61e9b33f4d94" "lv")
647 ("0q8jxg1af22hs9wjdf0jd3bqk4rafxyzvsjl35k75am7l2y1fl3c" "9e482f6dd72c" "mk")
648 ("1zsfzjrzbc58d30a9yz12h5vphywgpw8xg6y6zn3677a785dvr20" "1fd2763336a4" "mr")
649 ("1rzygkkpn1a59daygd3hdaqph2np6sqvpgh68j0xr4il958ymnsm" "67ddab62dab4" "ms")
650 ("16jp6w5gizfxs7jvncg3ly13m59vqvh4rlmjd0q23m5g5ff9sklc" "3ed015b51bf3" "my")
651 ("1wfv023j67lb4iyf49fsknwm4z3xy0xqcf25b2nzanggxj26n01x" "d01801233a8f" "nb-NO")
652 ("1946vfia58vbjfippb5pfsskbjj95w7hb340smn6ry2vmza99mxp" "582defb08fb2" "ne-NP")
653 ("12w5ywh4c3s55y3zqc48cp1gcpwwjg444yfh1bghhhb9ni1xkh5i" "05f6359a29a6" "nl")
654 ("17jb076320cgkw1ypwmws2vjxsqlv2ww8aaisa3j334vbrw1m4zx" "50b41a1ddded" "nn-NO")
655 ("1y840j0v5zdgj94cbacy6j1snf44rynmzxq3yk8i26arcar62akl" "a6a138531a44" "oc")
656 ("0jq1hq4xhqxpa26r8pb1bgbaljgfkhn9l6p5pbnslkllpbh70q6l" "e70a3afaef25" "pa-IN")
657 ("1hih138skwy2gb8q10ngg6zalrk3aa3d549mg79gqzxbi5zy19fw" "e035f33389eb" "pl")
658 ("1hhif4hx4k351wm1bzykzycfzb5q8msxmiwh5r1cy32rh8wkxwhh" "54098495f37f" "pt-BR")
659 ("0gkjs12rxjml1m3mljskpz1gr6aph0c31nwpwdqybfg54w9qslib" "3fdf021f624e" "pt-PT")
660 ("0anyvwd9v6mr8y3ww33s6qnxkawqn5lz65vrxx3m3kzky63ai1xk" "794f9374eb87" "rm")
661 ("1p4drj25gsfv7lwgm5saazh38iqrh53952n8i4bmxpn0nadbm2n5" "71ce18bcf6cc" "ro")
662 ("17yssf4axd3zvncl4ka4wkfnwcn0z0arp3390vb9cps67na29p36" "3a9587227699" "ru")
663 ("0xk6rksspcw1222v4rgk5a6gzrpx64k29hm7p9qkqwd70s34yj46" "c020582a72ce" "si")
664 ("1ax5ibydyn7sj208r66zcxlcr8dxdqrw28vqyjif4jx583rp4lfp" "745a699b7f51" "sk")
665 ("13rin7hm1dv8g0hbcv8mp2hiwpk1k5bhzvkqpqajkkik4lx523mc" "8e437e2351ef" "sl")
666 ("0yh5jkl5zw3f7x1w2w6zfj3dyvcl4wj1zv4di7qsq2nl2yyizf7x" "2d99e2eff94f" "son")
667 ("0vzq7s27jsdbw5k59wfykysg1kd8w229ab5d4zjdf30l59igkahh" "69bbdf07bd80" "sq")
668 ("1mwivvs8vrk6vjq6i33kwlrlisra7dy35521ayps9p2rz2dll4rr" "215df5c5125c" "sr")
669 ("0g97yz1rg5cfflj8vvq3sqliyvm06x818z9yldfh5rjg1y6n9fjd" "8be00a1a50d4" "sv-SE")
670 ("0ii02jn3lh2i6d0s95whx9aj6w3x8axc7w1rlzj0lc2s9n52krz3" "170a84339dbe" "ta")
671 ("1ss7symad2crapxjqc0xhc0n17l79r5vf7flvkgk7npjky4vb7nv" "72a79a304f7f" "te")
672 ("11iqmg8zamgscnvs4n2xpw3g9azn6w38qs313wiwm86pyx6694ss" "8e91ce3064c5" "th")
673 ("1zgkvn9flb8by62ip9r3gmpgxwgkww1zhml5mwa0djq3ppfdgi1c" "0f914d0cda56" "tl")
674 ("1filkhdak6dbrd83q602x1qw1703nlm53nm9gcyab8s16gsx6ylz" "62ca6a8eaeba" "tr")
675 ("0cgagdy0ixprk3knczdmkqxkmx4ybmshhh0956kxbd0iab0dfcf6" "f110ccac4cde" "trs")
676 ("1f1ghk67zwnwc5x3nk82vcv94nf8glngkfya1hg074q3088sj9pa" "56c0102d5f1c" "uk")
677 ("0iyw1b2jjylkdwxv9sxvj4ikxl64sx612b2dvvmf1di8bw86w74r" "7d53bce5ae98" "ur")
678 ("1q83cp5pfgs8l03zirwi8r5qp8qyh4zvxdx1ilgaqqlyg42yql7c" "9b500e1a054d" "uz")
679 ("1d4nkybz2hk64ay04k965b9lc5nhhpmzcs5ww3b6q4n93rf9c2z7" "2a000025928a" "vi")
680 ("1cnrsfnyl3sw3sxsggmjwydvphb2diy0vzknvxdhpnvq3ln18hga" "74724087c25b" "xh")
681 ("1j6l66v1xw27z8w78mpsnmqgv8m277mf4r0hgqcrb4zx7xc2vqyy" "527e5e090608" "zh-CN")
682 ("1frwx35klpyz3sdwrkz7945ivb2dwaawhhyfnz4092h9hn7rc4ky" "6cd366ad2947" "zh-TW")))
683
684 (define* (computed-origin-method gexp-promise hash-algo hash
685 #:optional (name "source")
686 #:key (system (%current-system))
687 (guile (default-guile)))
688 "Return a derivation that executes the G-expression that results
689 from forcing GEXP-PROMISE."
690 (mlet %store-monad ((guile (package->derivation guile system)))
691 (gexp->derivation (or name "computed-origin")
692 (force gexp-promise)
693 #:graft? #f ;nothing to graft
694 #:system system
695 #:guile-for-build guile)))
696
697 (define %icecat-version "78.13.0-guix0-preview1")
698 (define %icecat-build-id "20210810000000") ;must be of the form YYYYMMDDhhmmss
699
700 ;; 'icecat-source' is a "computed" origin that generates an IceCat tarball
701 ;; from the corresponding upstream Firefox ESR tarball, using the 'makeicecat'
702 ;; script from the upstream IceCat project.
703 (define icecat-source
704 (let* ((base-version (first (string-split %icecat-version #\-)))
705
706 (major-version (first (string-split base-version #\.)))
707 (minor-version (second (string-split base-version #\.)))
708 (sub-version (third (string-split base-version #\.)))
709
710 (upstream-firefox-version (string-append base-version "esr"))
711 (upstream-firefox-source
712 (origin
713 (method url-fetch)
714 (uri (string-append
715 "https://ftp.mozilla.org/pub/firefox/releases/"
716 upstream-firefox-version "/source/"
717 "firefox-" upstream-firefox-version ".source.tar.xz"))
718 (sha256
719 (base32
720 "0v2g5clp9qlsbqfjb6yz614nq8x8c4k1p6m4axyv6g27qbiaky8r"))))
721
722 (upstream-icecat-base-version "78.7.0") ; maybe older than base-version
723 ;;(gnuzilla-commit (string-append "v" upstream-icecat-base-version))
724 (gnuzilla-commit "abfe5eebaca3c2787f1a9505669393674493c177")
725 (gnuzilla-source
726 (origin
727 (method git-fetch)
728 (uri (git-reference
729 (url "git://git.savannah.gnu.org/gnuzilla.git")
730 (commit gnuzilla-commit)))
731 (file-name (git-file-name "gnuzilla"
732 ;;upstream-icecat-base-version
733 (string-take gnuzilla-commit 8)))
734 (sha256
735 (base32
736 "00ws3540x5whpicc5fx4k949ff73cqvajz6jp13ahn49wqdads47"))))
737
738 ;; 'search-patch' returns either a valid file name or #f, so wrap it
739 ;; in 'assume-valid-file-name' to avoid 'local-file' warnings.
740 (gnuzilla-fixes-patch
741 (local-file (assume-valid-file-name
742 (search-patch "icecat-use-older-reveal-hidden-html.patch"))))
743 (makeicecat-patch
744 (local-file (assume-valid-file-name
745 (search-patch "icecat-makeicecat.patch")))))
746
747 (origin
748 (method computed-origin-method)
749 (file-name (string-append "icecat-" %icecat-version ".tar.xz"))
750 (sha256 #f)
751 (uri
752 (delay
753 (with-imported-modules '((guix build utils))
754 #~(begin
755 (use-modules (guix build utils))
756 (let ((firefox-dir
757 (string-append "firefox-" #$base-version))
758 (icecat-dir
759 (string-append "icecat-" #$%icecat-version)))
760
761 (mkdir "/tmp/bin")
762 (set-path-environment-variable
763 "PATH" '("bin")
764 (list "/tmp"
765 #+(canonical-package bash)
766 #+(canonical-package coreutils)
767 #+(canonical-package findutils)
768 #+(canonical-package patch)
769 #+(canonical-package xz)
770 #+(canonical-package sed)
771 #+(canonical-package grep)
772 #+(canonical-package bzip2)
773 #+(canonical-package gzip)
774 #+(canonical-package tar)
775 #+rename))
776
777 (symlink #+(file-append rename "/bin/rename")
778 "/tmp/bin/prename")
779
780 ;; We copy the gnuzilla source directory because it is
781 ;; read-only in 'gnuzilla-source', and the makeicecat script
782 ;; uses "cp -a" to copy parts of it and assumes that the
783 ;; copies will be writable.
784 (copy-recursively #+gnuzilla-source "/tmp/gnuzilla"
785 #:log (%make-void-port "w"))
786
787 (with-directory-excursion "/tmp/gnuzilla"
788 (make-file-writable "makeicecat")
789 (invoke "patch" "--force" "--no-backup-if-mismatch"
790 "-p1" "--input" #+gnuzilla-fixes-patch)
791 (invoke "patch" "--force" "--no-backup-if-mismatch"
792 "-p1" "--input" #+makeicecat-patch)
793 (patch-shebang "makeicecat")
794 (substitute* "makeicecat"
795 (("^FFMAJOR=(.*)" all ffmajor)
796 (unless (string=? #$major-version
797 (string-trim-both ffmajor))
798 ;; The makeicecat script cannot be expected to work
799 ;; properly on a different version of Firefox, even if
800 ;; no errors occur during execution.
801 (error "makeicecat major version mismatch"))
802 (string-append "FFMAJOR=" #$major-version "\n"))
803 (("^FFMINOR=.*")
804 (string-append "FFMINOR=" #$minor-version "\n"))
805 (("^FFSUB=.*")
806 (string-append "FFSUB=" #$sub-version "\n"))
807 (("^DATA=.*")
808 "DATA=/tmp/gnuzilla/data\n")
809 (("/bin/sed")
810 #+(file-append (canonical-package sed) "/bin/sed"))))
811
812 (format #t "Unpacking upstream firefox tarball...~%")
813 (force-output)
814 (invoke "tar" "xf" #+upstream-firefox-source)
815 (rename-file firefox-dir icecat-dir)
816
817 (with-directory-excursion icecat-dir
818 (format #t "Populating l10n directory...~%")
819 (force-output)
820 (mkdir "l10n")
821 (with-directory-excursion "l10n"
822 (for-each
823 (lambda (locale-dir)
824 (let ((locale
825 (string-drop (basename locale-dir)
826 (+ 32 ; length of hash
827 (string-length "-mozilla-locale-")))))
828 (format #t " ~a~%" locale)
829 (force-output)
830 (copy-recursively locale-dir locale
831 #:log (%make-void-port "w"))
832 (for-each make-file-writable (find-files locale))
833 (with-directory-excursion locale
834 (when (file-exists? ".hgtags")
835 (delete-file ".hgtags"))
836 (mkdir-p "browser/chrome/browser/preferences")
837 (call-with-output-file
838 "browser/chrome/browser/preferences/advanced-scripts.dtd"
839 (lambda (port) #f)))))
840 '#+all-mozilla-locales)
841 (copy-recursively #+mozilla-compare-locales
842 "compare-locales"
843 #:log (%make-void-port "w"))
844 (delete-file "compare-locales/.gitignore")
845 (delete-file "compare-locales/.hgignore")
846 (delete-file "compare-locales/.hgtags"))
847
848 (format #t "Running makeicecat script...~%")
849 (force-output)
850 (invoke "bash" "/tmp/gnuzilla/makeicecat"))
851
852 (format #t "Packing IceCat source tarball...~%")
853 (force-output)
854 (invoke "tar" "cfa" #$output
855 ;; Avoid non-determinism in the archive. We set the
856 ;; mtime of files in the archive to early 1980 because
857 ;; the build process fails if the mtime of source
858 ;; files is pre-1980, due to the creation of zip
859 ;; archives.
860 "--mtime=@315619200" ; 1980-01-02 UTC
861 "--owner=root:0"
862 "--group=root:0"
863 "--sort=name"
864 icecat-dir)
865
866 #t))))))))
867
868 (define-public icecat
869 (package
870 (name "icecat")
871 (version %icecat-version)
872 (source icecat-source)
873 (build-system gnu-build-system)
874 (inputs
875 `(("alsa-lib" ,alsa-lib)
876 ("bzip2" ,bzip2)
877 ("cups" ,cups)
878 ("dbus-glib" ,dbus-glib)
879 ("gdk-pixbuf" ,gdk-pixbuf)
880 ("glib" ,glib)
881 ("gtk+" ,gtk+)
882 ("gtk+-2" ,gtk+-2)
883 ;; UNBUNDLE-ME! ("graphite2" ,graphite2)
884 ("pango" ,pango)
885 ("freetype" ,freetype)
886 ;; UNBUNDLE-ME! ("harfbuzz" ,harfbuzz)
887 ("libcanberra" ,libcanberra)
888 ("libgnome" ,libgnome)
889 ("libjpeg-turbo" ,libjpeg-turbo)
890 ;; UNBUNDLE-ME! ("libogg" ,libogg)
891 ;; UNBUNDLE-ME! ("libtheora" ,libtheora) ; wants theora-1.2, not yet released
892 ;; UNBUNDLE-ME! ("libvorbis" ,libvorbis)
893 ("libxft" ,libxft)
894 ("libevent" ,libevent)
895 ("libxinerama" ,libxinerama)
896 ("libxscrnsaver" ,libxscrnsaver)
897 ("libxcomposite" ,libxcomposite)
898 ("libxt" ,libxt)
899 ("libffi" ,libffi)
900 ("ffmpeg" ,ffmpeg)
901 ;; UNBUNDLE-ME! ("libvpx" ,libvpx)
902 ("icu4c" ,icu4c-67)
903 ("pixman" ,pixman)
904 ("pulseaudio" ,pulseaudio)
905 ("mesa" ,mesa)
906 ("mit-krb5" ,mit-krb5)
907 ;; See <https://bugs.gnu.org/32833>
908 ;; and related comments in the 'remove-bundled-libraries' phase.
909 ;; UNBUNDLE-ME! ("nspr" ,nspr)
910 ;; UNBUNDLE-ME! ("nss" ,nss)
911 ("shared-mime-info" ,shared-mime-info)
912 ;; UNBUNDLE-ME! ("sqlite" ,sqlite)
913 ("unzip" ,unzip)
914 ("zip" ,zip)
915 ;; UNBUNDLE-ME! ("zlib" ,zlib)
916 ))
917 (native-inputs
918 ;; The following patches are specific to the Guix packaging of IceCat,
919 ;; and therefore we prefer to leave them out of 'source', which should be
920 ;; a tarball suitable for compilation on any system that IceCat supports.
921 ;; (Bug fixes and security fixes, however, should go in 'source').
922 `(;; XXX TODO: Adapt these patches to IceCat 68.
923 ;; ("icecat-avoid-bundled-libraries.patch"
924 ;; ,(search-patch "icecat-avoid-bundled-libraries.patch"))
925 ;; ("icecat-use-system-graphite2+harfbuzz.patch"
926 ;; ,(search-patch "icecat-use-system-graphite2+harfbuzz.patch"))
927 ;; ("icecat-use-system-media-libs.patch"
928 ;; ,(search-patch "icecat-use-system-media-libs.patch"))
929
930 ("patch" ,(canonical-package patch))
931
932 ("rust" ,rust-1.41)
933 ("cargo" ,rust-1.41 "cargo")
934 ("rust-cbindgen" ,rust-cbindgen-0.14)
935 ("llvm" ,llvm)
936 ("clang" ,clang)
937 ("perl" ,perl)
938 ("node" ,node)
939 ("python" ,python)
940 ("python-2" ,python-2)
941 ("python2-pysqlite" ,python2-pysqlite)
942 ("yasm" ,yasm)
943 ("nasm" ,nasm) ; XXX FIXME: only needed on x86_64 and i686
944 ("pkg-config" ,pkg-config)
945 ("autoconf" ,autoconf-2.13)
946 ("which" ,which)))
947 (arguments
948 `(#:tests? #f ; no check target
949 #:out-of-source? #t ; must be built outside of the source directory
950
951 #:configure-flags `("--enable-default-toolkit=cairo-gtk3-wayland"
952
953 "--with-distribution-id=org.gnu"
954
955 ;; Do not require addons in the global app or
956 ;; system directories to be signed by Mozilla.
957 "--with-unsigned-addon-scopes=app,system"
958 "--allow-addon-sideload"
959
960 "--enable-pulseaudio"
961
962 "--disable-tests"
963 "--disable-updater"
964 "--disable-crashreporter"
965 "--disable-eme"
966
967 ;; Building with debugging symbols takes ~5GiB, so
968 ;; disable it.
969 "--disable-debug"
970 "--disable-debug-symbols"
971
972 ;; Clang is needed to build Stylo, Mozilla's new
973 ;; CSS engine. We must specify the clang paths
974 ;; manually, because otherwise the Mozilla build
975 ;; system looks in the directories returned by
976 ;; llvm-config --bindir and llvm-config --libdir,
977 ;; which return paths in the llvm package where
978 ;; clang is not found.
979 ,(string-append "--with-clang-path="
980 (assoc-ref %build-inputs "clang")
981 "/bin/clang")
982 ,(string-append "--with-libclang-path="
983 (assoc-ref %build-inputs "clang")
984 "/lib")
985
986 ;; Hack to work around missing
987 ;; "unofficial" branding in icecat.
988 "--enable-official-branding"
989
990 ;; Avoid bundled libraries.
991 "--with-system-jpeg" ; must be libjpeg-turbo
992 ;; UNBUNDLE-ME! "--with-system-zlib"
993 ;; UNBUNDLE-ME! "--with-system-bz2"
994 ;; UNBUNDLE-ME! "--with-system-libevent"
995 ;; UNBUNDLE-ME! "--with-system-ogg"
996 ;; UNBUNDLE-ME! "--with-system-vorbis"
997 ;; UNBUNDLE-ME! "--with-system-theora" ; wants theora-1.2, not yet released
998 ;; UNBUNDLE-ME! "--with-system-libvpx"
999 "--with-system-icu"
1000
1001 ;; See <https://bugs.gnu.org/32833>
1002 ;; and related comments in the
1003 ;; 'remove-bundled-libraries' phase below.
1004 ;; UNBUNDLE-ME! "--with-system-nspr"
1005 ;; UNBUNDLE-ME! "--with-system-nss"
1006
1007 ;; UNBUNDLE-ME! "--with-system-harfbuzz"
1008 ;; UNBUNDLE-ME! "--with-system-graphite2"
1009 "--enable-system-pixman"
1010 "--enable-system-ffi"
1011 ;; UNBUNDLE-ME! "--enable-system-sqlite"
1012
1013 ;; Fails with "--with-system-png won't work because
1014 ;; the system's libpng doesn't have APNG support".
1015 ;; According to
1016 ;; http://sourceforge.net/projects/libpng-apng/ ,
1017 ;; "the Animated Portable Network Graphics (APNG)
1018 ;; is an unofficial extension of the Portable
1019 ;; Network Graphics (PNG) format";
1020 ;; we probably do not wish to support it.
1021 ;; "--with-system-png"
1022 )
1023
1024 #:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums'
1025
1026 #:modules ((ice-9 ftw)
1027 (ice-9 rdelim)
1028 (ice-9 regex)
1029 (ice-9 match)
1030 (srfi srfi-34)
1031 (srfi srfi-35)
1032 (rnrs bytevectors)
1033 (rnrs io ports)
1034 (guix elf)
1035 (guix build gremlin)
1036 ,@%gnu-build-system-modules)
1037 #:phases
1038 (modify-phases %standard-phases
1039 (add-after 'unpack 'apply-guix-specific-patches
1040 (lambda* (#:key inputs native-inputs #:allow-other-keys)
1041 (let ((patch (string-append (assoc-ref (or native-inputs inputs)
1042 "patch")
1043 "/bin/patch")))
1044 (for-each (match-lambda
1045 ((label . file)
1046 (when (and (string-prefix? "icecat-" label)
1047 (string-suffix? ".patch" label))
1048 (format #t "applying '~a'...~%" file)
1049 (invoke patch "--force" "--no-backup-if-mismatch"
1050 "-p1" "--input" file))))
1051 (or native-inputs inputs)))
1052 #t))
1053 (add-after 'apply-guix-specific-patches 'remove-bundled-libraries
1054 (lambda _
1055 ;; Remove bundled libraries that we don't use, since they may
1056 ;; contain unpatched security flaws, they waste disk space and
1057 ;; memory, and may cause confusion.
1058 (for-each (lambda (file)
1059 (format #t "deleting '~a'...~%" file)
1060 (delete-file-recursively file))
1061 '(;; FIXME: Removing the bundled icu breaks configure.
1062 ;; * The bundled icu headers are used in some places.
1063 ;; * The version number is taken from the bundled copy.
1064 ;;"intl/icu"
1065 ;;
1066 ;; FIXME: A script from the bundled nspr is used.
1067 ;;"nsprpub"
1068 ;;
1069 ;; FIXME: With the update to IceCat 60, using system NSS
1070 ;; broke certificate validation. See
1071 ;; <https://bugs.gnu.org/32833>. For now, we use
1072 ;; the bundled NSPR and NSS. TODO: Investigate,
1073 ;; and try to unbundle these libraries again.
1074 ;; UNBUNDLE-ME! "security/nss"
1075 ;;
1076 ;; TODO: Use more system media libraries. See:
1077 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
1078 ;; * libtheora: esr60 wants v1.2, not yet released.
1079 ;; * soundtouch: avoiding the bundled library would
1080 ;; result in some loss of functionality. There's
1081 ;; also an issue with exception handling
1082 ;; configuration. It seems that this is needed in
1083 ;; some moz.build:
1084 ;; DEFINES['ST_NO_EXCEPTION_HANDLING'] = 1
1085 ;; * libopus
1086 ;; * speex
1087 ;;
1088 "modules/freetype2"
1089 ;; "media/libjpeg" ; needed for now, because media/libjpeg/moz.build is referenced from config/external/moz.build
1090 ;; UNBUNDLE-ME! "modules/zlib"
1091 ;; UNBUNDLE-ME! "ipc/chromium/src/third_party/libevent"
1092 ;; UNBUNDLE-ME! "media/libvpx"
1093 ;; UNBUNDLE-ME! "media/libogg"
1094 ;; UNBUNDLE-ME! "media/libvorbis"
1095 ;; UNBUNDLE-ME! "media/libtheora" ; wants theora-1.2, not yet released
1096 ;; UNBUNDLE-ME! "media/libtremor"
1097 ;; UNBUNDLE-ME! "gfx/harfbuzz"
1098 ;; UNBUNDLE-ME! "gfx/graphite2"
1099 "js/src/ctypes/libffi"
1100 ;; UNBUNDLE-ME! "db/sqlite3"
1101 ))
1102 #t))
1103 (add-after 'remove-bundled-libraries 'link-libxul-with-libraries
1104 (lambda _
1105 ;; libxul.so dynamically opens libraries, so here we explicitly
1106 ;; link them into libxul.so instead.
1107 ;;
1108 ;; TODO: It might be preferable to patch in absolute file names in
1109 ;; calls to dlopen or PR_LoadLibrary, but that didn't seem to
1110 ;; work. More investigation is needed.
1111 (substitute* "toolkit/library/moz.build"
1112 (("^# This library needs to be last" all)
1113 (string-append "OS_LIBS += [
1114 'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5',
1115 'avcodec', 'avutil', 'pulse' ]\n\n"
1116 all)))
1117 #t))
1118 (add-after 'link-libxul-with-libraries 'fix-ffmpeg-runtime-linker
1119 (lambda* (#:key inputs #:allow-other-keys)
1120 (let* ((ffmpeg (assoc-ref inputs "ffmpeg"))
1121 (libavcodec (string-append ffmpeg "/lib/libavcodec.so")))
1122 ;; Arrange to load libavcodec.so by its absolute file name.
1123 (substitute* "dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp"
1124 (("libavcodec\\.so")
1125 libavcodec))
1126 ;; Populate the sandbox read-path whitelist as needed by ffmpeg.
1127 (let* ((mime-info (assoc-ref inputs "shared-mime-info"))
1128 (libavcodec-runpath (call-with-input-file libavcodec
1129 (compose elf-dynamic-info-runpath
1130 elf-dynamic-info
1131 parse-elf
1132 get-bytevector-all)))
1133 (whitelist (cons (string-append mime-info "/share/mime/")
1134 (map (lambda (dir)
1135 (string-append dir "/"))
1136 libavcodec-runpath)))
1137 (whitelist-string (string-join whitelist ","))
1138 (port (open-file "browser/app/profile/icecat.js" "a")))
1139 (format #t "setting 'security.sandbox.content.read_path_whitelist' to '~a'~%"
1140 whitelist-string)
1141 (format port "~%pref(\"security.sandbox.content.read_path_whitelist\", ~S);~%"
1142 whitelist-string)
1143 (close-output-port port))
1144 #t)))
1145 (replace 'bootstrap
1146 (lambda _
1147 (invoke "sh" "-c" "autoconf old-configure.in > old-configure")
1148 ;; 'configure' must be newer than 'old-configure.in', or else the
1149 ;; build system will raise an alarm and abort.
1150 (invoke "touch" "configure")))
1151 (add-after 'patch-source-shebangs 'patch-cargo-checksums
1152 (lambda _
1153 (use-modules (guix build cargo-utils))
1154 (let ((null-hash "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))
1155 (for-each (lambda (file)
1156 (format #t "patching checksums in ~a~%" file)
1157 (substitute* file
1158 (("^checksum = \".*\"")
1159 (string-append "checksum = \"" null-hash "\""))))
1160 (find-files "." "Cargo.lock$"))
1161 (for-each generate-all-checksums
1162 '("services"
1163 "js"
1164 "third_party/rust"
1165 "dom/media"
1166 "dom/webauthn"
1167 "toolkit"
1168 "gfx"
1169 "storage"
1170 "modules"
1171 "xpcom/rust"
1172 "media"
1173 "mozglue/static/rust"
1174 "netwerk"
1175 "remote"
1176 "intl"
1177 "servo"
1178 "security/manager/ssl"
1179 "build")))
1180 #t))
1181 (replace 'configure
1182 ;; configure does not work followed by both "SHELL=..." and
1183 ;; "CONFIG_SHELL=..."; set environment variables instead
1184 (lambda* (#:key outputs configure-flags #:allow-other-keys)
1185 (let* ((out (assoc-ref outputs "out"))
1186 (bash (which "bash"))
1187 (abs-srcdir (getcwd))
1188 (srcdir (string-append "../" (basename abs-srcdir)))
1189 (flags `(,(string-append "--prefix=" out)
1190 ,(string-append "--with-l10n-base="
1191 abs-srcdir "/l10n")
1192 ,@configure-flags)))
1193 (setenv "SHELL" bash)
1194 (setenv "CONFIG_SHELL" bash)
1195 (setenv "AUTOCONF" (which "autoconf")) ; must be autoconf-2.13
1196 (setenv "CC" "gcc") ; apparently needed when Stylo is enabled
1197 (setenv "MOZ_BUILD_DATE" ,%icecat-build-id) ; avoid timestamp
1198 (setenv "LDFLAGS" (string-append "-Wl,-rpath="
1199 (assoc-ref outputs "out")
1200 "/lib/icecat"))
1201 (mkdir "../build")
1202 (chdir "../build")
1203 (format #t "build directory: ~s~%" (getcwd))
1204 (format #t "configure flags: ~s~%" flags)
1205 (apply invoke bash
1206 (string-append srcdir "/configure")
1207 flags))))
1208 (replace 'build
1209 ;; The build system often spuriously fails. See
1210 ;; <https://bugs.gentoo.org/show_bug.cgi?id=680934>. To
1211 ;; work around this, we try the standard 'build' phase up
1212 ;; to 5 times.
1213 (lambda args
1214 (let ((build (assoc-ref %standard-phases 'build)))
1215 (let retry ((remaining-attempts 5))
1216 (if (= remaining-attempts 1)
1217 (apply build args)
1218 (guard (c ((invoke-error? c)
1219 (format #t "~%Retrying build! (~a attempts remaining)~%~%"
1220 (- remaining-attempts 1))
1221 (force-output)
1222 (retry (- remaining-attempts 1))))
1223 (apply build args)))))))
1224 (add-after 'build 'neutralise-store-references
1225 (lambda _
1226 ;; Mangle the store references to compilers & other build tools in
1227 ;; about:buildconfig, reducing IceCat's closure by 1 GiB on x86-64.
1228 (substitute*
1229 "dist/bin/chrome/toolkit/content/global/buildconfig.html"
1230 (((format #f "(~a/)([0-9a-df-np-sv-z]{32})"
1231 (regexp-quote (%store-directory)))
1232 _ store hash)
1233 (string-append store
1234 (string-take hash 8)
1235 "<!-- Guix: not a runtime dependency -->"
1236 (string-drop hash 8))))
1237 #t))
1238 (add-before 'configure 'install-desktop-entry
1239 (lambda* (#:key outputs #:allow-other-keys)
1240 ;; Install the '.desktop' file.
1241 (let* ((desktop-file "taskcluster/docker/icecat-snap/icecat.desktop")
1242 (out (assoc-ref outputs "out"))
1243 (applications (string-append out "/share/applications")))
1244 (substitute* desktop-file
1245 (("^Exec=icecat") (string-append "Exec=" out "/bin/icecat"))
1246 (("IceCat") "GNU IceCat")
1247 (("Icon=.*") "Icon=icecat\n")
1248 (("NewWindow") "new-window")
1249 (("NewPrivateWindow") "new-private-window"))
1250 (install-file desktop-file applications)
1251 #t)))
1252 (add-after 'install-desktop-entry 'install-icons
1253 (lambda* (#:key outputs #:allow-other-keys)
1254 (let ((out (assoc-ref outputs "out")))
1255 (with-directory-excursion "browser/branding/official"
1256 (for-each
1257 (lambda (file)
1258 (let* ((size (string-filter char-numeric? file))
1259 (icons (string-append out "/share/icons/hicolor/"
1260 size "x" size "/apps")))
1261 (mkdir-p icons)
1262 (copy-file file (string-append icons "/icecat.png"))))
1263 '("default16.png" "default22.png" "default24.png"
1264 "default32.png" "default48.png" "content/icon64.png"
1265 "mozicon128.png" "default256.png"))
1266 #t))))
1267 ;; This fixes the file chooser crash that happens with GTK 3.
1268 (add-after 'install 'wrap-program
1269 (lambda* (#:key inputs outputs #:allow-other-keys)
1270 (let* ((out (assoc-ref outputs "out"))
1271 (lib (string-append out "/lib"))
1272 (gtk (assoc-ref inputs "gtk+"))
1273 (gtk-share (string-append gtk "/share"))
1274 (mesa (assoc-ref inputs "mesa"))
1275 (mesa-lib (string-append mesa "/lib"))
1276 (pulseaudio (assoc-ref inputs "pulseaudio"))
1277 (pulseaudio-lib (string-append pulseaudio "/lib"))
1278 (libxscrnsaver (assoc-ref inputs "libxscrnsaver"))
1279 (libxscrnsaver-lib (string-append libxscrnsaver "/lib"))
1280 (mit-krb5 (assoc-ref inputs "mit-krb5"))
1281 (mit-krb5-lib (string-append mit-krb5 "/lib")))
1282 (wrap-program (car (find-files lib "^icecat$"))
1283 `("XDG_DATA_DIRS" prefix (,gtk-share))
1284 ;; The following line is commented out because the icecat
1285 ;; package on guix has been observed to be unstable when
1286 ;; using wayland, and the bundled extensions stop working.
1287 ;; `("MOZ_ENABLE_WAYLAND" = ("1"))
1288 `("LD_LIBRARY_PATH" prefix (,pulseaudio-lib
1289 ,mesa-lib
1290 ,libxscrnsaver-lib
1291 ,mit-krb5-lib)))
1292 #t))))))
1293 (home-page "https://www.gnu.org/software/gnuzilla/")
1294 (synopsis "Entirely free browser derived from Mozilla Firefox")
1295 (description
1296 "IceCat is the GNU version of the Firefox browser. It is entirely free
1297 software, which does not recommend non-free plugins and addons. It also
1298 features built-in privacy-protecting features.
1299
1300 WARNING: IceCat 78 has not yet been released by the upstream IceCat project.
1301 This is a preview release, and does not currently meet the privacy-respecting
1302 standards of the IceCat project.")
1303 (license license:mpl2.0) ;and others, see toolkit/content/license.html
1304 (properties
1305 `((ftp-directory . "/gnu/gnuzilla")
1306 (cpe-name . "firefox_esr")
1307 (cpe-version . ,(first (string-split version #\-)))))))
1308
1309 ;; Update this together with icecat!
1310 (define %icedove-build-id "20210810000000") ;must be of the form YYYYMMDDhhmmss
1311 (define-public icedove
1312 (package
1313 (name "icedove")
1314 (version "78.13.0")
1315 (source icecat-source)
1316 (properties
1317 `((cpe-name . "thunderbird_esr")))
1318 (build-system gnu-build-system)
1319 (arguments
1320 `(#:tests? #f ; no check target
1321 #:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums'
1322 #:modules ((guix build utils) ;find-files
1323 (sxml simple)
1324 (ice-9 regex)
1325 ,@%gnu-build-system-modules)
1326 #:phases
1327 (modify-phases %standard-phases
1328 (add-after 'unpack 'prepare-thunderbird-sources
1329 (lambda* (#:key inputs #:allow-other-keys)
1330 (mkdir "comm")
1331 (copy-recursively (assoc-ref inputs "thunderbird-sources")
1332 "comm")
1333 (delete-file-recursively "obj-x86_64-pc-linux-gnu")
1334 (delete-file "sourcestamp.txt")
1335 #t))
1336 (add-after 'patch-source-shebangs 'patch-cargo-checksums
1337 (lambda _
1338 (use-modules (guix build cargo-utils))
1339 (let ((null-hash "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))
1340 (for-each (lambda (file)
1341 (format #t "patching checksums in ~a~%" file)
1342 (substitute* file
1343 (("^checksum = \".*\"")
1344 (string-append "checksum = \"" null-hash "\""))))
1345 (find-files "." "Cargo.lock$"))
1346 (for-each generate-all-checksums
1347 '("third_party/rust"
1348 "toolkit/library/rust")))
1349 #t))
1350 ;; Fixes issue where each installation directory generates its own profile.
1351 ;; See e.g. https://trac.torproject.org/projects/tor/ticket/31457
1352 (add-after 'patch-source-shebangs 'fix-profile-setting
1353 (lambda _
1354 (substitute* "comm/mail/moz.configure"
1355 (("'MOZ_DEDICATED_PROFILES', True")
1356 "'MOZ_DEDICATED_PROFILES', False"))
1357 #t))
1358 (add-after 'prepare-thunderbird-sources 'rename-to-icedove
1359 (lambda _
1360 (substitute* "comm/mail/confvars.sh"
1361 (("MOZ_APP_BASENAME=Thunderbird")
1362 "MOZ_APP_BASENAME=Icedove\nMOZ_APP_DISPLAYNAME=Icedove")
1363 (("MOZ_APP_NAME=thunderbird")
1364 "MOZ_APP_NAME=icedove")
1365 (("MOZ_UPDATER=1")
1366 "MOZ_UPDATER=0"))
1367 ;; Remove branding to comply with Mozilla's trademark policy
1368 (with-directory-excursion "comm/mail/branding/nightly"
1369 (delete-file "content/about-wordmark.svg")
1370 (call-with-output-file "content/about-wordmark.svg"
1371 (lambda (port)
1372 (sxml->xml '(svg (@ (xmlns "http://www.w3.org/2000/svg")
1373 (viewBox "0 0 789.1 90.78")
1374 (width "333")
1375 (height "48")
1376 (fill "#fff"))
1377 (text (@ (x "400") (y "70")
1378 (text-anchor "middle")
1379 (font-size "90"))
1380 "Icedove Daily"))
1381 port)))
1382 (substitute* '("locales/en-US/brand.properties"
1383 "locales/en-US/brand.ftl"
1384 "locales/en-US/brand.dtd"
1385 "configure.sh")
1386 (("Thunderbird") "Icedove")
1387 (("mozilla.org") "guix.gnu.org")))
1388 ;; Remove other mentions of Thunderbird in user-visible text.
1389 (with-directory-excursion "comm/mail/base/content"
1390 (substitute* '("overrides/app-license-name.html")
1391 (("Thunderbird") "Icedove")))
1392 (with-directory-excursion "comm/mail/components/"
1393 (substitute* '("MailGlue.jsm"
1394 "extensions/schemas/addressBook.json"
1395 "extensions/schemas/tabs.json"
1396 "extensions/schemas/cloudFile.json"
1397 "extensions/schemas/chrome_settings_overrides.json"
1398 "extensions/schemas/windows.json"
1399 "extensions/parent/ext-mail.js"
1400 "im/messages/mail/Info.plist"
1401 "enterprisepolicies/moz.build"
1402 "enterprisepolicies/helpers/moz.build"
1403 "enterprisepolicies/schemas/moz.build")
1404 (("Thunderbird") "Icedove")))
1405 (substitute* '("comm/mailnews/base/prefs/content/accountUtils.js"
1406 "comm/common/src/customizeToolbar.js")
1407 (("AppConstants.MOZ_APP_NAME (.)= \"thunderbird" _ e)
1408 (format #f "AppConstants.MOZ_APP_NAME ~a= \"icedove" e)))
1409
1410 ;; Override addon URLs and settings
1411 (substitute* "comm/mail/app/profile/all-thunderbird.js"
1412 (("(pref\\(\"extensions.webservice.discoverURL\").*" _ m)
1413 (string-append m ", \"https://directory.fsf.org/wiki/Icedove\");"))
1414 (("(pref\\(\"extensions.getAddons.search.url\").*" _ m)
1415 (string-append m ", \"https://guix.gnu.org/packages\");"))
1416 (("(pref\\(\"extensions.update.enabled\").*" _ m)
1417 (string-append m ", false);"))
1418 (("(pref\\(\"extensions.systemAddon.update.enabled\").*" _ m)
1419 (string-append m ", false);"))
1420 (("(pref\\(\"lightweightThemes.update.enabled\").*" _ m)
1421 (string-append m ", false);")))
1422 #t))
1423 (add-after 'build 'neutralize-store-references
1424 (lambda _
1425 ;; Mangle the store references to compilers & other build tools in
1426 ;; about:buildconfig, reducing Icedove's closure significant.
1427 ;; The resulting files are saved in lib/thunderbird/omni.ja
1428 (substitute*
1429 ;; Use find because the path "obj-x86_64-pc-linux-gnu" contains
1430 ;; the architecture and the system -> more complicated.
1431 (find-files "." "buildconfig.html")
1432 (((format #f "(~a/)([0-9a-df-np-sv-z]{32})"
1433 (regexp-quote (%store-directory)))
1434 _ store hash)
1435 (string-append store
1436 (string-take hash 8)
1437 "<!-- Guix: not a runtime dependency -->"
1438 (string-drop hash 8))))
1439 #t))
1440 (replace 'configure
1441 (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
1442 (let* ((out (assoc-ref outputs "out"))
1443 (bash (which "bash"))
1444 (abs-srcdir (getcwd))
1445 (srcdir (string-append "../" (basename abs-srcdir)))
1446 (flags `(,(string-append "--prefix=" out)
1447 ,@configure-flags))
1448 (mozconfig (string-append (getcwd) "/.mozconfig")))
1449 (setenv "SHELL" bash)
1450 (setenv "AUTOCONF"
1451 (string-append (assoc-ref %build-inputs
1452 "autoconf")
1453 "/bin/autoconf"))
1454 (setenv "CONFIG_SHELL" bash)
1455 (setenv "QA_CONFIGURE_OPTIONS" ".*")
1456 (setenv "MOZBUILD_STATE_PATH"
1457 (string-append (getcwd) "/mach_state"))
1458 (setenv "MOZCONFIG"
1459 (string-append (getcwd) "/.mozconfig"))
1460 (setenv "CC" "gcc")
1461 (setenv "MOZ_NOSPAM" "1")
1462 (setenv "PYTHON"
1463 (string-append (assoc-ref inputs "python2")
1464 "/bin/python"))
1465 (setenv "MOZ_BUILD_DATE" ,%icedove-build-id) ; avoid timestamp
1466 (setenv "LDFLAGS" (string-append "-Wl,-rpath="
1467 (assoc-ref outputs "out")
1468 "/lib/icedove"))
1469 (mkdir-p (string-append (getcwd) "/builddir"))
1470 (with-output-to-file mozconfig
1471 (lambda ()
1472 (display
1473 (string-append
1474 "ac_add_options --disable-crashreporter\n"
1475 "ac_add_options --disable-debug\n"
1476 "ac_add_options --disable-debug-symbols\n"
1477 "ac_add_options --disable-elf-hack\n"
1478 "ac_add_options --disable-jit\n"
1479 "ac_add_options --disable-necko-wifi\n"
1480 "ac_add_options --disable-official-branding\n"
1481 "ac_add_options --disable-tests\n"
1482 "ac_add_options --disable-updater\n"
1483 "ac_add_options --disable-webrtc\n"
1484 "ac_add_options --enable-application=comm/mail\n"
1485 "ac_add_options --enable-calendar\n"
1486 "ac_add_options --enable-default-toolkit=\"cairo-gtk3\"\n"
1487 "ac_add_options --enable-optimize\n"
1488 "ac_add_options --enable-pulseaudio\n"
1489 "ac_add_options --enable-release\n"
1490 "ac_add_options --enable-strip\n"
1491 "ac_add_options --enable-system-ffi\n"
1492 "ac_add_options --enable-system-pixman\n"
1493 "ac_add_options --prefix=" out "\n"
1494 "ac_add_options --with-clang-path=" (assoc-ref %build-inputs "clang") "/bin/clang\n"
1495 "ac_add_options --with-distribution-id=org.gnu\n"
1496 "ac_add_options --with-libclang-path=" (assoc-ref %build-inputs "clang") "/lib\n"
1497 "ac_add_options --with-system-bz2\n"
1498 "ac_add_options --with-system-icu\n"
1499 "ac_add_options --with-system-jpeg\n"
1500 "ac_add_options --with-system-libevent\n"
1501 "ac_add_options --with-system-nspr\n"
1502 "ac_add_options --with-system-nss\n"
1503 "ac_add_options --with-system-zlib\n"
1504 "ac_add_options --with-user-appdir=\\.icedove\n"
1505 "mk_add_options MOZ_MAKE_FLAGS=-j"
1506 (number->string (parallel-job-count)) "\n"))))
1507 (display (getcwd))
1508 (newline)
1509 (display "mach configure")
1510 (invoke "./mach" "configure"))))
1511 (replace 'build
1512 (lambda _ (invoke "./mach" "build")))
1513 (replace 'install
1514 (lambda _ (invoke "./mach" "install")))
1515 ;; Thunderbird doesn't provide any .desktop file.
1516 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1637575
1517 (add-after 'install 'install-desktop-file
1518 (lambda* (#:key outputs #:allow-other-keys)
1519 (let* ((out (assoc-ref outputs "out"))
1520 (apps (string-append out "/share/applications")))
1521 (mkdir-p apps)
1522 (with-output-to-file (string-append apps "/icedove.desktop")
1523 (lambda _
1524 (format #t
1525 "[Desktop Entry]~@
1526 Name=Icedove~@
1527 Exec=~a/bin/icedove~@
1528 Icon=icedove~@
1529 GenericName=Mail/News Client~@
1530 Categories=Network;Email;~@
1531 Terminal=false~@
1532 StartupNotify=true~@
1533 MimeType=x-scheme-handler/mailto;~@
1534 Type=Application~@
1535 Actions=ComposeMessage;~@
1536 [Desktop Action ComposeMessage]~@
1537 Name=Write new message~@
1538 Exec=~@*~a/bin/icedove -compose~%"
1539 out))))
1540 #t))
1541 (add-after 'install 'wrap-program
1542 (lambda* (#:key inputs outputs #:allow-other-keys)
1543 (let* ((out (assoc-ref outputs "out"))
1544 (lib (string-append out "/lib"))
1545 (gtk (assoc-ref inputs "gtk+"))
1546 (gtk-share (string-append gtk "/share"))
1547 (pulseaudio (assoc-ref inputs "pulseaudio"))
1548 (pulseaudio-lib (string-append pulseaudio "/lib"))
1549 (eudev (assoc-ref inputs "eudev"))
1550 (eudev-lib (string-append eudev "/lib")))
1551 (wrap-program (car (find-files lib "^icedove$"))
1552 `("XDG_DATA_DIRS" prefix (,gtk-share))
1553 `("LD_LIBRARY_PATH" prefix (,pulseaudio-lib ,eudev-lib)))
1554 #t))))))
1555 (inputs
1556 `(("bzip2" ,bzip2)
1557 ("cairo" ,cairo)
1558 ("cups" ,cups)
1559 ("dbus-glib" ,dbus-glib)
1560 ("ffmpeg" ,ffmpeg)
1561 ("freetype" ,freetype)
1562 ("gdk-pixbuf" ,gdk-pixbuf)
1563 ("glib" ,glib)
1564 ("gtk+" ,gtk+)
1565 ("gtk+-2" ,gtk+-2)
1566 ("hunspell" ,hunspell)
1567 ("icu4c" ,icu4c-67)
1568 ("libcanberra" ,libcanberra)
1569 ("libevent" ,libevent)
1570 ("libffi" ,libffi)
1571 ("libgnome" ,libgnome)
1572 ("libjpeg-turbo" ,libjpeg-turbo)
1573 ("libpng-apng" ,libpng-apng)
1574 ("libvpx" ,libvpx)
1575 ("libxcomposite" ,libxcomposite)
1576 ("libxft" ,libxft)
1577 ("libxinerama" ,libxinerama)
1578 ("libxscrnsaver" ,libxscrnsaver)
1579 ("libxt" ,libxt)
1580 ("mesa" ,mesa)
1581 ("mit-krb5" ,mit-krb5)
1582 ("nspr" ,nspr)
1583 ("nss" ,nss)
1584 ("pango" ,pango)
1585 ("pixman" ,pixman)
1586 ("pulseaudio" ,pulseaudio)
1587 ("sqlite" ,sqlite)
1588 ("startup-notification" ,startup-notification)
1589 ("eudev" ,eudev)
1590 ("unzip" ,unzip)
1591 ("zip" ,zip)
1592 ("zlib" ,zlib)))
1593 (native-inputs
1594 `(("thunderbird-sources"
1595 ;; The changeset identifier is taken from the file "sourcestamp.txt"
1596 ;; in the Thunderbird release tarball. We don't use the release
1597 ;; tarball because it duplicates the Icecat sources and only adds the
1598 ;; "comm" directory, which is provided by this repository.
1599 ,(let ((changeset "adcfedf831da719455116546865f9a5faea848a6"))
1600 (origin
1601 (method hg-fetch)
1602 (uri (hg-reference
1603 (url "https://hg.mozilla.org/releases/comm-esr78")
1604 (changeset changeset)))
1605 (file-name (string-append "thunderbird-" version "-checkout"))
1606 (sha256
1607 (base32
1608 "1dahf3y8bm3kh7amf341wnmh82a2r0ksqihc6dwiakh6x86a94cm")))))
1609 ("autoconf" ,autoconf-2.13)
1610 ("cargo" ,rust-1.41 "cargo")
1611 ("clang" ,clang)
1612 ("llvm" ,llvm)
1613 ("nasm" ,nasm)
1614 ("node" ,node)
1615 ("perl" ,perl)
1616 ("pkg-config" ,pkg-config)
1617 ("python" ,python)
1618 ("python2" ,python-2.7)
1619 ("rust" ,rust-1.41)
1620 ("rust-cbindgen" ,rust-cbindgen-0.14)
1621 ("which" ,which)
1622 ("yasm" ,yasm)))
1623 (home-page "https://www.thunderbird.net")
1624 (synopsis "Rebranded Mozilla Thunderbird email client")
1625 (description
1626 "This package provides an email client built based on Mozilla
1627 Thunderbird. It supports email, news feeds, chat, calendar and contacts.")
1628 (license license:mpl2.0)))
1629
1630 (define-public icedove/wayland
1631 (package
1632 (inherit icedove)
1633 (name "icedove-wayland")
1634 (native-inputs '())
1635 (inputs
1636 `(("bash" ,bash-minimal)
1637 ("icedove" ,icedove)))
1638 (build-system trivial-build-system)
1639 (arguments
1640 '(#:modules ((guix build utils))
1641 #:builder
1642 (begin
1643 (use-modules (guix build utils))
1644 (let* ((bash (assoc-ref %build-inputs "bash"))
1645 (icedove (assoc-ref %build-inputs "icedove"))
1646 (out (assoc-ref %outputs "out"))
1647 (exe (string-append out "/bin/icedove")))
1648 (mkdir-p (dirname exe))
1649
1650 (call-with-output-file exe
1651 (lambda (port)
1652 (format port "#!~a
1653 MOZ_ENABLE_WAYLAND=1 exec ~a $@"
1654 (string-append bash "/bin/bash")
1655 (string-append icedove "/bin/icedove"))))
1656 (chmod exe #o555)
1657
1658 ;; Provide the manual and .desktop file.
1659 (copy-recursively (string-append icedove "/share")
1660 (string-append out "/share"))
1661 (substitute* (string-append
1662 out "/share/applications/icedove.desktop")
1663 ((icedove) out))
1664 #t))))))
1665
1666 (define-public firefox-decrypt
1667 (package
1668 (name "firefox-decrypt")
1669 (version "0.7.0")
1670 (source (origin
1671 (method git-fetch)
1672 (uri (git-reference
1673 (url "https://github.com/Unode/firefox_decrypt")
1674 (commit version)))
1675 (file-name (git-file-name name version))
1676 (sha256
1677 (base32
1678 "17yyyxp47z4m8hnflcq34rc1y871515kr3f1y42j1l0yx3g0il07"))))
1679 (build-system trivial-build-system)
1680 (inputs
1681 `(("nss" ,nss)
1682 ("python" ,python)))
1683 (arguments
1684 `(#:modules ((guix build utils))
1685 #:builder
1686 (begin
1687 (use-modules (guix build utils))
1688 (setenv "PATH"
1689 (string-append
1690 (assoc-ref %build-inputs "python") "/bin"))
1691 (copy-file (string-append (assoc-ref %build-inputs "source")
1692 "/firefox_decrypt.py")
1693 "firefox_decrypt.py")
1694 (substitute* "firefox_decrypt.py"
1695 (("/usr/bin/env python") (which "python3"))
1696 (("libnss3.so") (string-append (assoc-ref %build-inputs "nss")
1697 "/lib/nss/libnss3.so")))
1698 (install-file "firefox_decrypt.py" (string-append %output "/bin"))
1699 #t)))
1700 (home-page "https://github.com/Unode/firefox_decrypt/")
1701 (synopsis "Tool to extract passwords from Mozilla profiles")
1702 (description "Firefox Decrypt is a tool to extract passwords from
1703 Mozilla (Firefox, Waterfox, Thunderbird, SeaMonkey) profiles.")
1704 (license license:gpl3+)))