gnu: Add external-program.
[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>
948879ee 4;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 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>
be0f6112
AE
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)
07d4d9b7 30 #:use-module ((srfi srfi-1) #:hide (zip))
1461dd24 31 #:use-module (ice-9 match)
be0f6112 32 #:use-module (gnu packages)
b5b73a82 33 #:use-module ((guix licenses) #:prefix license:)
be0f6112
AE
34 #:use-module (guix packages)
35 #:use-module (guix download)
192a59d0 36 #:use-module (guix git-download)
ad21d767 37 #:use-module (guix hg-download)
948879ee
MW
38 #:use-module (guix gexp)
39 #:use-module (guix store)
40 #:use-module (guix monads)
aaac423c 41 #:use-module (guix utils)
be0f6112 42 #:use-module (guix build-system gnu)
e67ad553 43 #:use-module (guix build-system cargo)
948879ee 44 #:use-module (gnu packages admin)
94e96f7f 45 #:use-module (gnu packages audio)
002c3e6d 46 #:use-module (gnu packages autotools)
bfb48f4f 47 #:use-module (gnu packages base)
948879ee 48 #:use-module (gnu packages bash)
1aaaff1a 49 #:use-module (gnu packages databases)
be0f6112 50 #:use-module (gnu packages glib)
be0f6112 51 #:use-module (gnu packages gtk)
90e1cdae
MW
52 #:use-module (gnu packages gnome)
53 #:use-module (gnu packages libcanberra)
54 #:use-module (gnu packages cups)
89e34644 55 #:use-module (gnu packages kerberos)
be0f6112
AE
56 #:use-module (gnu packages linux)
57 #:use-module (gnu packages perl)
58 #:use-module (gnu packages pkg-config)
1ae6df81 59 #:use-module (gnu packages compression)
74c7af9f 60 #:use-module (gnu packages fontutils)
1ae6df81 61 #:use-module (gnu packages libevent)
90e1cdae 62 #:use-module (gnu packages libreoffice) ;for hunspell
e55354b8 63 #:use-module (gnu packages image)
1ae6df81 64 #:use-module (gnu packages libffi)
74c7af9f 65 #:use-module (gnu packages pulseaudio)
be0f6112 66 #:use-module (gnu packages python)
44d10b1f 67 #:use-module (gnu packages python-xyz)
ad21d767 68 #:use-module (gnu packages node)
be0f6112 69 #:use-module (gnu packages xorg)
200726ed 70 #:use-module (gnu packages gl)
01497dfe 71 #:use-module (gnu packages assembly)
e67ad553 72 #:use-module (gnu packages rust)
c5c48761 73 #:use-module (gnu packages rust-apps)
8d956d86 74 #:use-module (gnu packages llvm)
aff0cce9 75 #:use-module (gnu packages nss)
13b284d9
MW
76 #:use-module (gnu packages icu4c)
77 #:use-module (gnu packages video)
94e96f7f 78 #:use-module (gnu packages xiph)
13b284d9 79 #:use-module (gnu packages xdisorg)
cd0322a3
RW
80 #:use-module (gnu packages readline)
81 #:use-module (gnu packages sqlite))
be0f6112 82
4923e06f
SB
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
68716289 94 "1fig2wf4f10v43mqx67y68z6h77sy900d1w0pz9qarrqx57rc7ij"))
a64b7da5 95 (patches (search-patches "mozjs17-aarch64-support.patch"))
68716289
SB
96 (modules '((guix build utils)))
97 (snippet
98 ;; Fix incompatibility with Perl 5.22+.
6cbee49d
MW
99 '(begin
100 (substitute* '("js/src/config/milestone.pl")
101 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE"))
102 #t))))
4923e06f
SB
103 (build-system gnu-build-system)
104 (native-inputs
f403c676
EF
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)))
4923e06f 112 (arguments
56486b3a
EF
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
a64b7da5 119 ;; This test times out on slower hardware.
e15793c8
MW
120 (lambda _
121 (delete-file "js/src/jit-test/tests/basic/bug698584.js")
122 #t))
56486b3a 123 (add-before 'configure 'chdir
4923e06f 124 (lambda _
56486b3a
EF
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"))
e15793c8
MW
133 (invoke "./configure" (string-append "--prefix=" out)
134 ,@(if (string=? "aarch64-linux"
135 (%current-system))
136 '("--host=aarch64-unknown-linux-gnu")
137 '()))))))))
4923e06f
SB
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
142in C/C++.")
87158e85 143 (license license:mpl2.0))) ; and others for some files
4923e06f 144
cefdcb38
SB
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
68716289
SB
156 "1n1phk8r3l8icqrrap4czplnylawa0ddc2cc4cgdz46x3lrkybz6"))
157 (modules '((guix build utils)))
26f38d31 158 (patches (search-patches "mozjs24-aarch64-support.patch"))
68716289
SB
159 (snippet
160 ;; Fix incompatibility with Perl 5.22+.
6cbee49d
MW
161 '(begin
162 (substitute* '("js/src/config/milestone.pl")
163 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE"))
164 #t))))
cefdcb38 165 (arguments
aaac423c
EF
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"))
6073ef75
MW
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 '())))))))))
cefdcb38
SB
184 (inputs
185 `(("libffi" ,libffi)
186 ("zlib" ,zlib)))))
187
29f381ba
CL
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
747c8f2a 196 "https://anduin.linuxfromscratch.org/BLFS/mozjs/"
29f381ba
CL
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"))
5f70b6d4
MW
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"
29f381ba 261
5f70b6d4
MW
262 ;; Intl API requires bundled ICU.
263 "--without-intl-api")))))))
29f381ba
CL
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
192a59d0
RW
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.
6cc147a3
RW
306 "--without-intl-api"
307
308 ;; Without this gnome-shell will crash at runtime.
309 "--disable-jemalloc")
192a59d0
RW
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
204cfbe1
RW
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
ad21d767
MW
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
bfb48f4f 531(define (mozilla-patch file-name changeset hash)
ae71cd8a 532 "Return an origin for CHANGESET from the mozilla-esr60 repository."
bfb48f4f
MW
533 (origin
534 (method url-fetch)
ae71cd8a 535 (uri (string-append "https://hg.mozilla.org/releases/mozilla-esr60/raw-rev/"
bfb48f4f
MW
536 changeset))
537 (sha256 (base32 hash))
538 (file-name file-name)))
539
948879ee
MW
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
545from forcing GEXP-PROMISE."
546 (mlet %store-monad ((guile (package->derivation guile system)))
547 (gexp->derivation (or name "computed-origin")
548 (force gexp-promise)
2a1ec7bc 549 #:graft? #f ;nothing to graft
948879ee
MW
550 #:system system
551 #:guile-for-build guile)))
552
34369f31
MW
553(define %icecat-version "68.3.0-guix0-preview1")
554(define %icecat-build-id "20191204000000") ;must be of the form YYYYMMDDhhmmss
948879ee
MW
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
34369f31 576 "0sfwp9vyjizj1lkvj6z51r85dl41q3l8380fkdyqdbp7f2d18cg1"))))
948879ee 577
34369f31 578 (upstream-icecat-base-version "68.3.0") ; maybe older than base-version
ad21d767 579 ;;(gnuzilla-commit (string-append "v" upstream-icecat-base-version))
34369f31 580 (gnuzilla-commit "85e99badac11983f6d50b0d9942f66a30f55b8e5")
948879ee
MW
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)))
9b096517
MW
587 (file-name (git-file-name "gnuzilla"
588 ;;upstream-icecat-base-version
589 (string-take gnuzilla-commit 8)))
948879ee
MW
590 (sha256
591 (base32
34369f31 592 "00mb734yvm0r7i64mbg7hvrvhbwkcii9f9hjgwi37aizd9k0n78a"))))
948879ee
MW
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
ad21d767 609 (string-append "icecat-" #$%icecat-version)))
948879ee
MW
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"
3e605b69
MW
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"))
948879ee
MW
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"))
948879ee
MW
655 (("^DATA=.*")
656 "DATA=/tmp/gnuzilla/data\n")
948879ee
MW
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
ad21d767
MW
666 (format #t "Populating l10n directory...~%")
667 (force-output)
05947d92 668 (mkdir "l10n")
ad21d767
MW
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
948879ee
MW
696 (format #t "Running makeicecat script...~%")
697 (force-output)
ad21d767 698 (invoke "bash" "/tmp/gnuzilla/makeicecat"))
948879ee 699
34369f31 700 (format #t "Packing IceCat source tarball...~%")
948879ee
MW
701 (force-output)
702 (invoke "tar" "cfa" #$output
8cf160e1
MW
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
948879ee
MW
709 "--owner=root:0"
710 "--group=root:0"
711 "--sort=name"
712 icecat-dir)
713
714 #t))))))))
715
be0f6112
AE
716(define-public icecat
717 (package
718 (name "icecat")
24886c13 719 (version %icecat-version)
46ce12d0 720 (source icecat-source)
be0f6112
AE
721 (build-system gnu-build-system)
722 (inputs
723 `(("alsa-lib" ,alsa-lib)
1ae6df81 724 ("bzip2" ,bzip2)
90e1cdae 725 ("cups" ,cups)
be0f6112 726 ("dbus-glib" ,dbus-glib)
90e1cdae
MW
727 ("gdk-pixbuf" ,gdk-pixbuf)
728 ("glib" ,glib)
002c3e6d
MW
729 ("gtk+" ,gtk+)
730 ("gtk+-2" ,gtk+-2)
257e3247 731 ("graphite2" ,graphite2)
74c7af9f
MW
732 ("pango" ,pango)
733 ("freetype" ,freetype)
257e3247 734 ("harfbuzz" ,harfbuzz)
90e1cdae
MW
735 ("libcanberra" ,libcanberra)
736 ("libgnome" ,libgnome)
7cba7647 737 ("libjpeg-turbo" ,libjpeg-turbo)
94e96f7f
MW
738 ("libogg" ,libogg)
739 ;; ("libtheora" ,libtheora) ; wants theora-1.2, not yet released
740 ("libvorbis" ,libvorbis)
74c7af9f 741 ("libxft" ,libxft)
94e96f7f 742 ("libevent" ,libevent)
90e1cdae
MW
743 ("libxinerama" ,libxinerama)
744 ("libxscrnsaver" ,libxscrnsaver)
9f7ae77f 745 ("libxcomposite" ,libxcomposite)
be0f6112 746 ("libxt" ,libxt)
1ae6df81 747 ("libffi" ,libffi)
e67ad553 748 ("ffmpeg" ,ffmpeg)
037d5913 749 ("libvpx" ,libvpx-1.7)
13b284d9
MW
750 ("icu4c" ,icu4c)
751 ("pixman" ,pixman)
74c7af9f 752 ("pulseaudio" ,pulseaudio)
be0f6112 753 ("mesa" ,mesa)
90e1cdae 754 ("mit-krb5" ,mit-krb5)
6d328879 755 ;; See <https://bugs.gnu.org/32833>
6c83c483 756 ;; and related comments in the 'remove-bundled-libraries' phase.
6d328879
MW
757 ;; UNBUNDLE-ME! ("nspr" ,nspr)
758 ;; UNBUNDLE-ME! ("nss" ,nss)
9bc79c11 759 ("sqlite" ,sqlite)
90e1cdae 760 ("startup-notification" ,startup-notification)
be0f6112 761 ("unzip" ,unzip)
1ae6df81
LC
762 ("zip" ,zip)
763 ("zlib" ,zlib)))
c4c4cc05 764 (native-inputs
46ce12d0
MW
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').
ad21d767
MW
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"))
46ce12d0
MW
776
777 ("patch" ,(canonical-package patch))
778
ad21d767
MW
779 ("rust" ,rust)
780 ("cargo" ,rust "cargo")
781 ("rust-cbindgen" ,rust-cbindgen)
782 ("llvm" ,llvm)
783 ("clang" ,clang)
e67ad553 784 ("perl" ,perl)
ad21d767
MW
785 ("node" ,node)
786 ("python" ,python)
787 ("python-2" ,python-2)
c4c4cc05 788 ("python2-pysqlite" ,python2-pysqlite)
002c3e6d 789 ("yasm" ,yasm)
ad21d767 790 ("nasm" ,nasm) ; XXX FIXME: only needed on x86_64 and i686
bfb48f4f 791 ("pkg-config" ,pkg-config)
002c3e6d 792 ("autoconf" ,autoconf-2.13)
bfb48f4f 793 ("which" ,which)))
be0f6112 794 (arguments
74c7af9f
MW
795 `(#:tests? #f ; no check target
796 #:out-of-source? #t ; must be built outside of the source directory
73b1b4eb
LC
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
8d956d86 804 #:configure-flags `("--enable-default-toolkit=cairo-gtk3"
9502ea3e
MW
805
806 "--with-distribution-id=org.gnu"
807
34369f31
MW
808 ;; Do not require addons in the global app
809 ;; directory to be signed by Mozilla.
810 "--with-unsigned-addon-scopes=app"
811
90e1cdae
MW
812 "--enable-startup-notification"
813 "--enable-pulseaudio"
90e1cdae 814
9502ea3e
MW
815 "--disable-tests"
816 "--disable-updater"
817 "--disable-crashreporter"
9502ea3e 818 "--disable-eme"
90e1cdae 819 "--disable-gconf"
e67ad553 820
90e1cdae 821 ;; Building with debugging symbols takes ~5GiB, so
1ae6df81
LC
822 ;; disable it.
823 "--disable-debug"
824 "--disable-debug-symbols"
825
8d956d86
MW
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
5bdec7d6
MW
840 ;; Hack to work around missing
841 ;; "unofficial" branding in icecat.
bfb48f4f
MW
842 "--enable-official-branding"
843
90e1cdae 844 ;; Avoid bundled libraries.
1ae6df81 845 "--with-system-zlib"
90e1cdae 846 "--with-system-bz2"
7cba7647 847 "--with-system-jpeg" ; must be libjpeg-turbo
ad21d767
MW
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"
483ab08f 853 "--with-system-icu"
6d328879
MW
854
855 ;; See <https://bugs.gnu.org/32833>
6c83c483
MW
856 ;; and related comments in the
857 ;; 'remove-bundled-libraries' phase below.
6d328879
MW
858 ;; UNBUNDLE-ME! "--with-system-nspr"
859 ;; UNBUNDLE-ME! "--with-system-nss"
860
ad21d767
MW
861 ;; UNBUNDLE-ME! "--with-system-harfbuzz"
862 ;; UNBUNDLE-ME! "--with-system-graphite2"
13b284d9 863 "--enable-system-pixman"
5b17fabc 864 "--enable-system-ffi"
ad21d767 865 ;; UNBUNDLE-ME! "--enable-system-sqlite"
1ae6df81 866
98a046cd
AE
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.
1ae6df81 875 ;; "--with-system-png"
5b17fabc 876 )
1ae6df81 877
e80a4479 878 #:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums'
7d141788 879
9f7ae77f 880 #:modules ((ice-9 ftw)
6cde5c34
LC
881 (ice-9 rdelim)
882 (ice-9 match)
ad21d767
MW
883 (srfi srfi-34)
884 (srfi srfi-35)
9f7ae77f 885 ,@%gnu-build-system-modules)
be0f6112 886 #:phases
90e1cdae 887 (modify-phases %standard-phases
46ce12d0
MW
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"
ad21d767
MW
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"
46ce12d0 948 "js/src/ctypes/libffi"
ad21d767
MW
949 ;; UNBUNDLE-ME! "db/sqlite3"
950 ))
46ce12d0
MW
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 += [
9f7ae77f 963 'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5',
002c3e6d 964 'avcodec', 'avutil', 'pulse' ]\n\n"
46ce12d0
MW
965 all)))
966 #t))
8e556719
JL
967 (add-after 'link-libxul-with-libraries 'fix-ffmpeg-runtime-linker
968 (lambda* (#:key inputs #:allow-other-keys)
969 ;; Arrange to load libavcodec.so by its absolute file name.
970 (substitute* "dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp"
971 (("libavcodec\\.so")
972 (string-append (assoc-ref inputs "ffmpeg") "/lib/libavcodec.so")))
973 #t))
94e96f7f
MW
974 (replace 'bootstrap
975 (lambda _
46ce12d0
MW
976 (invoke "sh" "-c" "autoconf old-configure.in > old-configure")
977 ;; 'configure' must be newer than 'old-configure.in', or else the
978 ;; build system will raise an alarm and abort.
979 (invoke "touch" "configure")))
e67ad553 980 (add-after 'patch-source-shebangs 'patch-cargo-checksums
257e3247 981 (lambda _
7d141788 982 (use-modules (guix build cargo-utils))
e88735b4 983 (let ((null-hash "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))
ad21d767 984 (substitute* '("Cargo.lock" "gfx/wr/Cargo.lock")
e67ad553
MW
985 (("(\"checksum .* = )\".*\"" all name)
986 (string-append name "\"" null-hash "\"")))
e80a4479 987 (generate-all-checksums "third_party/rust"))
e67ad553 988 #t))
8d956d86
MW
989 (add-before 'configure 'augment-CPLUS_INCLUDE_PATH
990 (lambda* (#:key build inputs #:allow-other-keys)
991 ;; Here, we add additional entries to CPLUS_INCLUDE_PATH, to work
992 ;; around a problem that otherwise occurs when attempting to
993 ;; build Stylo, which requires Rust and Clang. Without these
994 ;; additional entries, errors occur during the build indicating
995 ;; that the <cstddef> and "c++config.h" headers cannot be found.
996 ;; Note that the 'build' keyword argument contains the GNU
997 ;; triplet, e.g. "x86_64-unknown-linux-gnu".
998 (let ((gcc (assoc-ref inputs "gcc")))
999 (setenv "CPLUS_INCLUDE_PATH"
1000 (string-append gcc "/include/c++" ":"
8b3dc667 1001 gcc "/include/c++/" build)))
46ce12d0
MW
1002 #t))
1003 (replace 'configure
1004 ;; configure does not work followed by both "SHELL=..." and
1005 ;; "CONFIG_SHELL=..."; set environment variables instead
1006 (lambda* (#:key outputs configure-flags #:allow-other-keys)
1007 (let* ((out (assoc-ref outputs "out"))
1008 (bash (which "bash"))
1009 (abs-srcdir (getcwd))
1010 (srcdir (string-append "../" (basename abs-srcdir)))
1011 (flags `(,(string-append "--prefix=" out)
1012 ,(string-append "--with-l10n-base="
1013 abs-srcdir "/l10n")
1014 ,@configure-flags)))
1015 (setenv "SHELL" bash)
1016 (setenv "CONFIG_SHELL" bash)
1017 (setenv "AUTOCONF" (which "autoconf")) ; must be autoconf-2.13
1018 (setenv "CC" "gcc") ; apparently needed when Stylo is enabled
7a1b2ba5 1019 (setenv "MOZ_BUILD_DATE" ,%icecat-build-id) ; avoid timestamp
46ce12d0
MW
1020 (mkdir "../build")
1021 (chdir "../build")
1022 (format #t "build directory: ~s~%" (getcwd))
1023 (format #t "configure flags: ~s~%" flags)
1024 (apply invoke bash
1025 (string-append srcdir "/configure")
1026 flags))))
ad21d767
MW
1027 (replace 'build
1028 ;; The build system often spuriously fails. See
1029 ;; <https://bugs.gentoo.org/show_bug.cgi?id=680934>. To
1030 ;; work around this, we try the standard 'build' phase up
1031 ;; to 5 times.
1032 (lambda args
1033 (let ((build (assoc-ref %standard-phases 'build)))
1034 (let retry ((remaining-attempts 5))
1035 (if (= remaining-attempts 1)
1036 (apply build args)
1037 (guard (c ((invoke-error? c)
1038 (format #t "~%Retrying build! (~a attempts remaining)~%~%"
1039 (- remaining-attempts 1))
1040 (force-output)
1041 (retry (- remaining-attempts 1))))
1042 (apply build args)))))))
6cde5c34
LC
1043 (add-before 'configure 'install-desktop-entry
1044 (lambda* (#:key outputs #:allow-other-keys)
1045 ;; Install the '.desktop' file.
05947d92
MW
1046 (let* ((desktop-file "taskcluster/docker/icecat-snap/icecat.desktop")
1047 (out (assoc-ref outputs "out"))
6cde5c34 1048 (applications (string-append out "/share/applications")))
05947d92
MW
1049 (substitute* desktop-file
1050 (("^Exec=icecat") (string-append "Exec=" out "/bin/icecat"))
1051 (("IceCat") "GNU IceCat")
1052 (("Icon=.*") "Icon=icecat\n")
1053 (("NewWindow") "new-window")
1054 (("NewPrivateWindow") "new-private-window"))
1055 (install-file desktop-file applications)
88a8ce87
AG
1056 #t)))
1057 (add-after 'install-desktop-entry 'install-icons
1058 (lambda* (#:key outputs #:allow-other-keys)
1059 (let ((out (assoc-ref outputs "out")))
1060 (with-directory-excursion "browser/branding/official"
1061 (for-each
1062 (lambda (file)
1063 (let* ((size (string-filter char-numeric? file))
1064 (icons (string-append out "/share/icons/hicolor/"
1065 size "x" size "/apps")))
1066 (mkdir-p icons)
1067 (copy-file file (string-append icons "/icecat.png"))))
1068 '("default16.png" "default22.png" "default24.png"
1069 "default32.png" "default48.png" "content/icon64.png"
3f27124e
MW
1070 "mozicon128.png" "default256.png"))
1071 #t))))
6e75740f
CL
1072 ;; This fixes the file chooser crash that happens with GTK 3.
1073 (add-after 'install 'wrap-program
1074 (lambda* (#:key inputs outputs #:allow-other-keys)
1075 (let* ((out (assoc-ref outputs "out"))
1076 (lib (string-append out "/lib"))
1077 (gtk (assoc-ref inputs "gtk+"))
ad21d767
MW
1078 (gtk-share (string-append gtk "/share"))
1079 (pulseaudio (assoc-ref inputs "pulseaudio"))
1080 (pulseaudio-lib (string-append pulseaudio "/lib")))
6e75740f 1081 (wrap-program (car (find-files lib "^icecat$"))
ad21d767 1082 `("XDG_DATA_DIRS" prefix (,gtk-share))
a0619360 1083 `("LD_LIBRARY_PATH" prefix (,pulseaudio-lib)))
3f27124e 1084 #t))))))
6fd52309 1085 (home-page "https://www.gnu.org/software/gnuzilla/")
be0f6112
AE
1086 (synopsis "Entirely free browser derived from Mozilla Firefox")
1087 (description
1088 "IceCat is the GNU version of the Firefox browser. It is entirely free
c5779c93 1089software, which does not recommend non-free plugins and addons. It also
ad21d767
MW
1090features built-in privacy-protecting features.
1091
1092WARNING: IceCat 68 has not yet been released by the upstream IceCat project.
1093This is a preview release, and does not currently meet the privacy-respecting
1094standards of the IceCat project.")
63e8bb12 1095 (license license:mpl2.0) ;and others, see toolkit/content/license.html
99effc8f
LC
1096 (properties
1097 `((ftp-directory . "/gnu/gnuzilla")
1098 (cpe-name . "firefox_esr")
bfb48f4f 1099 (cpe-version . ,(first (string-split version #\-)))))))
f5301f00
LC
1100
1101(define-public conkeror
1102 ;; The Conkeror web browser relied on XULRunner, which IceCat > 50 no longer
1103 ;; provides. See <http://conkeror.org> for the original web page.
1104 (deprecated-package "conkeror" icecat))