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