gnu: gtk+-2: Split binaries.
[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, 2019 Ludovic Courtès <ludo@gnu.org>
4 ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
6 ;;; Copyright © 2016, 2017, 2018, 2019 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 ng0 <ng0@n0.is>
10 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
11 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
12 ;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com>
13 ;;;
14 ;;; This file is part of GNU Guix.
15 ;;;
16 ;;; GNU Guix is free software; you can redistribute it and/or modify it
17 ;;; under the terms of the GNU General Public License as published by
18 ;;; the Free Software Foundation; either version 3 of the License, or (at
19 ;;; your option) any later version.
20 ;;;
21 ;;; GNU Guix is distributed in the hope that it will be useful, but
22 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;;; GNU General Public License for more details.
25 ;;;
26 ;;; You should have received a copy of the GNU General Public License
27 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28
29 (define-module (gnu packages gnuzilla)
30 #:use-module ((srfi srfi-1) #:hide (zip))
31 #:use-module (ice-9 match)
32 #:use-module (gnu packages)
33 #:use-module ((guix licenses) #:prefix license:)
34 #:use-module (guix packages)
35 #:use-module (guix download)
36 #:use-module (guix git-download)
37 #:use-module (guix hg-download)
38 #:use-module (guix gexp)
39 #:use-module (guix store)
40 #:use-module (guix monads)
41 #:use-module (guix utils)
42 #:use-module (guix build-system gnu)
43 #:use-module (guix build-system cargo)
44 #:use-module (gnu packages admin)
45 #:use-module (gnu packages audio)
46 #:use-module (gnu packages autotools)
47 #:use-module (gnu packages base)
48 #:use-module (gnu packages bash)
49 #:use-module (gnu packages databases)
50 #:use-module (gnu packages glib)
51 #:use-module (gnu packages gtk)
52 #:use-module (gnu packages gnome)
53 #:use-module (gnu packages libcanberra)
54 #:use-module (gnu packages cups)
55 #:use-module (gnu packages kerberos)
56 #:use-module (gnu packages linux)
57 #:use-module (gnu packages perl)
58 #:use-module (gnu packages pkg-config)
59 #:use-module (gnu packages compression)
60 #:use-module (gnu packages fontutils)
61 #:use-module (gnu packages libevent)
62 #:use-module (gnu packages libreoffice) ;for hunspell
63 #:use-module (gnu packages image)
64 #:use-module (gnu packages libffi)
65 #:use-module (gnu packages pulseaudio)
66 #:use-module (gnu packages python)
67 #:use-module (gnu packages python-xyz)
68 #:use-module (gnu packages node)
69 #:use-module (gnu packages xorg)
70 #:use-module (gnu packages gl)
71 #:use-module (gnu packages assembly)
72 #:use-module (gnu packages rust)
73 #:use-module (gnu packages rust-cbindgen)
74 #:use-module (gnu packages llvm)
75 #:use-module (gnu packages nss)
76 #:use-module (gnu packages icu4c)
77 #:use-module (gnu packages video)
78 #:use-module (gnu packages xiph)
79 #:use-module (gnu packages xdisorg)
80 #:use-module (gnu packages readline)
81 #:use-module (gnu packages sqlite))
82
83 (define-public mozjs
84 (package
85 (name "mozjs")
86 (version "17.0.0")
87 (source (origin
88 (method url-fetch)
89 (uri (string-append
90 "https://ftp.mozilla.org/pub/mozilla.org/js/"
91 name version ".tar.gz"))
92 (sha256
93 (base32
94 "1fig2wf4f10v43mqx67y68z6h77sy900d1w0pz9qarrqx57rc7ij"))
95 (patches (search-patches "mozjs17-aarch64-support.patch"))
96 (modules '((guix build utils)))
97 (snippet
98 ;; Fix incompatibility with Perl 5.22+.
99 '(begin
100 (substitute* '("js/src/config/milestone.pl")
101 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE"))
102 #t))))
103 (build-system gnu-build-system)
104 (native-inputs
105 `(("perl" ,perl)
106 ("pkg-config" ,pkg-config)
107 ("python" ,python-2)))
108 (propagated-inputs
109 `(("nspr" ,nspr))) ; in the Requires.private field of mozjs-17.0.pc
110 (inputs
111 `(("zlib" ,zlib)))
112 (arguments
113 `(;; XXX: parallel build fails, lacking:
114 ;; mkdir -p "system_wrapper_js/"
115 #:parallel-build? #f
116 #:phases
117 (modify-phases %standard-phases
118 (add-after 'unpack 'delete-timedout-test
119 ;; This test times out on slower hardware.
120 (lambda _
121 (delete-file "js/src/jit-test/tests/basic/bug698584.js")
122 #t))
123 (add-before 'configure 'chdir
124 (lambda _
125 (chdir "js/src")
126 #t))
127 (replace 'configure
128 ;; configure fails if it is followed by SHELL and CONFIG_SHELL
129 (lambda* (#:key outputs #:allow-other-keys)
130 (let ((out (assoc-ref outputs "out")))
131 (setenv "SHELL" (which "sh"))
132 (setenv "CONFIG_SHELL" (which "sh"))
133 (invoke "./configure" (string-append "--prefix=" out)
134 ,@(if (string=? "aarch64-linux"
135 (%current-system))
136 '("--host=aarch64-unknown-linux-gnu")
137 '()))))))))
138 (home-page
139 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey")
140 (synopsis "Mozilla javascript engine")
141 (description "SpiderMonkey is Mozilla's JavaScript engine written
142 in C/C++.")
143 (license license:mpl2.0))) ; and others for some files
144
145 (define-public mozjs-24
146 (package (inherit mozjs)
147 (name "mozjs")
148 (version "24.2.0")
149 (source (origin
150 (method url-fetch)
151 (uri (string-append
152 "https://ftp.mozilla.org/pub/mozilla.org/js/"
153 name "-" version ".tar.bz2"))
154 (sha256
155 (base32
156 "1n1phk8r3l8icqrrap4czplnylawa0ddc2cc4cgdz46x3lrkybz6"))
157 (modules '((guix build utils)))
158 (patches (search-patches "mozjs24-aarch64-support.patch"))
159 (snippet
160 ;; Fix incompatibility with Perl 5.22+.
161 '(begin
162 (substitute* '("js/src/config/milestone.pl")
163 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE"))
164 #t))))
165 (arguments
166 (substitute-keyword-arguments (package-arguments mozjs)
167 ((#:phases phases)
168 `(modify-phases ,phases
169 (replace 'configure
170 (lambda* (#:key outputs #:allow-other-keys)
171 (let ((out (assoc-ref outputs "out")))
172 ;; configure fails if it is followed by SHELL and CONFIG_SHELL
173 (setenv "SHELL" (which "sh"))
174 (setenv "CONFIG_SHELL" (which "sh"))
175 (invoke "./configure"
176 (string-append "--prefix=" out)
177 "--with-system-nspr"
178 "--enable-system-ffi"
179 "--enable-threadsafe"
180 ,@(if (string=? "aarch64-linux"
181 (%current-system))
182 '("--host=aarch64-unknown-linux-gnu")
183 '())))))))))
184 (inputs
185 `(("libffi" ,libffi)
186 ("zlib" ,zlib)))))
187
188 (define-public mozjs-38
189 (package
190 (inherit mozjs)
191 (name "mozjs")
192 (version "38.2.1.rc0")
193 (source (origin
194 (method url-fetch)
195 (uri (string-append
196 "https://anduin.linuxfromscratch.org/BLFS/mozjs/"
197 name "-" version ".tar.bz2"))
198 (sha256
199 (base32
200 "0p4bmbpgkfsj54xschcny0a118jdrdgg0q29rwxigg3lh5slr681"))
201 (patches
202 (search-patches
203 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1269317 for
204 ;; GCC 6 compatibility.
205
206 "mozjs38-version-detection.patch" ; for 0ad
207 "mozjs38-tracelogger.patch"
208
209 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1339931.
210 "mozjs38-pkg-config-version.patch"
211 "mozjs38-shell-version.patch"))
212 (modules '((guix build utils)))
213 (snippet
214 '(begin
215 ;; Fix incompatibility with sed 4.4.
216 (substitute* "js/src/configure"
217 (("\\^\\[:space:\\]") "^[[:space:]]"))
218
219 ;; The headers are symlinks to files that are in /tmp, so they
220 ;; end up broken. Copy them instead.
221 (substitute*
222 "python/mozbuild/mozbuild/backend/recursivemake.py"
223 (("\\['dist_include'\\].add_symlink")
224 "['dist_include'].add_copy"))
225
226 ;; Remove bundled libraries.
227 (for-each delete-file-recursively
228 '("intl"
229 "js/src/ctypes/libffi"
230 "js/src/ctypes/libffi-patches"
231 "modules/zlib"))
232 #t))))
233 (arguments
234 `(;; XXX: parallel build fails, lacking:
235 ;; mkdir -p "system_wrapper_js/"
236 #:parallel-build? #f
237 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1008470.
238 #:tests? #f
239 #:phases
240 (modify-phases %standard-phases
241 (replace 'configure
242 (lambda* (#:key outputs #:allow-other-keys)
243 (let ((out (assoc-ref outputs "out")))
244 (chdir "js/src")
245 (setenv "SHELL" (which "sh"))
246 (setenv "CONFIG_SHELL" (which "sh"))
247 (invoke "./configure"
248 (string-append "--prefix=" out)
249 "--enable-ctypes"
250 "--enable-gcgenerational"
251 "--enable-optimize"
252 "--enable-pie"
253 "--enable-readline"
254 "--enable-shared-js"
255 "--enable-system-ffi"
256 "--enable-threadsafe"
257 "--enable-xterm-updates"
258 "--with-system-icu"
259 "--with-system-nspr"
260 "--with-system-zlib"
261
262 ;; Intl API requires bundled ICU.
263 "--without-intl-api")))))))
264 (native-inputs
265 `(("perl" ,perl)
266 ("pkg-config" ,pkg-config)
267 ("python-2" ,python-2)))
268 (inputs
269 `(("libffi" ,libffi)
270 ("readline" ,readline)
271 ("icu4c" ,icu4c)
272 ("zlib" ,zlib)))))
273
274 (define-public mozjs-52
275 ;; No releases yet at <https://archive.mozilla.org/pub/spidermonkey/releases/>.
276 ;; While we could take a snapshot of the complete mozilla-esr52 repository at
277 ;; <https://treeherder.mozilla.org/#/jobs?repo=mozilla-esr52&filter-searchStr=sm-tc>,
278 ;; we take the Debian version instead, because it is easier to work with.
279 (let ((commit "6507e63cc416fd7a3269e390efe712f8b56f374a")
280 (revision "1"))
281 (package (inherit mozjs-38)
282 (version (git-version "52.0" revision commit))
283 (source (origin
284 (method git-fetch)
285 (uri (git-reference
286 (url "https://salsa.debian.org/gnome-team/mozjs52.git")
287 (commit commit)))
288 (file-name (git-file-name "mozjs" version))
289 (sha256
290 (base32
291 "1ny0s53r8wn4byys87h784xrq1xg767akmfm6gqrbvrz57mlm3q2"))))
292 (arguments
293 `(#:tests? #f ; depends on repository metadata
294 #:configure-flags
295 '("--enable-ctypes"
296 "--enable-optimize"
297 "--enable-pie"
298 "--enable-readline"
299 "--enable-shared-js"
300 "--enable-system-ffi"
301 "--with-system-icu"
302 "--with-system-nspr"
303 "--with-system-zlib"
304
305 ;; Intl API requires bundled ICU.
306 "--without-intl-api"
307
308 ;; Without this gnome-shell will crash at runtime.
309 "--disable-jemalloc")
310 #:phases
311 (modify-phases %standard-phases
312 (add-after 'unpack 'patch-and-chdir
313 (lambda* (#:key inputs #:allow-other-keys)
314 ;; This patch prevents a segfault when executing JS_Init().
315 ;; The build does not fail without this patch, but the
316 ;; configure phase of the gjs package would fail.
317 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1176787
318 (make-file-writable "js/src/old-configure.in")
319 (make-file-writable "js/src/old-configure")
320 (make-file-writable "mozglue/build/moz.build")
321 (invoke "patch" "-p1" "--force"
322 "--input" "debian/patches/disable-mozglue.patch")
323 (invoke "touch" "js/src/configure")
324 (chdir "js/src")
325 #t))
326 (replace 'configure
327 (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
328 ;; The configure script does not accept environment variables
329 ;; as arguments.
330 (let ((out (assoc-ref outputs "out")))
331 (setenv "SHELL" (which "sh"))
332 (setenv "CONFIG_SHELL" (which "sh"))
333 (setenv "AUTOCONF" (string-append (assoc-ref inputs "autoconf")
334 "/bin/autoconf"))
335 (apply invoke "./configure"
336 (cons (string-append "--prefix=" out)
337 configure-flags))))))))
338 (native-inputs
339 `(("autoconf" ,autoconf-2.13)
340 ("automake" ,automake)
341 ,@(package-native-inputs mozjs-38))))))
342
343 (define-public mozjs-60
344 ;; No releases yet at <https://archive.mozilla.org/pub/spidermonkey/releases/>.
345 ;; While we could take a snapshot of the complete mozilla-esr60 repository at
346 ;; <https://treeherder.mozilla.org/#/jobs?repo=mozilla-esr60&filter-searchStr=sm-tc>,
347 ;; we take the Debian version instead, because it is easier to work with.
348 (package
349 (inherit mozjs-38)
350 (version "60.2.3-2")
351 (source (origin
352 (method git-fetch)
353 (uri (git-reference
354 (url "https://salsa.debian.org/gnome-team/mozjs60.git")
355 (commit (string-append "debian/" version))))
356 (file-name (git-file-name "mozjs" version))
357 (sha256
358 (base32
359 "091w050rwzrdcbgyi934k2viyccmlqxrp13sm2mql71mabb5dai6"))))
360 (arguments
361 `(#:tests? #f ; FIXME: all tests pass, but then the check phase fails anyway.
362 #:test-target "check-jstests"
363 #:configure-flags
364 '("--enable-ctypes"
365 "--enable-optimize"
366 "--enable-pie"
367 "--enable-readline"
368 "--enable-shared-js"
369 "--enable-system-ffi"
370 "--with-system-nspr"
371 "--with-system-zlib"
372 "--with-system-icu"
373 "--with-intl-api"
374 ;; This is important because without it gjs will segfault during the
375 ;; configure phase. With jemalloc only the standalone mozjs console
376 ;; will work.
377 "--disable-jemalloc")
378 #:phases
379 (modify-phases %standard-phases
380 (replace 'configure
381 (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
382 ;; The configure script does not accept environment variables as
383 ;; arguments. It also must be run from a different directory,
384 ;; but not the root directory either.
385 (let ((out (assoc-ref outputs "out")))
386 (mkdir "run-configure-from-here")
387 (chdir "run-configure-from-here")
388 (setenv "SHELL" (which "sh"))
389 (setenv "CONFIG_SHELL" (which "sh"))
390 (setenv "AUTOCONF" (string-append (assoc-ref inputs "autoconf")
391 "/bin/autoconf"))
392 (apply invoke "../js/src/configure"
393 (cons (string-append "--prefix=" out)
394 configure-flags))
395 #t)))
396 (add-after 'unpack 'disable-broken-tests
397 (lambda _
398 ;; This test assumes that /bin exists and contains certain
399 ;; executables.
400 (delete-file "js/src/tests/shell/os.js")
401 #t)))))
402 (native-inputs
403 `(("autoconf" ,autoconf)
404 ("automake" ,automake)
405 ("which" ,which)
406 ("perl" ,perl)
407 ("pkg-config" ,pkg-config)
408 ("python" ,python-2)))))
409
410 (define mozilla-compare-locales
411 (origin
412 (method hg-fetch)
413 (uri (hg-reference
414 (url "https://hg.mozilla.org/l10n/compare-locales/")
415 (changeset "RELEASE_3_3_0")))
416 (file-name "mozilla-compare-locales")
417 (sha256 (base32 "0biazbq7vbi99b99rfn4szwyx032dkpi09c9z4zs6f1br0f86iy1"))))
418
419 (define (mozilla-locale locale changeset hash-string)
420 (origin
421 (method hg-fetch)
422 (uri (hg-reference
423 (url (string-append "https://hg.mozilla.org/l10n-central/"
424 locale))
425 (changeset changeset)))
426 (file-name (string-append "mozilla-locale-" locale))
427 (sha256 (base32 hash-string))))
428
429 (define-syntax-rule (mozilla-locales (hash-string changeset locale) ...)
430 (list (mozilla-locale locale changeset hash-string)
431 ...))
432
433 (define all-mozilla-locales
434 (mozilla-locales
435 ;; sha256 changeset locale
436 ;;---------------------------------------------------------------------------
437 ("0pybx6j2ycbrr1xmv0spv19sd8a1dyzcs8kf6pzn71w8y6kiagcf" "35959cf2343c" "ach")
438 ("0dixmkha738w7fkx20nx95xkfyrqb9vczpy6m03qnqfvb76xaxj5" "e8dc1010f909" "af")
439 ("124j09va25gwfxdzyfixrli0skxv53c7niagjyp7g3a3kcv2lbhc" "4c67f6b96a7b" "an")
440 ("0flgqll3xx0ym0zj0w9j2jw3fmhs6h9m4l5da6m0bpnk5ff80r06" "34cbea5f44a5" "ar")
441 ("0kdb1yqfbfz508f4p77z3p1v6fwy190vs5ipj58hgdixjgbxkqay" "b4790b27633c" "ast")
442 ("1vm5xw6wg12pygswd3p0qpkaxyryah6nif5n15chb4sb42c1gqcm" "96d341bf49d4" "az")
443 ("1j2qrrws51qij6haz5b77n5vzqhsxgs1ppqqw4mdrkacwvz4ciwh" "4adaede00646" "be")
444 ("0ydr8f9lbd51prgcbjb5yacb461j8va0s5bqfs0rnglkvhmk6ard" "d1140972aefe" "bg")
445 ("0wyw90zjp8kpd1gljng00in9wr2cf59ww6z002lgx5k4gibnqcfd" "2b3ce92c2310" "bn")
446 ("0kkq621h1qdmimyrmms9g5p70m54z2ddw4cd962nqbkrnmabq9vn" "426896350893" "br")
447 ("0vibhnb3cbpbgf10db04g6vm372kb9i27p0jkwif019f7qprswd8" "7463f339ce07" "bs")
448 ("1l8cn2fqfvx7bswzfy9vavv8cd32ha9ygdxxdbxi64wcgw0f80bf" "dab3f05125e4" "ca")
449 ("0fik17y8zyg9w82lq501ic73a53c0q9r8v4zgn9bnzgsygig8qpq" "ebb9d989275a" "cak")
450 ("0sj29v6144h39wzb4rvxph3cwgvs4gzkgpr0463d3fcs6jdi0kjs" "522352780348" "cs")
451 ("1nz8jlx62l69jcdi59hlk8jysm15sh3d1cxqginjmx7w351wsidm" "0791b954c333" "cy")
452 ("1vc01q1vlq26xm1vm1x0119jawxxp975p9k8ashmiwncl1bvqb48" "121f5f876f4c" "da")
453 ("1iqny61rg57banfbbskc2y3pr6d35fabnxmynv7vxm9jd86pndz3" "95fb3e99a2bc" "de")
454 ("06v9j8acx5h8za7m65v6qm0wjbkx6vm46m8sigcp69phyg3fjc96" "90e681b74587" "dsb")
455 ("0lbk90x2dxdbh63fycqxspx6jqq2zlzys6grg45balw8yyvzqrkz" "58ba4c13fd42" "el")
456 ("0c2ypvy0z8g78s5158v6h9khckq1xps34r5wbiiciix289m43dgl" "8953d8c98a30" "en-CA")
457 ("0z3riz3w2z6p710p90ridmwwam4snnz5mn90gd4jc1h2n7vc9mr0" "5a2b9bca3f52" "en-GB")
458 ("102gn3h4ap8c3x1p7vfc88vapkfiz6264y6byhxy1axxjk3x3a77" "e87cb1c61d6e" "eo")
459 ("148wj6wsx0aq7cpaxk8njj7cb1wfjr2m96dgxq6b3qcv781ldvjn" "5db15fdf95d5" "es-AR")
460 ("0r11d8vzvbyz17n371byvkrnszcv1zhr7rg64i58xra3y6d7is7n" "ce2ee0e51a92" "es-CL")
461 ("1xmqa8p7lpqvkgg879hfnmf6kxcpawjk8z31cdzfp1hrdlmxg8n7" "7346617620f3" "es-ES")
462 ("0jxv3jh2018lnybr9mzqrffvwmr87yab9bh8lxqjj294fxw1hrxm" "687f05eb0c58" "es-MX")
463 ("1rpgv7pajv4xldsn1xxsia5j72vn3x8zl5wmbzkyw56lvn9fckvf" "839a5029c496" "et")
464 ("0hxp4fr3y05rkpamdb1hlmybn6d3bv3rcawjm3axbpqxbyfdpfzc" "54e8d87230c9" "eu")
465 ("1y50knymnmcihw8bhvahicc386mjm6dx4hx0j6fv8sl23wzx2h9m" "c5ffca960f9c" "fa")
466 ("0pj9zgi0c3yl3myhvb5afiijayp2lqzhlk630ahxn5hgjgkz0lx7" "75c000a8538d" "ff")
467 ("199jg0zv7wp1cq0ik2hf84j99jx5vq2jwac0gaayvjzkh2z83jqr" "f11b2e689e7b" "fi")
468 ("1vxkiwwni7470ywy99arxxa56ljkhjrhxslsp1l1l61g6gdbbspr" "49ec4f791806" "fr")
469 ("0d8gwdcj0jpjv03nhjds8jrg86pg371xpylaibwri76wlyl7m54i" "faa761a5cfdc" "fy-NL")
470 ("0nipbxx11a2sjadzhbi88vgknw5hzr4nqy2722q3kc1212jbi754" "5bd9466f9f9d" "ga-IE")
471 ("0bay8mrm65cvmnvqpwqgzr0h3cb18ifzg5kbsbxcvdfm9xv0zi9g" "a4f6a47e82dd" "gd")
472 ("00kn5w3nnpw1pxg6hhrn9asf9hgpjd6ia4038iwzcqs68w887qcy" "6c2aa01ada4e" "gl")
473 ("0jj13i0ach85c975vaz2rr83mibs29ipssa7qsjkb0y2ch6xya1k" "c2d607e36cb5" "gn")
474 ("1nhqbgzilcb0pr7941dxkhg079bf8v7ldikp1s5xli34wf9sabm2" "f34465d6ac1c" "gu-IN")
475 ("11bh0541d996cfin1zy72l66753q94i4idgv2waf0h40h9g3z1bm" "c2ecb2762274" "he")
476 ("1lslji7hh5lx5ig1xgfjh4cdindsgh3n2a7qlvzwz96gda43lvv4" "94d2bb10ee03" "hi-IN")
477 ("1nx5yw00l25i3m3grdm29mi9mi7h0cy5qx02pypir754pk3hiwcc" "08df0d94edd5" "hr")
478 ("19yc9dk2pwqycynmx58d1ik6x4mnyfxscgr6sg676dpl613xd7nq" "21b614e77025" "hsb")
479 ("0l3z64jlx6b6ivk1b5hwqyx9hm1m5721ywnb2m4zmg3g9fw4vn7f" "f82cad7170af" "hu")
480 ("1sn0dxbbf2zwcpybwcw77qb4p0hf6fxapnsnn4avaab5g55dlgz4" "d94c30920396" "hy-AM")
481 ("0c92cqxrhv4317kirmhpjk7mrq44yn6fp3v6syxnhz7xwxnhshjm" "6a5f176b0626" "ia")
482 ("03gyg9gqsd6pwb9nydglhm46fi2wk2p2qygmhmrf8hnav3ba7n0r" "94e4302e0f85" "id")
483 ("0ky8aaps92mn56rvkwn0i13wg8av8hzi1fvr0ahqhjcpj5sfgdwq" "eca348a59888" "is")
484 ("01py0sfg7nljcsgpivryrvai4p4wzbcvhgc2ymr19r579nv1vw7g" "d541a6197359" "it")
485 ("0iv7vmj43njmi7g1gjzsv68ax4j502d2wnkvbfz1rx11lrqs7yw1" "a5ab3a1d95b7" "ja")
486 ("1sr9ccshcw6agbj4hbnpblxixb1jz0m36glas6f9ahxmi7m605si" "63763ffa5a94" "ja-JP-mac")
487 ("1as33pzcsdkynrj16dv7w642vl6plbhk650am4l5djwm64f2rgms" "aa83e8555ddc" "ka")
488 ("1jwaqb5qps3i5y9iw8l2hrwa0n8lfnx1k9x0p54y3jkh6p3q3fzc" "0e0e25c26247" "kab")
489 ("0cjfiwv0q5i8d7fpwb4m2w5ahq687dqjlwlicgpa443yi2zsxr4s" "33117723ceb1" "kk")
490 ("0k5b56cv39aaxf9r0p9c27f3fp6yq2ffd4w6qmd0ibpl69sm629d" "aff7b2a7825e" "km")
491 ("1a0zg96jgq4zn9cz0h2qwc0vv1fbkfzs5qrgabg62wqgz286jvvv" "ea91638cb1dd" "kn")
492 ("0jhmv2n3yx55r6fg3myg7j1c1nhsv25g016m6lh2j023xbr723gp" "88821009b5b3" "ko")
493 ("06bybgv4m4i7r9p0qld65j31vbrnljhsdj649dl93msv2r69ilif" "88685d5f07b3" "lij")
494 ("1bzjf8smw6ngi88j5g3fawrg54m8fifbhshwjbgkpj7rnrpjgh4w" "e046c7ffa7d0" "lt")
495 ("18dmzmpavijb7fwzffas0j5nb6byqp8h6ki7hhf6qb35diqgfq6n" "c520ef4f576c" "lv")
496 ("055zf7xj5h1h8mzxj1cjzhngpcvg2p5vs2dmffsa5zfprj02d0dm" "9e43723f18ad" "mk")
497 ("1496fbyyzcl075gzcd3xy50h9jyhnzgb544k1scji56yhyfajacb" "ce615fef92c1" "mr")
498 ("1wc1q8ksry181pvnysqsq4dhhsg5adw5vgqafmmq5sf6i2bwn2z0" "4fefe88cfaee" "ms")
499 ("0awf6mrdwdhy2yvxynssvp1zg1nc2fqbmg2d2bhjcib69zx944xw" "3987a06866fd" "my")
500 ("1hycvz7i4jd40hfs5abx6sgfdkafg0jhdgqih9b7lb08aqcl35pj" "2b3b8997d9a1" "nb-NO")
501 ("048z1ib46izwryyy8l1x71kq4775n7l2ilbskhsyrbxqryma13k8" "f25324281615" "ne-NP")
502 ("1qkxqpyr4la9bn1bqsgc2h9869arglh9n2kwpkq6722jzdbynkz2" "04c7d32c57f6" "nl")
503 ("08gnmdll55dbqj7qs63gq1kljbvg24nzns6q4m0av3sszsic0jv5" "5587520e5019" "nn-NO")
504 ("1yh2p4ipj5p2b7gh0xxj0n7ndvwn5bw2773ibrh7vz932mkzhhjn" "499386b02695" "oc")
505 ("0kjbnixjzv9hvyba4ll20gs76vx84pviy134fvpjp9lfjpnpib55" "31c01c325675" "pa-IN")
506 ("0g61imvr4639bbydyi0kwc1il7l1gzlfij4ywx7hdcmq2x6vgb9v" "fb5f3b8dea09" "pl")
507 ("13n68d7z94d7943m6fwl4kizbqm3wp82xz69vng4w9vyqlvv7d41" "9a541cbdc748" "pt-BR")
508 ("1j8afvrl1afmj2zixrp91rrhag5w4xw90raca1ic6mxyih9kvdi4" "edc959a685c2" "pt-PT")
509 ("0wf4a6q9nvcmam2g8ksbymjdnrz59pdr5nirfpjprfhifjmxx4nn" "d2699db715cd" "rm")
510 ("1k9qalir5pbh490w1mxyq31yhy9hbxsyrrk11hwlwlgn6syp9nvp" "b5460a9017bc" "ro")
511 ("1avy6wyfa5lbvy36wai6mwhhh6x1y8a0jyjk8hvjn52yfxj1gypk" "59ffa8ad047a" "ru")
512 ("1cakhm4jxcw1ij0l1vhxw74hsp5wg68i3319dkdncyyc5a2s1qv9" "8b3c8a7ebdfa" "si")
513 ("0s534r09bqdfvw3q17y9b1035kzzlafjv656v73mqhyz3fkffsx5" "cb39dc77980e" "sk")
514 ("1s58vgmnb9aiaiaqwwcivq3iyzpzj527w2aqh2nrh6xmaw7f43sr" "17d7969b1d9a" "sl")
515 ("147qm7x5z8rkf24jpqvkdlqg0fjz1l3zwnaxvkh9y2jpzv7m0x7z" "c55b0e9ff99d" "son")
516 ("0nn4r1rxi8cy7x9nmn5ljd8gcsn2rjl2ma2j7waxkafkm4rs6n20" "2bb3808072da" "sq")
517 ("0jsb01b94z7qbm59yaj56nb7yx7a6hpgw8v6nzwhbvmnmcsird4p" "c323c0d02d61" "sr")
518 ("1n7vv9y4sk3gig56rgfd2jk8jr2160grxk31bd1wkm7fvbndd259" "4220ce487cbc" "sv-SE")
519 ("06270mq7gajxfrsb8gqd25v2dac68ask5vvlh6kkkp3hrgy02vid" "6a1dbc2fe1d3" "ta")
520 ("10az7pd3npa7n8wq0qywvsj2qrx9592i2wffs3rnc1fviv1i1q0y" "028505b5ecd1" "te")
521 ("0yj0c3iyibb3jyypvyiyhbr9asxa48v0nq21kcf9gphi8fnyp5if" "e44d38b6a67b" "th")
522 ("1qc4nvhw834lx7p304fxma0fjdr4xfj4lf69dhh6biqz795lx45p" "1e0771d95708" "tr")
523 ("1g4y2yq5xp61ncy7c08j7fqqr1jc0m1hjxmbg5659wzif3b3dkg4" "e3c96943e98f" "uk")
524 ("1zbi28z1c3p5il7ndixyjsv4nrimzq36zjvlmq10am38ycqr9df8" "f35da1b02691" "ur")
525 ("1jrxjjj8k771y0wljqbadxdj4pasg0771jmg4l3hvpgs929i3j9g" "6fd2084b3efe" "uz")
526 ("1f8sqgxzgqmw6vzjv3f49lg43q09i3j62f471864vr71815agl8n" "33b5dfd0cd63" "vi")
527 ("0ssnsbxw3q5k88fa081gkn1mbqn4j7bm6vb7yvz6h44j214xkz9x" "2d87c0740715" "xh")
528 ("0kd3mrvvgczhsmw4rvpxxxc71bb469ayr8r4azf7gc0y5nmlm950" "a2b6625688d3" "zh-CN")
529 ("0qy1asyfplkyc89z3g3gfm7b32aka92350b3ayv9d9dcgwxmfdwz" "4d6e959a13d1" "zh-TW")))
530
531 (define (mozilla-patch file-name changeset hash)
532 "Return an origin for CHANGESET from the mozilla-esr60 repository."
533 (origin
534 (method url-fetch)
535 (uri (string-append "https://hg.mozilla.org/releases/mozilla-esr60/raw-rev/"
536 changeset))
537 (sha256 (base32 hash))
538 (file-name file-name)))
539
540 (define* (computed-origin-method gexp-promise hash-algo hash
541 #:optional (name "source")
542 #:key (system (%current-system))
543 (guile (default-guile)))
544 "Return a derivation that executes the G-expression that results
545 from forcing GEXP-PROMISE."
546 (mlet %store-monad ((guile (package->derivation guile system)))
547 (gexp->derivation (or name "computed-origin")
548 (force gexp-promise)
549 #:graft? #f ;nothing to graft
550 #:system system
551 #:guile-for-build guile)))
552
553 (define %icecat-version "68.3.0-guix0-preview1")
554 (define %icecat-build-id "20191204000000") ;must be of the form YYYYMMDDhhmmss
555
556 ;; 'icecat-source' is a "computed" origin that generates an IceCat tarball
557 ;; from the corresponding upstream Firefox ESR tarball, using the 'makeicecat'
558 ;; script from the upstream IceCat project.
559 (define icecat-source
560 (let* ((base-version (first (string-split %icecat-version #\-)))
561
562 (major-version (first (string-split base-version #\.)))
563 (minor-version (second (string-split base-version #\.)))
564 (sub-version (third (string-split base-version #\.)))
565
566 (upstream-firefox-version (string-append base-version "esr"))
567 (upstream-firefox-source
568 (origin
569 (method url-fetch)
570 (uri (string-append
571 "https://ftp.mozilla.org/pub/firefox/releases/"
572 upstream-firefox-version "/source/"
573 "firefox-" upstream-firefox-version ".source.tar.xz"))
574 (sha256
575 (base32
576 "0sfwp9vyjizj1lkvj6z51r85dl41q3l8380fkdyqdbp7f2d18cg1"))))
577
578 (upstream-icecat-base-version "68.3.0") ; maybe older than base-version
579 ;;(gnuzilla-commit (string-append "v" upstream-icecat-base-version))
580 (gnuzilla-commit "85e99badac11983f6d50b0d9942f66a30f55b8e5")
581 (gnuzilla-source
582 (origin
583 (method git-fetch)
584 (uri (git-reference
585 (url "git://git.savannah.gnu.org/gnuzilla.git")
586 (commit gnuzilla-commit)))
587 (file-name (git-file-name "gnuzilla"
588 ;;upstream-icecat-base-version
589 (string-take gnuzilla-commit 8)))
590 (sha256
591 (base32
592 "00mb734yvm0r7i64mbg7hvrvhbwkcii9f9hjgwi37aizd9k0n78a"))))
593
594 (makeicecat-patch
595 (local-file (search-patch "icecat-makeicecat.patch"))))
596
597 (origin
598 (method computed-origin-method)
599 (file-name (string-append "icecat-" %icecat-version ".tar.xz"))
600 (sha256 #f)
601 (uri
602 (delay
603 (with-imported-modules '((guix build utils))
604 #~(begin
605 (use-modules (guix build utils))
606 (let ((firefox-dir
607 (string-append "firefox-" #$base-version))
608 (icecat-dir
609 (string-append "icecat-" #$%icecat-version)))
610
611 (mkdir "/tmp/bin")
612 (set-path-environment-variable
613 "PATH" '("bin")
614 (list "/tmp"
615 #+(canonical-package bash)
616 #+(canonical-package coreutils)
617 #+(canonical-package findutils)
618 #+(canonical-package patch)
619 #+(canonical-package xz)
620 #+(canonical-package sed)
621 #+(canonical-package grep)
622 #+(canonical-package bzip2)
623 #+(canonical-package gzip)
624 #+(canonical-package tar)
625 #+rename))
626
627 (symlink #+(file-append rename "/bin/rename")
628 "/tmp/bin/prename")
629
630 ;; We copy the gnuzilla source directory because it is
631 ;; read-only in 'gnuzilla-source', and the makeicecat script
632 ;; uses "cp -a" to copy parts of it and assumes that the
633 ;; copies will be writable.
634 (copy-recursively #+gnuzilla-source "/tmp/gnuzilla"
635 #:log (%make-void-port "w"))
636
637 (with-directory-excursion "/tmp/gnuzilla"
638 (make-file-writable "makeicecat")
639 (invoke "patch" "--force" "--no-backup-if-mismatch"
640 "-p1" "--input" #+makeicecat-patch)
641 (patch-shebang "makeicecat")
642 (substitute* "makeicecat"
643 (("^FFMAJOR=(.*)" all ffmajor)
644 (unless (string=? #$major-version
645 (string-trim-both ffmajor))
646 ;; The makeicecat script cannot be expected to work
647 ;; properly on a different version of Firefox, even if
648 ;; no errors occur during execution.
649 (error "makeicecat major version mismatch"))
650 (string-append "FFMAJOR=" #$major-version "\n"))
651 (("^FFMINOR=.*")
652 (string-append "FFMINOR=" #$minor-version "\n"))
653 (("^FFSUB=.*")
654 (string-append "FFSUB=" #$sub-version "\n"))
655 (("^DATA=.*")
656 "DATA=/tmp/gnuzilla/data\n")
657 (("/bin/sed")
658 #+(file-append (canonical-package sed) "/bin/sed"))))
659
660 (format #t "Unpacking upstream firefox tarball...~%")
661 (force-output)
662 (invoke "tar" "xf" #+upstream-firefox-source)
663 (rename-file firefox-dir icecat-dir)
664
665 (with-directory-excursion icecat-dir
666 (format #t "Populating l10n directory...~%")
667 (force-output)
668 (mkdir "l10n")
669 (with-directory-excursion "l10n"
670 (for-each
671 (lambda (locale-dir)
672 (let ((locale
673 (string-drop (basename locale-dir)
674 (+ 32 ; length of hash
675 (string-length "-mozilla-locale-")))))
676 (format #t " ~a~%" locale)
677 (force-output)
678 (copy-recursively locale-dir locale
679 #:log (%make-void-port "w"))
680 (for-each make-file-writable (find-files locale))
681 (with-directory-excursion locale
682 (when (file-exists? ".hgtags")
683 (delete-file ".hgtags"))
684 (mkdir-p "browser/chrome/browser/preferences")
685 (call-with-output-file
686 "browser/chrome/browser/preferences/advanced-scripts.dtd"
687 (lambda (port) #f)))))
688 '#+all-mozilla-locales)
689 (copy-recursively #+mozilla-compare-locales
690 "compare-locales"
691 #:log (%make-void-port "w"))
692 (delete-file "compare-locales/.gitignore")
693 (delete-file "compare-locales/.hgignore")
694 (delete-file "compare-locales/.hgtags"))
695
696 (format #t "Running makeicecat script...~%")
697 (force-output)
698 (invoke "bash" "/tmp/gnuzilla/makeicecat"))
699
700 (format #t "Packing IceCat source tarball...~%")
701 (force-output)
702 (invoke "tar" "cfa" #$output
703 ;; Avoid non-determinism in the archive. We set the
704 ;; mtime of files in the archive to early 1980 because
705 ;; the build process fails if the mtime of source
706 ;; files is pre-1980, due to the creation of zip
707 ;; archives.
708 "--mtime=@315619200" ; 1980-01-02 UTC
709 "--owner=root:0"
710 "--group=root:0"
711 "--sort=name"
712 icecat-dir)
713
714 #t))))))))
715
716 (define-public icecat
717 (package
718 (name "icecat")
719 (version %icecat-version)
720 (source icecat-source)
721 (build-system gnu-build-system)
722 (inputs
723 `(("alsa-lib" ,alsa-lib)
724 ("bzip2" ,bzip2)
725 ("cups" ,cups)
726 ("dbus-glib" ,dbus-glib)
727 ("gdk-pixbuf" ,gdk-pixbuf)
728 ("glib" ,glib)
729 ("gtk+" ,gtk+)
730 ("gtk+-2" ,gtk+-2)
731 ("graphite2" ,graphite2)
732 ("pango" ,pango)
733 ("freetype" ,freetype)
734 ("harfbuzz" ,harfbuzz)
735 ("libcanberra" ,libcanberra)
736 ("libgnome" ,libgnome)
737 ("libjpeg-turbo" ,libjpeg-turbo)
738 ("libogg" ,libogg)
739 ;; ("libtheora" ,libtheora) ; wants theora-1.2, not yet released
740 ("libvorbis" ,libvorbis)
741 ("libxft" ,libxft)
742 ("libevent" ,libevent)
743 ("libxinerama" ,libxinerama)
744 ("libxscrnsaver" ,libxscrnsaver)
745 ("libxcomposite" ,libxcomposite)
746 ("libxt" ,libxt)
747 ("libffi" ,libffi)
748 ("ffmpeg" ,ffmpeg)
749 ("libvpx" ,libvpx-1.7)
750 ("icu4c" ,icu4c)
751 ("pixman" ,pixman)
752 ("pulseaudio" ,pulseaudio)
753 ("mesa" ,mesa)
754 ("mit-krb5" ,mit-krb5)
755 ;; See <https://bugs.gnu.org/32833>
756 ;; and related comments in the 'remove-bundled-libraries' phase.
757 ;; UNBUNDLE-ME! ("nspr" ,nspr)
758 ;; UNBUNDLE-ME! ("nss" ,nss)
759 ("sqlite" ,sqlite)
760 ("startup-notification" ,startup-notification)
761 ("unzip" ,unzip)
762 ("zip" ,zip)
763 ("zlib" ,zlib)))
764 (native-inputs
765 ;; The following patches are specific to the Guix packaging of IceCat,
766 ;; and therefore we prefer to leave them out of 'source', which should be
767 ;; a tarball suitable for compilation on any system that IceCat supports.
768 ;; (Bug fixes and security fixes, however, should go in 'source').
769 `(;; XXX TODO: Adapt these patches to IceCat 68.
770 ;; ("icecat-avoid-bundled-libraries.patch"
771 ;; ,(search-patch "icecat-avoid-bundled-libraries.patch"))
772 ;; ("icecat-use-system-graphite2+harfbuzz.patch"
773 ;; ,(search-patch "icecat-use-system-graphite2+harfbuzz.patch"))
774 ;; ("icecat-use-system-media-libs.patch"
775 ;; ,(search-patch "icecat-use-system-media-libs.patch"))
776
777 ("patch" ,(canonical-package patch))
778
779 ("rust" ,rust)
780 ("cargo" ,rust "cargo")
781 ("rust-cbindgen" ,rust-cbindgen)
782 ("llvm" ,llvm)
783 ("clang" ,clang)
784 ("perl" ,perl)
785 ("node" ,node)
786 ("python" ,python)
787 ("python-2" ,python-2)
788 ("python2-pysqlite" ,python2-pysqlite)
789 ("yasm" ,yasm)
790 ("nasm" ,nasm) ; XXX FIXME: only needed on x86_64 and i686
791 ("pkg-config" ,pkg-config)
792 ("autoconf" ,autoconf-2.13)
793 ("which" ,which)))
794 (arguments
795 `(#:tests? #f ; no check target
796 #:out-of-source? #t ; must be built outside of the source directory
797
798 ;; XXX: There are RUNPATH issues such as
799 ;; $prefix/lib/icecat-31.6.0/plugin-container NEEDing libmozalloc.so,
800 ;; which is not in its RUNPATH, but they appear to be harmless in
801 ;; practice somehow. See <http://hydra.gnu.org/build/378133>.
802 #:validate-runpath? #f
803
804 #:configure-flags `("--enable-default-toolkit=cairo-gtk3"
805
806 "--with-distribution-id=org.gnu"
807
808 ;; Do not require addons in the global app
809 ;; directory to be signed by Mozilla.
810 "--with-unsigned-addon-scopes=app"
811
812 "--enable-startup-notification"
813 "--enable-pulseaudio"
814
815 "--disable-tests"
816 "--disable-updater"
817 "--disable-crashreporter"
818 "--disable-eme"
819 "--disable-gconf"
820
821 ;; Building with debugging symbols takes ~5GiB, so
822 ;; disable it.
823 "--disable-debug"
824 "--disable-debug-symbols"
825
826 ;; Clang is needed to build Stylo, Mozilla's new
827 ;; CSS engine. We must specify the clang paths
828 ;; manually, because otherwise the Mozilla build
829 ;; system looks in the directories returned by
830 ;; llvm-config --bindir and llvm-config --libdir,
831 ;; which return paths in the llvm package where
832 ;; clang is not found.
833 ,(string-append "--with-clang-path="
834 (assoc-ref %build-inputs "clang")
835 "/bin/clang")
836 ,(string-append "--with-libclang-path="
837 (assoc-ref %build-inputs "clang")
838 "/lib")
839
840 ;; Hack to work around missing
841 ;; "unofficial" branding in icecat.
842 "--enable-official-branding"
843
844 ;; Avoid bundled libraries.
845 "--with-system-zlib"
846 "--with-system-bz2"
847 "--with-system-jpeg" ; must be libjpeg-turbo
848 ;; UNBUNDLE-ME! "--with-system-libevent"
849 ;; UNBUNDLE-ME! "--with-system-ogg"
850 ;; UNBUNDLE-ME! "--with-system-vorbis"
851 ;; UNBUNDLE-ME! "--with-system-theora" ; wants theora-1.2, not yet released
852 ;; UNBUNDLE-ME! "--with-system-libvpx"
853 "--with-system-icu"
854
855 ;; See <https://bugs.gnu.org/32833>
856 ;; and related comments in the
857 ;; 'remove-bundled-libraries' phase below.
858 ;; UNBUNDLE-ME! "--with-system-nspr"
859 ;; UNBUNDLE-ME! "--with-system-nss"
860
861 ;; UNBUNDLE-ME! "--with-system-harfbuzz"
862 ;; UNBUNDLE-ME! "--with-system-graphite2"
863 "--enable-system-pixman"
864 "--enable-system-ffi"
865 ;; UNBUNDLE-ME! "--enable-system-sqlite"
866
867 ;; Fails with "--with-system-png won't work because
868 ;; the system's libpng doesn't have APNG support".
869 ;; According to
870 ;; http://sourceforge.net/projects/libpng-apng/ ,
871 ;; "the Animated Portable Network Graphics (APNG)
872 ;; is an unofficial extension of the Portable
873 ;; Network Graphics (PNG) format";
874 ;; we probably do not wish to support it.
875 ;; "--with-system-png"
876 )
877
878 #:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums'
879
880 #:modules ((ice-9 ftw)
881 (ice-9 rdelim)
882 (ice-9 match)
883 (srfi srfi-34)
884 (srfi srfi-35)
885 ,@%gnu-build-system-modules)
886 #:phases
887 (modify-phases %standard-phases
888 (add-after 'unpack 'apply-guix-specific-patches
889 (lambda* (#:key inputs native-inputs #:allow-other-keys)
890 (let ((patch (string-append (assoc-ref (or native-inputs inputs)
891 "patch")
892 "/bin/patch")))
893 (for-each (match-lambda
894 ((label . file)
895 (when (and (string-prefix? "icecat-" label)
896 (string-suffix? ".patch" label))
897 (format #t "applying '~a'...~%" file)
898 (invoke patch "--force" "--no-backup-if-mismatch"
899 "-p1" "--input" file))))
900 (or native-inputs inputs)))
901 #t))
902 (add-after 'apply-guix-specific-patches 'remove-bundled-libraries
903 (lambda _
904 ;; Remove bundled libraries that we don't use, since they may
905 ;; contain unpatched security flaws, they waste disk space and
906 ;; memory, and may cause confusion.
907 (for-each (lambda (file)
908 (format #t "deleting '~a'...~%" file)
909 (delete-file-recursively file))
910 '(;; FIXME: Removing the bundled icu breaks configure.
911 ;; * The bundled icu headers are used in some places.
912 ;; * The version number is taken from the bundled copy.
913 ;;"intl/icu"
914 ;;
915 ;; FIXME: A script from the bundled nspr is used.
916 ;;"nsprpub"
917 ;;
918 ;; FIXME: With the update to IceCat 60, using system NSS
919 ;; broke certificate validation. See
920 ;; <https://bugs.gnu.org/32833>. For now, we use
921 ;; the bundled NSPR and NSS. TODO: Investigate,
922 ;; and try to unbundle these libraries again.
923 ;; UNBUNDLE-ME! "security/nss"
924 ;;
925 ;; TODO: Use more system media libraries. See:
926 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
927 ;; * libtheora: esr60 wants v1.2, not yet released.
928 ;; * soundtouch: avoiding the bundled library would
929 ;; result in some loss of functionality. There's
930 ;; also an issue with exception handling
931 ;; configuration. It seems that this is needed in
932 ;; some moz.build:
933 ;; DEFINES['ST_NO_EXCEPTION_HANDLING'] = 1
934 ;; * libopus
935 ;; * speex
936 ;;
937 "modules/freetype2"
938 "modules/zlib"
939 ;; "media/libjpeg" ; needed for now, because media/libjpeg/moz.build is referenced from config/external/moz.build
940 ;; UNBUNDLE-ME! "ipc/chromium/src/third_party/libevent"
941 ;; UNBUNDLE-ME! "media/libvpx"
942 ;; UNBUNDLE-ME! "media/libogg"
943 ;; UNBUNDLE-ME! "media/libvorbis"
944 ;; UNBUNDLE-ME! "media/libtheora" ; wants theora-1.2, not yet released
945 ;; UNBUNDLE-ME! "media/libtremor"
946 ;; UNBUNDLE-ME! "gfx/harfbuzz"
947 ;; UNBUNDLE-ME! "gfx/graphite2"
948 "js/src/ctypes/libffi"
949 ;; UNBUNDLE-ME! "db/sqlite3"
950 ))
951 #t))
952 (add-after 'remove-bundled-libraries 'link-libxul-with-libraries
953 (lambda _
954 ;; libxul.so dynamically opens libraries, so here we explicitly
955 ;; link them into libxul.so instead.
956 ;;
957 ;; TODO: It might be preferable to patch in absolute file names in
958 ;; calls to dlopen or PR_LoadLibrary, but that didn't seem to
959 ;; work. More investigation is needed.
960 (substitute* "toolkit/library/moz.build"
961 (("^# This library needs to be last" all)
962 (string-append "OS_LIBS += [
963 'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5',
964 'avcodec', 'avutil', 'pulse' ]\n\n"
965 all)))
966 #t))
967 (replace 'bootstrap
968 (lambda _
969 (invoke "sh" "-c" "autoconf old-configure.in > old-configure")
970 ;; 'configure' must be newer than 'old-configure.in', or else the
971 ;; build system will raise an alarm and abort.
972 (invoke "touch" "configure")))
973 (add-after 'patch-source-shebangs 'patch-cargo-checksums
974 (lambda _
975 (use-modules (guix build cargo-utils))
976 (let ((null-hash "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))
977 (substitute* '("Cargo.lock" "gfx/wr/Cargo.lock")
978 (("(\"checksum .* = )\".*\"" all name)
979 (string-append name "\"" null-hash "\"")))
980 (generate-all-checksums "third_party/rust"))
981 #t))
982 (add-before 'configure 'augment-CPLUS_INCLUDE_PATH
983 (lambda* (#:key build inputs #:allow-other-keys)
984 ;; Here, we add additional entries to CPLUS_INCLUDE_PATH, to work
985 ;; around a problem that otherwise occurs when attempting to
986 ;; build Stylo, which requires Rust and Clang. Without these
987 ;; additional entries, errors occur during the build indicating
988 ;; that the <cstddef> and "c++config.h" headers cannot be found.
989 ;; Note that the 'build' keyword argument contains the GNU
990 ;; triplet, e.g. "x86_64-unknown-linux-gnu".
991 (let ((gcc (assoc-ref inputs "gcc")))
992 (setenv "CPLUS_INCLUDE_PATH"
993 (string-append gcc "/include/c++" ":"
994 gcc "/include/c++/" build)))
995 #t))
996 (replace 'configure
997 ;; configure does not work followed by both "SHELL=..." and
998 ;; "CONFIG_SHELL=..."; set environment variables instead
999 (lambda* (#:key outputs configure-flags #:allow-other-keys)
1000 (let* ((out (assoc-ref outputs "out"))
1001 (bash (which "bash"))
1002 (abs-srcdir (getcwd))
1003 (srcdir (string-append "../" (basename abs-srcdir)))
1004 (flags `(,(string-append "--prefix=" out)
1005 ,(string-append "--with-l10n-base="
1006 abs-srcdir "/l10n")
1007 ,@configure-flags)))
1008 (setenv "SHELL" bash)
1009 (setenv "CONFIG_SHELL" bash)
1010 (setenv "AUTOCONF" (which "autoconf")) ; must be autoconf-2.13
1011 (setenv "CC" "gcc") ; apparently needed when Stylo is enabled
1012 (setenv "MOZ_BUILD_DATE" ,%icecat-build-id) ; avoid timestamp
1013 (mkdir "../build")
1014 (chdir "../build")
1015 (format #t "build directory: ~s~%" (getcwd))
1016 (format #t "configure flags: ~s~%" flags)
1017 (apply invoke bash
1018 (string-append srcdir "/configure")
1019 flags))))
1020 (replace 'build
1021 ;; The build system often spuriously fails. See
1022 ;; <https://bugs.gentoo.org/show_bug.cgi?id=680934>. To
1023 ;; work around this, we try the standard 'build' phase up
1024 ;; to 5 times.
1025 (lambda args
1026 (let ((build (assoc-ref %standard-phases 'build)))
1027 (let retry ((remaining-attempts 5))
1028 (if (= remaining-attempts 1)
1029 (apply build args)
1030 (guard (c ((invoke-error? c)
1031 (format #t "~%Retrying build! (~a attempts remaining)~%~%"
1032 (- remaining-attempts 1))
1033 (force-output)
1034 (retry (- remaining-attempts 1))))
1035 (apply build args)))))))
1036 (add-before 'configure 'install-desktop-entry
1037 (lambda* (#:key outputs #:allow-other-keys)
1038 ;; Install the '.desktop' file.
1039 (let* ((desktop-file "taskcluster/docker/icecat-snap/icecat.desktop")
1040 (out (assoc-ref outputs "out"))
1041 (applications (string-append out "/share/applications")))
1042 (substitute* desktop-file
1043 (("^Exec=icecat") (string-append "Exec=" out "/bin/icecat"))
1044 (("IceCat") "GNU IceCat")
1045 (("Icon=.*") "Icon=icecat\n")
1046 (("NewWindow") "new-window")
1047 (("NewPrivateWindow") "new-private-window"))
1048 (install-file desktop-file applications)
1049 #t)))
1050 (add-after 'install-desktop-entry 'install-icons
1051 (lambda* (#:key outputs #:allow-other-keys)
1052 (let ((out (assoc-ref outputs "out")))
1053 (with-directory-excursion "browser/branding/official"
1054 (for-each
1055 (lambda (file)
1056 (let* ((size (string-filter char-numeric? file))
1057 (icons (string-append out "/share/icons/hicolor/"
1058 size "x" size "/apps")))
1059 (mkdir-p icons)
1060 (copy-file file (string-append icons "/icecat.png"))))
1061 '("default16.png" "default22.png" "default24.png"
1062 "default32.png" "default48.png" "content/icon64.png"
1063 "mozicon128.png" "default256.png"))
1064 #t))))
1065 ;; This fixes the file chooser crash that happens with GTK 3.
1066 (add-after 'install 'wrap-program
1067 (lambda* (#:key inputs outputs #:allow-other-keys)
1068 (let* ((out (assoc-ref outputs "out"))
1069 (lib (string-append out "/lib"))
1070 (gtk (assoc-ref inputs "gtk+"))
1071 (gtk-share (string-append gtk "/share"))
1072 (pulseaudio (assoc-ref inputs "pulseaudio"))
1073 (pulseaudio-lib (string-append pulseaudio "/lib")))
1074 (wrap-program (car (find-files lib "^icecat$"))
1075 `("XDG_DATA_DIRS" prefix (,gtk-share))
1076 `("LD_LIBRARY_PATH" prefix (,pulseaudio-lib)))
1077 #t))))))
1078 (home-page "https://www.gnu.org/software/gnuzilla/")
1079 (synopsis "Entirely free browser derived from Mozilla Firefox")
1080 (description
1081 "IceCat is the GNU version of the Firefox browser. It is entirely free
1082 software, which does not recommend non-free plugins and addons. It also
1083 features built-in privacy-protecting features.
1084
1085 WARNING: IceCat 68 has not yet been released by the upstream IceCat project.
1086 This is a preview release, and does not currently meet the privacy-respecting
1087 standards of the IceCat project.")
1088 (license license:mpl2.0) ;and others, see toolkit/content/license.html
1089 (properties
1090 `((ftp-directory . "/gnu/gnuzilla")
1091 (cpe-name . "firefox_esr")
1092 (cpe-version . ,(first (string-split version #\-)))))))
1093
1094 (define-public conkeror
1095 ;; The Conkeror web browser relied on XULRunner, which IceCat > 50 no longer
1096 ;; provides. See <http://conkeror.org> for the original web page.
1097 (deprecated-package "conkeror" icecat))