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