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