offload: Display the normalized load in 'guix offload status' output.
[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>
1b321229 3;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
c1c2e1d7 4;;; Copyright © 2014, 2015, 2016, 2017, 2018 Mark H Weaver <mhw@netris.org>
1aaaff1a 5;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
89f9df6c 6;;; Copyright © 2016, 2017, 2018 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>
4a78fd46 9;;; Copyright © 2017 Nils Gillmann <ng0@n0.is>
71a96ecb 10;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
192a59d0 11;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
be0f6112
AE
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)
07d4d9b7 29 #:use-module ((srfi srfi-1) #:hide (zip))
1461dd24 30 #:use-module (ice-9 match)
be0f6112 31 #:use-module (gnu packages)
b5b73a82 32 #:use-module ((guix licenses) #:prefix license:)
be0f6112
AE
33 #:use-module (guix packages)
34 #:use-module (guix download)
192a59d0 35 #:use-module (guix git-download)
aaac423c 36 #:use-module (guix utils)
be0f6112 37 #:use-module (guix build-system gnu)
e67ad553 38 #:use-module (guix build-system cargo)
94e96f7f 39 #:use-module (gnu packages audio)
002c3e6d 40 #:use-module (gnu packages autotools)
bfb48f4f 41 #:use-module (gnu packages base)
bc9aa60b 42 #:use-module (gnu packages check)
1aaaff1a 43 #:use-module (gnu packages databases)
be0f6112 44 #:use-module (gnu packages glib)
be0f6112 45 #:use-module (gnu packages gtk)
90e1cdae
MW
46 #:use-module (gnu packages gnome)
47 #:use-module (gnu packages libcanberra)
48 #:use-module (gnu packages cups)
89e34644 49 #:use-module (gnu packages kerberos)
be0f6112
AE
50 #:use-module (gnu packages linux)
51 #:use-module (gnu packages perl)
52 #:use-module (gnu packages pkg-config)
1ae6df81 53 #:use-module (gnu packages compression)
74c7af9f 54 #:use-module (gnu packages fontutils)
1ae6df81 55 #:use-module (gnu packages libevent)
90e1cdae 56 #:use-module (gnu packages libreoffice) ;for hunspell
e55354b8 57 #:use-module (gnu packages image)
1ae6df81 58 #:use-module (gnu packages libffi)
74c7af9f 59 #:use-module (gnu packages pulseaudio)
be0f6112
AE
60 #:use-module (gnu packages python)
61 #:use-module (gnu packages xorg)
200726ed 62 #:use-module (gnu packages gl)
01497dfe 63 #:use-module (gnu packages assembly)
e67ad553 64 #:use-module (gnu packages rust)
8d956d86 65 #:use-module (gnu packages llvm)
13b284d9
MW
66 #:use-module (gnu packages icu4c)
67 #:use-module (gnu packages video)
94e96f7f 68 #:use-module (gnu packages xiph)
13b284d9 69 #:use-module (gnu packages xdisorg)
29f381ba 70 #:use-module (gnu packages readline))
be0f6112 71
4923e06f
SB
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
68716289 83 "1fig2wf4f10v43mqx67y68z6h77sy900d1w0pz9qarrqx57rc7ij"))
a64b7da5 84 (patches (search-patches "mozjs17-aarch64-support.patch"))
68716289
SB
85 (modules '((guix build utils)))
86 (snippet
87 ;; Fix incompatibility with Perl 5.22+.
6cbee49d
MW
88 '(begin
89 (substitute* '("js/src/config/milestone.pl")
90 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE"))
91 #t))))
4923e06f
SB
92 (build-system gnu-build-system)
93 (native-inputs
f403c676
EF
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)))
4923e06f 101 (arguments
56486b3a
EF
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
a64b7da5 108 ;; This test times out on slower hardware.
e15793c8
MW
109 (lambda _
110 (delete-file "js/src/jit-test/tests/basic/bug698584.js")
111 #t))
56486b3a 112 (add-before 'configure 'chdir
4923e06f 113 (lambda _
56486b3a
EF
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"))
e15793c8
MW
122 (invoke "./configure" (string-append "--prefix=" out)
123 ,@(if (string=? "aarch64-linux"
124 (%current-system))
125 '("--host=aarch64-unknown-linux-gnu")
126 '()))))))))
4923e06f
SB
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
131in C/C++.")
87158e85 132 (license license:mpl2.0))) ; and others for some files
4923e06f 133
cefdcb38
SB
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
68716289
SB
145 "1n1phk8r3l8icqrrap4czplnylawa0ddc2cc4cgdz46x3lrkybz6"))
146 (modules '((guix build utils)))
26f38d31 147 (patches (search-patches "mozjs24-aarch64-support.patch"))
68716289
SB
148 (snippet
149 ;; Fix incompatibility with Perl 5.22+.
6cbee49d
MW
150 '(begin
151 (substitute* '("js/src/config/milestone.pl")
152 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE"))
153 #t))))
cefdcb38 154 (arguments
aaac423c
EF
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"))
6073ef75
MW
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 '())))))))))
cefdcb38
SB
173 (inputs
174 `(("libffi" ,libffi)
175 ("zlib" ,zlib)))))
176
29f381ba
CL
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"))
5f70b6d4
MW
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"
29f381ba 250
5f70b6d4
MW
251 ;; Intl API requires bundled ICU.
252 "--without-intl-api")))))))
29f381ba
CL
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
192a59d0
RW
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
4923e06f
SB
329(define-public nspr
330 (package
331 (name "nspr")
7ea90c21 332 (version "4.20")
4923e06f
SB
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
7ea90c21 340 "0vjms4j75zvv5b2siyafg7hh924ysx2cwjad8spzp7x87n8n929c"))))
4923e06f
SB
341 (build-system gnu-build-system)
342 (native-inputs
84fb4bd9 343 `(("perl" ,perl)))
4923e06f 344 (arguments
8550894b
LC
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"))
6d7786ff
MB
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")
04952bd7
EF
354 #:phases (modify-phases %standard-phases
355 (add-before 'configure 'chdir
356 (lambda _ (chdir "nspr") #t)))))
4923e06f
SB
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")
a440a6af 360 (description "Netscape Portable Runtime (@dfn{NSPR}) provides a
4923e06f
SB
361platform-neutral API for system level and libc-like functions. It is used
362in the Mozilla clients.")
363 (license license:mpl2.0)))
364
1aaaff1a
SB
365(define-public nss
366 (package
367 (name "nss")
e5958848 368 (version "3.39")
1aaaff1a
SB
369 (source (origin
370 (method url-fetch)
2bb9b5de
MW
371 (uri (let ((version-with-underscores
372 (string-join (string-split version #\.) "_")))
373 (string-append
fe88f636 374 "https://ftp.mozilla.org/pub/mozilla.org/security/nss/"
2bb9b5de
MW
375 "releases/NSS_" version-with-underscores "_RTM/src/"
376 "nss-" version ".tar.gz")))
1aaaff1a
SB
377 (sha256
378 (base32
e5958848 379 "0jw6qlfl2g47hhx056nvnj6h92bk3sn46hy3ig61a911dzblvrkb"))
1aaaff1a 380 ;; Create nss.pc and nss-config.
d027b001
MB
381 (patches (search-patches "nss-pkgconfig.patch"
382 "nss-increase-test-timeout.patch"))))
1aaaff1a
SB
383 (build-system gnu-build-system)
384 (outputs '("out" "bin"))
385 (arguments
1461dd24 386 `(#:parallel-build? #f ; not supported
1aaaff1a
SB
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))
1aaaff1a 403 #:phases
db3c06d5
MB
404 (modify-phases %standard-phases
405 (replace 'configure
1461dd24 406 (lambda _
db3c06d5
MB
407 (setenv "CC" "gcc")
408 ;; Tells NSS to build for the 64-bit ABI if we are 64-bit system.
1461dd24
MB
409 ,@(match (%current-system)
410 ((or "x86_64-linux" "aarch64-linux")
411 `((setenv "USE_64" "1")))
412 (_
413 '()))
db3c06d5
MB
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" "(none)")
420 (setenv "USE_IP" "TRUE")
421 (setenv "IP_ADDRESS" "127.0.0.1")
bc9aa60b
LC
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-09-01" "./nss/tests/all.sh")))
db3c06d5
MB
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)
3161f6a4 449
db3c06d5
MB
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"))
bd512249 456 (delete-file (string-append lib "/libgtestutil.so"))
3161f6a4 457
db3c06d5 458 #t))))))
1aaaff1a
SB
459 (inputs
460 `(("sqlite" ,sqlite)
461 ("zlib" ,zlib)))
462 (propagated-inputs `(("nspr" ,nspr))) ; required by nss.pc.
bc9aa60b
LC
463 (native-inputs `(("perl" ,perl)
464 ("libfaketime" ,libfaketime))) ;for tests
86e3e370 465
e9b718a0
MW
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
86e3e370 469
1aaaff1a
SB
470 (home-page
471 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS")
472 (synopsis "Network Security Services")
473 (description
e26e55c8
TGR
474 "Network Security Services (@dfn{NSS}) is a set of libraries designed to
475support cross-platform development of security-enabled client and server
476applications. Applications built with NSS can support SSL v2 and v3, TLS,
477PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509 v3 certificates, and other
478security standards.")
1aaaff1a
SB
479 (license license:mpl2.0)))
480
bfb48f4f 481(define (mozilla-patch file-name changeset hash)
ae71cd8a 482 "Return an origin for CHANGESET from the mozilla-esr60 repository."
bfb48f4f
MW
483 (origin
484 (method url-fetch)
ae71cd8a 485 (uri (string-append "https://hg.mozilla.org/releases/mozilla-esr60/raw-rev/"
bfb48f4f
MW
486 changeset))
487 (sha256 (base32 hash))
488 (file-name file-name)))
489
be0f6112
AE
490(define-public icecat
491 (package
492 (name "icecat")
3b144946 493 (version "60.3.0-gnu1")
be0f6112
AE
494 (source
495 (origin
496 (method url-fetch)
5bdec7d6
MW
497 (uri (string-append "mirror://gnu/gnuzilla/"
498 (first (string-split version #\-))
499 "/" name "-" version ".tar.bz2"))
be0f6112
AE
500 (sha256
501 (base32
3b144946 502 "0icnl64nxcyf7dprpdpygxhabsvyhps8c3ixysj9bcdlj9q34ib1"))
bfb48f4f 503 (patches
5bdec7d6 504 (list
257e3247
MW
505 (search-patch "icecat-avoid-bundled-libraries.patch")
506 (search-patch "icecat-use-system-graphite2+harfbuzz.patch")
717d29e2
MW
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")
29eb0bc7
MW
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")
717d29e2 516 (mozilla-patch "icecat-bug-1477773.patch" "ec13fda7c9b0" "0zj7aylgw55g0y7plaafn5gq8jwcsdr1bpdxacs0hq914nm8zy9z")
29eb0bc7 517 (mozilla-patch "icecat-CVE-2018-12405-pt03.patch" "5e1a9644aeef" "1qimrpgyrd8zkiri7w57j0aymk20y9b34am5w7rvr6qj1lhrbfla")
717d29e2 518 (mozilla-patch "icecat-bug-1485655.patch" "9055726e2d89" "1pppxr94zqh6zmi2mn1ih21qap09vk5ivbhnwxqr8iszvygjg44g")
46e613e3 519 (mozilla-patch "icecat-bug-1410214.patch" "9e641345e2ef" "0542xss2jdb8drh4g50cfy32l300x69dyywgx3dqs03vgr3qplxy")
46e613e3
MW
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")
46e613e3
MW
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")))
90e1cdae
MW
540 (modules '((guix build utils)))
541 (snippet
542 '(begin
bfb48f4f 543 (use-modules (ice-9 ftw))
90e1cdae
MW
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 ;;
6d328879
MW
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 ;;
94e96f7f 563 ;; TODO: Use more system media libraries. See:
90e1cdae 564 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
94e96f7f
MW
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
90e1cdae
MW
572 ;; * libopus
573 ;; * speex
90e1cdae 574 ;;
90e1cdae
MW
575 "modules/freetype2"
576 "modules/zlib"
577 "modules/libbz2"
94e96f7f 578 "ipc/chromium/src/third_party/libevent"
7cba7647 579 "media/libjpeg"
90e1cdae 580 "media/libvpx"
94e96f7f
MW
581 "media/libogg"
582 "media/libvorbis"
583 ;; "media/libtheora" ; wants theora-1.2, not yet released
584 "media/libtremor"
257e3247
MW
585 "gfx/harfbuzz"
586 "gfx/graphite2"
90e1cdae
MW
587 "js/src/ctypes/libffi"
588 "db/sqlite3"))
bfb48f4f
MW
589 ;; Delete .pyc files, typically present in icecat source tarballs
590 (for-each delete-file (find-files "." "\\.pyc$"))
5bdec7d6 591 ;; Delete obj-* directories, sometimes present in icecat tarballs
bfb48f4f
MW
592 (for-each delete-file-recursively
593 (scandir "." (lambda (name)
594 (string-prefix? "obj-" name))))
a5e55dfb 595 #t))))
be0f6112
AE
596 (build-system gnu-build-system)
597 (inputs
598 `(("alsa-lib" ,alsa-lib)
1ae6df81 599 ("bzip2" ,bzip2)
90e1cdae 600 ("cups" ,cups)
be0f6112 601 ("dbus-glib" ,dbus-glib)
90e1cdae
MW
602 ("gdk-pixbuf" ,gdk-pixbuf)
603 ("glib" ,glib)
002c3e6d
MW
604 ("gtk+" ,gtk+)
605 ("gtk+-2" ,gtk+-2)
257e3247 606 ("graphite2" ,graphite2)
74c7af9f
MW
607 ("pango" ,pango)
608 ("freetype" ,freetype)
257e3247 609 ("harfbuzz" ,harfbuzz)
90e1cdae
MW
610 ("hunspell" ,hunspell)
611 ("libcanberra" ,libcanberra)
612 ("libgnome" ,libgnome)
7cba7647 613 ("libjpeg-turbo" ,libjpeg-turbo)
94e96f7f
MW
614 ("libogg" ,libogg)
615 ;; ("libtheora" ,libtheora) ; wants theora-1.2, not yet released
616 ("libvorbis" ,libvorbis)
74c7af9f 617 ("libxft" ,libxft)
94e96f7f 618 ("libevent" ,libevent)
90e1cdae
MW
619 ("libxinerama" ,libxinerama)
620 ("libxscrnsaver" ,libxscrnsaver)
9f7ae77f 621 ("libxcomposite" ,libxcomposite)
be0f6112 622 ("libxt" ,libxt)
1ae6df81 623 ("libffi" ,libffi)
e67ad553 624 ("ffmpeg" ,ffmpeg)
13b284d9
MW
625 ("libvpx" ,libvpx)
626 ("icu4c" ,icu4c)
627 ("pixman" ,pixman)
74c7af9f 628 ("pulseaudio" ,pulseaudio)
be0f6112 629 ("mesa" ,mesa)
90e1cdae 630 ("mit-krb5" ,mit-krb5)
6d328879
MW
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)
9bc79c11 635 ("sqlite" ,sqlite)
90e1cdae 636 ("startup-notification" ,startup-notification)
be0f6112 637 ("unzip" ,unzip)
1ae6df81
LC
638 ("zip" ,zip)
639 ("zlib" ,zlib)))
c4c4cc05 640 (native-inputs
89f9df6c
EF
641 ;; Icecat 60 checkes for rust>=1.24
642 `(("rust" ,rust-1.24)
643 ("cargo" ,rust-1.24 "cargo")
8d956d86
MW
644 ("llvm" ,llvm-3.9.1)
645 ("clang" ,clang-3.9.1)
e67ad553 646 ("perl" ,perl)
c4c4cc05
JD
647 ("python" ,python-2) ; Python 3 not supported
648 ("python2-pysqlite" ,python2-pysqlite)
002c3e6d 649 ("yasm" ,yasm)
bfb48f4f 650 ("pkg-config" ,pkg-config)
002c3e6d 651 ("autoconf" ,autoconf-2.13)
bfb48f4f 652 ("which" ,which)))
be0f6112 653 (arguments
74c7af9f
MW
654 `(#:tests? #f ; no check target
655 #:out-of-source? #t ; must be built outside of the source directory
73b1b4eb
LC
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
e67ad553
MW
663 #:imported-modules ,%cargo-build-system-modules ;for `generate-checksums'
664
8d956d86 665 #:configure-flags `("--enable-default-toolkit=cairo-gtk3"
9502ea3e
MW
666
667 "--with-distribution-id=org.gnu"
668
90e1cdae
MW
669 "--enable-startup-notification"
670 "--enable-pulseaudio"
90e1cdae 671
9502ea3e
MW
672 "--disable-tests"
673 "--disable-updater"
674 "--disable-crashreporter"
675 "--disable-maintenance-service"
676 "--disable-eme"
90e1cdae 677 "--disable-gconf"
e67ad553 678
90e1cdae 679 ;; Building with debugging symbols takes ~5GiB, so
1ae6df81
LC
680 ;; disable it.
681 "--disable-debug"
682 "--disable-debug-symbols"
683
8d956d86
MW
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
5bdec7d6
MW
698 ;; Hack to work around missing
699 ;; "unofficial" branding in icecat.
bfb48f4f
MW
700 "--enable-official-branding"
701
90e1cdae 702 ;; Avoid bundled libraries.
1ae6df81 703 "--with-system-zlib"
90e1cdae 704 "--with-system-bz2"
7cba7647 705 "--with-system-jpeg" ; must be libjpeg-turbo
94e96f7f
MW
706 "--with-system-libevent"
707 "--with-system-ogg"
708 "--with-system-vorbis"
709 ;; "--with-system-theora" ; wants theora-1.2, not yet released
13b284d9 710 "--with-system-libvpx"
483ab08f 711 "--with-system-icu"
6d328879
MW
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
257e3247
MW
718 "--with-system-harfbuzz"
719 "--with-system-graphite2"
13b284d9 720 "--enable-system-pixman"
5b17fabc 721 "--enable-system-ffi"
90e1cdae 722 "--enable-system-hunspell"
9128e323 723 "--enable-system-sqlite"
1ae6df81 724
98a046cd
AE
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.
1ae6df81 733 ;; "--with-system-png"
5b17fabc 734 )
1ae6df81 735
9f7ae77f 736 #:modules ((ice-9 ftw)
6cde5c34
LC
737 (ice-9 rdelim)
738 (ice-9 match)
9f7ae77f 739 ,@%gnu-build-system-modules)
be0f6112 740 #:phases
90e1cdae 741 (modify-phases %standard-phases
9f7ae77f
MW
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)))
90e1cdae 754 (add-after
9502ea3e 755 'unpack 'link-libxul-with-libraries
90e1cdae
MW
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.
9f7ae77f 763 (substitute* "toolkit/library/moz.build"
002c3e6d
MW
764 (("^# This library needs to be last" all)
765 (string-append "OS_LIBS += [
9f7ae77f 766 'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5',
002c3e6d
MW
767 'avcodec', 'avutil', 'pulse' ]\n\n"
768 all)))
9f7ae77f 769 #t))
94e96f7f
MW
770 (replace 'bootstrap
771 (lambda _
772 (invoke "sh" "-c" "autoconf old-configure.in > old-configure")))
e67ad553 773 (add-after 'patch-source-shebangs 'patch-cargo-checksums
257e3247 774 (lambda _
e67ad553
MW
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))
8d956d86
MW
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"))))))
90e1cdae
MW
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)
002c3e6d 820 (setenv "AUTOCONF" (which "autoconf")) ; must be autoconf-2.13
8d956d86 821 (setenv "CC" "gcc") ; apparently needed when Stylo is enabled
90e1cdae
MW
822 (mkdir "../build")
823 (chdir "../build")
824 (format #t "build directory: ~s~%" (getcwd))
825 (format #t "configure flags: ~s~%" flags)
3f27124e
MW
826 (apply invoke bash
827 (string-append srcdir "/configure")
828 flags))))
6cde5c34
LC
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)
88a8ce87
AG
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"
3f27124e
MW
883 "mozicon128.png" "default256.png"))
884 #t))))
6e75740f
CL
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$"))
3f27124e
MW
893 `("XDG_DATA_DIRS" ":" prefix (,gtk-share)))
894 #t))))))
6fd52309 895 (home-page "https://www.gnu.org/software/gnuzilla/")
be0f6112
AE
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
c5779c93 899software, which does not recommend non-free plugins and addons. It also
79c311b8 900features built-in privacy-protecting features.")
63e8bb12 901 (license license:mpl2.0) ;and others, see toolkit/content/license.html
99effc8f
LC
902 (properties
903 `((ftp-directory . "/gnu/gnuzilla")
904 (cpe-name . "firefox_esr")
bfb48f4f 905 (cpe-version . ,(first (string-split version #\-)))))))