gnu: icecat: Update to 78.10.0-guix0-preview1 [security fixes].
[jackhill/guix/guix.git] / gnu / packages / gnuzilla.scm
CommitLineData
be0f6112 1;;; GNU Guix --- Functional package management for GNU
5deea4fc 2;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
27913a6d 3;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
01fa1cd6 4;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Mark H Weaver <mhw@netris.org>
1aaaff1a 5;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
e80a4479 6;;; Copyright © 2016, 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
88a8ce87 7;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
8db94716 8;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
b14aab67 9;;; Copyright © 2017, 2018 Nikita <nikita@n0.is>
37db2370 10;;; Copyright © 2017, 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
b14aab67 11;;; Copyright © 2018, 2020 Ricardo Wurmus <rekado@elephly.net>
7d141788 12;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com>
167a0ce0 13;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
37db2370 14;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
b14aab67
JB
15;;; Copyright © 2019, 2020 Adrian Malacoda <malacoda@monarch-pass.net>
16;;; Copyright © 2020 Jonathan Brielmaier <jonathan.brielmaier@web.de>
37ec5df6 17;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
be0f6112
AE
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)
07d4d9b7 35 #:use-module ((srfi srfi-1) #:hide (zip))
1461dd24 36 #:use-module (ice-9 match)
be0f6112 37 #:use-module (gnu packages)
b5b73a82 38 #:use-module ((guix licenses) #:prefix license:)
be0f6112
AE
39 #:use-module (guix packages)
40 #:use-module (guix download)
192a59d0 41 #:use-module (guix git-download)
ad21d767 42 #:use-module (guix hg-download)
948879ee
MW
43 #:use-module (guix gexp)
44 #:use-module (guix store)
45 #:use-module (guix monads)
aaac423c 46 #:use-module (guix utils)
be0f6112 47 #:use-module (guix build-system gnu)
e67ad553 48 #:use-module (guix build-system cargo)
167a0ce0 49 #:use-module (guix build-system trivial)
948879ee 50 #:use-module (gnu packages admin)
94e96f7f 51 #:use-module (gnu packages audio)
002c3e6d 52 #:use-module (gnu packages autotools)
bfb48f4f 53 #:use-module (gnu packages base)
948879ee 54 #:use-module (gnu packages bash)
1aaaff1a 55 #:use-module (gnu packages databases)
be0f6112 56 #:use-module (gnu packages glib)
be0f6112 57 #:use-module (gnu packages gtk)
90e1cdae
MW
58 #:use-module (gnu packages gnome)
59 #:use-module (gnu packages libcanberra)
60 #:use-module (gnu packages cups)
89e34644 61 #:use-module (gnu packages kerberos)
be0f6112
AE
62 #:use-module (gnu packages linux)
63 #:use-module (gnu packages perl)
64 #:use-module (gnu packages pkg-config)
1ae6df81 65 #:use-module (gnu packages compression)
74c7af9f 66 #:use-module (gnu packages fontutils)
1ae6df81 67 #:use-module (gnu packages libevent)
90e1cdae 68 #:use-module (gnu packages libreoffice) ;for hunspell
e55354b8 69 #:use-module (gnu packages image)
1ae6df81 70 #:use-module (gnu packages libffi)
74c7af9f 71 #:use-module (gnu packages pulseaudio)
be0f6112 72 #:use-module (gnu packages python)
44d10b1f 73 #:use-module (gnu packages python-xyz)
ad21d767 74 #:use-module (gnu packages node)
be0f6112 75 #:use-module (gnu packages xorg)
200726ed 76 #:use-module (gnu packages gl)
01497dfe 77 #:use-module (gnu packages assembly)
e67ad553 78 #:use-module (gnu packages rust)
c5c48761 79 #:use-module (gnu packages rust-apps)
8d956d86 80 #:use-module (gnu packages llvm)
aff0cce9 81 #:use-module (gnu packages nss)
13b284d9
MW
82 #:use-module (gnu packages icu4c)
83 #:use-module (gnu packages video)
94e96f7f 84 #:use-module (gnu packages xiph)
13b284d9 85 #:use-module (gnu packages xdisorg)
cd0322a3
RW
86 #:use-module (gnu packages readline)
87 #:use-module (gnu packages sqlite))
be0f6112 88
4923e06f
SB
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
68716289 100 "1fig2wf4f10v43mqx67y68z6h77sy900d1w0pz9qarrqx57rc7ij"))
a64b7da5 101 (patches (search-patches "mozjs17-aarch64-support.patch"))
68716289
SB
102 (modules '((guix build utils)))
103 (snippet
104 ;; Fix incompatibility with Perl 5.22+.
6cbee49d
MW
105 '(begin
106 (substitute* '("js/src/config/milestone.pl")
107 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE"))
108 #t))))
4923e06f
SB
109 (build-system gnu-build-system)
110 (native-inputs
f403c676
EF
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)))
4923e06f 118 (arguments
56486b3a
EF
119 `(;; XXX: parallel build fails, lacking:
120 ;; mkdir -p "system_wrapper_js/"
121 #:parallel-build? #f
87eeeeb0 122 #:make-flags '("CXXFLAGS=-fpermissive")
56486b3a
EF
123 #:phases
124 (modify-phases %standard-phases
125 (add-after 'unpack 'delete-timedout-test
a64b7da5 126 ;; This test times out on slower hardware.
e15793c8
MW
127 (lambda _
128 (delete-file "js/src/jit-test/tests/basic/bug698584.js")
129 #t))
56486b3a 130 (add-before 'configure 'chdir
4923e06f 131 (lambda _
56486b3a
EF
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"))
e15793c8
MW
140 (invoke "./configure" (string-append "--prefix=" out)
141 ,@(if (string=? "aarch64-linux"
142 (%current-system))
143 '("--host=aarch64-unknown-linux-gnu")
144 '()))))))))
4923e06f
SB
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
149in C/C++.")
87158e85 150 (license license:mpl2.0))) ; and others for some files
4923e06f 151
cefdcb38
SB
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
68716289
SB
163 "1n1phk8r3l8icqrrap4czplnylawa0ddc2cc4cgdz46x3lrkybz6"))
164 (modules '((guix build utils)))
26f38d31 165 (patches (search-patches "mozjs24-aarch64-support.patch"))
68716289
SB
166 (snippet
167 ;; Fix incompatibility with Perl 5.22+.
6cbee49d
MW
168 '(begin
169 (substitute* '("js/src/config/milestone.pl")
170 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE"))
171 #t))))
cefdcb38 172 (arguments
aaac423c
EF
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"))
6073ef75
MW
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 '())))))))))
cefdcb38
SB
191 (inputs
192 `(("libffi" ,libffi)
193 ("zlib" ,zlib)))))
194
29f381ba
CL
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
747c8f2a 203 "https://anduin.linuxfromscratch.org/BLFS/mozjs/"
29f381ba
CL
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"))
5f70b6d4
MW
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"
29f381ba 268
5f70b6d4
MW
269 ;; Intl API requires bundled ICU.
270 "--without-intl-api")))))))
29f381ba
CL
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
192a59d0
RW
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.
6cc147a3
RW
313 "--without-intl-api"
314
315 ;; Without this gnome-shell will crash at runtime.
316 "--disable-jemalloc")
192a59d0
RW
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
204cfbe1
RW
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
37ec5df6
MB
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
ad21d767
MW
560(define mozilla-compare-locales
561 (origin
562 (method hg-fetch)
563 (uri (hg-reference
564 (url "https://hg.mozilla.org/l10n/compare-locales/")
c7011ff8 565 (changeset "RELEASE_8_0_0")))
ad21d767 566 (file-name "mozilla-compare-locales")
c7011ff8 567 (sha256 (base32 "0052wq92sg4i776x407b5838jx9h3phl9xy69m2q34f31n3gdyk2"))))
ad21d767
MW
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 ;;---------------------------------------------------------------------------
c7011ff8
MW
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")))
bfb48f4f 683
948879ee
MW
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
689from forcing GEXP-PROMISE."
690 (mlet %store-monad ((guile (package->derivation guile system)))
691 (gexp->derivation (or name "computed-origin")
692 (force gexp-promise)
2a1ec7bc 693 #:graft? #f ;nothing to graft
948879ee
MW
694 #:system system
695 #:guile-for-build guile)))
696
53ed3e4b
MW
697(define %icecat-version "78.10.0-guix0-preview1")
698(define %icecat-build-id "20210419000000") ;must be of the form YYYYMMDDhhmmss
948879ee
MW
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
53ed3e4b 720 "0h6zl87czbhyhy3597bxqzwy4p1vsaqimkg92lw31gjbv6k434cp"))))
948879ee 721
cf5e0b26 722 (upstream-icecat-base-version "78.7.0") ; maybe older than base-version
ad21d767 723 ;;(gnuzilla-commit (string-append "v" upstream-icecat-base-version))
cf5e0b26 724 (gnuzilla-commit "abfe5eebaca3c2787f1a9505669393674493c177")
948879ee
MW
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)))
9b096517
MW
731 (file-name (git-file-name "gnuzilla"
732 ;;upstream-icecat-base-version
733 (string-take gnuzilla-commit 8)))
948879ee
MW
734 (sha256
735 (base32
cf5e0b26 736 "00ws3540x5whpicc5fx4k949ff73cqvajz6jp13ahn49wqdads47"))))
948879ee 737
27913a6d
LC
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.
c2614688 740 (gnuzilla-fixes-patch
27913a6d
LC
741 (local-file (assume-valid-file-name
742 (search-patch "icecat-use-older-reveal-hidden-html.patch"))))
c7011ff8 743 (makeicecat-patch
27913a6d
LC
744 (local-file (assume-valid-file-name
745 (search-patch "icecat-makeicecat.patch")))))
948879ee
MW
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
ad21d767 759 (string-append "icecat-" #$%icecat-version)))
948879ee
MW
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")
c2614688
MW
789 (invoke "patch" "--force" "--no-backup-if-mismatch"
790 "-p1" "--input" #+gnuzilla-fixes-patch)
c7011ff8
MW
791 (invoke "patch" "--force" "--no-backup-if-mismatch"
792 "-p1" "--input" #+makeicecat-patch)
948879ee
MW
793 (patch-shebang "makeicecat")
794 (substitute* "makeicecat"
3e605b69
MW
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"))
948879ee
MW
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"))
948879ee
MW
807 (("^DATA=.*")
808 "DATA=/tmp/gnuzilla/data\n")
948879ee
MW
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
ad21d767
MW
818 (format #t "Populating l10n directory...~%")
819 (force-output)
05947d92 820 (mkdir "l10n")
ad21d767
MW
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
948879ee
MW
848 (format #t "Running makeicecat script...~%")
849 (force-output)
ad21d767 850 (invoke "bash" "/tmp/gnuzilla/makeicecat"))
948879ee 851
34369f31 852 (format #t "Packing IceCat source tarball...~%")
948879ee
MW
853 (force-output)
854 (invoke "tar" "cfa" #$output
8cf160e1
MW
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
948879ee
MW
861 "--owner=root:0"
862 "--group=root:0"
863 "--sort=name"
864 icecat-dir)
865
866 #t))))))))
867
be0f6112
AE
868(define-public icecat
869 (package
870 (name "icecat")
24886c13 871 (version %icecat-version)
46ce12d0 872 (source icecat-source)
be0f6112
AE
873 (build-system gnu-build-system)
874 (inputs
875 `(("alsa-lib" ,alsa-lib)
1ae6df81 876 ("bzip2" ,bzip2)
90e1cdae 877 ("cups" ,cups)
be0f6112 878 ("dbus-glib" ,dbus-glib)
90e1cdae
MW
879 ("gdk-pixbuf" ,gdk-pixbuf)
880 ("glib" ,glib)
002c3e6d
MW
881 ("gtk+" ,gtk+)
882 ("gtk+-2" ,gtk+-2)
c7011ff8 883 ;; UNBUNDLE-ME! ("graphite2" ,graphite2)
74c7af9f
MW
884 ("pango" ,pango)
885 ("freetype" ,freetype)
c7011ff8 886 ;; UNBUNDLE-ME! ("harfbuzz" ,harfbuzz)
90e1cdae
MW
887 ("libcanberra" ,libcanberra)
888 ("libgnome" ,libgnome)
7cba7647 889 ("libjpeg-turbo" ,libjpeg-turbo)
c7011ff8
MW
890 ;; UNBUNDLE-ME! ("libogg" ,libogg)
891 ;; UNBUNDLE-ME! ("libtheora" ,libtheora) ; wants theora-1.2, not yet released
892 ;; UNBUNDLE-ME! ("libvorbis" ,libvorbis)
74c7af9f 893 ("libxft" ,libxft)
94e96f7f 894 ("libevent" ,libevent)
90e1cdae
MW
895 ("libxinerama" ,libxinerama)
896 ("libxscrnsaver" ,libxscrnsaver)
9f7ae77f 897 ("libxcomposite" ,libxcomposite)
be0f6112 898 ("libxt" ,libxt)
1ae6df81 899 ("libffi" ,libffi)
e67ad553 900 ("ffmpeg" ,ffmpeg)
c7011ff8 901 ;; UNBUNDLE-ME! ("libvpx" ,libvpx)
f0648a4b 902 ("icu4c" ,icu4c-67)
13b284d9 903 ("pixman" ,pixman)
74c7af9f 904 ("pulseaudio" ,pulseaudio)
be0f6112 905 ("mesa" ,mesa)
90e1cdae 906 ("mit-krb5" ,mit-krb5)
6d328879 907 ;; See <https://bugs.gnu.org/32833>
6c83c483 908 ;; and related comments in the 'remove-bundled-libraries' phase.
6d328879
MW
909 ;; UNBUNDLE-ME! ("nspr" ,nspr)
910 ;; UNBUNDLE-ME! ("nss" ,nss)
429c8284 911 ("shared-mime-info" ,shared-mime-info)
c7011ff8 912 ;; UNBUNDLE-ME! ("sqlite" ,sqlite)
be0f6112 913 ("unzip" ,unzip)
1ae6df81 914 ("zip" ,zip)
c7011ff8
MW
915 ;; UNBUNDLE-ME! ("zlib" ,zlib)
916 ))
c4c4cc05 917 (native-inputs
46ce12d0
MW
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').
ad21d767
MW
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"))
46ce12d0
MW
929
930 ("patch" ,(canonical-package patch))
931
c7011ff8
MW
932 ("rust" ,rust-1.41)
933 ("cargo" ,rust-1.41 "cargo")
934 ("rust-cbindgen" ,rust-cbindgen-0.14)
ad21d767
MW
935 ("llvm" ,llvm)
936 ("clang" ,clang)
e67ad553 937 ("perl" ,perl)
18f10c0b 938 ("node" ,node)
ad21d767
MW
939 ("python" ,python)
940 ("python-2" ,python-2)
c4c4cc05 941 ("python2-pysqlite" ,python2-pysqlite)
002c3e6d 942 ("yasm" ,yasm)
ad21d767 943 ("nasm" ,nasm) ; XXX FIXME: only needed on x86_64 and i686
bfb48f4f 944 ("pkg-config" ,pkg-config)
002c3e6d 945 ("autoconf" ,autoconf-2.13)
bfb48f4f 946 ("which" ,which)))
be0f6112 947 (arguments
74c7af9f
MW
948 `(#:tests? #f ; no check target
949 #:out-of-source? #t ; must be built outside of the source directory
73b1b4eb
LC
950
951 ;; XXX: There are RUNPATH issues such as
952 ;; $prefix/lib/icecat-31.6.0/plugin-container NEEDing libmozalloc.so,
953 ;; which is not in its RUNPATH, but they appear to be harmless in
954 ;; practice somehow. See <http://hydra.gnu.org/build/378133>.
955 #:validate-runpath? #f
956
c7011ff8 957 #:configure-flags `("--enable-default-toolkit=cairo-gtk3-wayland"
9502ea3e
MW
958
959 "--with-distribution-id=org.gnu"
960
c7011ff8
MW
961 ;; Do not require addons in the global app or
962 ;; system directories to be signed by Mozilla.
963 "--with-unsigned-addon-scopes=app,system"
964 "--allow-addon-sideload"
34369f31 965
90e1cdae 966 "--enable-pulseaudio"
90e1cdae 967
9502ea3e
MW
968 "--disable-tests"
969 "--disable-updater"
970 "--disable-crashreporter"
9502ea3e 971 "--disable-eme"
e67ad553 972
90e1cdae 973 ;; Building with debugging symbols takes ~5GiB, so
1ae6df81
LC
974 ;; disable it.
975 "--disable-debug"
976 "--disable-debug-symbols"
977
8d956d86
MW
978 ;; Clang is needed to build Stylo, Mozilla's new
979 ;; CSS engine. We must specify the clang paths
980 ;; manually, because otherwise the Mozilla build
981 ;; system looks in the directories returned by
982 ;; llvm-config --bindir and llvm-config --libdir,
983 ;; which return paths in the llvm package where
984 ;; clang is not found.
985 ,(string-append "--with-clang-path="
986 (assoc-ref %build-inputs "clang")
987 "/bin/clang")
988 ,(string-append "--with-libclang-path="
989 (assoc-ref %build-inputs "clang")
990 "/lib")
991
5bdec7d6
MW
992 ;; Hack to work around missing
993 ;; "unofficial" branding in icecat.
bfb48f4f
MW
994 "--enable-official-branding"
995
90e1cdae 996 ;; Avoid bundled libraries.
7cba7647 997 "--with-system-jpeg" ; must be libjpeg-turbo
c7011ff8
MW
998 ;; UNBUNDLE-ME! "--with-system-zlib"
999 ;; UNBUNDLE-ME! "--with-system-bz2"
ad21d767
MW
1000 ;; UNBUNDLE-ME! "--with-system-libevent"
1001 ;; UNBUNDLE-ME! "--with-system-ogg"
1002 ;; UNBUNDLE-ME! "--with-system-vorbis"
1003 ;; UNBUNDLE-ME! "--with-system-theora" ; wants theora-1.2, not yet released
1004 ;; UNBUNDLE-ME! "--with-system-libvpx"
f0648a4b
ZZ
1005 "--with-system-icu"
1006
6d328879 1007 ;; See <https://bugs.gnu.org/32833>
6c83c483
MW
1008 ;; and related comments in the
1009 ;; 'remove-bundled-libraries' phase below.
6d328879
MW
1010 ;; UNBUNDLE-ME! "--with-system-nspr"
1011 ;; UNBUNDLE-ME! "--with-system-nss"
c7011ff8 1012
ad21d767
MW
1013 ;; UNBUNDLE-ME! "--with-system-harfbuzz"
1014 ;; UNBUNDLE-ME! "--with-system-graphite2"
13b284d9 1015 "--enable-system-pixman"
5b17fabc 1016 "--enable-system-ffi"
ad21d767 1017 ;; UNBUNDLE-ME! "--enable-system-sqlite"
1ae6df81 1018
98a046cd
AE
1019 ;; Fails with "--with-system-png won't work because
1020 ;; the system's libpng doesn't have APNG support".
1021 ;; According to
1022 ;; http://sourceforge.net/projects/libpng-apng/ ,
1023 ;; "the Animated Portable Network Graphics (APNG)
1024 ;; is an unofficial extension of the Portable
1025 ;; Network Graphics (PNG) format";
1026 ;; we probably do not wish to support it.
1ae6df81 1027 ;; "--with-system-png"
5b17fabc 1028 )
1ae6df81 1029
e80a4479 1030 #:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums'
7d141788 1031
9f7ae77f 1032 #:modules ((ice-9 ftw)
6cde5c34 1033 (ice-9 rdelim)
37db2370 1034 (ice-9 regex)
6cde5c34 1035 (ice-9 match)
ad21d767
MW
1036 (srfi srfi-34)
1037 (srfi srfi-35)
429c8284
MW
1038 (rnrs bytevectors)
1039 (rnrs io ports)
1040 (guix elf)
1041 (guix build gremlin)
9f7ae77f 1042 ,@%gnu-build-system-modules)
be0f6112 1043 #:phases
90e1cdae 1044 (modify-phases %standard-phases
46ce12d0
MW
1045 (add-after 'unpack 'apply-guix-specific-patches
1046 (lambda* (#:key inputs native-inputs #:allow-other-keys)
1047 (let ((patch (string-append (assoc-ref (or native-inputs inputs)
1048 "patch")
1049 "/bin/patch")))
1050 (for-each (match-lambda
1051 ((label . file)
1052 (when (and (string-prefix? "icecat-" label)
1053 (string-suffix? ".patch" label))
1054 (format #t "applying '~a'...~%" file)
1055 (invoke patch "--force" "--no-backup-if-mismatch"
1056 "-p1" "--input" file))))
1057 (or native-inputs inputs)))
1058 #t))
1059 (add-after 'apply-guix-specific-patches 'remove-bundled-libraries
1060 (lambda _
1061 ;; Remove bundled libraries that we don't use, since they may
1062 ;; contain unpatched security flaws, they waste disk space and
1063 ;; memory, and may cause confusion.
1064 (for-each (lambda (file)
1065 (format #t "deleting '~a'...~%" file)
1066 (delete-file-recursively file))
1067 '(;; FIXME: Removing the bundled icu breaks configure.
1068 ;; * The bundled icu headers are used in some places.
1069 ;; * The version number is taken from the bundled copy.
1070 ;;"intl/icu"
1071 ;;
1072 ;; FIXME: A script from the bundled nspr is used.
1073 ;;"nsprpub"
1074 ;;
1075 ;; FIXME: With the update to IceCat 60, using system NSS
1076 ;; broke certificate validation. See
1077 ;; <https://bugs.gnu.org/32833>. For now, we use
1078 ;; the bundled NSPR and NSS. TODO: Investigate,
1079 ;; and try to unbundle these libraries again.
1080 ;; UNBUNDLE-ME! "security/nss"
1081 ;;
1082 ;; TODO: Use more system media libraries. See:
1083 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
1084 ;; * libtheora: esr60 wants v1.2, not yet released.
1085 ;; * soundtouch: avoiding the bundled library would
1086 ;; result in some loss of functionality. There's
1087 ;; also an issue with exception handling
1088 ;; configuration. It seems that this is needed in
1089 ;; some moz.build:
1090 ;; DEFINES['ST_NO_EXCEPTION_HANDLING'] = 1
1091 ;; * libopus
1092 ;; * speex
1093 ;;
1094 "modules/freetype2"
ad21d767 1095 ;; "media/libjpeg" ; needed for now, because media/libjpeg/moz.build is referenced from config/external/moz.build
c7011ff8 1096 ;; UNBUNDLE-ME! "modules/zlib"
ad21d767
MW
1097 ;; UNBUNDLE-ME! "ipc/chromium/src/third_party/libevent"
1098 ;; UNBUNDLE-ME! "media/libvpx"
1099 ;; UNBUNDLE-ME! "media/libogg"
1100 ;; UNBUNDLE-ME! "media/libvorbis"
1101 ;; UNBUNDLE-ME! "media/libtheora" ; wants theora-1.2, not yet released
1102 ;; UNBUNDLE-ME! "media/libtremor"
1103 ;; UNBUNDLE-ME! "gfx/harfbuzz"
1104 ;; UNBUNDLE-ME! "gfx/graphite2"
46ce12d0 1105 "js/src/ctypes/libffi"
ad21d767
MW
1106 ;; UNBUNDLE-ME! "db/sqlite3"
1107 ))
46ce12d0
MW
1108 #t))
1109 (add-after 'remove-bundled-libraries 'link-libxul-with-libraries
1110 (lambda _
1111 ;; libxul.so dynamically opens libraries, so here we explicitly
1112 ;; link them into libxul.so instead.
1113 ;;
1114 ;; TODO: It might be preferable to patch in absolute file names in
1115 ;; calls to dlopen or PR_LoadLibrary, but that didn't seem to
1116 ;; work. More investigation is needed.
1117 (substitute* "toolkit/library/moz.build"
1118 (("^# This library needs to be last" all)
1119 (string-append "OS_LIBS += [
9f7ae77f 1120 'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5',
002c3e6d 1121 'avcodec', 'avutil', 'pulse' ]\n\n"
46ce12d0
MW
1122 all)))
1123 #t))
8e556719
JL
1124 (add-after 'link-libxul-with-libraries 'fix-ffmpeg-runtime-linker
1125 (lambda* (#:key inputs #:allow-other-keys)
429c8284
MW
1126 (let* ((ffmpeg (assoc-ref inputs "ffmpeg"))
1127 (libavcodec (string-append ffmpeg "/lib/libavcodec.so")))
1128 ;; Arrange to load libavcodec.so by its absolute file name.
1129 (substitute* "dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp"
1130 (("libavcodec\\.so")
1131 libavcodec))
1132 ;; Populate the sandbox read-path whitelist as needed by ffmpeg.
1133 (let* ((mime-info (assoc-ref inputs "shared-mime-info"))
1134 (libavcodec-runpath (call-with-input-file libavcodec
1135 (compose elf-dynamic-info-runpath
1136 elf-dynamic-info
1137 parse-elf
1138 get-bytevector-all)))
1139 (whitelist (cons (string-append mime-info "/share/mime/")
1140 (map (lambda (dir)
1141 (string-append dir "/"))
1142 libavcodec-runpath)))
1143 (whitelist-string (string-join whitelist ","))
1144 (port (open-file "browser/app/profile/icecat.js" "a")))
1145 (format #t "setting 'security.sandbox.content.read_path_whitelist' to '~a'~%"
1146 whitelist-string)
1147 (format port "~%pref(\"security.sandbox.content.read_path_whitelist\", ~S);~%"
1148 whitelist-string)
1149 (close-output-port port))
1150 #t)))
94e96f7f
MW
1151 (replace 'bootstrap
1152 (lambda _
46ce12d0
MW
1153 (invoke "sh" "-c" "autoconf old-configure.in > old-configure")
1154 ;; 'configure' must be newer than 'old-configure.in', or else the
1155 ;; build system will raise an alarm and abort.
1156 (invoke "touch" "configure")))
e67ad553 1157 (add-after 'patch-source-shebangs 'patch-cargo-checksums
257e3247 1158 (lambda _
7d141788 1159 (use-modules (guix build cargo-utils))
e88735b4 1160 (let ((null-hash "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))
c7011ff8
MW
1161 (for-each (lambda (file)
1162 (format #t "patching checksums in ~a~%" file)
981cdc90 1163 (substitute* file
c7011ff8
MW
1164 (("^checksum = \".*\"")
1165 (string-append "checksum = \"" null-hash "\""))))
1166 (find-files "." "Cargo.lock$"))
1167 (for-each generate-all-checksums
1168 '("services"
1169 "js"
1170 "third_party/rust"
1171 "dom/media"
1172 "dom/webauthn"
1173 "toolkit"
1174 "gfx"
1175 "storage"
1176 "modules"
1177 "xpcom/rust"
1178 "media"
1179 "mozglue/static/rust"
1180 "netwerk"
1181 "remote"
1182 "intl"
1183 "servo"
1184 "security/manager/ssl"
1185 "build")))
e67ad553 1186 #t))
46ce12d0
MW
1187 (replace 'configure
1188 ;; configure does not work followed by both "SHELL=..." and
1189 ;; "CONFIG_SHELL=..."; set environment variables instead
1190 (lambda* (#:key outputs configure-flags #:allow-other-keys)
1191 (let* ((out (assoc-ref outputs "out"))
1192 (bash (which "bash"))
1193 (abs-srcdir (getcwd))
1194 (srcdir (string-append "../" (basename abs-srcdir)))
1195 (flags `(,(string-append "--prefix=" out)
1196 ,(string-append "--with-l10n-base="
1197 abs-srcdir "/l10n")
1198 ,@configure-flags)))
1199 (setenv "SHELL" bash)
1200 (setenv "CONFIG_SHELL" bash)
1201 (setenv "AUTOCONF" (which "autoconf")) ; must be autoconf-2.13
1202 (setenv "CC" "gcc") ; apparently needed when Stylo is enabled
7a1b2ba5 1203 (setenv "MOZ_BUILD_DATE" ,%icecat-build-id) ; avoid timestamp
46ce12d0
MW
1204 (mkdir "../build")
1205 (chdir "../build")
1206 (format #t "build directory: ~s~%" (getcwd))
1207 (format #t "configure flags: ~s~%" flags)
1208 (apply invoke bash
1209 (string-append srcdir "/configure")
1210 flags))))
ad21d767
MW
1211 (replace 'build
1212 ;; The build system often spuriously fails. See
1213 ;; <https://bugs.gentoo.org/show_bug.cgi?id=680934>. To
1214 ;; work around this, we try the standard 'build' phase up
1215 ;; to 5 times.
1216 (lambda args
1217 (let ((build (assoc-ref %standard-phases 'build)))
1218 (let retry ((remaining-attempts 5))
1219 (if (= remaining-attempts 1)
1220 (apply build args)
1221 (guard (c ((invoke-error? c)
1222 (format #t "~%Retrying build! (~a attempts remaining)~%~%"
1223 (- remaining-attempts 1))
1224 (force-output)
1225 (retry (- remaining-attempts 1))))
1226 (apply build args)))))))
37db2370
JK
1227 (add-after 'build 'neutralise-store-references
1228 (lambda _
1229 ;; Mangle the store references to compilers & other build tools in
1230 ;; about:buildconfig, reducing IceCat's closure by 1 GiB on x86-64.
1231 (substitute*
1232 "dist/bin/chrome/toolkit/content/global/buildconfig.html"
1233 (((format #f "(~a/)([0-9a-df-np-sv-z]{32})"
1234 (regexp-quote (%store-directory)))
1235 _ store hash)
1236 (string-append store
1237 (string-take hash 8)
1238 "<!-- Guix: not a runtime dependency -->"
1239 (string-drop hash 8))))
1240 #t))
6cde5c34
LC
1241 (add-before 'configure 'install-desktop-entry
1242 (lambda* (#:key outputs #:allow-other-keys)
1243 ;; Install the '.desktop' file.
05947d92
MW
1244 (let* ((desktop-file "taskcluster/docker/icecat-snap/icecat.desktop")
1245 (out (assoc-ref outputs "out"))
6cde5c34 1246 (applications (string-append out "/share/applications")))
05947d92
MW
1247 (substitute* desktop-file
1248 (("^Exec=icecat") (string-append "Exec=" out "/bin/icecat"))
1249 (("IceCat") "GNU IceCat")
1250 (("Icon=.*") "Icon=icecat\n")
1251 (("NewWindow") "new-window")
1252 (("NewPrivateWindow") "new-private-window"))
1253 (install-file desktop-file applications)
88a8ce87
AG
1254 #t)))
1255 (add-after 'install-desktop-entry 'install-icons
1256 (lambda* (#:key outputs #:allow-other-keys)
1257 (let ((out (assoc-ref outputs "out")))
1258 (with-directory-excursion "browser/branding/official"
1259 (for-each
1260 (lambda (file)
1261 (let* ((size (string-filter char-numeric? file))
1262 (icons (string-append out "/share/icons/hicolor/"
1263 size "x" size "/apps")))
1264 (mkdir-p icons)
1265 (copy-file file (string-append icons "/icecat.png"))))
1266 '("default16.png" "default22.png" "default24.png"
1267 "default32.png" "default48.png" "content/icon64.png"
3f27124e
MW
1268 "mozicon128.png" "default256.png"))
1269 #t))))
6e75740f
CL
1270 ;; This fixes the file chooser crash that happens with GTK 3.
1271 (add-after 'install 'wrap-program
1272 (lambda* (#:key inputs outputs #:allow-other-keys)
1273 (let* ((out (assoc-ref outputs "out"))
1274 (lib (string-append out "/lib"))
1275 (gtk (assoc-ref inputs "gtk+"))
ad21d767 1276 (gtk-share (string-append gtk "/share"))
9c6ea3cb
EZ
1277 (mesa (assoc-ref inputs "mesa"))
1278 (mesa-lib (string-append mesa "/lib"))
ad21d767 1279 (pulseaudio (assoc-ref inputs "pulseaudio"))
f11d4290
IK
1280 (pulseaudio-lib (string-append pulseaudio "/lib"))
1281 (libxscrnsaver (assoc-ref inputs "libxscrnsaver"))
1282 (libxscrnsaver-lib (string-append libxscrnsaver "/lib")))
6e75740f 1283 (wrap-program (car (find-files lib "^icecat$"))
ad21d767 1284 `("XDG_DATA_DIRS" prefix (,gtk-share))
c7011ff8
MW
1285 ;; The following line is commented out because the icecat
1286 ;; package on guix has been observed to be unstable when
1287 ;; using wayland, and the bundled extensions stop working.
1288 ;; `("MOZ_ENABLE_WAYLAND" = ("1"))
f11d4290 1289 `("LD_LIBRARY_PATH" prefix (,pulseaudio-lib ,mesa-lib ,libxscrnsaver-lib)))
3f27124e 1290 #t))))))
6fd52309 1291 (home-page "https://www.gnu.org/software/gnuzilla/")
be0f6112
AE
1292 (synopsis "Entirely free browser derived from Mozilla Firefox")
1293 (description
1294 "IceCat is the GNU version of the Firefox browser. It is entirely free
c5779c93 1295software, which does not recommend non-free plugins and addons. It also
ad21d767
MW
1296features built-in privacy-protecting features.
1297
c7011ff8 1298WARNING: IceCat 78 has not yet been released by the upstream IceCat project.
ad21d767
MW
1299This is a preview release, and does not currently meet the privacy-respecting
1300standards of the IceCat project.")
63e8bb12 1301 (license license:mpl2.0) ;and others, see toolkit/content/license.html
99effc8f
LC
1302 (properties
1303 `((ftp-directory . "/gnu/gnuzilla")
1304 (cpe-name . "firefox_esr")
bfb48f4f 1305 (cpe-version . ,(first (string-split version #\-)))))))
f5301f00 1306
b14aab67 1307;; Update this together with icecat!
c7d04418 1308(define %icedove-build-id "20210323000000") ;must be of the form YYYYMMDDhhmmss
b14aab67
JB
1309(define-public icedove
1310 (package
1311 (name "icedove")
c7d04418 1312 (version "78.9.0")
597aa644 1313 (source icecat-source)
b14aab67
JB
1314 (properties
1315 `((cpe-name . "thunderbird_esr")))
1316 (build-system gnu-build-system)
1317 (arguments
1318 `(#:tests? #f ; no check target
1319 #:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums'
1320 #:modules ((guix build utils) ;find-files
1321 (sxml simple)
1322 (ice-9 regex)
1323 ,@%gnu-build-system-modules)
1324 #:phases
1325 (modify-phases %standard-phases
1326 (add-after 'unpack 'prepare-thunderbird-sources
1327 (lambda* (#:key inputs #:allow-other-keys)
1328 (mkdir "comm")
1329 (copy-recursively (assoc-ref inputs "thunderbird-sources")
1330 "comm")
1331 (delete-file-recursively "obj-x86_64-pc-linux-gnu")
1332 (delete-file "sourcestamp.txt")
1333 #t))
1334 (add-after 'patch-source-shebangs 'patch-cargo-checksums
1335 (lambda _
1336 (use-modules (guix build cargo-utils))
1337 (let ((null-hash "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))
597aa644
JB
1338 (for-each (lambda (file)
1339 (format #t "patching checksums in ~a~%" file)
1340 (substitute* file
1341 (("^checksum = \".*\"")
1342 (string-append "checksum = \"" null-hash "\""))))
1343 (find-files "." "Cargo.lock$"))
1344 (for-each generate-all-checksums
1345 '("third_party/rust"
1346 "toolkit/library/rust")))
b14aab67
JB
1347 #t))
1348 ;; Fixes issue where each installation directory generates its own profile.
1349 ;; See e.g. https://trac.torproject.org/projects/tor/ticket/31457
1350 (add-after 'patch-source-shebangs 'fix-profile-setting
1351 (lambda _
1352 (substitute* "comm/mail/moz.configure"
1353 (("'MOZ_DEDICATED_PROFILES', True")
1354 "'MOZ_DEDICATED_PROFILES', False"))
1355 #t))
1356 (add-after 'prepare-thunderbird-sources 'rename-to-icedove
1357 (lambda _
1358 (substitute* "comm/mail/confvars.sh"
1359 (("MOZ_APP_BASENAME=Thunderbird")
1360 "MOZ_APP_BASENAME=Icedove\nMOZ_APP_DISPLAYNAME=Icedove")
1361 (("MOZ_APP_NAME=thunderbird")
1362 "MOZ_APP_NAME=icedove")
1363 (("MOZ_UPDATER=1")
1364 "MOZ_UPDATER=0"))
1365 ;; Remove branding to comply with Mozilla's trademark policy
1366 (with-directory-excursion "comm/mail/branding/nightly"
1367 (delete-file "content/about-wordmark.svg")
1368 (call-with-output-file "content/about-wordmark.svg"
1369 (lambda (port)
1370 (sxml->xml '(svg (@ (xmlns "http://www.w3.org/2000/svg")
1371 (viewBox "0 0 789.1 90.78")
1372 (width "333")
1373 (height "48")
1374 (fill "#fff"))
1375 (text (@ (x "400") (y "70")
1376 (text-anchor "middle")
1377 (font-size "90"))
1378 "Icedove Daily"))
1379 port)))
1380 (substitute* '("locales/en-US/brand.properties"
1381 "locales/en-US/brand.ftl"
1382 "locales/en-US/brand.dtd"
1383 "configure.sh")
1384 (("Thunderbird") "Icedove")
1385 (("mozilla.org") "guix.gnu.org")))
1386 ;; Remove other mentions of Thunderbird in user-visible text.
1387 (with-directory-excursion "comm/mail/base/content"
597aa644 1388 (substitute* '("overrides/app-license-name.html")
b14aab67
JB
1389 (("Thunderbird") "Icedove")))
1390 (with-directory-excursion "comm/mail/components/"
597aa644 1391 (substitute* '("MailGlue.jsm"
b14aab67
JB
1392 "extensions/schemas/addressBook.json"
1393 "extensions/schemas/tabs.json"
1394 "extensions/schemas/cloudFile.json"
1395 "extensions/schemas/chrome_settings_overrides.json"
1396 "extensions/schemas/windows.json"
1397 "extensions/parent/ext-mail.js"
1398 "im/messages/mail/Info.plist"
1399 "enterprisepolicies/moz.build"
1400 "enterprisepolicies/helpers/moz.build"
597aa644 1401 "enterprisepolicies/schemas/moz.build")
b14aab67 1402 (("Thunderbird") "Icedove")))
b14aab67 1403 (substitute* '("comm/mailnews/base/prefs/content/accountUtils.js"
b14aab67
JB
1404 "comm/common/src/customizeToolbar.js")
1405 (("AppConstants.MOZ_APP_NAME (.)= \"thunderbird" _ e)
1406 (format #f "AppConstants.MOZ_APP_NAME ~a= \"icedove" e)))
1407
1408 ;; Override addon URLs and settings
1409 (substitute* "comm/mail/app/profile/all-thunderbird.js"
1410 (("(pref\\(\"extensions.webservice.discoverURL\").*" _ m)
1411 (string-append m ", \"https://directory.fsf.org/wiki/Icedove\");"))
1412 (("(pref\\(\"extensions.getAddons.search.url\").*" _ m)
1413 (string-append m ", \"https://guix.gnu.org/packages\");"))
1414 (("(pref\\(\"extensions.update.enabled\").*" _ m)
1415 (string-append m ", false);"))
1416 (("(pref\\(\"extensions.systemAddon.update.enabled\").*" _ m)
1417 (string-append m ", false);"))
1418 (("(pref\\(\"lightweightThemes.update.enabled\").*" _ m)
1419 (string-append m ", false);")))
1420 #t))
1421 (add-after 'build 'neutralize-store-references
1422 (lambda _
1423 ;; Mangle the store references to compilers & other build tools in
1424 ;; about:buildconfig, reducing Icedove's closure significant.
1425 ;; The resulting files are saved in lib/thunderbird/omni.ja
1426 (substitute*
1427 ;; Use find because the path "obj-x86_64-pc-linux-gnu" contains
1428 ;; the architecture and the system -> more complicated.
1429 (find-files "." "buildconfig.html")
1430 (((format #f "(~a/)([0-9a-df-np-sv-z]{32})"
1431 (regexp-quote (%store-directory)))
1432 _ store hash)
1433 (string-append store
1434 (string-take hash 8)
1435 "<!-- Guix: not a runtime dependency -->"
1436 (string-drop hash 8))))
1437 #t))
1438 (replace 'configure
1439 (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
1440 (let* ((out (assoc-ref outputs "out"))
1441 (bash (which "bash"))
1442 (abs-srcdir (getcwd))
1443 (srcdir (string-append "../" (basename abs-srcdir)))
1444 (flags `(,(string-append "--prefix=" out)
1445 ,@configure-flags))
1446 (mozconfig (string-append (getcwd) "/.mozconfig")))
1447 (setenv "SHELL" bash)
1448 (setenv "AUTOCONF"
1449 (string-append (assoc-ref %build-inputs
1450 "autoconf")
1451 "/bin/autoconf"))
1452 (setenv "CONFIG_SHELL" bash)
1453 (setenv "QA_CONFIGURE_OPTIONS" ".*")
1454 (setenv "MOZBUILD_STATE_PATH"
1455 (string-append (getcwd) "/mach_state"))
1456 (setenv "MOZCONFIG"
1457 (string-append (getcwd) "/.mozconfig"))
1458 (setenv "CC" "gcc")
1459 (setenv "MOZ_NOSPAM" "1")
1460 (setenv "PYTHON"
1461 (string-append (assoc-ref inputs "python2")
1462 "/bin/python"))
1463 (setenv "MOZ_BUILD_DATE" ,%icedove-build-id) ; avoid timestamp
1464 (setenv "LDFLAGS" (string-append "-Wl,-rpath="
1465 (assoc-ref outputs "out")
1466 "/lib/icedove"))
1467 (mkdir-p (string-append (getcwd) "/builddir"))
1468 (with-output-to-file mozconfig
1469 (lambda ()
1470 (display
1471 (string-append
1472 "ac_add_options --disable-crashreporter\n"
1473 "ac_add_options --disable-debug\n"
1474 "ac_add_options --disable-debug-symbols\n"
1475 "ac_add_options --disable-elf-hack\n"
597aa644 1476 "ac_add_options --disable-jit\n"
b14aab67
JB
1477 "ac_add_options --disable-necko-wifi\n"
1478 "ac_add_options --disable-official-branding\n"
1479 "ac_add_options --disable-tests\n"
1480 "ac_add_options --disable-updater\n"
1481 "ac_add_options --disable-webrtc\n"
1482 "ac_add_options --enable-application=comm/mail\n"
1483 "ac_add_options --enable-calendar\n"
b14aab67
JB
1484 "ac_add_options --enable-default-toolkit=\"cairo-gtk3\"\n"
1485 "ac_add_options --enable-optimize\n"
1486 "ac_add_options --enable-pulseaudio\n"
1487 "ac_add_options --enable-release\n"
b14aab67
JB
1488 "ac_add_options --enable-strip\n"
1489 "ac_add_options --enable-system-ffi\n"
1490 "ac_add_options --enable-system-pixman\n"
b14aab67
JB
1491 "ac_add_options --prefix=" out "\n"
1492 "ac_add_options --with-clang-path=" (assoc-ref %build-inputs "clang") "/bin/clang\n"
1493 "ac_add_options --with-distribution-id=org.gnu\n"
1494 "ac_add_options --with-libclang-path=" (assoc-ref %build-inputs "clang") "/lib\n"
1495 "ac_add_options --with-system-bz2\n"
1496 "ac_add_options --with-system-icu\n"
1497 "ac_add_options --with-system-jpeg\n"
1498 "ac_add_options --with-system-libevent\n"
1499 "ac_add_options --with-system-nspr\n"
1500 "ac_add_options --with-system-nss\n"
1501 "ac_add_options --with-system-zlib\n"
1502 "ac_add_options --with-user-appdir=\\.icedove\n"))))
1503 (display (getcwd))
1504 (newline)
1505 (display "mach configure")
1506 (invoke "./mach" "configure"))))
1507 (replace 'build
1508 (lambda _ (invoke "./mach" "build")))
1509 (replace 'install
1510 (lambda _ (invoke "./mach" "install")))
964ba656
JB
1511 ;; Thunderbird doesn't provide any .desktop file.
1512 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1637575
1513 (add-after 'install 'install-desktop-file
1514 (lambda* (#:key outputs #:allow-other-keys)
1515 (let* ((out (assoc-ref outputs "out"))
1516 (apps (string-append out "/share/applications")))
1517 (mkdir-p apps)
1518 (with-output-to-file (string-append apps "/icedove.desktop")
1519 (lambda _
1520 (format #t
1521 "[Desktop Entry]~@
1522 Name=Icedove~@
1523 Exec=~a/bin/icedove~@
1524 Icon=icedove~@
1525 GenericName=Mail/News Client~@
1526 Categories=Network;Email;~@
1527 Terminal=false~@
1528 StartupNotify=true~@
1529 MimeType=x-scheme-handler/mailto;~@
1530 Type=Application~@
1531 Actions=ComposeMessage;~@
1532 [Desktop Action ComposeMessage]~@
1533 Name=Write new message~@
1534 Exec=~@*~a/bin/icedove -compose~%"
1535 out))))
1536 #t))
b14aab67
JB
1537 (add-after 'install 'wrap-program
1538 (lambda* (#:key inputs outputs #:allow-other-keys)
1539 (let* ((out (assoc-ref outputs "out"))
1540 (lib (string-append out "/lib"))
1541 (gtk (assoc-ref inputs "gtk+"))
1542 (gtk-share (string-append gtk "/share"))
1543 (pulseaudio (assoc-ref inputs "pulseaudio"))
1544 (pulseaudio-lib (string-append pulseaudio "/lib")))
1545 (wrap-program (car (find-files lib "^icedove$"))
1546 `("XDG_DATA_DIRS" prefix (,gtk-share))
1547 `("LD_LIBRARY_PATH" prefix (,pulseaudio-lib)))
1548 #t))))))
1549 (inputs
1550 `(("bzip2" ,bzip2)
1551 ("cairo" ,cairo)
1552 ("cups" ,cups)
1553 ("dbus-glib" ,dbus-glib)
1554 ("ffmpeg" ,ffmpeg)
1555 ("freetype" ,freetype)
1556 ("gdk-pixbuf" ,gdk-pixbuf)
1557 ("glib" ,glib)
1558 ("gtk+" ,gtk+)
1559 ("gtk+-2" ,gtk+-2)
1560 ("hunspell" ,hunspell)
597aa644 1561 ("icu4c" ,icu4c-67)
b14aab67
JB
1562 ("libcanberra" ,libcanberra)
1563 ("libevent" ,libevent)
1564 ("libffi" ,libffi)
1565 ("libgnome" ,libgnome)
1566 ("libjpeg-turbo" ,libjpeg-turbo)
1567 ("libpng-apng" ,libpng-apng)
1568 ("libvpx" ,libvpx)
1569 ("libxcomposite" ,libxcomposite)
1570 ("libxft" ,libxft)
1571 ("libxinerama" ,libxinerama)
1572 ("libxscrnsaver" ,libxscrnsaver)
1573 ("libxt" ,libxt)
1574 ("mesa" ,mesa)
1575 ("mit-krb5" ,mit-krb5)
1576 ("nspr" ,nspr)
b6fc2054 1577 ("nss" ,nss)
b14aab67
JB
1578 ("pango" ,pango)
1579 ("pixman" ,pixman)
1580 ("pulseaudio" ,pulseaudio)
1581 ("sqlite" ,sqlite)
1582 ("startup-notification" ,startup-notification)
1583 ("unzip" ,unzip)
1584 ("zip" ,zip)
1585 ("zlib" ,zlib)))
1586 (native-inputs
1587 `(("thunderbird-sources"
1588 ;; The changeset identifier is taken from the file "sourcestamp.txt"
1589 ;; in the Thunderbird release tarball. We don't use the release
1590 ;; tarball because it duplicates the Icecat sources and only adds the
1591 ;; "comm" directory, which is provided by this repository.
c7d04418 1592 ,(let ((changeset "1a5cd2aa11de609116f258b413afcf113ed72f3a"))
b14aab67
JB
1593 (origin
1594 (method hg-fetch)
1595 (uri (hg-reference
597aa644 1596 (url "https://hg.mozilla.org/releases/comm-esr78")
b14aab67
JB
1597 (changeset changeset)))
1598 (file-name (string-append "thunderbird-" version "-checkout"))
1599 (sha256
1600 (base32
c7d04418 1601 "0qgz9qj8gbn2ccmhvk3259ahs9p435ipvkzsysn3xj8a6klbz02w")))))
b14aab67 1602 ("autoconf" ,autoconf-2.13)
597aa644 1603 ("cargo" ,rust-1.41 "cargo")
b14aab67
JB
1604 ("clang" ,clang)
1605 ("llvm" ,llvm)
1606 ("nasm" ,nasm)
18f10c0b 1607 ("node" ,node)
b14aab67
JB
1608 ("perl" ,perl)
1609 ("pkg-config" ,pkg-config)
1610 ("python" ,python)
1611 ("python2" ,python-2.7)
597aa644
JB
1612 ("rust" ,rust-1.41)
1613 ("rust-cbindgen" ,rust-cbindgen-0.14)
b14aab67
JB
1614 ("which" ,which)
1615 ("yasm" ,yasm)))
1616 (home-page "https://www.thunderbird.net")
1617 (synopsis "Rebranded Mozilla Thunderbird email client")
1618 (description
1619 "This package provides an email client built based on Mozilla
1620Thunderbird. It supports email, news feeds, chat, calendar and contacts.")
1621 (license license:mpl2.0)))
1622
764c682e
JB
1623(define-public icedove/wayland
1624 (package/inherit icedove
1625 (name "icedove-wayland")
1626 (arguments
1627 (substitute-keyword-arguments (package-arguments icedove)
1628 ((#:phases phases)
1629 `(modify-phases ,phases
1630 (replace 'wrap-program
1631 (lambda* (#:key inputs outputs #:allow-other-keys)
1632 (let* ((out (assoc-ref outputs "out"))
1633 (lib (string-append out "/lib"))
1634 (gtk (assoc-ref inputs "gtk+"))
1635 (gtk-share (string-append gtk "/share"))
1636 (pulseaudio (assoc-ref inputs "pulseaudio"))
1637 (pulseaudio-lib (string-append pulseaudio "/lib")))
1638 (wrap-program (car (find-files lib "^icedove$"))
1639 `("MOZ_ENABLE_WAYLAND" = ("1"))
1640 `("XDG_DATA_DIRS" prefix (,gtk-share))
1641 `("LD_LIBRARY_PATH" prefix (,pulseaudio-lib)))
1642 #t)))))))))
1643
167a0ce0
OP
1644(define-public firefox-decrypt
1645 (package
1646 (name "firefox-decrypt")
1647 (version "0.7.0")
1648 (source (origin
1649 (method git-fetch)
1650 (uri (git-reference
b0e7b699 1651 (url "https://github.com/Unode/firefox_decrypt")
167a0ce0
OP
1652 (commit version)))
1653 (file-name (git-file-name name version))
1654 (sha256
1655 (base32
1656 "17yyyxp47z4m8hnflcq34rc1y871515kr3f1y42j1l0yx3g0il07"))))
1657 (build-system trivial-build-system)
1658 (inputs
1659 `(("nss" ,nss)
1660 ("python" ,python)))
1661 (arguments
1662 `(#:modules ((guix build utils))
1663 #:builder
1664 (begin
1665 (use-modules (guix build utils))
1666 (setenv "PATH"
1667 (string-append
1668 (assoc-ref %build-inputs "python") "/bin"))
1669 (copy-file (string-append (assoc-ref %build-inputs "source")
1670 "/firefox_decrypt.py")
1671 "firefox_decrypt.py")
1672 (substitute* "firefox_decrypt.py"
1673 (("/usr/bin/env python") (which "python3"))
1674 (("libnss3.so") (string-append (assoc-ref %build-inputs "nss")
1675 "/lib/nss/libnss3.so")))
1676 (install-file "firefox_decrypt.py" (string-append %output "/bin"))
1677 #t)))
1678 (home-page "https://github.com/Unode/firefox_decrypt/")
1679 (synopsis "Tool to extract passwords from Mozilla profiles")
1680 (description "Firefox Decrypt is a tool to extract passwords from
1681Mozilla (Firefox, Waterfox, Thunderbird, SeaMonkey) profiles.")
1682 (license license:gpl3+)))