gnu: Add python-pyshp.
[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>
d8c1413a 6;;; Copyright © 2016, 2017, 2018, 2019, 2021 Efraim Flashner <efraim@flashner.co.il>
88a8ce87 7;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
8db94716 8;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
b14aab67 9;;; Copyright © 2017, 2018 Nikita <nikita@n0.is>
37db2370 10;;; Copyright © 2017, 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
b14aab67 11;;; Copyright © 2018, 2020 Ricardo Wurmus <rekado@elephly.net>
7d141788 12;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com>
167a0ce0 13;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
37db2370 14;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
b14aab67
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
873c6b4f
MW
697(define %icecat-version "78.11.0-guix0-preview1")
698(define %icecat-build-id "20210601000000") ;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
873c6b4f 720 "0zjpzkxx3wc2840d7q4b9lnkj1kwk1qps29s9c83jf5y6xclnf9q"))))
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 950
c7011ff8 951 #:configure-flags `("--enable-default-toolkit=cairo-gtk3-wayland"
9502ea3e
MW
952
953 "--with-distribution-id=org.gnu"
954
c7011ff8
MW
955 ;; Do not require addons in the global app or
956 ;; system directories to be signed by Mozilla.
957 "--with-unsigned-addon-scopes=app,system"
958 "--allow-addon-sideload"
34369f31 959
90e1cdae 960 "--enable-pulseaudio"
90e1cdae 961
9502ea3e
MW
962 "--disable-tests"
963 "--disable-updater"
964 "--disable-crashreporter"
9502ea3e 965 "--disable-eme"
e67ad553 966
90e1cdae 967 ;; Building with debugging symbols takes ~5GiB, so
1ae6df81
LC
968 ;; disable it.
969 "--disable-debug"
970 "--disable-debug-symbols"
971
8d956d86
MW
972 ;; Clang is needed to build Stylo, Mozilla's new
973 ;; CSS engine. We must specify the clang paths
974 ;; manually, because otherwise the Mozilla build
975 ;; system looks in the directories returned by
976 ;; llvm-config --bindir and llvm-config --libdir,
977 ;; which return paths in the llvm package where
978 ;; clang is not found.
979 ,(string-append "--with-clang-path="
980 (assoc-ref %build-inputs "clang")
981 "/bin/clang")
982 ,(string-append "--with-libclang-path="
983 (assoc-ref %build-inputs "clang")
984 "/lib")
985
5bdec7d6
MW
986 ;; Hack to work around missing
987 ;; "unofficial" branding in icecat.
bfb48f4f
MW
988 "--enable-official-branding"
989
90e1cdae 990 ;; Avoid bundled libraries.
7cba7647 991 "--with-system-jpeg" ; must be libjpeg-turbo
c7011ff8
MW
992 ;; UNBUNDLE-ME! "--with-system-zlib"
993 ;; UNBUNDLE-ME! "--with-system-bz2"
ad21d767
MW
994 ;; UNBUNDLE-ME! "--with-system-libevent"
995 ;; UNBUNDLE-ME! "--with-system-ogg"
996 ;; UNBUNDLE-ME! "--with-system-vorbis"
997 ;; UNBUNDLE-ME! "--with-system-theora" ; wants theora-1.2, not yet released
998 ;; UNBUNDLE-ME! "--with-system-libvpx"
f0648a4b
ZZ
999 "--with-system-icu"
1000
6d328879 1001 ;; See <https://bugs.gnu.org/32833>
6c83c483
MW
1002 ;; and related comments in the
1003 ;; 'remove-bundled-libraries' phase below.
6d328879
MW
1004 ;; UNBUNDLE-ME! "--with-system-nspr"
1005 ;; UNBUNDLE-ME! "--with-system-nss"
c7011ff8 1006
ad21d767
MW
1007 ;; UNBUNDLE-ME! "--with-system-harfbuzz"
1008 ;; UNBUNDLE-ME! "--with-system-graphite2"
13b284d9 1009 "--enable-system-pixman"
5b17fabc 1010 "--enable-system-ffi"
ad21d767 1011 ;; UNBUNDLE-ME! "--enable-system-sqlite"
1ae6df81 1012
98a046cd
AE
1013 ;; Fails with "--with-system-png won't work because
1014 ;; the system's libpng doesn't have APNG support".
1015 ;; According to
1016 ;; http://sourceforge.net/projects/libpng-apng/ ,
1017 ;; "the Animated Portable Network Graphics (APNG)
1018 ;; is an unofficial extension of the Portable
1019 ;; Network Graphics (PNG) format";
1020 ;; we probably do not wish to support it.
1ae6df81 1021 ;; "--with-system-png"
5b17fabc 1022 )
1ae6df81 1023
e80a4479 1024 #:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums'
7d141788 1025
9f7ae77f 1026 #:modules ((ice-9 ftw)
6cde5c34 1027 (ice-9 rdelim)
37db2370 1028 (ice-9 regex)
6cde5c34 1029 (ice-9 match)
ad21d767
MW
1030 (srfi srfi-34)
1031 (srfi srfi-35)
429c8284
MW
1032 (rnrs bytevectors)
1033 (rnrs io ports)
1034 (guix elf)
1035 (guix build gremlin)
9f7ae77f 1036 ,@%gnu-build-system-modules)
be0f6112 1037 #:phases
90e1cdae 1038 (modify-phases %standard-phases
46ce12d0
MW
1039 (add-after 'unpack 'apply-guix-specific-patches
1040 (lambda* (#:key inputs native-inputs #:allow-other-keys)
1041 (let ((patch (string-append (assoc-ref (or native-inputs inputs)
1042 "patch")
1043 "/bin/patch")))
1044 (for-each (match-lambda
1045 ((label . file)
1046 (when (and (string-prefix? "icecat-" label)
1047 (string-suffix? ".patch" label))
1048 (format #t "applying '~a'...~%" file)
1049 (invoke patch "--force" "--no-backup-if-mismatch"
1050 "-p1" "--input" file))))
1051 (or native-inputs inputs)))
1052 #t))
1053 (add-after 'apply-guix-specific-patches 'remove-bundled-libraries
1054 (lambda _
1055 ;; Remove bundled libraries that we don't use, since they may
1056 ;; contain unpatched security flaws, they waste disk space and
1057 ;; memory, and may cause confusion.
1058 (for-each (lambda (file)
1059 (format #t "deleting '~a'...~%" file)
1060 (delete-file-recursively file))
1061 '(;; FIXME: Removing the bundled icu breaks configure.
1062 ;; * The bundled icu headers are used in some places.
1063 ;; * The version number is taken from the bundled copy.
1064 ;;"intl/icu"
1065 ;;
1066 ;; FIXME: A script from the bundled nspr is used.
1067 ;;"nsprpub"
1068 ;;
1069 ;; FIXME: With the update to IceCat 60, using system NSS
1070 ;; broke certificate validation. See
1071 ;; <https://bugs.gnu.org/32833>. For now, we use
1072 ;; the bundled NSPR and NSS. TODO: Investigate,
1073 ;; and try to unbundle these libraries again.
1074 ;; UNBUNDLE-ME! "security/nss"
1075 ;;
1076 ;; TODO: Use more system media libraries. See:
1077 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
1078 ;; * libtheora: esr60 wants v1.2, not yet released.
1079 ;; * soundtouch: avoiding the bundled library would
1080 ;; result in some loss of functionality. There's
1081 ;; also an issue with exception handling
1082 ;; configuration. It seems that this is needed in
1083 ;; some moz.build:
1084 ;; DEFINES['ST_NO_EXCEPTION_HANDLING'] = 1
1085 ;; * libopus
1086 ;; * speex
1087 ;;
1088 "modules/freetype2"
ad21d767 1089 ;; "media/libjpeg" ; needed for now, because media/libjpeg/moz.build is referenced from config/external/moz.build
c7011ff8 1090 ;; UNBUNDLE-ME! "modules/zlib"
ad21d767
MW
1091 ;; UNBUNDLE-ME! "ipc/chromium/src/third_party/libevent"
1092 ;; UNBUNDLE-ME! "media/libvpx"
1093 ;; UNBUNDLE-ME! "media/libogg"
1094 ;; UNBUNDLE-ME! "media/libvorbis"
1095 ;; UNBUNDLE-ME! "media/libtheora" ; wants theora-1.2, not yet released
1096 ;; UNBUNDLE-ME! "media/libtremor"
1097 ;; UNBUNDLE-ME! "gfx/harfbuzz"
1098 ;; UNBUNDLE-ME! "gfx/graphite2"
46ce12d0 1099 "js/src/ctypes/libffi"
ad21d767
MW
1100 ;; UNBUNDLE-ME! "db/sqlite3"
1101 ))
46ce12d0
MW
1102 #t))
1103 (add-after 'remove-bundled-libraries 'link-libxul-with-libraries
1104 (lambda _
1105 ;; libxul.so dynamically opens libraries, so here we explicitly
1106 ;; link them into libxul.so instead.
1107 ;;
1108 ;; TODO: It might be preferable to patch in absolute file names in
1109 ;; calls to dlopen or PR_LoadLibrary, but that didn't seem to
1110 ;; work. More investigation is needed.
1111 (substitute* "toolkit/library/moz.build"
1112 (("^# This library needs to be last" all)
1113 (string-append "OS_LIBS += [
9f7ae77f 1114 'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5',
002c3e6d 1115 'avcodec', 'avutil', 'pulse' ]\n\n"
46ce12d0
MW
1116 all)))
1117 #t))
8e556719
JL
1118 (add-after 'link-libxul-with-libraries 'fix-ffmpeg-runtime-linker
1119 (lambda* (#:key inputs #:allow-other-keys)
429c8284
MW
1120 (let* ((ffmpeg (assoc-ref inputs "ffmpeg"))
1121 (libavcodec (string-append ffmpeg "/lib/libavcodec.so")))
1122 ;; Arrange to load libavcodec.so by its absolute file name.
1123 (substitute* "dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp"
1124 (("libavcodec\\.so")
1125 libavcodec))
1126 ;; Populate the sandbox read-path whitelist as needed by ffmpeg.
1127 (let* ((mime-info (assoc-ref inputs "shared-mime-info"))
1128 (libavcodec-runpath (call-with-input-file libavcodec
1129 (compose elf-dynamic-info-runpath
1130 elf-dynamic-info
1131 parse-elf
1132 get-bytevector-all)))
1133 (whitelist (cons (string-append mime-info "/share/mime/")
1134 (map (lambda (dir)
1135 (string-append dir "/"))
1136 libavcodec-runpath)))
1137 (whitelist-string (string-join whitelist ","))
1138 (port (open-file "browser/app/profile/icecat.js" "a")))
1139 (format #t "setting 'security.sandbox.content.read_path_whitelist' to '~a'~%"
1140 whitelist-string)
1141 (format port "~%pref(\"security.sandbox.content.read_path_whitelist\", ~S);~%"
1142 whitelist-string)
1143 (close-output-port port))
1144 #t)))
94e96f7f
MW
1145 (replace 'bootstrap
1146 (lambda _
46ce12d0
MW
1147 (invoke "sh" "-c" "autoconf old-configure.in > old-configure")
1148 ;; 'configure' must be newer than 'old-configure.in', or else the
1149 ;; build system will raise an alarm and abort.
1150 (invoke "touch" "configure")))
e67ad553 1151 (add-after 'patch-source-shebangs 'patch-cargo-checksums
257e3247 1152 (lambda _
7d141788 1153 (use-modules (guix build cargo-utils))
e88735b4 1154 (let ((null-hash "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))
c7011ff8
MW
1155 (for-each (lambda (file)
1156 (format #t "patching checksums in ~a~%" file)
981cdc90 1157 (substitute* file
c7011ff8
MW
1158 (("^checksum = \".*\"")
1159 (string-append "checksum = \"" null-hash "\""))))
1160 (find-files "." "Cargo.lock$"))
1161 (for-each generate-all-checksums
1162 '("services"
1163 "js"
1164 "third_party/rust"
1165 "dom/media"
1166 "dom/webauthn"
1167 "toolkit"
1168 "gfx"
1169 "storage"
1170 "modules"
1171 "xpcom/rust"
1172 "media"
1173 "mozglue/static/rust"
1174 "netwerk"
1175 "remote"
1176 "intl"
1177 "servo"
1178 "security/manager/ssl"
1179 "build")))
e67ad553 1180 #t))
46ce12d0
MW
1181 (replace 'configure
1182 ;; configure does not work followed by both "SHELL=..." and
1183 ;; "CONFIG_SHELL=..."; set environment variables instead
1184 (lambda* (#:key outputs configure-flags #:allow-other-keys)
1185 (let* ((out (assoc-ref outputs "out"))
1186 (bash (which "bash"))
1187 (abs-srcdir (getcwd))
1188 (srcdir (string-append "../" (basename abs-srcdir)))
1189 (flags `(,(string-append "--prefix=" out)
1190 ,(string-append "--with-l10n-base="
1191 abs-srcdir "/l10n")
1192 ,@configure-flags)))
1193 (setenv "SHELL" bash)
1194 (setenv "CONFIG_SHELL" bash)
1195 (setenv "AUTOCONF" (which "autoconf")) ; must be autoconf-2.13
1196 (setenv "CC" "gcc") ; apparently needed when Stylo is enabled
7a1b2ba5 1197 (setenv "MOZ_BUILD_DATE" ,%icecat-build-id) ; avoid timestamp
d8c1413a
EF
1198 (setenv "LDFLAGS" (string-append "-Wl,-rpath="
1199 (assoc-ref outputs "out")
1200 "/lib/icecat"))
46ce12d0
MW
1201 (mkdir "../build")
1202 (chdir "../build")
1203 (format #t "build directory: ~s~%" (getcwd))
1204 (format #t "configure flags: ~s~%" flags)
1205 (apply invoke bash
1206 (string-append srcdir "/configure")
1207 flags))))
ad21d767
MW
1208 (replace 'build
1209 ;; The build system often spuriously fails. See
1210 ;; <https://bugs.gentoo.org/show_bug.cgi?id=680934>. To
1211 ;; work around this, we try the standard 'build' phase up
1212 ;; to 5 times.
1213 (lambda args
1214 (let ((build (assoc-ref %standard-phases 'build)))
1215 (let retry ((remaining-attempts 5))
1216 (if (= remaining-attempts 1)
1217 (apply build args)
1218 (guard (c ((invoke-error? c)
1219 (format #t "~%Retrying build! (~a attempts remaining)~%~%"
1220 (- remaining-attempts 1))
1221 (force-output)
1222 (retry (- remaining-attempts 1))))
1223 (apply build args)))))))
37db2370
JK
1224 (add-after 'build 'neutralise-store-references
1225 (lambda _
1226 ;; Mangle the store references to compilers & other build tools in
1227 ;; about:buildconfig, reducing IceCat's closure by 1 GiB on x86-64.
1228 (substitute*
1229 "dist/bin/chrome/toolkit/content/global/buildconfig.html"
1230 (((format #f "(~a/)([0-9a-df-np-sv-z]{32})"
1231 (regexp-quote (%store-directory)))
1232 _ store hash)
1233 (string-append store
1234 (string-take hash 8)
1235 "<!-- Guix: not a runtime dependency -->"
1236 (string-drop hash 8))))
1237 #t))
6cde5c34
LC
1238 (add-before 'configure 'install-desktop-entry
1239 (lambda* (#:key outputs #:allow-other-keys)
1240 ;; Install the '.desktop' file.
05947d92
MW
1241 (let* ((desktop-file "taskcluster/docker/icecat-snap/icecat.desktop")
1242 (out (assoc-ref outputs "out"))
6cde5c34 1243 (applications (string-append out "/share/applications")))
05947d92
MW
1244 (substitute* desktop-file
1245 (("^Exec=icecat") (string-append "Exec=" out "/bin/icecat"))
1246 (("IceCat") "GNU IceCat")
1247 (("Icon=.*") "Icon=icecat\n")
1248 (("NewWindow") "new-window")
1249 (("NewPrivateWindow") "new-private-window"))
1250 (install-file desktop-file applications)
88a8ce87
AG
1251 #t)))
1252 (add-after 'install-desktop-entry 'install-icons
1253 (lambda* (#:key outputs #:allow-other-keys)
1254 (let ((out (assoc-ref outputs "out")))
1255 (with-directory-excursion "browser/branding/official"
1256 (for-each
1257 (lambda (file)
1258 (let* ((size (string-filter char-numeric? file))
1259 (icons (string-append out "/share/icons/hicolor/"
1260 size "x" size "/apps")))
1261 (mkdir-p icons)
1262 (copy-file file (string-append icons "/icecat.png"))))
1263 '("default16.png" "default22.png" "default24.png"
1264 "default32.png" "default48.png" "content/icon64.png"
3f27124e
MW
1265 "mozicon128.png" "default256.png"))
1266 #t))))
6e75740f
CL
1267 ;; This fixes the file chooser crash that happens with GTK 3.
1268 (add-after 'install 'wrap-program
1269 (lambda* (#:key inputs outputs #:allow-other-keys)
1270 (let* ((out (assoc-ref outputs "out"))
1271 (lib (string-append out "/lib"))
1272 (gtk (assoc-ref inputs "gtk+"))
ad21d767 1273 (gtk-share (string-append gtk "/share"))
9c6ea3cb
EZ
1274 (mesa (assoc-ref inputs "mesa"))
1275 (mesa-lib (string-append mesa "/lib"))
ad21d767 1276 (pulseaudio (assoc-ref inputs "pulseaudio"))
f11d4290
IK
1277 (pulseaudio-lib (string-append pulseaudio "/lib"))
1278 (libxscrnsaver (assoc-ref inputs "libxscrnsaver"))
61b904b7
MW
1279 (libxscrnsaver-lib (string-append libxscrnsaver "/lib"))
1280 (mit-krb5 (assoc-ref inputs "mit-krb5"))
1281 (mit-krb5-lib (string-append mit-krb5 "/lib")))
6e75740f 1282 (wrap-program (car (find-files lib "^icecat$"))
ad21d767 1283 `("XDG_DATA_DIRS" prefix (,gtk-share))
c7011ff8
MW
1284 ;; The following line is commented out because the icecat
1285 ;; package on guix has been observed to be unstable when
1286 ;; using wayland, and the bundled extensions stop working.
1287 ;; `("MOZ_ENABLE_WAYLAND" = ("1"))
61b904b7
MW
1288 `("LD_LIBRARY_PATH" prefix (,pulseaudio-lib
1289 ,mesa-lib
1290 ,libxscrnsaver-lib
1291 ,mit-krb5-lib)))
3f27124e 1292 #t))))))
6fd52309 1293 (home-page "https://www.gnu.org/software/gnuzilla/")
be0f6112
AE
1294 (synopsis "Entirely free browser derived from Mozilla Firefox")
1295 (description
1296 "IceCat is the GNU version of the Firefox browser. It is entirely free
c5779c93 1297software, which does not recommend non-free plugins and addons. It also
ad21d767
MW
1298features built-in privacy-protecting features.
1299
c7011ff8 1300WARNING: IceCat 78 has not yet been released by the upstream IceCat project.
ad21d767
MW
1301This is a preview release, and does not currently meet the privacy-respecting
1302standards of the IceCat project.")
63e8bb12 1303 (license license:mpl2.0) ;and others, see toolkit/content/license.html
99effc8f
LC
1304 (properties
1305 `((ftp-directory . "/gnu/gnuzilla")
1306 (cpe-name . "firefox_esr")
bfb48f4f 1307 (cpe-version . ,(first (string-split version #\-)))))))
f5301f00 1308
b14aab67 1309;; Update this together with icecat!
f1e0e5fd 1310(define %icedove-build-id "20210601000000") ;must be of the form YYYYMMDDhhmmss
b14aab67
JB
1311(define-public icedove
1312 (package
1313 (name "icedove")
f1e0e5fd 1314 (version "78.11.0")
597aa644 1315 (source icecat-source)
b14aab67
JB
1316 (properties
1317 `((cpe-name . "thunderbird_esr")))
1318 (build-system gnu-build-system)
1319 (arguments
1320 `(#:tests? #f ; no check target
1321 #:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums'
1322 #:modules ((guix build utils) ;find-files
1323 (sxml simple)
1324 (ice-9 regex)
1325 ,@%gnu-build-system-modules)
1326 #:phases
1327 (modify-phases %standard-phases
1328 (add-after 'unpack 'prepare-thunderbird-sources
1329 (lambda* (#:key inputs #:allow-other-keys)
1330 (mkdir "comm")
1331 (copy-recursively (assoc-ref inputs "thunderbird-sources")
1332 "comm")
1333 (delete-file-recursively "obj-x86_64-pc-linux-gnu")
1334 (delete-file "sourcestamp.txt")
1335 #t))
1336 (add-after 'patch-source-shebangs 'patch-cargo-checksums
1337 (lambda _
1338 (use-modules (guix build cargo-utils))
1339 (let ((null-hash "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))
597aa644
JB
1340 (for-each (lambda (file)
1341 (format #t "patching checksums in ~a~%" file)
1342 (substitute* file
1343 (("^checksum = \".*\"")
1344 (string-append "checksum = \"" null-hash "\""))))
1345 (find-files "." "Cargo.lock$"))
1346 (for-each generate-all-checksums
1347 '("third_party/rust"
1348 "toolkit/library/rust")))
b14aab67
JB
1349 #t))
1350 ;; Fixes issue where each installation directory generates its own profile.
1351 ;; See e.g. https://trac.torproject.org/projects/tor/ticket/31457
1352 (add-after 'patch-source-shebangs 'fix-profile-setting
1353 (lambda _
1354 (substitute* "comm/mail/moz.configure"
1355 (("'MOZ_DEDICATED_PROFILES', True")
1356 "'MOZ_DEDICATED_PROFILES', False"))
1357 #t))
1358 (add-after 'prepare-thunderbird-sources 'rename-to-icedove
1359 (lambda _
1360 (substitute* "comm/mail/confvars.sh"
1361 (("MOZ_APP_BASENAME=Thunderbird")
1362 "MOZ_APP_BASENAME=Icedove\nMOZ_APP_DISPLAYNAME=Icedove")
1363 (("MOZ_APP_NAME=thunderbird")
1364 "MOZ_APP_NAME=icedove")
1365 (("MOZ_UPDATER=1")
1366 "MOZ_UPDATER=0"))
1367 ;; Remove branding to comply with Mozilla's trademark policy
1368 (with-directory-excursion "comm/mail/branding/nightly"
1369 (delete-file "content/about-wordmark.svg")
1370 (call-with-output-file "content/about-wordmark.svg"
1371 (lambda (port)
1372 (sxml->xml '(svg (@ (xmlns "http://www.w3.org/2000/svg")
1373 (viewBox "0 0 789.1 90.78")
1374 (width "333")
1375 (height "48")
1376 (fill "#fff"))
1377 (text (@ (x "400") (y "70")
1378 (text-anchor "middle")
1379 (font-size "90"))
1380 "Icedove Daily"))
1381 port)))
1382 (substitute* '("locales/en-US/brand.properties"
1383 "locales/en-US/brand.ftl"
1384 "locales/en-US/brand.dtd"
1385 "configure.sh")
1386 (("Thunderbird") "Icedove")
1387 (("mozilla.org") "guix.gnu.org")))
1388 ;; Remove other mentions of Thunderbird in user-visible text.
1389 (with-directory-excursion "comm/mail/base/content"
597aa644 1390 (substitute* '("overrides/app-license-name.html")
b14aab67
JB
1391 (("Thunderbird") "Icedove")))
1392 (with-directory-excursion "comm/mail/components/"
597aa644 1393 (substitute* '("MailGlue.jsm"
b14aab67
JB
1394 "extensions/schemas/addressBook.json"
1395 "extensions/schemas/tabs.json"
1396 "extensions/schemas/cloudFile.json"
1397 "extensions/schemas/chrome_settings_overrides.json"
1398 "extensions/schemas/windows.json"
1399 "extensions/parent/ext-mail.js"
1400 "im/messages/mail/Info.plist"
1401 "enterprisepolicies/moz.build"
1402 "enterprisepolicies/helpers/moz.build"
597aa644 1403 "enterprisepolicies/schemas/moz.build")
b14aab67 1404 (("Thunderbird") "Icedove")))
b14aab67 1405 (substitute* '("comm/mailnews/base/prefs/content/accountUtils.js"
b14aab67
JB
1406 "comm/common/src/customizeToolbar.js")
1407 (("AppConstants.MOZ_APP_NAME (.)= \"thunderbird" _ e)
1408 (format #f "AppConstants.MOZ_APP_NAME ~a= \"icedove" e)))
1409
1410 ;; Override addon URLs and settings
1411 (substitute* "comm/mail/app/profile/all-thunderbird.js"
1412 (("(pref\\(\"extensions.webservice.discoverURL\").*" _ m)
1413 (string-append m ", \"https://directory.fsf.org/wiki/Icedove\");"))
1414 (("(pref\\(\"extensions.getAddons.search.url\").*" _ m)
1415 (string-append m ", \"https://guix.gnu.org/packages\");"))
1416 (("(pref\\(\"extensions.update.enabled\").*" _ m)
1417 (string-append m ", false);"))
1418 (("(pref\\(\"extensions.systemAddon.update.enabled\").*" _ m)
1419 (string-append m ", false);"))
1420 (("(pref\\(\"lightweightThemes.update.enabled\").*" _ m)
1421 (string-append m ", false);")))
1422 #t))
1423 (add-after 'build 'neutralize-store-references
1424 (lambda _
1425 ;; Mangle the store references to compilers & other build tools in
1426 ;; about:buildconfig, reducing Icedove's closure significant.
1427 ;; The resulting files are saved in lib/thunderbird/omni.ja
1428 (substitute*
1429 ;; Use find because the path "obj-x86_64-pc-linux-gnu" contains
1430 ;; the architecture and the system -> more complicated.
1431 (find-files "." "buildconfig.html")
1432 (((format #f "(~a/)([0-9a-df-np-sv-z]{32})"
1433 (regexp-quote (%store-directory)))
1434 _ store hash)
1435 (string-append store
1436 (string-take hash 8)
1437 "<!-- Guix: not a runtime dependency -->"
1438 (string-drop hash 8))))
1439 #t))
1440 (replace 'configure
1441 (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
1442 (let* ((out (assoc-ref outputs "out"))
1443 (bash (which "bash"))
1444 (abs-srcdir (getcwd))
1445 (srcdir (string-append "../" (basename abs-srcdir)))
1446 (flags `(,(string-append "--prefix=" out)
1447 ,@configure-flags))
1448 (mozconfig (string-append (getcwd) "/.mozconfig")))
1449 (setenv "SHELL" bash)
1450 (setenv "AUTOCONF"
1451 (string-append (assoc-ref %build-inputs
1452 "autoconf")
1453 "/bin/autoconf"))
1454 (setenv "CONFIG_SHELL" bash)
1455 (setenv "QA_CONFIGURE_OPTIONS" ".*")
1456 (setenv "MOZBUILD_STATE_PATH"
1457 (string-append (getcwd) "/mach_state"))
1458 (setenv "MOZCONFIG"
1459 (string-append (getcwd) "/.mozconfig"))
1460 (setenv "CC" "gcc")
1461 (setenv "MOZ_NOSPAM" "1")
1462 (setenv "PYTHON"
1463 (string-append (assoc-ref inputs "python2")
1464 "/bin/python"))
1465 (setenv "MOZ_BUILD_DATE" ,%icedove-build-id) ; avoid timestamp
1466 (setenv "LDFLAGS" (string-append "-Wl,-rpath="
1467 (assoc-ref outputs "out")
1468 "/lib/icedove"))
1469 (mkdir-p (string-append (getcwd) "/builddir"))
1470 (with-output-to-file mozconfig
1471 (lambda ()
1472 (display
1473 (string-append
1474 "ac_add_options --disable-crashreporter\n"
1475 "ac_add_options --disable-debug\n"
1476 "ac_add_options --disable-debug-symbols\n"
1477 "ac_add_options --disable-elf-hack\n"
597aa644 1478 "ac_add_options --disable-jit\n"
b14aab67
JB
1479 "ac_add_options --disable-necko-wifi\n"
1480 "ac_add_options --disable-official-branding\n"
1481 "ac_add_options --disable-tests\n"
1482 "ac_add_options --disable-updater\n"
1483 "ac_add_options --disable-webrtc\n"
1484 "ac_add_options --enable-application=comm/mail\n"
1485 "ac_add_options --enable-calendar\n"
b14aab67
JB
1486 "ac_add_options --enable-default-toolkit=\"cairo-gtk3\"\n"
1487 "ac_add_options --enable-optimize\n"
1488 "ac_add_options --enable-pulseaudio\n"
1489 "ac_add_options --enable-release\n"
b14aab67
JB
1490 "ac_add_options --enable-strip\n"
1491 "ac_add_options --enable-system-ffi\n"
1492 "ac_add_options --enable-system-pixman\n"
b14aab67
JB
1493 "ac_add_options --prefix=" out "\n"
1494 "ac_add_options --with-clang-path=" (assoc-ref %build-inputs "clang") "/bin/clang\n"
1495 "ac_add_options --with-distribution-id=org.gnu\n"
1496 "ac_add_options --with-libclang-path=" (assoc-ref %build-inputs "clang") "/lib\n"
1497 "ac_add_options --with-system-bz2\n"
1498 "ac_add_options --with-system-icu\n"
1499 "ac_add_options --with-system-jpeg\n"
1500 "ac_add_options --with-system-libevent\n"
1501 "ac_add_options --with-system-nspr\n"
1502 "ac_add_options --with-system-nss\n"
1503 "ac_add_options --with-system-zlib\n"
1504 "ac_add_options --with-user-appdir=\\.icedove\n"))))
1505 (display (getcwd))
1506 (newline)
1507 (display "mach configure")
1508 (invoke "./mach" "configure"))))
1509 (replace 'build
1510 (lambda _ (invoke "./mach" "build")))
1511 (replace 'install
1512 (lambda _ (invoke "./mach" "install")))
964ba656
JB
1513 ;; Thunderbird doesn't provide any .desktop file.
1514 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1637575
1515 (add-after 'install 'install-desktop-file
1516 (lambda* (#:key outputs #:allow-other-keys)
1517 (let* ((out (assoc-ref outputs "out"))
1518 (apps (string-append out "/share/applications")))
1519 (mkdir-p apps)
1520 (with-output-to-file (string-append apps "/icedove.desktop")
1521 (lambda _
1522 (format #t
1523 "[Desktop Entry]~@
1524 Name=Icedove~@
1525 Exec=~a/bin/icedove~@
1526 Icon=icedove~@
1527 GenericName=Mail/News Client~@
1528 Categories=Network;Email;~@
1529 Terminal=false~@
1530 StartupNotify=true~@
1531 MimeType=x-scheme-handler/mailto;~@
1532 Type=Application~@
1533 Actions=ComposeMessage;~@
1534 [Desktop Action ComposeMessage]~@
1535 Name=Write new message~@
1536 Exec=~@*~a/bin/icedove -compose~%"
1537 out))))
1538 #t))
b14aab67
JB
1539 (add-after 'install 'wrap-program
1540 (lambda* (#:key inputs outputs #:allow-other-keys)
1541 (let* ((out (assoc-ref outputs "out"))
1542 (lib (string-append out "/lib"))
1543 (gtk (assoc-ref inputs "gtk+"))
1544 (gtk-share (string-append gtk "/share"))
1545 (pulseaudio (assoc-ref inputs "pulseaudio"))
1546 (pulseaudio-lib (string-append pulseaudio "/lib")))
1547 (wrap-program (car (find-files lib "^icedove$"))
1548 `("XDG_DATA_DIRS" prefix (,gtk-share))
1549 `("LD_LIBRARY_PATH" prefix (,pulseaudio-lib)))
1550 #t))))))
1551 (inputs
1552 `(("bzip2" ,bzip2)
1553 ("cairo" ,cairo)
1554 ("cups" ,cups)
1555 ("dbus-glib" ,dbus-glib)
1556 ("ffmpeg" ,ffmpeg)
1557 ("freetype" ,freetype)
1558 ("gdk-pixbuf" ,gdk-pixbuf)
1559 ("glib" ,glib)
1560 ("gtk+" ,gtk+)
1561 ("gtk+-2" ,gtk+-2)
1562 ("hunspell" ,hunspell)
597aa644 1563 ("icu4c" ,icu4c-67)
b14aab67
JB
1564 ("libcanberra" ,libcanberra)
1565 ("libevent" ,libevent)
1566 ("libffi" ,libffi)
1567 ("libgnome" ,libgnome)
1568 ("libjpeg-turbo" ,libjpeg-turbo)
1569 ("libpng-apng" ,libpng-apng)
1570 ("libvpx" ,libvpx)
1571 ("libxcomposite" ,libxcomposite)
1572 ("libxft" ,libxft)
1573 ("libxinerama" ,libxinerama)
1574 ("libxscrnsaver" ,libxscrnsaver)
1575 ("libxt" ,libxt)
1576 ("mesa" ,mesa)
1577 ("mit-krb5" ,mit-krb5)
1578 ("nspr" ,nspr)
b6fc2054 1579 ("nss" ,nss)
b14aab67
JB
1580 ("pango" ,pango)
1581 ("pixman" ,pixman)
1582 ("pulseaudio" ,pulseaudio)
1583 ("sqlite" ,sqlite)
1584 ("startup-notification" ,startup-notification)
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.
f1e0e5fd 1594 ,(let ((changeset "1717d8d5fbd359aab7a4a0a15f4d15c72a7e6afc"))
b14aab67
JB
1595 (origin
1596 (method hg-fetch)
1597 (uri (hg-reference
597aa644 1598 (url "https://hg.mozilla.org/releases/comm-esr78")
b14aab67
JB
1599 (changeset changeset)))
1600 (file-name (string-append "thunderbird-" version "-checkout"))
1601 (sha256
1602 (base32
f1e0e5fd 1603 "10l042dd7b8rvla0cbiks5kjrz2b28yy7hr8sr169wlx202hxa01")))))
b14aab67 1604 ("autoconf" ,autoconf-2.13)
597aa644 1605 ("cargo" ,rust-1.41 "cargo")
b14aab67
JB
1606 ("clang" ,clang)
1607 ("llvm" ,llvm)
1608 ("nasm" ,nasm)
18f10c0b 1609 ("node" ,node)
b14aab67
JB
1610 ("perl" ,perl)
1611 ("pkg-config" ,pkg-config)
1612 ("python" ,python)
1613 ("python2" ,python-2.7)
597aa644
JB
1614 ("rust" ,rust-1.41)
1615 ("rust-cbindgen" ,rust-cbindgen-0.14)
b14aab67
JB
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
1622Thunderbird. It supports email, news feeds, chat, calendar and contacts.")
1623 (license license:mpl2.0)))
1624
764c682e 1625(define-public icedove/wayland
db8ea15b
JB
1626 (package
1627 (inherit icedove)
764c682e 1628 (name "icedove-wayland")
db8ea15b
JB
1629 (native-inputs '())
1630 (inputs
1631 `(("bash" ,bash-minimal)
1632 ("icedove" ,icedove)))
1633 (build-system trivial-build-system)
764c682e 1634 (arguments
db8ea15b
JB
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))))))
764c682e 1660
167a0ce0
OP
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
b0e7b699 1668 (url "https://github.com/Unode/firefox_decrypt")
167a0ce0
OP
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
1698Mozilla (Firefox, Waterfox, Thunderbird, SeaMonkey) profiles.")
1699 (license license:gpl3+)))