gnu: mozjs@24: Use invoke.
[jackhill/guix/guix.git] / gnu / packages / gnuzilla.scm
CommitLineData
be0f6112 1;;; GNU Guix --- Functional package management for GNU
5deea4fc 2;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
1b321229 3;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
c1c2e1d7 4;;; Copyright © 2014, 2015, 2016, 2017, 2018 Mark H Weaver <mhw@netris.org>
1aaaff1a 5;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
1461dd24 6;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
88a8ce87 7;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
8db94716 8;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
4a78fd46 9;;; Copyright © 2017 Nils Gillmann <ng0@n0.is>
71a96ecb 10;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
be0f6112
AE
11;;;
12;;; This file is part of GNU Guix.
13;;;
14;;; GNU Guix is free software; you can redistribute it and/or modify it
15;;; under the terms of the GNU General Public License as published by
16;;; the Free Software Foundation; either version 3 of the License, or (at
17;;; your option) any later version.
18;;;
19;;; GNU Guix is distributed in the hope that it will be useful, but
20;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22;;; GNU General Public License for more details.
23;;;
24;;; You should have received a copy of the GNU General Public License
25;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27(define-module (gnu packages gnuzilla)
07d4d9b7 28 #:use-module ((srfi srfi-1) #:hide (zip))
1461dd24 29 #:use-module (ice-9 match)
be0f6112 30 #:use-module (gnu packages)
b5b73a82 31 #:use-module ((guix licenses) #:prefix license:)
be0f6112
AE
32 #:use-module (guix packages)
33 #:use-module (guix download)
aaac423c 34 #:use-module (guix utils)
be0f6112 35 #:use-module (guix build-system gnu)
002c3e6d 36 #:use-module (gnu packages autotools)
bfb48f4f 37 #:use-module (gnu packages base)
1aaaff1a 38 #:use-module (gnu packages databases)
be0f6112 39 #:use-module (gnu packages glib)
be0f6112 40 #:use-module (gnu packages gtk)
90e1cdae
MW
41 #:use-module (gnu packages gnome)
42 #:use-module (gnu packages libcanberra)
43 #:use-module (gnu packages cups)
89e34644 44 #:use-module (gnu packages kerberos)
be0f6112
AE
45 #:use-module (gnu packages linux)
46 #:use-module (gnu packages perl)
47 #:use-module (gnu packages pkg-config)
1ae6df81 48 #:use-module (gnu packages compression)
74c7af9f 49 #:use-module (gnu packages fontutils)
1ae6df81 50 #:use-module (gnu packages libevent)
90e1cdae 51 #:use-module (gnu packages libreoffice) ;for hunspell
e55354b8 52 #:use-module (gnu packages image)
1ae6df81 53 #:use-module (gnu packages libffi)
74c7af9f 54 #:use-module (gnu packages pulseaudio)
be0f6112
AE
55 #:use-module (gnu packages python)
56 #:use-module (gnu packages xorg)
200726ed 57 #:use-module (gnu packages gl)
01497dfe 58 #:use-module (gnu packages assembly)
13b284d9
MW
59 #:use-module (gnu packages icu4c)
60 #:use-module (gnu packages video)
61 #:use-module (gnu packages xdisorg)
29f381ba 62 #:use-module (gnu packages readline))
be0f6112 63
4923e06f
SB
64(define-public mozjs
65 (package
66 (name "mozjs")
67 (version "17.0.0")
68 (source (origin
69 (method url-fetch)
70 (uri (string-append
71 "https://ftp.mozilla.org/pub/mozilla.org/js/"
72 name version ".tar.gz"))
73 (sha256
74 (base32
68716289 75 "1fig2wf4f10v43mqx67y68z6h77sy900d1w0pz9qarrqx57rc7ij"))
a64b7da5 76 (patches (search-patches "mozjs17-aarch64-support.patch"))
68716289
SB
77 (modules '((guix build utils)))
78 (snippet
79 ;; Fix incompatibility with Perl 5.22+.
6cbee49d
MW
80 '(begin
81 (substitute* '("js/src/config/milestone.pl")
82 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE"))
83 #t))))
4923e06f
SB
84 (build-system gnu-build-system)
85 (native-inputs
f403c676
EF
86 `(("perl" ,perl)
87 ("pkg-config" ,pkg-config)
88 ("python" ,python-2)))
89 (propagated-inputs
90 `(("nspr" ,nspr))) ; in the Requires.private field of mozjs-17.0.pc
91 (inputs
92 `(("zlib" ,zlib)))
4923e06f 93 (arguments
56486b3a
EF
94 `(;; XXX: parallel build fails, lacking:
95 ;; mkdir -p "system_wrapper_js/"
96 #:parallel-build? #f
97 #:phases
98 (modify-phases %standard-phases
99 (add-after 'unpack 'delete-timedout-test
a64b7da5 100 ;; This test times out on slower hardware.
e15793c8
MW
101 (lambda _
102 (delete-file "js/src/jit-test/tests/basic/bug698584.js")
103 #t))
56486b3a 104 (add-before 'configure 'chdir
4923e06f 105 (lambda _
56486b3a
EF
106 (chdir "js/src")
107 #t))
108 (replace 'configure
109 ;; configure fails if it is followed by SHELL and CONFIG_SHELL
110 (lambda* (#:key outputs #:allow-other-keys)
111 (let ((out (assoc-ref outputs "out")))
112 (setenv "SHELL" (which "sh"))
113 (setenv "CONFIG_SHELL" (which "sh"))
e15793c8
MW
114 (invoke "./configure" (string-append "--prefix=" out)
115 ,@(if (string=? "aarch64-linux"
116 (%current-system))
117 '("--host=aarch64-unknown-linux-gnu")
118 '()))))))))
4923e06f
SB
119 (home-page
120 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey")
121 (synopsis "Mozilla javascript engine")
122 (description "SpiderMonkey is Mozilla's JavaScript engine written
123in C/C++.")
87158e85 124 (license license:mpl2.0))) ; and others for some files
4923e06f 125
cefdcb38
SB
126(define-public mozjs-24
127 (package (inherit mozjs)
128 (name "mozjs")
129 (version "24.2.0")
130 (source (origin
131 (method url-fetch)
132 (uri (string-append
133 "https://ftp.mozilla.org/pub/mozilla.org/js/"
134 name "-" version ".tar.bz2"))
135 (sha256
136 (base32
68716289
SB
137 "1n1phk8r3l8icqrrap4czplnylawa0ddc2cc4cgdz46x3lrkybz6"))
138 (modules '((guix build utils)))
26f38d31 139 (patches (search-patches "mozjs24-aarch64-support.patch"))
68716289
SB
140 (snippet
141 ;; Fix incompatibility with Perl 5.22+.
6cbee49d
MW
142 '(begin
143 (substitute* '("js/src/config/milestone.pl")
144 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE"))
145 #t))))
cefdcb38 146 (arguments
aaac423c
EF
147 (substitute-keyword-arguments (package-arguments mozjs)
148 ((#:phases phases)
149 `(modify-phases ,phases
150 (replace 'configure
151 (lambda* (#:key outputs #:allow-other-keys)
152 (let ((out (assoc-ref outputs "out")))
153 ;; configure fails if it is followed by SHELL and CONFIG_SHELL
154 (setenv "SHELL" (which "sh"))
155 (setenv "CONFIG_SHELL" (which "sh"))
6073ef75
MW
156 (invoke "./configure"
157 (string-append "--prefix=" out)
158 "--with-system-nspr"
159 "--enable-system-ffi"
160 "--enable-threadsafe"
161 ,@(if (string=? "aarch64-linux"
162 (%current-system))
163 '("--host=aarch64-unknown-linux-gnu")
164 '())))))))))
cefdcb38
SB
165 (inputs
166 `(("libffi" ,libffi)
167 ("zlib" ,zlib)))))
168
29f381ba
CL
169(define-public mozjs-38
170 (package
171 (inherit mozjs)
172 (name "mozjs")
173 (version "38.2.1.rc0")
174 (source (origin
175 (method url-fetch)
176 (uri (string-append
177 "https://people.mozilla.org/~sstangl/"
178 name "-" version ".tar.bz2"))
179 (sha256
180 (base32
181 "0p4bmbpgkfsj54xschcny0a118jdrdgg0q29rwxigg3lh5slr681"))
182 (patches
183 (search-patches
184 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1269317 for
185 ;; GCC 6 compatibility.
186
187 "mozjs38-version-detection.patch" ; for 0ad
188 "mozjs38-tracelogger.patch"
189
190 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1339931.
191 "mozjs38-pkg-config-version.patch"
192 "mozjs38-shell-version.patch"))
193 (modules '((guix build utils)))
194 (snippet
195 '(begin
196 ;; Fix incompatibility with sed 4.4.
197 (substitute* "js/src/configure"
198 (("\\^\\[:space:\\]") "^[[:space:]]"))
199
200 ;; The headers are symlinks to files that are in /tmp, so they
201 ;; end up broken. Copy them instead.
202 (substitute*
203 "python/mozbuild/mozbuild/backend/recursivemake.py"
204 (("\\['dist_include'\\].add_symlink")
205 "['dist_include'].add_copy"))
206
207 ;; Remove bundled libraries.
208 (for-each delete-file-recursively
209 '("intl"
210 "js/src/ctypes/libffi"
211 "js/src/ctypes/libffi-patches"
212 "modules/zlib"))
213 #t))))
214 (arguments
215 `(;; XXX: parallel build fails, lacking:
216 ;; mkdir -p "system_wrapper_js/"
217 #:parallel-build? #f
218 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1008470.
219 #:tests? #f
220 #:phases
221 (modify-phases %standard-phases
222 (replace 'configure
223 (lambda* (#:key outputs #:allow-other-keys)
224 (let ((out (assoc-ref outputs "out")))
225 (chdir "js/src")
226 (setenv "SHELL" (which "sh"))
227 (setenv "CONFIG_SHELL" (which "sh"))
228 (zero? (system* "./configure"
229 (string-append "--prefix=" out)
230 "--enable-ctypes"
231 "--enable-gcgenerational"
232 "--enable-optimize"
233 "--enable-pie"
234 "--enable-readline"
235 "--enable-shared-js"
236 "--enable-system-ffi"
237 "--enable-threadsafe"
238 "--enable-xterm-updates"
239 "--with-system-icu"
240 "--with-system-nspr"
241 "--with-system-zlib"
242
243 ;; Intl API requires bundled ICU.
244 "--without-intl-api"))))))))
245 (native-inputs
246 `(("perl" ,perl)
247 ("pkg-config" ,pkg-config)
248 ("python-2" ,python-2)))
249 (inputs
250 `(("libffi" ,libffi)
251 ("readline" ,readline)
252 ("icu4c" ,icu4c)
253 ("zlib" ,zlib)))))
254
4923e06f
SB
255(define-public nspr
256 (package
257 (name "nspr")
ddc162af 258 (version "4.19")
4923e06f
SB
259 (source (origin
260 (method url-fetch)
261 (uri (string-append
262 "https://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v"
263 version "/src/nspr-" version ".tar.gz"))
264 (sha256
265 (base32
ddc162af 266 "0agpv3f17h8kmzi0ifibaaxc1k3xc0q61wqw3l6r2xr2z8bmkn9f"))))
4923e06f
SB
267 (build-system gnu-build-system)
268 (native-inputs
84fb4bd9 269 `(("perl" ,perl)))
4923e06f 270 (arguments
8550894b
LC
271 `(#:tests? #f ; no check target
272 #:configure-flags (list "--enable-64bit"
273 (string-append "LDFLAGS=-Wl,-rpath="
274 (assoc-ref %outputs "out")
275 "/lib"))
6d7786ff
MB
276 ;; Use fixed timestamps for reproducibility.
277 #:make-flags '("SH_DATE='1970-01-01 00:00:01'"
278 ;; This is epoch 1 in microseconds.
279 "SH_NOW=100000")
04952bd7
EF
280 #:phases (modify-phases %standard-phases
281 (add-before 'configure 'chdir
282 (lambda _ (chdir "nspr") #t)))))
4923e06f
SB
283 (home-page
284 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR")
285 (synopsis "Netscape API for system level and libc-like functions")
a440a6af 286 (description "Netscape Portable Runtime (@dfn{NSPR}) provides a
4923e06f
SB
287platform-neutral API for system level and libc-like functions. It is used
288in the Mozilla clients.")
289 (license license:mpl2.0)))
290
1aaaff1a
SB
291(define-public nss
292 (package
293 (name "nss")
9fcec717 294 (version "3.36")
1aaaff1a
SB
295 (source (origin
296 (method url-fetch)
2bb9b5de
MW
297 (uri (let ((version-with-underscores
298 (string-join (string-split version #\.) "_")))
299 (string-append
fe88f636 300 "https://ftp.mozilla.org/pub/mozilla.org/security/nss/"
2bb9b5de
MW
301 "releases/NSS_" version-with-underscores "_RTM/src/"
302 "nss-" version ".tar.gz")))
1aaaff1a
SB
303 (sha256
304 (base32
9fcec717 305 "1580qc0a4s8v3k3vg7zz4xly4alkjrw7qq9zy2nf6p4v56wcfg53"))
1aaaff1a 306 ;; Create nss.pc and nss-config.
d027b001
MB
307 (patches (search-patches "nss-pkgconfig.patch"
308 "nss-increase-test-timeout.patch"))))
1aaaff1a
SB
309 (build-system gnu-build-system)
310 (outputs '("out" "bin"))
311 (arguments
1461dd24 312 `(#:parallel-build? #f ; not supported
1aaaff1a
SB
313 #:make-flags
314 (let* ((out (assoc-ref %outputs "out"))
315 (nspr (string-append (assoc-ref %build-inputs "nspr")))
316 (rpath (string-append "-Wl,-rpath=" out "/lib/nss")))
317 (list "-C" "nss" (string-append "PREFIX=" out)
318 "NSDISTMODE=copy"
319 "NSS_USE_SYSTEM_SQLITE=1"
320 (string-append "NSPR_INCLUDE_DIR=" nspr "/include/nspr")
321 ;; Add $out/lib/nss to RPATH.
322 (string-append "RPATH=" rpath)
323 (string-append "LDFLAGS=" rpath)))
324 #:modules ((guix build gnu-build-system)
325 (guix build utils)
326 (ice-9 ftw)
327 (ice-9 match)
328 (srfi srfi-26))
1aaaff1a 329 #:phases
db3c06d5
MB
330 (modify-phases %standard-phases
331 (replace 'configure
1461dd24 332 (lambda _
db3c06d5
MB
333 (setenv "CC" "gcc")
334 ;; Tells NSS to build for the 64-bit ABI if we are 64-bit system.
1461dd24
MB
335 ,@(match (%current-system)
336 ((or "x86_64-linux" "aarch64-linux")
337 `((setenv "USE_64" "1")))
338 (_
339 '()))
db3c06d5
MB
340 #t))
341 (replace 'check
342 (lambda _
343 ;; Use 127.0.0.1 instead of $HOST.$DOMSUF as HOSTADDR for testing.
344 ;; The later requires a working DNS or /etc/hosts.
345 (setenv "DOMSUF" "(none)")
346 (setenv "USE_IP" "TRUE")
347 (setenv "IP_ADDRESS" "127.0.0.1")
348 (zero? (system* "./nss/tests/all.sh"))))
349 (replace 'install
350 (lambda* (#:key outputs #:allow-other-keys)
351 (let* ((out (assoc-ref outputs "out"))
352 (bin (string-append (assoc-ref outputs "bin") "/bin"))
353 (inc (string-append out "/include/nss"))
354 (lib (string-append out "/lib/nss"))
355 (obj (match (scandir "dist" (cut string-suffix? "OBJ" <>))
356 ((obj) (string-append "dist/" obj)))))
357 ;; Install nss-config to $out/bin.
358 (install-file (string-append obj "/bin/nss-config")
359 (string-append out "/bin"))
360 (delete-file (string-append obj "/bin/nss-config"))
361 ;; Install nss.pc to $out/lib/pkgconfig.
362 (install-file (string-append obj "/lib/pkgconfig/nss.pc")
363 (string-append out "/lib/pkgconfig"))
364 (delete-file (string-append obj "/lib/pkgconfig/nss.pc"))
365 (rmdir (string-append obj "/lib/pkgconfig"))
366 ;; Install other files.
367 (copy-recursively "dist/public/nss" inc)
368 (copy-recursively (string-append obj "/bin") bin)
369 (copy-recursively (string-append obj "/lib") lib)
3161f6a4 370
db3c06d5
MB
371 ;; FIXME: libgtest1.so is installed in the above step, and it's
372 ;; (unnecessarily) linked with several NSS libraries, but
373 ;; without the needed rpaths, causing the 'validate-runpath'
374 ;; phase to fail. Here we simply delete libgtest1.so, since it
375 ;; seems to be used only during the tests.
376 (delete-file (string-append lib "/libgtest1.so"))
bd512249 377 (delete-file (string-append lib "/libgtestutil.so"))
3161f6a4 378
db3c06d5 379 #t))))))
1aaaff1a
SB
380 (inputs
381 `(("sqlite" ,sqlite)
382 ("zlib" ,zlib)))
383 (propagated-inputs `(("nspr" ,nspr))) ; required by nss.pc.
384 (native-inputs `(("perl" ,perl)))
86e3e370 385
e9b718a0
MW
386 ;; The NSS test suite takes around 48 hours on Loongson 3A (MIPS) when
387 ;; another build is happening concurrently on the same machine.
388 (properties '((timeout . 216000))) ; 60 hours
86e3e370 389
1aaaff1a
SB
390 (home-page
391 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS")
392 (synopsis "Network Security Services")
393 (description
e26e55c8
TGR
394 "Network Security Services (@dfn{NSS}) is a set of libraries designed to
395support cross-platform development of security-enabled client and server
396applications. Applications built with NSS can support SSL v2 and v3, TLS,
397PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509 v3 certificates, and other
398security standards.")
1aaaff1a
SB
399 (license license:mpl2.0)))
400
bfb48f4f 401(define (mozilla-patch file-name changeset hash)
002c3e6d 402 "Return an origin for CHANGESET from the mozilla-esr52 repository."
bfb48f4f
MW
403 (origin
404 (method url-fetch)
002c3e6d 405 (uri (string-append "https://hg.mozilla.org/releases/mozilla-esr52/raw-rev/"
bfb48f4f
MW
406 changeset))
407 (sha256 (base32 hash))
408 (file-name file-name)))
409
be0f6112
AE
410(define-public icecat
411 (package
412 (name "icecat")
8863f2f0 413 (version "52.6.0-gnu1")
be0f6112
AE
414 (source
415 (origin
416 (method url-fetch)
5bdec7d6
MW
417 (uri (string-append "mirror://gnu/gnuzilla/"
418 (first (string-split version #\-))
419 "/" name "-" version ".tar.bz2"))
be0f6112
AE
420 (sha256
421 (base32
8863f2f0 422 "09fn54glqg1aa93hnz5zdcy07cps09dbni2b4200azh6nang630a"))
bfb48f4f 423 (patches
5bdec7d6
MW
424 (list
425 (search-patch "icecat-avoid-bundled-libraries.patch")
110afdde
MW
426 (search-patch "icecat-use-system-harfbuzz.patch")
427 (search-patch "icecat-use-system-graphite2.patch")
3c7c9161
MW
428 (mozilla-patch "icecat-bug-546387.patch" "d13e3fefb76e" "1b760r0bg2ydbl585wlmajljh1nlisrwxvjws5b28a3sgjy01i6k")
429 (mozilla-patch "icecat-bug-1350152.patch" "f822bda79c28" "1wf56169ca874shr6r7qx40s17h2gwj7ngmpyylrpmd1c6hipvsj")
e8e860a5 430 (mozilla-patch "icecat-bug-1411708.patch" "34c968767eb7" "0l2jy201ikj3m3h66mvlsj4y0ki7cpm7x7nnfygbwnfxg42s1sip")
c5971d47 431 (mozilla-patch "icecat-bug-1375217.patch" "00fc630c9a46" "17pcprp452nslk6sac6sili0p74zh8w3g0v1wsdn0ikm9xmnphhv")
a76c2057
MW
432 (mozilla-patch "icecat-CVE-2018-5145.patch" "f0ec180993d2" "0jiazxcwki83wr00fyh2g518ynsd33p7nk65zk4d1682gn22lc8v")
433 (mozilla-patch "icecat-CVE-2018-5130.patch" "a6a9e26688c1" "0cvizvilb4k422j2gzqcbakznvsffmk6n6xn1ayj5rgxfaizkkqk")
434 (mozilla-patch "icecat-CVE-2018-5125-pt1.patch" "198ad052621e" "1721zx8hifdlflrhvw6hmkdgjbvsmxl9n84iji5qywhlp2krdk9r")
99654a16
MW
435 (mozilla-patch "icecat-bug-1426087.patch" "391ea77ebfdb" "1fhkvd0z6mvdkj7m0d3jlj42rsdw5r4x122c1wb1i428228ifw6n")
436 (mozilla-patch "icecat-bug-1416307.patch" "54f2f7f93b30" "1ncjir16mqya37wgf6fy2rqki3vl433c4grjr3fypmlig6xfgg1l")
a76c2057
MW
437 (mozilla-patch "icecat-CVE-2018-5127.patch" "2c4d7a59041b" "178c6gid89cvw52yqs43i6x6s5w0hslj0rfa2r8b4762ij3civ92")
438 (mozilla-patch "icecat-CVE-2018-5125-pt2.patch" "f87ef3774d5e" "0payf3az2w93nzl5qknqx290jbxk8v39rwhdgq7wyd5f245dywxk")
439 (mozilla-patch "icecat-CVE-2018-5125-pt3.patch" "ac743923f81d" "0msyr45xr1j5q4x6ah4r907pwjngyi0k6pp9y8ixk21cnwbzrdwx")
440 (mozilla-patch "icecat-CVE-2018-5129.patch" "456913d7e8b5" "0fx0s06kxxj7g4hllinaskgh41z3k48zml6yqqzxx485qk3hdh9x")
99654a16
MW
441 (mozilla-patch "icecat-bug-1334465-pt1.patch" "f95c5b881442" "0iaddhf65jd9cycj4bw0b207n2jiqkr4q84jifzyqn4ygs75wdqd")
442 (mozilla-patch "icecat-bug-1334465-pt2.patch" "8a4265c8fb41" "1d9zfdbrlw9wzr84b7pj7lxgy487lsx0kfd89287hjk0al8m6vrw")
443 (mozilla-patch "icecat-bug-1398021.patch" "28855df568d8" "1kmq836gniplxpjnvq8lhbcc1aqi56al628r1mzdy94b5yb0lis3")
444 (mozilla-patch "icecat-bug-1388020.patch" "e8ab2736499b" "0n28vcd65rxsyq3z22rfcfksryfndhm1i3g6ah3akg11jnagqf5v")
a76c2057
MW
445 (mozilla-patch "icecat-CVE-2018-5125-pt4.patch" "014877bf17ea" "0hk90pnf7h7kvidji6ydvva1zpyraipn03pjhvprdqr7k2fqzmsz")
446 (mozilla-patch "icecat-CVE-2018-5125-pt5.patch" "5b3a5de48912" "1ifya05rcd34ryp9zawdacihhkkf2m0xn2q8m8c6v78bvxj0mgig")
447 (mozilla-patch "icecat-CVE-2018-5144.patch" "1df9b4404acd" "1sd59vsarfsbh3vlrzrqv6n1ni7vxdzm83j6s6g0fygl1h8kwijg")
99654a16 448 (mozilla-patch "icecat-bug-1430173-pt1.patch" "9124c3972e2b" "13ns5yy39yzfx7lrkv4rgwdz6s6q0z4i09wkbxdvnkfsz17cd17i")
3328132b
MW
449 (mozilla-patch "icecat-bug-1430173-pt2.patch" "9f6dc031be51" "0bv2p98z5ahp3x9wxnhwxn87g21djvzzp7jy55ik90hqixsbhwdl")
450 (mozilla-patch "icecat-CVE-2018-5131.patch" "3102fbb97b32" "0kg0183v92gxjb9255xjwhxyd6gl77l9c0civx3040k975fybwlp")
451 (mozilla-patch "icecat-CVE-2018-5125-pt6.patch" "4904c0f4a645" "0lsq62ynksy1fbw0m87f1d741fyvrrp1vrznx5hx0l2p4g4frhv3")
452 (mozilla-patch "icecat-CVE-2018-5125-pt7.patch" "16b8073d5c30" "1dv94qqah1wjd3bxjvrkmjbb2f95d3d11zpm8mggdk52il575bwl")
453 (mozilla-patch "icecat-bug-1442127-pt1.patch" "f931f85b09da" "02s380w8a73g4w2wm810lbigh4z4rrlfy10ywwhv4lpkbk8xg7pr")
454 (mozilla-patch "icecat-bug-1442127-pt2.patch" "da5792b70f30" "116k9qja5ir9b3laazasp43f5jx59qq72nknmq5bn5v1ixya9r4l")
455 (mozilla-patch "icecat-CVE-2018-5125-pt8.patch" "62b831df8269" "109pn0hqn7s27580glv4z7qv1pmjzii9szvf3wkn97k5wybrzgkx")
456 (mozilla-patch "icecat-bug-1442504.patch" "8954ce68a364" "0bl65zw82bwqg0mmcri94pxqq6ibff7y5rclkzapb081p6yvf73q")
cc4c8a57
MW
457 (mozilla-patch "icecat-CVE-2018-5125-pt9.patch" "8a16f439117c" "108iarql6z7h1r4rlzac6n6lrzs78x7kcdbfa0b5dbr5xc66jmgb")
458 (mozilla-patch "icecat-bug-1426603.patch" "ca0b92ecedee" "0dc3mdl4a3hrq4j384zjavf3splj6blv4masign710hk7svlgbhq")
459 (mozilla-patch "icecat-CVE-2018-5146.patch" "494e5d5278ba" "1yb4lxjw499ppwhk31vz0vzl0cfqvj9d4jwqag7ayj53ybwsqgjr")
460 (mozilla-patch "icecat-CVE-2018-5147.patch" "5cd5586a2f48" "10s774pwvj6xfk3kk6ivnhp2acc8x9sqq6na8z47nkhgwl2712i5")))
90e1cdae
MW
461 (modules '((guix build utils)))
462 (snippet
463 '(begin
bfb48f4f 464 (use-modules (ice-9 ftw))
90e1cdae
MW
465 ;; Remove bundled libraries that we don't use, since they may
466 ;; contain unpatched security flaws, they waste disk space and
467 ;; network bandwidth, and may cause confusion.
468 (for-each delete-file-recursively
469 '(;; FIXME: Removing the bundled icu breaks configure.
470 ;; * The bundled icu headers are used in some places.
471 ;; * The version number is taken from the bundled copy.
472 ;;"intl/icu"
473 ;;
474 ;; FIXME: A script from the bundled nspr is used.
475 ;;"nsprpub"
476 ;;
477 ;; TODO: Use system media libraries. Waiting for:
478 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
479 ;; * libogg
480 ;; * libtheora
481 ;; * libvorbis
482 ;; * libtremor (not yet in guix)
483 ;; * libopus
484 ;; * speex
485 ;; * soundtouch (not yet in guix)
486 ;;
90e1cdae
MW
487 "modules/freetype2"
488 "modules/zlib"
489 "modules/libbz2"
490 "ipc/chromium/src/third_party/libevent"
7cba7647 491 "media/libjpeg"
90e1cdae
MW
492 "media/libvpx"
493 "security/nss"
494 "gfx/cairo"
110afdde
MW
495 "gfx/harfbuzz"
496 "gfx/graphite2"
90e1cdae
MW
497 "js/src/ctypes/libffi"
498 "db/sqlite3"))
bfb48f4f
MW
499 ;; Delete .pyc files, typically present in icecat source tarballs
500 (for-each delete-file (find-files "." "\\.pyc$"))
5bdec7d6 501 ;; Delete obj-* directories, sometimes present in icecat tarballs
bfb48f4f
MW
502 (for-each delete-file-recursively
503 (scandir "." (lambda (name)
504 (string-prefix? "obj-" name))))
a5e55dfb 505 #t))))
be0f6112
AE
506 (build-system gnu-build-system)
507 (inputs
508 `(("alsa-lib" ,alsa-lib)
1ae6df81 509 ("bzip2" ,bzip2)
5b17fabc 510 ("cairo" ,cairo)
90e1cdae 511 ("cups" ,cups)
be0f6112 512 ("dbus-glib" ,dbus-glib)
90e1cdae
MW
513 ("gdk-pixbuf" ,gdk-pixbuf)
514 ("glib" ,glib)
002c3e6d
MW
515 ("gtk+" ,gtk+)
516 ("gtk+-2" ,gtk+-2)
110afdde 517 ("graphite2" ,graphite2)
74c7af9f
MW
518 ("pango" ,pango)
519 ("freetype" ,freetype)
110afdde 520 ("harfbuzz" ,harfbuzz)
90e1cdae
MW
521 ("hunspell" ,hunspell)
522 ("libcanberra" ,libcanberra)
523 ("libgnome" ,libgnome)
7cba7647 524 ("libjpeg-turbo" ,libjpeg-turbo)
74c7af9f 525 ("libxft" ,libxft)
e8fc1a0d 526 ("libevent" ,libevent-2.0)
90e1cdae
MW
527 ("libxinerama" ,libxinerama)
528 ("libxscrnsaver" ,libxscrnsaver)
9f7ae77f 529 ("libxcomposite" ,libxcomposite)
be0f6112 530 ("libxt" ,libxt)
1ae6df81 531 ("libffi" ,libffi)
002c3e6d 532 ("ffmpeg" ,ffmpeg)
13b284d9
MW
533 ("libvpx" ,libvpx)
534 ("icu4c" ,icu4c)
535 ("pixman" ,pixman)
74c7af9f 536 ("pulseaudio" ,pulseaudio)
be0f6112 537 ("mesa" ,mesa)
90e1cdae 538 ("mit-krb5" ,mit-krb5)
5b17fabc
MW
539 ("nspr" ,nspr)
540 ("nss" ,nss)
9bc79c11 541 ("sqlite" ,sqlite)
90e1cdae 542 ("startup-notification" ,startup-notification)
be0f6112 543 ("unzip" ,unzip)
1ae6df81
LC
544 ("zip" ,zip)
545 ("zlib" ,zlib)))
c4c4cc05
JD
546 (native-inputs
547 `(("perl" ,perl)
548 ("python" ,python-2) ; Python 3 not supported
549 ("python2-pysqlite" ,python2-pysqlite)
002c3e6d 550 ("yasm" ,yasm)
bfb48f4f 551 ("pkg-config" ,pkg-config)
002c3e6d 552 ("autoconf" ,autoconf-2.13)
bfb48f4f 553 ("which" ,which)))
be0f6112 554 (arguments
74c7af9f
MW
555 `(#:tests? #f ; no check target
556 #:out-of-source? #t ; must be built outside of the source directory
73b1b4eb
LC
557
558 ;; XXX: There are RUNPATH issues such as
559 ;; $prefix/lib/icecat-31.6.0/plugin-container NEEDing libmozalloc.so,
560 ;; which is not in its RUNPATH, but they appear to be harmless in
561 ;; practice somehow. See <http://hydra.gnu.org/build/378133>.
562 #:validate-runpath? #f
563
002c3e6d 564 #:configure-flags '("--enable-default-toolkit=cairo-gtk3"
90e1cdae 565 "--enable-gio"
90e1cdae
MW
566 "--enable-startup-notification"
567 "--enable-pulseaudio"
90e1cdae 568
90e1cdae
MW
569 "--disable-gconf"
570 "--disable-gnomeui"
571
572 ;; Building with debugging symbols takes ~5GiB, so
1ae6df81
LC
573 ;; disable it.
574 "--disable-debug"
575 "--disable-debug-symbols"
576
5bdec7d6
MW
577 ;; Hack to work around missing
578 ;; "unofficial" branding in icecat.
bfb48f4f
MW
579 "--enable-official-branding"
580
90e1cdae 581 ;; Avoid bundled libraries.
1ae6df81 582 "--with-system-zlib"
90e1cdae 583 "--with-system-bz2"
7cba7647 584 "--with-system-jpeg" ; must be libjpeg-turbo
1ae6df81 585 "--with-system-libevent"
13b284d9 586 "--with-system-libvpx"
483ab08f 587 "--with-system-icu"
5b17fabc
MW
588 "--with-system-nspr"
589 "--with-system-nss"
110afdde
MW
590 "--with-system-harfbuzz"
591 "--with-system-graphite2"
13b284d9 592 "--enable-system-pixman"
5b17fabc
MW
593 "--enable-system-cairo"
594 "--enable-system-ffi"
90e1cdae 595 "--enable-system-hunspell"
9128e323 596 "--enable-system-sqlite"
1ae6df81 597
98a046cd
AE
598 ;; Fails with "--with-system-png won't work because
599 ;; the system's libpng doesn't have APNG support".
600 ;; According to
601 ;; http://sourceforge.net/projects/libpng-apng/ ,
602 ;; "the Animated Portable Network Graphics (APNG)
603 ;; is an unofficial extension of the Portable
604 ;; Network Graphics (PNG) format";
605 ;; we probably do not wish to support it.
1ae6df81 606 ;; "--with-system-png"
5b17fabc 607 )
1ae6df81 608
9f7ae77f 609 #:modules ((ice-9 ftw)
6cde5c34
LC
610 (ice-9 rdelim)
611 (ice-9 match)
9f7ae77f 612 ,@%gnu-build-system-modules)
be0f6112 613 #:phases
90e1cdae 614 (modify-phases %standard-phases
9f7ae77f
MW
615 (add-after
616 'unpack 'ensure-no-mtimes-pre-1980
617 (lambda _
618 ;; Without this, the 'source/test/addons/packed.xpi' and
619 ;; 'source/test/addons/simple-prefs.xpi' targets fail while trying
620 ;; to create zip archives.
621 (let ((early-1980 315619200)) ; 1980-01-02 UTC
622 (ftw "." (lambda (file stat flag)
623 (unless (<= early-1980 (stat:mtime stat))
624 (utime file early-1980 early-1980))
625 #t))
626 #t)))
2abf6371
MW
627 (add-after
628 'unpack 'use-skia-by-default
629 (lambda _
630 ;; Use the bundled Skia library by default, since IceCat appears
631 ;; to be far more stable when using it than when using our system
632 ;; Cairo.
633 (let ((out (open "browser/app/profile/icecat.js"
634 (logior O_WRONLY O_APPEND))))
635 (format out "~%// Use Skia by default~%")
636 (format out "pref(~s, ~s);~%" "gfx.canvas.azure.backends" "skia")
637 (format out "pref(~s, ~s);~%" "gfx.content.azure.backends" "skia")
638 (close-port out))
639 #t))
90e1cdae
MW
640 (add-after
641 'unpack 'arrange-to-link-libxul-with-libraries-it-might-dlopen
642 (lambda _
643 ;; libxul.so dynamically opens libraries, so here we explicitly
644 ;; link them into libxul.so instead.
645 ;;
646 ;; TODO: It might be preferable to patch in absolute file names in
647 ;; calls to dlopen or PR_LoadLibrary, but that didn't seem to
648 ;; work. More investigation is needed.
9f7ae77f 649 (substitute* "toolkit/library/moz.build"
002c3e6d
MW
650 (("^# This library needs to be last" all)
651 (string-append "OS_LIBS += [
9f7ae77f 652 'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5',
002c3e6d
MW
653 'avcodec', 'avutil', 'pulse' ]\n\n"
654 all)))
9f7ae77f 655 #t))
90e1cdae
MW
656 (replace
657 'configure
658 ;; configure does not work followed by both "SHELL=..." and
659 ;; "CONFIG_SHELL=..."; set environment variables instead
660 (lambda* (#:key outputs configure-flags #:allow-other-keys)
661 (let* ((out (assoc-ref outputs "out"))
662 (bash (which "bash"))
663 (abs-srcdir (getcwd))
664 (srcdir (string-append "../" (basename abs-srcdir)))
665 (flags `(,(string-append "--prefix=" out)
666 ,(string-append "--with-l10n-base="
667 abs-srcdir "/l10n")
668 ,@configure-flags)))
669 (setenv "SHELL" bash)
670 (setenv "CONFIG_SHELL" bash)
002c3e6d 671 (setenv "AUTOCONF" (which "autoconf")) ; must be autoconf-2.13
90e1cdae
MW
672 (mkdir "../build")
673 (chdir "../build")
674 (format #t "build directory: ~s~%" (getcwd))
675 (format #t "configure flags: ~s~%" flags)
3f27124e
MW
676 (apply invoke bash
677 (string-append srcdir "/configure")
678 flags))))
6cde5c34
LC
679 (add-before 'configure 'install-desktop-entry
680 (lambda* (#:key outputs #:allow-other-keys)
681 ;; Install the '.desktop' file.
682 (define (swallow-%%-directives input output)
683 ;; Interpret '%%ifdef' directives found in the '.desktop' file.
684 (let loop ((state 'top))
685 (match (read-line input 'concat)
686 ((? eof-object?)
687 #t)
688 ((? string? line)
689 (cond ((string-prefix? "%%ifdef" line)
690 (loop 'ifdef))
691 ((string-prefix? "%%else" line)
692 (loop 'else))
693 ((string-prefix? "%%endif" line)
694 (loop 'top))
695 (else
696 (case state
697 ((top else)
698 (display line output)
699 (loop state))
700 (else
701 (loop state)))))))))
702
703 (let* ((out (assoc-ref outputs "out"))
704 (applications (string-append out "/share/applications")))
705 (call-with-input-file "debian/icecat.desktop.in"
706 (lambda (input)
707 (call-with-output-file "debian/icecat.desktop"
708 (lambda (output)
709 (swallow-%%-directives input output)))))
710
711 (substitute* "debian/icecat.desktop"
712 (("@MOZ_DISPLAY_NAME@")
713 "GNU IceCat")
714 (("^Exec=@MOZ_APP_NAME@")
715 (string-append "Exec=" out "/bin/icecat"))
716 (("@MOZ_APP_NAME@")
717 "icecat"))
718 (install-file "debian/icecat.desktop" applications)
88a8ce87
AG
719 #t)))
720 (add-after 'install-desktop-entry 'install-icons
721 (lambda* (#:key outputs #:allow-other-keys)
722 (let ((out (assoc-ref outputs "out")))
723 (with-directory-excursion "browser/branding/official"
724 (for-each
725 (lambda (file)
726 (let* ((size (string-filter char-numeric? file))
727 (icons (string-append out "/share/icons/hicolor/"
728 size "x" size "/apps")))
729 (mkdir-p icons)
730 (copy-file file (string-append icons "/icecat.png"))))
731 '("default16.png" "default22.png" "default24.png"
732 "default32.png" "default48.png" "content/icon64.png"
3f27124e
MW
733 "mozicon128.png" "default256.png"))
734 #t))))
6e75740f
CL
735 ;; This fixes the file chooser crash that happens with GTK 3.
736 (add-after 'install 'wrap-program
737 (lambda* (#:key inputs outputs #:allow-other-keys)
738 (let* ((out (assoc-ref outputs "out"))
739 (lib (string-append out "/lib"))
740 (gtk (assoc-ref inputs "gtk+"))
741 (gtk-share (string-append gtk "/share")))
742 (wrap-program (car (find-files lib "^icecat$"))
3f27124e
MW
743 `("XDG_DATA_DIRS" ":" prefix (,gtk-share)))
744 #t))))))
6fd52309 745 (home-page "https://www.gnu.org/software/gnuzilla/")
be0f6112
AE
746 (synopsis "Entirely free browser derived from Mozilla Firefox")
747 (description
748 "IceCat is the GNU version of the Firefox browser. It is entirely free
c5779c93 749software, which does not recommend non-free plugins and addons. It also
79c311b8 750features built-in privacy-protecting features.")
63e8bb12 751 (license license:mpl2.0) ;and others, see toolkit/content/license.html
99effc8f
LC
752 (properties
753 `((ftp-directory . "/gnu/gnuzilla")
754 (cpe-name . "firefox_esr")
bfb48f4f 755 (cpe-version . ,(first (string-split version #\-)))))))