Merge branch 'master' into staging
[jackhill/guix/guix.git] / gnu / packages / gnuzilla.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
4 ;;; Copyright © 2014, 2015, 2016, 2017, 2018 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
6 ;;; Copyright © 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
8 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
9 ;;; Copyright © 2017 Nils Gillmann <ng0@n0.is>
10 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
11 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
12 ;;;
13 ;;; This file is part of GNU Guix.
14 ;;;
15 ;;; GNU Guix is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
19 ;;;
20 ;;; GNU Guix is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
24 ;;;
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27
28 (define-module (gnu packages gnuzilla)
29 #:use-module ((srfi srfi-1) #:hide (zip))
30 #:use-module (ice-9 match)
31 #:use-module (gnu packages)
32 #:use-module ((guix licenses) #:prefix license:)
33 #:use-module (guix packages)
34 #:use-module (guix download)
35 #:use-module (guix git-download)
36 #:use-module (guix utils)
37 #:use-module (guix build-system gnu)
38 #:use-module (guix build-system cargo)
39 #:use-module (gnu packages audio)
40 #:use-module (gnu packages autotools)
41 #:use-module (gnu packages base)
42 #:use-module (gnu packages check)
43 #:use-module (gnu packages databases)
44 #:use-module (gnu packages glib)
45 #:use-module (gnu packages gtk)
46 #:use-module (gnu packages gnome)
47 #:use-module (gnu packages libcanberra)
48 #:use-module (gnu packages cups)
49 #:use-module (gnu packages kerberos)
50 #:use-module (gnu packages linux)
51 #:use-module (gnu packages perl)
52 #:use-module (gnu packages pkg-config)
53 #:use-module (gnu packages compression)
54 #:use-module (gnu packages fontutils)
55 #:use-module (gnu packages libevent)
56 #:use-module (gnu packages libreoffice) ;for hunspell
57 #:use-module (gnu packages image)
58 #:use-module (gnu packages libffi)
59 #:use-module (gnu packages pulseaudio)
60 #:use-module (gnu packages python)
61 #:use-module (gnu packages xorg)
62 #:use-module (gnu packages gl)
63 #:use-module (gnu packages assembly)
64 #:use-module (gnu packages rust)
65 #:use-module (gnu packages llvm)
66 #:use-module (gnu packages icu4c)
67 #:use-module (gnu packages video)
68 #:use-module (gnu packages xiph)
69 #:use-module (gnu packages xdisorg)
70 #:use-module (gnu packages readline))
71
72 (define-public mozjs
73 (package
74 (name "mozjs")
75 (version "17.0.0")
76 (source (origin
77 (method url-fetch)
78 (uri (string-append
79 "https://ftp.mozilla.org/pub/mozilla.org/js/"
80 name version ".tar.gz"))
81 (sha256
82 (base32
83 "1fig2wf4f10v43mqx67y68z6h77sy900d1w0pz9qarrqx57rc7ij"))
84 (patches (search-patches "mozjs17-aarch64-support.patch"))
85 (modules '((guix build utils)))
86 (snippet
87 ;; Fix incompatibility with Perl 5.22+.
88 '(begin
89 (substitute* '("js/src/config/milestone.pl")
90 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE"))
91 #t))))
92 (build-system gnu-build-system)
93 (native-inputs
94 `(("perl" ,perl)
95 ("pkg-config" ,pkg-config)
96 ("python" ,python-2)))
97 (propagated-inputs
98 `(("nspr" ,nspr))) ; in the Requires.private field of mozjs-17.0.pc
99 (inputs
100 `(("zlib" ,zlib)))
101 (arguments
102 `(;; XXX: parallel build fails, lacking:
103 ;; mkdir -p "system_wrapper_js/"
104 #:parallel-build? #f
105 #:phases
106 (modify-phases %standard-phases
107 (add-after 'unpack 'delete-timedout-test
108 ;; This test times out on slower hardware.
109 (lambda _
110 (delete-file "js/src/jit-test/tests/basic/bug698584.js")
111 #t))
112 (add-before 'configure 'chdir
113 (lambda _
114 (chdir "js/src")
115 #t))
116 (replace 'configure
117 ;; configure fails if it is followed by SHELL and CONFIG_SHELL
118 (lambda* (#:key outputs #:allow-other-keys)
119 (let ((out (assoc-ref outputs "out")))
120 (setenv "SHELL" (which "sh"))
121 (setenv "CONFIG_SHELL" (which "sh"))
122 (invoke "./configure" (string-append "--prefix=" out)
123 ,@(if (string=? "aarch64-linux"
124 (%current-system))
125 '("--host=aarch64-unknown-linux-gnu")
126 '()))))))))
127 (home-page
128 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey")
129 (synopsis "Mozilla javascript engine")
130 (description "SpiderMonkey is Mozilla's JavaScript engine written
131 in C/C++.")
132 (license license:mpl2.0))) ; and others for some files
133
134 (define-public mozjs-24
135 (package (inherit mozjs)
136 (name "mozjs")
137 (version "24.2.0")
138 (source (origin
139 (method url-fetch)
140 (uri (string-append
141 "https://ftp.mozilla.org/pub/mozilla.org/js/"
142 name "-" version ".tar.bz2"))
143 (sha256
144 (base32
145 "1n1phk8r3l8icqrrap4czplnylawa0ddc2cc4cgdz46x3lrkybz6"))
146 (modules '((guix build utils)))
147 (patches (search-patches "mozjs24-aarch64-support.patch"))
148 (snippet
149 ;; Fix incompatibility with Perl 5.22+.
150 '(begin
151 (substitute* '("js/src/config/milestone.pl")
152 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE"))
153 #t))))
154 (arguments
155 (substitute-keyword-arguments (package-arguments mozjs)
156 ((#:phases phases)
157 `(modify-phases ,phases
158 (replace 'configure
159 (lambda* (#:key outputs #:allow-other-keys)
160 (let ((out (assoc-ref outputs "out")))
161 ;; configure fails if it is followed by SHELL and CONFIG_SHELL
162 (setenv "SHELL" (which "sh"))
163 (setenv "CONFIG_SHELL" (which "sh"))
164 (invoke "./configure"
165 (string-append "--prefix=" out)
166 "--with-system-nspr"
167 "--enable-system-ffi"
168 "--enable-threadsafe"
169 ,@(if (string=? "aarch64-linux"
170 (%current-system))
171 '("--host=aarch64-unknown-linux-gnu")
172 '())))))))))
173 (inputs
174 `(("libffi" ,libffi)
175 ("zlib" ,zlib)))))
176
177 (define-public mozjs-38
178 (package
179 (inherit mozjs)
180 (name "mozjs")
181 (version "38.2.1.rc0")
182 (source (origin
183 (method url-fetch)
184 (uri (string-append
185 "https://people.mozilla.org/~sstangl/"
186 name "-" version ".tar.bz2"))
187 (sha256
188 (base32
189 "0p4bmbpgkfsj54xschcny0a118jdrdgg0q29rwxigg3lh5slr681"))
190 (patches
191 (search-patches
192 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1269317 for
193 ;; GCC 6 compatibility.
194
195 "mozjs38-version-detection.patch" ; for 0ad
196 "mozjs38-tracelogger.patch"
197
198 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1339931.
199 "mozjs38-pkg-config-version.patch"
200 "mozjs38-shell-version.patch"))
201 (modules '((guix build utils)))
202 (snippet
203 '(begin
204 ;; Fix incompatibility with sed 4.4.
205 (substitute* "js/src/configure"
206 (("\\^\\[:space:\\]") "^[[:space:]]"))
207
208 ;; The headers are symlinks to files that are in /tmp, so they
209 ;; end up broken. Copy them instead.
210 (substitute*
211 "python/mozbuild/mozbuild/backend/recursivemake.py"
212 (("\\['dist_include'\\].add_symlink")
213 "['dist_include'].add_copy"))
214
215 ;; Remove bundled libraries.
216 (for-each delete-file-recursively
217 '("intl"
218 "js/src/ctypes/libffi"
219 "js/src/ctypes/libffi-patches"
220 "modules/zlib"))
221 #t))))
222 (arguments
223 `(;; XXX: parallel build fails, lacking:
224 ;; mkdir -p "system_wrapper_js/"
225 #:parallel-build? #f
226 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1008470.
227 #:tests? #f
228 #:phases
229 (modify-phases %standard-phases
230 (replace 'configure
231 (lambda* (#:key outputs #:allow-other-keys)
232 (let ((out (assoc-ref outputs "out")))
233 (chdir "js/src")
234 (setenv "SHELL" (which "sh"))
235 (setenv "CONFIG_SHELL" (which "sh"))
236 (invoke "./configure"
237 (string-append "--prefix=" out)
238 "--enable-ctypes"
239 "--enable-gcgenerational"
240 "--enable-optimize"
241 "--enable-pie"
242 "--enable-readline"
243 "--enable-shared-js"
244 "--enable-system-ffi"
245 "--enable-threadsafe"
246 "--enable-xterm-updates"
247 "--with-system-icu"
248 "--with-system-nspr"
249 "--with-system-zlib"
250
251 ;; Intl API requires bundled ICU.
252 "--without-intl-api")))))))
253 (native-inputs
254 `(("perl" ,perl)
255 ("pkg-config" ,pkg-config)
256 ("python-2" ,python-2)))
257 (inputs
258 `(("libffi" ,libffi)
259 ("readline" ,readline)
260 ("icu4c" ,icu4c)
261 ("zlib" ,zlib)))))
262
263 (define-public mozjs-52
264 ;; No releases yet at <https://archive.mozilla.org/pub/spidermonkey/releases/>.
265 ;; While we could take a snapshot of the complete mozilla-esr52 repository at
266 ;; <https://treeherder.mozilla.org/#/jobs?repo=mozilla-esr52&filter-searchStr=sm-tc>,
267 ;; we take the Debian version instead, because it is easier to work with.
268 (let ((commit "6507e63cc416fd7a3269e390efe712f8b56f374a")
269 (revision "1"))
270 (package (inherit mozjs-38)
271 (version (git-version "52.0" revision commit))
272 (source (origin
273 (method git-fetch)
274 (uri (git-reference
275 (url "https://salsa.debian.org/gnome-team/mozjs52.git")
276 (commit commit)))
277 (file-name (git-file-name "mozjs" version))
278 (sha256
279 (base32
280 "1ny0s53r8wn4byys87h784xrq1xg767akmfm6gqrbvrz57mlm3q2"))))
281 (arguments
282 `(#:tests? #f ; depends on repository metadata
283 #:configure-flags
284 '("--enable-ctypes"
285 "--enable-optimize"
286 "--enable-pie"
287 "--enable-readline"
288 "--enable-shared-js"
289 "--enable-system-ffi"
290 "--with-system-icu"
291 "--with-system-nspr"
292 "--with-system-zlib"
293
294 ;; Intl API requires bundled ICU.
295 "--without-intl-api")
296 #:phases
297 (modify-phases %standard-phases
298 (add-after 'unpack 'patch-and-chdir
299 (lambda* (#:key inputs #:allow-other-keys)
300 ;; This patch prevents a segfault when executing JS_Init().
301 ;; The build does not fail without this patch, but the
302 ;; configure phase of the gjs package would fail.
303 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1176787
304 (make-file-writable "js/src/old-configure.in")
305 (make-file-writable "js/src/old-configure")
306 (make-file-writable "mozglue/build/moz.build")
307 (invoke "patch" "-p1" "--force"
308 "--input" "debian/patches/disable-mozglue.patch")
309 (invoke "touch" "js/src/configure")
310 (chdir "js/src")
311 #t))
312 (replace 'configure
313 (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
314 ;; The configure script does not accept environment variables
315 ;; as arguments.
316 (let ((out (assoc-ref outputs "out")))
317 (setenv "SHELL" (which "sh"))
318 (setenv "CONFIG_SHELL" (which "sh"))
319 (setenv "AUTOCONF" (string-append (assoc-ref inputs "autoconf")
320 "/bin/autoconf"))
321 (apply invoke "./configure"
322 (cons (string-append "--prefix=" out)
323 configure-flags))))))))
324 (native-inputs
325 `(("autoconf" ,autoconf-2.13)
326 ("automake" ,automake)
327 ,@(package-native-inputs mozjs-38))))))
328
329 (define-public nspr
330 (package
331 (name "nspr")
332 (version "4.20")
333 (source (origin
334 (method url-fetch)
335 (uri (string-append
336 "https://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v"
337 version "/src/nspr-" version ".tar.gz"))
338 (sha256
339 (base32
340 "0vjms4j75zvv5b2siyafg7hh924ysx2cwjad8spzp7x87n8n929c"))))
341 (build-system gnu-build-system)
342 (native-inputs
343 `(("perl" ,perl)))
344 (arguments
345 `(#:tests? #f ; no check target
346 #:configure-flags (list "--enable-64bit"
347 (string-append "LDFLAGS=-Wl,-rpath="
348 (assoc-ref %outputs "out")
349 "/lib"))
350 ;; Use fixed timestamps for reproducibility.
351 #:make-flags '("SH_DATE='1970-01-01 00:00:01'"
352 ;; This is epoch 1 in microseconds.
353 "SH_NOW=100000")
354 #:phases (modify-phases %standard-phases
355 (add-before 'configure 'chdir
356 (lambda _ (chdir "nspr") #t)))))
357 (home-page
358 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR")
359 (synopsis "Netscape API for system level and libc-like functions")
360 (description "Netscape Portable Runtime (@dfn{NSPR}) provides a
361 platform-neutral API for system level and libc-like functions. It is used
362 in the Mozilla clients.")
363 (license license:mpl2.0)))
364
365 (define-public nss
366 (package
367 (name "nss")
368 (version "3.41")
369 (source (origin
370 (method url-fetch)
371 (uri (let ((version-with-underscores
372 (string-join (string-split version #\.) "_")))
373 (string-append
374 "https://ftp.mozilla.org/pub/mozilla.org/security/nss/"
375 "releases/NSS_" version-with-underscores "_RTM/src/"
376 "nss-" version ".tar.gz")))
377 (sha256
378 (base32
379 "0bbif42fzz5gk451sv3yphdrl7m4p6zgk5jk0307j06xs3sihbmb"))
380 ;; Create nss.pc and nss-config.
381 (patches (search-patches "nss-pkgconfig.patch"
382 "nss-increase-test-timeout.patch"))))
383 (build-system gnu-build-system)
384 (outputs '("out" "bin"))
385 (arguments
386 `(#:parallel-build? #f ; not supported
387 #:make-flags
388 (let* ((out (assoc-ref %outputs "out"))
389 (nspr (string-append (assoc-ref %build-inputs "nspr")))
390 (rpath (string-append "-Wl,-rpath=" out "/lib/nss")))
391 (list "-C" "nss" (string-append "PREFIX=" out)
392 "NSDISTMODE=copy"
393 "NSS_USE_SYSTEM_SQLITE=1"
394 (string-append "NSPR_INCLUDE_DIR=" nspr "/include/nspr")
395 ;; Add $out/lib/nss to RPATH.
396 (string-append "RPATH=" rpath)
397 (string-append "LDFLAGS=" rpath)))
398 #:modules ((guix build gnu-build-system)
399 (guix build utils)
400 (ice-9 ftw)
401 (ice-9 match)
402 (srfi srfi-26))
403 #:phases
404 (modify-phases %standard-phases
405 (replace 'configure
406 (lambda _
407 (setenv "CC" "gcc")
408 ;; Tells NSS to build for the 64-bit ABI if we are 64-bit system.
409 ,@(match (%current-system)
410 ((or "x86_64-linux" "aarch64-linux")
411 `((setenv "USE_64" "1")))
412 (_
413 '()))
414 #t))
415 (replace 'check
416 (lambda _
417 ;; Use 127.0.0.1 instead of $HOST.$DOMSUF as HOSTADDR for testing.
418 ;; The later requires a working DNS or /etc/hosts.
419 (setenv "DOMSUF" "localdomain")
420 (setenv "USE_IP" "TRUE")
421 (setenv "IP_ADDRESS" "127.0.0.1")
422
423 ;; The "PayPalEE.cert" certificate expires every six months,
424 ;; leading to test failures:
425 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=609734>. To
426 ;; work around that, set the time to roughly the release date.
427 (invoke "faketime" "2018-12-01" "./nss/tests/all.sh")))
428 (replace 'install
429 (lambda* (#:key outputs #:allow-other-keys)
430 (let* ((out (assoc-ref outputs "out"))
431 (bin (string-append (assoc-ref outputs "bin") "/bin"))
432 (inc (string-append out "/include/nss"))
433 (lib (string-append out "/lib/nss"))
434 (obj (match (scandir "dist" (cut string-suffix? "OBJ" <>))
435 ((obj) (string-append "dist/" obj)))))
436 ;; Install nss-config to $out/bin.
437 (install-file (string-append obj "/bin/nss-config")
438 (string-append out "/bin"))
439 (delete-file (string-append obj "/bin/nss-config"))
440 ;; Install nss.pc to $out/lib/pkgconfig.
441 (install-file (string-append obj "/lib/pkgconfig/nss.pc")
442 (string-append out "/lib/pkgconfig"))
443 (delete-file (string-append obj "/lib/pkgconfig/nss.pc"))
444 (rmdir (string-append obj "/lib/pkgconfig"))
445 ;; Install other files.
446 (copy-recursively "dist/public/nss" inc)
447 (copy-recursively (string-append obj "/bin") bin)
448 (copy-recursively (string-append obj "/lib") lib)
449
450 ;; FIXME: libgtest1.so is installed in the above step, and it's
451 ;; (unnecessarily) linked with several NSS libraries, but
452 ;; without the needed rpaths, causing the 'validate-runpath'
453 ;; phase to fail. Here we simply delete libgtest1.so, since it
454 ;; seems to be used only during the tests.
455 (delete-file (string-append lib "/libgtest1.so"))
456 (delete-file (string-append lib "/libgtestutil.so"))
457
458 #t))))))
459 (inputs
460 `(("sqlite" ,sqlite)
461 ("zlib" ,zlib)))
462 (propagated-inputs `(("nspr" ,nspr))) ; required by nss.pc.
463 (native-inputs `(("perl" ,perl)
464 ("libfaketime" ,libfaketime))) ;for tests
465
466 ;; The NSS test suite takes around 48 hours on Loongson 3A (MIPS) when
467 ;; another build is happening concurrently on the same machine.
468 (properties '((timeout . 216000))) ; 60 hours
469
470 (home-page
471 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS")
472 (synopsis "Network Security Services")
473 (description
474 "Network Security Services (@dfn{NSS}) is a set of libraries designed to
475 support cross-platform development of security-enabled client and server
476 applications. Applications built with NSS can support SSL v2 and v3, TLS,
477 PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509 v3 certificates, and other
478 security standards.")
479 (license license:mpl2.0)))
480
481 (define (mozilla-patch file-name changeset hash)
482 "Return an origin for CHANGESET from the mozilla-esr60 repository."
483 (origin
484 (method url-fetch)
485 (uri (string-append "https://hg.mozilla.org/releases/mozilla-esr60/raw-rev/"
486 changeset))
487 (sha256 (base32 hash))
488 (file-name file-name)))
489
490 (define-public icecat
491 (package
492 (name "icecat")
493 (version "60.3.0-gnu1")
494 (source
495 (origin
496 (method url-fetch)
497 (uri (string-append "mirror://gnu/gnuzilla/"
498 (first (string-split version #\-))
499 "/" name "-" version ".tar.bz2"))
500 (sha256
501 (base32
502 "0icnl64nxcyf7dprpdpygxhabsvyhps8c3ixysj9bcdlj9q34ib1"))
503 (patches
504 (list
505 (search-patch "icecat-avoid-bundled-libraries.patch")
506 (search-patch "icecat-use-system-graphite2+harfbuzz.patch")
507 (search-patch "icecat-use-system-media-libs.patch")
508 (mozilla-patch "icecat-bug-1464061.patch" "d28761dbff18" "1f58rzwx4s1af66fdwn9lgkcd1ksmq8kn8imvf78p90jqi24h7b4")
509 (mozilla-patch "icecat-bug-1479853.patch" "4faeb696dd06" "12891xx9c15s6kby6d3zk64v5nqgaq7sw597zv1fkd3a6x69hlva")
510 (mozilla-patch "icecat-CVE-2018-17466.patch" "12ba39f69876" "1piyq44f0xa0a9z2748aqwpaziaxwp61d86gyhalbyag8lcxfb3p")
511 (mozilla-patch "icecat-CVE-2018-18498.patch" "a0adabeedf26" "0f5wazha3zxzhy2j8f93hx62l9p02b1p40vi07qah3ar67h4ccj9")
512 (mozilla-patch "icecat-CVE-2018-12405-pt01.patch" "19604eb26230" "1wqxgph4z14ijhk2j2m4av5p6gx72d02lzz83q6yy0k065kw8psb")
513 (mozilla-patch "icecat-CVE-2018-18492.patch" "98737ab09270" "0fyl6wv0jxcxpkfpsff46y93k49n8lrw0k7c1p45g8da015dx27a")
514 (mozilla-patch "icecat-CVE-2018-18493.patch" "1cf7d80355d5" "19jp4x32vyxam54d1r9fm7jwf6krhhf3xazfqmxb9aw4iwdil7dl")
515 (mozilla-patch "icecat-CVE-2018-12405-pt02.patch" "c264774b8913" "1hxyi131x8jwawrq90cgkph833iv9ixrdrgzl1r978gbzwq10xz2")
516 (mozilla-patch "icecat-bug-1477773.patch" "ec13fda7c9b0" "0zj7aylgw55g0y7plaafn5gq8jwcsdr1bpdxacs0hq914nm8zy9z")
517 (mozilla-patch "icecat-CVE-2018-12405-pt03.patch" "5e1a9644aeef" "1qimrpgyrd8zkiri7w57j0aymk20y9b34am5w7rvr6qj1lhrbfla")
518 (mozilla-patch "icecat-bug-1485655.patch" "9055726e2d89" "1pppxr94zqh6zmi2mn1ih21qap09vk5ivbhnwxqr8iszvygjg44g")
519 (mozilla-patch "icecat-bug-1410214.patch" "9e641345e2ef" "0542xss2jdb8drh4g50cfy32l300x69dyywgx3dqs03vgr3qplxy")
520 (mozilla-patch "icecat-CVE-2018-12405-pt04.patch" "6398541ec302" "1c2yi7mkg3d5afxsgj9fp3zq8yhkmphrll5d60d5xsdv88kqqiyf")
521 (mozilla-patch "icecat-bug-1496736.patch" "3bed863ee656" "038k7jk3yp16410crwfdvhyb2vis49c6bplrfr83v51885cqldar")
522 (mozilla-patch "icecat-bug-1498765.patch" "a08c8493ba19" "0bwg4vg03j962lb9q8ihpiy4rmygykf1q9ij8x7h34q7hg43yjya")
523 (mozilla-patch "icecat-CVE-2018-12405-pt05.patch" "ee204e26690e" "1scs45xhlr1mwv6x2q6n22363f42by8cjmifqwzlikggs21f5mcq")
524 (mozilla-patch "icecat-bug-1507035.patch" "cec8b58ab3fe" "1f131ibpkrhsa44l822hnm5qgvapbs3i9pj25iimdwvr933winz8")
525 (mozilla-patch "icecat-bug-1501680.patch" "282c6bb81562" "1zgw7l5zmni8468y3f6cip1nlw63cfdd9vv9b00cbrgy96d1q2cp")
526 (mozilla-patch "icecat-bug-1500310.patch" "b3a439a26186" "0mrjxcmrlv04fyl36dwxk97dw08g2hlikvw2hfa1l0y8zsc4bgw8")
527 (mozilla-patch "icecat-bug-1500366.patch" "abd59256c4e3" "1jgwh2v4kwb6kf2h7mwf128w1k1jj119bfhlgqpmn9ami35wpzf3")
528 (mozilla-patch "icecat-bug-1493080.patch" "a7cabf306d05" "1n7wv67rcaz8wj31jc77ssjdj3kb61gdg7pigj828c5z2cgns1k5")
529 (mozilla-patch "icecat-CVE-2018-12405-pt06.patch" "8bbf80948b50" "1nvc69zgz9nvbw1pwxkil1fx4cxxpr6bsjrpp6l2kv7jhgax1bqk")
530 (mozilla-patch "icecat-bug-1507564.patch" "60619cc47b10" "09fanqr08kqgraw4xp7y2az4jc7ia8nn200rqjfj20vmkyjz97j3")
531 (mozilla-patch "icecat-bug-1507730.patch" "dd0f01818b9c" "14ziq1bm72n58xrvsgzpjj5z6ifpvi70r5jfhbkbj69mf4y4cx2z")
532 (mozilla-patch "icecat-CVE-2018-12405-pt07.patch" "a73a46ddc848" "1bvvyav3xyn6rgn6haicinxn0dasl9dyc1i37fyb7wr5wcpahybs")
533 (mozilla-patch "icecat-CVE-2018-18494.patch" "a72ec8e21577" "095zghmwdcbaid5426p9vpl757d8sfbsvgn201bjm7nhm03m4z7i")
534 (mozilla-patch "icecat-CVE-2018-12405-pt08.patch" "b6d0fc61fd0b" "0059avawxi4s4747plybjsjq8j2h4z7amw05p28xyg95a2njwnaa")
535 (mozilla-patch "icecat-bug-1499028.patch" "a62ede2dd3bc" "0ikmnibni8bdvpr9p42wskyyic08vzqdz5qr028bqzyg5119gily")
536 (mozilla-patch "icecat-bug-1426574.patch" "0db86656655b" "0kmccb4ccdzbzncwklx7w1bg7r61zwl2wnfp67vl27hm9xykbck7")
537 (mozilla-patch "icecat-CVE-2018-12405-pt09.patch" "20e31905de62" "0b5a441645wy3q4asaygvdq0inrxmxrh33cpgdp6ngflq9p2i6h0")
538 (mozilla-patch "icecat-CVE-2018-12405-pt10.patch" "c2832f98fe51" "0b4jfjfdyrihwjdfavd54hn9kdg2f017lmfr7mj2llp71flxwwj7")
539 (mozilla-patch "icecat-bug-1511495.patch" "d428d2b8f585" "1f9xs0bjhbphvkv60cnvz34sr2rv38jzvi47wh3nablg41yjpdrk")))
540 (modules '((guix build utils)))
541 (snippet
542 '(begin
543 (use-modules (ice-9 ftw))
544 ;; Remove bundled libraries that we don't use, since they may
545 ;; contain unpatched security flaws, they waste disk space and
546 ;; network bandwidth, and may cause confusion.
547 (for-each delete-file-recursively
548 '(;; FIXME: Removing the bundled icu breaks configure.
549 ;; * The bundled icu headers are used in some places.
550 ;; * The version number is taken from the bundled copy.
551 ;;"intl/icu"
552 ;;
553 ;; FIXME: A script from the bundled nspr is used.
554 ;;"nsprpub"
555 ;;
556 ;; FIXME: With the update to IceCat 60, using system NSS
557 ;; broke certificate validation. See
558 ;; <https://bugs.gnu.org/32833>. For now, we use
559 ;; the bundled NSPR and NSS. TODO: Investigate,
560 ;; and try to unbundle these libraries again.
561 ;; UNBUNDLE-ME! "security/nss"
562 ;;
563 ;; TODO: Use more system media libraries. See:
564 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
565 ;; * libtheora: esr60 wants v1.2, not yet released.
566 ;; * soundtouch: avoiding the bundled library would
567 ;; result in some loss of functionality. There's
568 ;; also an issue with exception handling
569 ;; configuration. It seems that this is needed in
570 ;; some moz.build:
571 ;; DEFINES['ST_NO_EXCEPTION_HANDLING'] = 1
572 ;; * libopus
573 ;; * speex
574 ;;
575 "modules/freetype2"
576 "modules/zlib"
577 "modules/libbz2"
578 "ipc/chromium/src/third_party/libevent"
579 "media/libjpeg"
580 "media/libvpx"
581 "media/libogg"
582 "media/libvorbis"
583 ;; "media/libtheora" ; wants theora-1.2, not yet released
584 "media/libtremor"
585 "gfx/harfbuzz"
586 "gfx/graphite2"
587 "js/src/ctypes/libffi"
588 "db/sqlite3"))
589 ;; Delete .pyc files, typically present in icecat source tarballs
590 (for-each delete-file (find-files "." "\\.pyc$"))
591 ;; Delete obj-* directories, sometimes present in icecat tarballs
592 (for-each delete-file-recursively
593 (scandir "." (lambda (name)
594 (string-prefix? "obj-" name))))
595 #t))))
596 (build-system gnu-build-system)
597 (inputs
598 `(("alsa-lib" ,alsa-lib)
599 ("bzip2" ,bzip2)
600 ("cups" ,cups)
601 ("dbus-glib" ,dbus-glib)
602 ("gdk-pixbuf" ,gdk-pixbuf)
603 ("glib" ,glib)
604 ("gtk+" ,gtk+)
605 ("gtk+-2" ,gtk+-2)
606 ("graphite2" ,graphite2)
607 ("pango" ,pango)
608 ("freetype" ,freetype)
609 ("harfbuzz" ,harfbuzz)
610 ("hunspell" ,hunspell)
611 ("libcanberra" ,libcanberra)
612 ("libgnome" ,libgnome)
613 ("libjpeg-turbo" ,libjpeg-turbo)
614 ("libogg" ,libogg)
615 ;; ("libtheora" ,libtheora) ; wants theora-1.2, not yet released
616 ("libvorbis" ,libvorbis)
617 ("libxft" ,libxft)
618 ("libevent" ,libevent)
619 ("libxinerama" ,libxinerama)
620 ("libxscrnsaver" ,libxscrnsaver)
621 ("libxcomposite" ,libxcomposite)
622 ("libxt" ,libxt)
623 ("libffi" ,libffi)
624 ("ffmpeg" ,ffmpeg)
625 ("libvpx" ,libvpx)
626 ("icu4c" ,icu4c)
627 ("pixman" ,pixman)
628 ("pulseaudio" ,pulseaudio)
629 ("mesa" ,mesa)
630 ("mit-krb5" ,mit-krb5)
631 ;; See <https://bugs.gnu.org/32833>
632 ;; and related comments in the 'snippet' above.
633 ;; UNBUNDLE-ME! ("nspr" ,nspr)
634 ;; UNBUNDLE-ME! ("nss" ,nss)
635 ("sqlite" ,sqlite)
636 ("startup-notification" ,startup-notification)
637 ("unzip" ,unzip)
638 ("zip" ,zip)
639 ("zlib" ,zlib)))
640 (native-inputs
641 ;; Icecat 60 checkes for rust>=1.24
642 `(("rust" ,rust-1.24)
643 ("cargo" ,rust-1.24 "cargo")
644 ("llvm" ,llvm-3.9.1)
645 ("clang" ,clang-3.9.1)
646 ("perl" ,perl)
647 ("python" ,python-2) ; Python 3 not supported
648 ("python2-pysqlite" ,python2-pysqlite)
649 ("yasm" ,yasm)
650 ("pkg-config" ,pkg-config)
651 ("autoconf" ,autoconf-2.13)
652 ("which" ,which)))
653 (arguments
654 `(#:tests? #f ; no check target
655 #:out-of-source? #t ; must be built outside of the source directory
656
657 ;; XXX: There are RUNPATH issues such as
658 ;; $prefix/lib/icecat-31.6.0/plugin-container NEEDing libmozalloc.so,
659 ;; which is not in its RUNPATH, but they appear to be harmless in
660 ;; practice somehow. See <http://hydra.gnu.org/build/378133>.
661 #:validate-runpath? #f
662
663 #:imported-modules ,%cargo-build-system-modules ;for `generate-checksums'
664
665 #:configure-flags `("--enable-default-toolkit=cairo-gtk3"
666
667 "--with-distribution-id=org.gnu"
668
669 "--enable-startup-notification"
670 "--enable-pulseaudio"
671
672 "--disable-tests"
673 "--disable-updater"
674 "--disable-crashreporter"
675 "--disable-maintenance-service"
676 "--disable-eme"
677 "--disable-gconf"
678
679 ;; Building with debugging symbols takes ~5GiB, so
680 ;; disable it.
681 "--disable-debug"
682 "--disable-debug-symbols"
683
684 ;; Clang is needed to build Stylo, Mozilla's new
685 ;; CSS engine. We must specify the clang paths
686 ;; manually, because otherwise the Mozilla build
687 ;; system looks in the directories returned by
688 ;; llvm-config --bindir and llvm-config --libdir,
689 ;; which return paths in the llvm package where
690 ;; clang is not found.
691 ,(string-append "--with-clang-path="
692 (assoc-ref %build-inputs "clang")
693 "/bin/clang")
694 ,(string-append "--with-libclang-path="
695 (assoc-ref %build-inputs "clang")
696 "/lib")
697
698 ;; Hack to work around missing
699 ;; "unofficial" branding in icecat.
700 "--enable-official-branding"
701
702 ;; Avoid bundled libraries.
703 "--with-system-zlib"
704 "--with-system-bz2"
705 "--with-system-jpeg" ; must be libjpeg-turbo
706 "--with-system-libevent"
707 "--with-system-ogg"
708 "--with-system-vorbis"
709 ;; "--with-system-theora" ; wants theora-1.2, not yet released
710 "--with-system-libvpx"
711 "--with-system-icu"
712
713 ;; See <https://bugs.gnu.org/32833>
714 ;; and related comments in the 'snippet' above.
715 ;; UNBUNDLE-ME! "--with-system-nspr"
716 ;; UNBUNDLE-ME! "--with-system-nss"
717
718 "--with-system-harfbuzz"
719 "--with-system-graphite2"
720 "--enable-system-pixman"
721 "--enable-system-ffi"
722 "--enable-system-hunspell"
723 "--enable-system-sqlite"
724
725 ;; Fails with "--with-system-png won't work because
726 ;; the system's libpng doesn't have APNG support".
727 ;; According to
728 ;; http://sourceforge.net/projects/libpng-apng/ ,
729 ;; "the Animated Portable Network Graphics (APNG)
730 ;; is an unofficial extension of the Portable
731 ;; Network Graphics (PNG) format";
732 ;; we probably do not wish to support it.
733 ;; "--with-system-png"
734 )
735
736 #:modules ((ice-9 ftw)
737 (ice-9 rdelim)
738 (ice-9 match)
739 ,@%gnu-build-system-modules)
740 #:phases
741 (modify-phases %standard-phases
742 (add-after
743 'unpack 'ensure-no-mtimes-pre-1980
744 (lambda _
745 ;; Without this, the 'source/test/addons/packed.xpi' and
746 ;; 'source/test/addons/simple-prefs.xpi' targets fail while trying
747 ;; to create zip archives.
748 (let ((early-1980 315619200)) ; 1980-01-02 UTC
749 (ftw "." (lambda (file stat flag)
750 (unless (<= early-1980 (stat:mtime stat))
751 (utime file early-1980 early-1980))
752 #t))
753 #t)))
754 (add-after
755 'unpack 'link-libxul-with-libraries
756 (lambda _
757 ;; libxul.so dynamically opens libraries, so here we explicitly
758 ;; link them into libxul.so instead.
759 ;;
760 ;; TODO: It might be preferable to patch in absolute file names in
761 ;; calls to dlopen or PR_LoadLibrary, but that didn't seem to
762 ;; work. More investigation is needed.
763 (substitute* "toolkit/library/moz.build"
764 (("^# This library needs to be last" all)
765 (string-append "OS_LIBS += [
766 'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5',
767 'avcodec', 'avutil', 'pulse' ]\n\n"
768 all)))
769 #t))
770 (replace 'bootstrap
771 (lambda _
772 (invoke "sh" "-c" "autoconf old-configure.in > old-configure")))
773 (add-after 'patch-source-shebangs 'patch-cargo-checksums
774 (lambda _
775 (use-modules (guix build cargo-build-system))
776 (let ((null-file "/dev/null")
777 (null-hash "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))
778 (substitute* '("Cargo.lock" "servo/Cargo.lock")
779 (("(\"checksum .* = )\".*\"" all name)
780 (string-append name "\"" null-hash "\"")))
781 (for-each
782 (lambda (filename)
783 (delete-file filename)
784 (let ((dir (dirname filename)))
785 (display (string-append
786 "patch-cargo-checksums: generate-checksums for "
787 dir "\n"))
788 (generate-checksums dir null-file)))
789 (find-files "third_party/rust" ".cargo-checksum.json")))
790 #t))
791 (add-before 'configure 'augment-CPLUS_INCLUDE_PATH
792 (lambda* (#:key build inputs #:allow-other-keys)
793 ;; Here, we add additional entries to CPLUS_INCLUDE_PATH, to work
794 ;; around a problem that otherwise occurs when attempting to
795 ;; build Stylo, which requires Rust and Clang. Without these
796 ;; additional entries, errors occur during the build indicating
797 ;; that the <cstddef> and "c++config.h" headers cannot be found.
798 ;; Note that the 'build' keyword argument contains the GNU
799 ;; triplet, e.g. "x86_64-unknown-linux-gnu".
800 (let ((gcc (assoc-ref inputs "gcc")))
801 (setenv "CPLUS_INCLUDE_PATH"
802 (string-append gcc "/include/c++" ":"
803 gcc "/include/c++/" build ":"
804 (getenv "CPLUS_INCLUDE_PATH"))))))
805 (replace
806 'configure
807 ;; configure does not work followed by both "SHELL=..." and
808 ;; "CONFIG_SHELL=..."; set environment variables instead
809 (lambda* (#:key outputs configure-flags #:allow-other-keys)
810 (let* ((out (assoc-ref outputs "out"))
811 (bash (which "bash"))
812 (abs-srcdir (getcwd))
813 (srcdir (string-append "../" (basename abs-srcdir)))
814 (flags `(,(string-append "--prefix=" out)
815 ,(string-append "--with-l10n-base="
816 abs-srcdir "/l10n")
817 ,@configure-flags)))
818 (setenv "SHELL" bash)
819 (setenv "CONFIG_SHELL" bash)
820 (setenv "AUTOCONF" (which "autoconf")) ; must be autoconf-2.13
821 (setenv "CC" "gcc") ; apparently needed when Stylo is enabled
822 (mkdir "../build")
823 (chdir "../build")
824 (format #t "build directory: ~s~%" (getcwd))
825 (format #t "configure flags: ~s~%" flags)
826 (apply invoke bash
827 (string-append srcdir "/configure")
828 flags))))
829 (add-before 'configure 'install-desktop-entry
830 (lambda* (#:key outputs #:allow-other-keys)
831 ;; Install the '.desktop' file.
832 (define (swallow-%%-directives input output)
833 ;; Interpret '%%ifdef' directives found in the '.desktop' file.
834 (let loop ((state 'top))
835 (match (read-line input 'concat)
836 ((? eof-object?)
837 #t)
838 ((? string? line)
839 (cond ((string-prefix? "%%ifdef" line)
840 (loop 'ifdef))
841 ((string-prefix? "%%else" line)
842 (loop 'else))
843 ((string-prefix? "%%endif" line)
844 (loop 'top))
845 (else
846 (case state
847 ((top else)
848 (display line output)
849 (loop state))
850 (else
851 (loop state)))))))))
852
853 (let* ((out (assoc-ref outputs "out"))
854 (applications (string-append out "/share/applications")))
855 (call-with-input-file "debian/icecat.desktop.in"
856 (lambda (input)
857 (call-with-output-file "debian/icecat.desktop"
858 (lambda (output)
859 (swallow-%%-directives input output)))))
860
861 (substitute* "debian/icecat.desktop"
862 (("@MOZ_DISPLAY_NAME@")
863 "GNU IceCat")
864 (("^Exec=@MOZ_APP_NAME@")
865 (string-append "Exec=" out "/bin/icecat"))
866 (("@MOZ_APP_NAME@")
867 "icecat"))
868 (install-file "debian/icecat.desktop" applications)
869 #t)))
870 (add-after 'install-desktop-entry 'install-icons
871 (lambda* (#:key outputs #:allow-other-keys)
872 (let ((out (assoc-ref outputs "out")))
873 (with-directory-excursion "browser/branding/official"
874 (for-each
875 (lambda (file)
876 (let* ((size (string-filter char-numeric? file))
877 (icons (string-append out "/share/icons/hicolor/"
878 size "x" size "/apps")))
879 (mkdir-p icons)
880 (copy-file file (string-append icons "/icecat.png"))))
881 '("default16.png" "default22.png" "default24.png"
882 "default32.png" "default48.png" "content/icon64.png"
883 "mozicon128.png" "default256.png"))
884 #t))))
885 ;; This fixes the file chooser crash that happens with GTK 3.
886 (add-after 'install 'wrap-program
887 (lambda* (#:key inputs outputs #:allow-other-keys)
888 (let* ((out (assoc-ref outputs "out"))
889 (lib (string-append out "/lib"))
890 (gtk (assoc-ref inputs "gtk+"))
891 (gtk-share (string-append gtk "/share")))
892 (wrap-program (car (find-files lib "^icecat$"))
893 `("XDG_DATA_DIRS" ":" prefix (,gtk-share)))
894 #t))))))
895 (home-page "https://www.gnu.org/software/gnuzilla/")
896 (synopsis "Entirely free browser derived from Mozilla Firefox")
897 (description
898 "IceCat is the GNU version of the Firefox browser. It is entirely free
899 software, which does not recommend non-free plugins and addons. It also
900 features built-in privacy-protecting features.")
901 (license license:mpl2.0) ;and others, see toolkit/content/license.html
902 (properties
903 `((ftp-directory . "/gnu/gnuzilla")
904 (cpe-name . "firefox_esr")
905 (cpe-version . ,(first (string-split version #\-)))))))
906
907 (define-public conkeror
908 ;; The Conkeror web browser relied on XULRunner, which IceCat > 50 no longer
909 ;; provides. See <http://conkeror.org> for the original web page.
910 (deprecated-package "conkeror" icecat))