gnu: icecat: Add more fixes from upstream mozilla-esr52.
[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>
89e34644 3;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
98986200 4;;; Copyright © 2014, 2015, 2016, 2017 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>
29f381ba 9;;; Copyright © 2017 ng0 <ng0@no-reply.pragmatique.xyz>
be0f6112
AE
10;;;
11;;; This file is part of GNU Guix.
12;;;
13;;; GNU Guix is free software; you can redistribute it and/or modify it
14;;; under the terms of the GNU General Public License as published by
15;;; the Free Software Foundation; either version 3 of the License, or (at
16;;; your option) any later version.
17;;;
18;;; GNU Guix is distributed in the hope that it will be useful, but
19;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21;;; GNU General Public License for more details.
22;;;
23;;; You should have received a copy of the GNU General Public License
24;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
26(define-module (gnu packages gnuzilla)
07d4d9b7 27 #:use-module ((srfi srfi-1) #:hide (zip))
1461dd24 28 #:use-module (ice-9 match)
be0f6112 29 #:use-module (gnu packages)
b5b73a82 30 #:use-module ((guix licenses) #:prefix license:)
be0f6112
AE
31 #:use-module (guix packages)
32 #:use-module (guix download)
aaac423c 33 #:use-module (guix utils)
be0f6112 34 #:use-module (guix build-system gnu)
002c3e6d 35 #:use-module (gnu packages autotools)
bfb48f4f 36 #:use-module (gnu packages base)
1aaaff1a 37 #:use-module (gnu packages databases)
be0f6112 38 #:use-module (gnu packages glib)
be0f6112 39 #:use-module (gnu packages gtk)
90e1cdae
MW
40 #:use-module (gnu packages gnome)
41 #:use-module (gnu packages libcanberra)
42 #:use-module (gnu packages cups)
89e34644 43 #:use-module (gnu packages kerberos)
be0f6112
AE
44 #:use-module (gnu packages linux)
45 #:use-module (gnu packages perl)
46 #:use-module (gnu packages pkg-config)
1ae6df81 47 #:use-module (gnu packages compression)
74c7af9f 48 #:use-module (gnu packages fontutils)
1ae6df81 49 #:use-module (gnu packages libevent)
90e1cdae 50 #:use-module (gnu packages libreoffice) ;for hunspell
e55354b8 51 #:use-module (gnu packages image)
1ae6df81 52 #:use-module (gnu packages libffi)
74c7af9f 53 #:use-module (gnu packages pulseaudio)
be0f6112
AE
54 #:use-module (gnu packages python)
55 #:use-module (gnu packages xorg)
200726ed 56 #:use-module (gnu packages gl)
01497dfe 57 #:use-module (gnu packages assembly)
13b284d9
MW
58 #:use-module (gnu packages icu4c)
59 #:use-module (gnu packages video)
60 #:use-module (gnu packages xdisorg)
29f381ba 61 #:use-module (gnu packages readline))
be0f6112 62
4923e06f
SB
63(define-public mozjs
64 (package
65 (name "mozjs")
66 (version "17.0.0")
67 (source (origin
68 (method url-fetch)
69 (uri (string-append
70 "https://ftp.mozilla.org/pub/mozilla.org/js/"
71 name version ".tar.gz"))
72 (sha256
73 (base32
68716289 74 "1fig2wf4f10v43mqx67y68z6h77sy900d1w0pz9qarrqx57rc7ij"))
a64b7da5 75 (patches (search-patches "mozjs17-aarch64-support.patch"))
68716289
SB
76 (modules '((guix build utils)))
77 (snippet
78 ;; Fix incompatibility with Perl 5.22+.
79 '(substitute* '("js/src/config/milestone.pl")
80 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE")))))
4923e06f
SB
81 (build-system gnu-build-system)
82 (native-inputs
f403c676
EF
83 `(("perl" ,perl)
84 ("pkg-config" ,pkg-config)
85 ("python" ,python-2)))
86 (propagated-inputs
87 `(("nspr" ,nspr))) ; in the Requires.private field of mozjs-17.0.pc
88 (inputs
89 `(("zlib" ,zlib)))
4923e06f 90 (arguments
56486b3a
EF
91 `(;; XXX: parallel build fails, lacking:
92 ;; mkdir -p "system_wrapper_js/"
93 #:parallel-build? #f
94 #:phases
95 (modify-phases %standard-phases
96 (add-after 'unpack 'delete-timedout-test
a64b7da5 97 ;; This test times out on slower hardware.
56486b3a
EF
98 (lambda _ (delete-file "js/src/jit-test/tests/basic/bug698584.js")))
99 (add-before 'configure 'chdir
4923e06f 100 (lambda _
56486b3a
EF
101 (chdir "js/src")
102 #t))
103 (replace 'configure
104 ;; configure fails if it is followed by SHELL and CONFIG_SHELL
105 (lambda* (#:key outputs #:allow-other-keys)
106 (let ((out (assoc-ref outputs "out")))
107 (setenv "SHELL" (which "sh"))
108 (setenv "CONFIG_SHELL" (which "sh"))
109 (zero? (system*
110 "./configure" (string-append "--prefix=" out)
111 ,@(if (string=? "aarch64-linux"
112 (%current-system))
113 '("--host=aarch64-unknown-linux-gnu")
114 '())))))))))
4923e06f
SB
115 (home-page
116 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey")
117 (synopsis "Mozilla javascript engine")
118 (description "SpiderMonkey is Mozilla's JavaScript engine written
119in C/C++.")
87158e85 120 (license license:mpl2.0))) ; and others for some files
4923e06f 121
cefdcb38
SB
122(define-public mozjs-24
123 (package (inherit mozjs)
124 (name "mozjs")
125 (version "24.2.0")
126 (source (origin
127 (method url-fetch)
128 (uri (string-append
129 "https://ftp.mozilla.org/pub/mozilla.org/js/"
130 name "-" version ".tar.bz2"))
131 (sha256
132 (base32
68716289
SB
133 "1n1phk8r3l8icqrrap4czplnylawa0ddc2cc4cgdz46x3lrkybz6"))
134 (modules '((guix build utils)))
26f38d31 135 (patches (search-patches "mozjs24-aarch64-support.patch"))
68716289
SB
136 (snippet
137 ;; Fix incompatibility with Perl 5.22+.
138 '(substitute* '("js/src/config/milestone.pl")
139 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE")))))
cefdcb38 140 (arguments
aaac423c
EF
141 (substitute-keyword-arguments (package-arguments mozjs)
142 ((#:phases phases)
143 `(modify-phases ,phases
144 (replace 'configure
145 (lambda* (#:key outputs #:allow-other-keys)
146 (let ((out (assoc-ref outputs "out")))
147 ;; configure fails if it is followed by SHELL and CONFIG_SHELL
148 (setenv "SHELL" (which "sh"))
149 (setenv "CONFIG_SHELL" (which "sh"))
150 (zero? (system* "./configure"
151 (string-append "--prefix=" out)
152 "--with-system-nspr"
153 "--enable-system-ffi"
154 "--enable-threadsafe"
155 ,@(if (string=? "aarch64-linux"
156 (%current-system))
157 '("--host=aarch64-unknown-linux-gnu")
158 '()))))))))))
cefdcb38
SB
159 (inputs
160 `(("libffi" ,libffi)
161 ("zlib" ,zlib)))))
162
29f381ba
CL
163(define-public mozjs-38
164 (package
165 (inherit mozjs)
166 (name "mozjs")
167 (version "38.2.1.rc0")
168 (source (origin
169 (method url-fetch)
170 (uri (string-append
171 "https://people.mozilla.org/~sstangl/"
172 name "-" version ".tar.bz2"))
173 (sha256
174 (base32
175 "0p4bmbpgkfsj54xschcny0a118jdrdgg0q29rwxigg3lh5slr681"))
176 (patches
177 (search-patches
178 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1269317 for
179 ;; GCC 6 compatibility.
180
181 "mozjs38-version-detection.patch" ; for 0ad
182 "mozjs38-tracelogger.patch"
183
184 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1339931.
185 "mozjs38-pkg-config-version.patch"
186 "mozjs38-shell-version.patch"))
187 (modules '((guix build utils)))
188 (snippet
189 '(begin
190 ;; Fix incompatibility with sed 4.4.
191 (substitute* "js/src/configure"
192 (("\\^\\[:space:\\]") "^[[:space:]]"))
193
194 ;; The headers are symlinks to files that are in /tmp, so they
195 ;; end up broken. Copy them instead.
196 (substitute*
197 "python/mozbuild/mozbuild/backend/recursivemake.py"
198 (("\\['dist_include'\\].add_symlink")
199 "['dist_include'].add_copy"))
200
201 ;; Remove bundled libraries.
202 (for-each delete-file-recursively
203 '("intl"
204 "js/src/ctypes/libffi"
205 "js/src/ctypes/libffi-patches"
206 "modules/zlib"))
207 #t))))
208 (arguments
209 `(;; XXX: parallel build fails, lacking:
210 ;; mkdir -p "system_wrapper_js/"
211 #:parallel-build? #f
212 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1008470.
213 #:tests? #f
214 #:phases
215 (modify-phases %standard-phases
216 (replace 'configure
217 (lambda* (#:key outputs #:allow-other-keys)
218 (let ((out (assoc-ref outputs "out")))
219 (chdir "js/src")
220 (setenv "SHELL" (which "sh"))
221 (setenv "CONFIG_SHELL" (which "sh"))
222 (zero? (system* "./configure"
223 (string-append "--prefix=" out)
224 "--enable-ctypes"
225 "--enable-gcgenerational"
226 "--enable-optimize"
227 "--enable-pie"
228 "--enable-readline"
229 "--enable-shared-js"
230 "--enable-system-ffi"
231 "--enable-threadsafe"
232 "--enable-xterm-updates"
233 "--with-system-icu"
234 "--with-system-nspr"
235 "--with-system-zlib"
236
237 ;; Intl API requires bundled ICU.
238 "--without-intl-api"))))))))
239 (native-inputs
240 `(("perl" ,perl)
241 ("pkg-config" ,pkg-config)
242 ("python-2" ,python-2)))
243 (inputs
244 `(("libffi" ,libffi)
245 ("readline" ,readline)
246 ("icu4c" ,icu4c)
247 ("zlib" ,zlib)))))
248
4923e06f
SB
249(define-public nspr
250 (package
251 (name "nspr")
ad7a73a9 252 (version "4.17")
4923e06f
SB
253 (source (origin
254 (method url-fetch)
255 (uri (string-append
256 "https://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v"
257 version "/src/nspr-" version ".tar.gz"))
258 (sha256
259 (base32
ad7a73a9 260 "158hdn285dsb5rys8wl1wi32dd1axwhqq0r8fwny4aj157m0l2jr"))))
4923e06f
SB
261 (build-system gnu-build-system)
262 (native-inputs
84fb4bd9 263 `(("perl" ,perl)))
4923e06f 264 (arguments
8550894b
LC
265 `(#:tests? #f ; no check target
266 #:configure-flags (list "--enable-64bit"
267 (string-append "LDFLAGS=-Wl,-rpath="
268 (assoc-ref %outputs "out")
269 "/lib"))
04952bd7
EF
270 #:phases (modify-phases %standard-phases
271 (add-before 'configure 'chdir
272 (lambda _ (chdir "nspr") #t)))))
4923e06f
SB
273 (home-page
274 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR")
275 (synopsis "Netscape API for system level and libc-like functions")
276 (description "Netscape Portable Runtime (NSPR) provides a
277platform-neutral API for system level and libc-like functions. It is used
278in the Mozilla clients.")
279 (license license:mpl2.0)))
280
1aaaff1a
SB
281(define-public nss
282 (package
283 (name "nss")
40f16947 284 (version "3.33")
1aaaff1a
SB
285 (source (origin
286 (method url-fetch)
2bb9b5de
MW
287 (uri (let ((version-with-underscores
288 (string-join (string-split version #\.) "_")))
289 (string-append
fe88f636 290 "https://ftp.mozilla.org/pub/mozilla.org/security/nss/"
2bb9b5de
MW
291 "releases/NSS_" version-with-underscores "_RTM/src/"
292 "nss-" version ".tar.gz")))
1aaaff1a
SB
293 (sha256
294 (base32
40f16947 295 "1r44qa4j7sri50mxxbnrpm6fxprwrhv76whi7bfq73j06syxmw4q"))
1aaaff1a 296 ;; Create nss.pc and nss-config.
d027b001
MB
297 (patches (search-patches "nss-pkgconfig.patch"
298 "nss-increase-test-timeout.patch"))))
1aaaff1a
SB
299 (build-system gnu-build-system)
300 (outputs '("out" "bin"))
301 (arguments
1461dd24 302 `(#:parallel-build? #f ; not supported
1aaaff1a
SB
303 #:make-flags
304 (let* ((out (assoc-ref %outputs "out"))
305 (nspr (string-append (assoc-ref %build-inputs "nspr")))
306 (rpath (string-append "-Wl,-rpath=" out "/lib/nss")))
307 (list "-C" "nss" (string-append "PREFIX=" out)
308 "NSDISTMODE=copy"
309 "NSS_USE_SYSTEM_SQLITE=1"
310 (string-append "NSPR_INCLUDE_DIR=" nspr "/include/nspr")
311 ;; Add $out/lib/nss to RPATH.
312 (string-append "RPATH=" rpath)
313 (string-append "LDFLAGS=" rpath)))
314 #:modules ((guix build gnu-build-system)
315 (guix build utils)
316 (ice-9 ftw)
317 (ice-9 match)
318 (srfi srfi-26))
1aaaff1a 319 #:phases
db3c06d5
MB
320 (modify-phases %standard-phases
321 (replace 'configure
1461dd24 322 (lambda _
db3c06d5
MB
323 (setenv "CC" "gcc")
324 ;; Tells NSS to build for the 64-bit ABI if we are 64-bit system.
1461dd24
MB
325 ,@(match (%current-system)
326 ((or "x86_64-linux" "aarch64-linux")
327 `((setenv "USE_64" "1")))
328 (_
329 '()))
db3c06d5
MB
330 #t))
331 (replace 'check
332 (lambda _
333 ;; Use 127.0.0.1 instead of $HOST.$DOMSUF as HOSTADDR for testing.
334 ;; The later requires a working DNS or /etc/hosts.
335 (setenv "DOMSUF" "(none)")
336 (setenv "USE_IP" "TRUE")
337 (setenv "IP_ADDRESS" "127.0.0.1")
338 (zero? (system* "./nss/tests/all.sh"))))
339 (replace 'install
340 (lambda* (#:key outputs #:allow-other-keys)
341 (let* ((out (assoc-ref outputs "out"))
342 (bin (string-append (assoc-ref outputs "bin") "/bin"))
343 (inc (string-append out "/include/nss"))
344 (lib (string-append out "/lib/nss"))
345 (obj (match (scandir "dist" (cut string-suffix? "OBJ" <>))
346 ((obj) (string-append "dist/" obj)))))
347 ;; Install nss-config to $out/bin.
348 (install-file (string-append obj "/bin/nss-config")
349 (string-append out "/bin"))
350 (delete-file (string-append obj "/bin/nss-config"))
351 ;; Install nss.pc to $out/lib/pkgconfig.
352 (install-file (string-append obj "/lib/pkgconfig/nss.pc")
353 (string-append out "/lib/pkgconfig"))
354 (delete-file (string-append obj "/lib/pkgconfig/nss.pc"))
355 (rmdir (string-append obj "/lib/pkgconfig"))
356 ;; Install other files.
357 (copy-recursively "dist/public/nss" inc)
358 (copy-recursively (string-append obj "/bin") bin)
359 (copy-recursively (string-append obj "/lib") lib)
3161f6a4 360
db3c06d5
MB
361 ;; FIXME: libgtest1.so is installed in the above step, and it's
362 ;; (unnecessarily) linked with several NSS libraries, but
363 ;; without the needed rpaths, causing the 'validate-runpath'
364 ;; phase to fail. Here we simply delete libgtest1.so, since it
365 ;; seems to be used only during the tests.
366 (delete-file (string-append lib "/libgtest1.so"))
bd512249 367 (delete-file (string-append lib "/libgtestutil.so"))
3161f6a4 368
db3c06d5 369 #t))))))
1aaaff1a
SB
370 (inputs
371 `(("sqlite" ,sqlite)
372 ("zlib" ,zlib)))
373 (propagated-inputs `(("nspr" ,nspr))) ; required by nss.pc.
374 (native-inputs `(("perl" ,perl)))
86e3e370 375
e9b718a0
MW
376 ;; The NSS test suite takes around 48 hours on Loongson 3A (MIPS) when
377 ;; another build is happening concurrently on the same machine.
378 (properties '((timeout . 216000))) ; 60 hours
86e3e370 379
1aaaff1a
SB
380 (home-page
381 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS")
382 (synopsis "Network Security Services")
383 (description
384 "Network Security Services (NSS) is a set of libraries designed to support
385cross-platform development of security-enabled client and server applications.
386Applications built with NSS can support SSL v2 and v3, TLS, PKCS #5, PKCS #7,
387PKCS #11, PKCS #12, S/MIME, X.509 v3 certificates, and other security
388standards.")
389 (license license:mpl2.0)))
390
bfb48f4f 391(define (mozilla-patch file-name changeset hash)
002c3e6d 392 "Return an origin for CHANGESET from the mozilla-esr52 repository."
bfb48f4f
MW
393 (origin
394 (method url-fetch)
002c3e6d 395 (uri (string-append "https://hg.mozilla.org/releases/mozilla-esr52/raw-rev/"
bfb48f4f
MW
396 changeset))
397 (sha256 (base32 hash))
398 (file-name file-name)))
399
be0f6112
AE
400(define-public icecat
401 (package
402 (name "icecat")
3c7c9161 403 (version "52.3.0-gnu1")
be0f6112
AE
404 (source
405 (origin
406 (method url-fetch)
5bdec7d6
MW
407 (uri (string-append "mirror://gnu/gnuzilla/"
408 (first (string-split version #\-))
409 "/" name "-" version ".tar.bz2"))
be0f6112
AE
410 (sha256
411 (base32
3c7c9161 412 "00jki754d6310fxj1b7dbhqj69y5igck6gqg6rgfya243nsb56k9"))
bfb48f4f 413 (patches
5bdec7d6
MW
414 (list
415 (search-patch "icecat-avoid-bundled-libraries.patch")
3c7c9161
MW
416 (mozilla-patch "icecat-bug-546387.patch" "d13e3fefb76e" "1b760r0bg2ydbl585wlmajljh1nlisrwxvjws5b28a3sgjy01i6k")
417 (mozilla-patch "icecat-bug-1350152.patch" "f822bda79c28" "1wf56169ca874shr6r7qx40s17h2gwj7ngmpyylrpmd1c6hipvsj")
418 (mozilla-patch "icecat-bug-1388166.patch" "fbb0bdb191d5" "1y8wpj38vw1dd6f375s9i0mrk9bd8z8gz5g70p4qynfllpkn072d")
3fd2f86a
MW
419 (mozilla-patch "icecat-CVE-2017-7810-pt1.patch" "fbddb5cdd3c7" "0k5nyl2z1y2rx9fwqyfj64678yv6v3pnmshgk552pbzqmaf8i1hq")
420 (mozilla-patch "icecat-CVE-2017-7810-pt2.patch" "76c25987a275" "095b9vwsiza9ikbnnppfcld16h75x5bxjfxc73913y04n0i42ifh")
421 (mozilla-patch "icecat-CVE-2017-7810-pt3.patch" "32eec29a85a5" "057simakqg56jvas1wkskg5kszn96m74nca26x08d5w7rzmbv1q2")
3c7c9161 422 (mozilla-patch "icecat-bug-1373222.patch" "ecef71fa933f" "0vsymgy5j702lamvh2riahni7rdj9ba3bd6i4a2m22d638rwp1i2")
3fd2f86a 423 (mozilla-patch "icecat-CVE-2017-7814.patch" "68a444daf85b" "1faaadaajidzb9i00710zxdyv370hlrdg1l5rw2ymfmzbjj4jqyd")
3c7c9161
MW
424 (mozilla-patch "icecat-bug-1376825.patch" "eeeec9cafc4e" "188qf6zi9kyxb33330yia6wmrd5mdyqn5hr1cl38zy7m3akv8srh")
425 (mozilla-patch "icecat-bug-1385272.patch" "d68fa12fbffc" "13gh97vz9n2b7303jcvr1072iy8bghy9chvbmxzvw82prvkscavw")
426 (mozilla-patch "icecat-bug-1390002.patch" "c24e6fc9f689" "0aswhy5fz2f6wzd5j5gg3nqvz707ip344089h2z2chcp146vxmf4")
3fd2f86a 427 (mozilla-patch "icecat-CVE-2017-7810-pt4.patch" "ae110cf77596" "0gdrkfq9wy9cfcdgbj14ci86xgh2prkbz69pfy97r9igd8059syw")
464a2889
MW
428 (mozilla-patch "icecat-CVE-2017-7810-pt5.patch" "b8417112486d" "1hya6lccz7vm51v4f6ww072794cwzmfn9xhxmvrnqbiyspxx5fz4")
429 (mozilla-patch "icecat-bug-1386905.patch" "badbf4308211" "0fj1pyjqfdsbrlfykwmkzav2nvdj1f4grwq3cal9f7ay6wjnfs9b")
430 (mozilla-patch "icecat-CVE-2017-7810-pt6.patch" "d78675515c78" "03w5hqy40xkckbaf5bm9kdbdqvp9ffvpk9mlrc9lja6b7qa4pjhg")
431 (mozilla-patch "icecat-bug-1382303.patch" "f01155fe4d54" "0hnz1kvmvspg6453kydsklbvrjgzn8x3djvrym3f2xl2yinaf90d")
432 (mozilla-patch "icecat-bug-1393467.patch" "4eec2a60622c" "1h006mwcsagq7mz7haymwgr7fn4zj14n5lxbjcmhdqrxdvma2hjj")
433 (mozilla-patch "icecat-bug-1384801.patch" "9556e792f905" "0i74r807189s8i78483caiifw68cn7fs543i4cys6k3gn12dhhjy")
434 (mozilla-patch "icecat-CVE-2017-7823.patch" "bd284765b5bc" "1c4hss87kc4qwx30magbqczm9h7zmwirjfc8zimqbrnwv9bbsfh3")
435 (mozilla-patch "icecat-CVE-2017-7805.patch" "113da8d46aa4" "1vy0lw659mwixmb57mgybga152rdwqd5zj1g7nfw1zgp15pfwr75")
436 (mozilla-patch "icecat-bug-1376399.patch" "58a574502ca9" "1zmg91pg0s5nwngc32a4fywidvxyaayvx1h052fsv0i4cfm16l9v")
437 (mozilla-patch "icecat-bug-1396570.patch" "24db61862c54" "0af1jjfma042xvn0xhgims1yvb2b51nhn4m0pcfwg3fn0llmka03")
438 (mozilla-patch "icecat-CVE-2017-7819.patch" "1a02f11c6efe" "18a9qvdvrqw34qw3lljg6gkn358jl23lyimhmbc964023rhs36sz")
439 (mozilla-patch "icecat-CVE-2017-7810-pt7.patch" "002686d9536f" "065g0d759wfiaj69b1sqg7l08p2knc0q9m9hvkgwwsf0r78xcbjj")
440 (mozilla-patch "icecat-CVE-2017-7810-pt8.patch" "eaadb31758d8" "0b3k3la6ykac5mbp9gyqqgjbmj19vx9sl1b0wp387qar0p12nyaz")
441 (mozilla-patch "icecat-bug-1368269.patch" "0cff5e66e0f4" "0jb0wqi7c0ih4441s1908j6gv18v4inh7k2w47h3c9nhz4rgyrw7")
442 (mozilla-patch "icecat-CVE-2017-7793.patch" "6ff3c82962f0" "0bw82034kdmrpznigbavzzsiybzrw8giyf8v0z2cxf6mwl72bf9k")
443 (mozilla-patch "icecat-bug-1400399.patch" "d6f78b1349b7" "0i3gwr2al3xl65yfa3nimvy8dp0jzpx21f6bjw18xwn7zkkh9j54")
bb234ed8 444 (mozilla-patch "icecat-bug-1400721.patch" "285cde398833" "0a1i32zl30wfyw7zkqj595s94n6wdlg5c495m0910pd05pjg3qam")
6a71fa6f
MW
445 (mozilla-patch "icecat-CVE-2017-7826-pt01.patch" "98b3988592a6" "03wy173lj6mvmh5q92brf596h8676h0zasgqfnndpvsmsiaih120")
446 (mozilla-patch "icecat-CVE-2017-7826-pt02.patch" "47590f0c274b" "0zsys6dcyhfb4a8k2dhsls7425jg6r1ijlrsn1lc5smwyf62zx5v")
447 (mozilla-patch "icecat-CVE-2017-7826-pt03.patch" "55b435cbbb55" "1gcasaqrxa13a55v05bkxl3d1md829kpfhqiaws83wn08x28l0my")
448 (mozilla-patch "icecat-CVE-2017-7826-pt04.patch" "8549cf2dab3e" "168gs32ncavaj9xn4gwhh9i01cbpnhgx9yn333apsrc1gwknpvsr")
449 (mozilla-patch "icecat-CVE-2017-7826-pt05.patch" "349acf56ff49" "1vwn87rdryfjsn809pl50xmr82q98gz3vz9h6clkd905vbd9rwz7")
450 (mozilla-patch "icecat-CVE-2017-7826-pt06.patch" "3af5bf8bdea0" "07az28dnpxr36j7i3llxkrlkrmg0bwk4f3sm75x1f0r1v5575p3p")
451 (mozilla-patch "icecat-CVE-2017-7826-pt07.patch" "592df6088926" "1gy27idik4b6wcg4szww08cmpcljssja8wql6w1d807h7ni65lr7")
452 (mozilla-patch "icecat-CVE-2017-7826-pt08.patch" "77a2d4610275" "13ysbwflnysj4rs45ibckd621s0vyg1s8dvannlvanvrz1g72zcz")
453 (mozilla-patch "icecat-CVE-2017-7826-pt09.patch" "2b30335d0b95" "0hs5cwickvfw7r5dn7y148jgr2b21hl613qp83k56634d0y64qwp")
454 (mozilla-patch "icecat-CVE-2017-7826-pt10.patch" "d6f008f95598" "0xclxrbg7pv8pa2j15p0gy9c8sigy2i9j0kvazl5fbyg6jsg3xgd")
455 (mozilla-patch "icecat-CVE-2017-7826-pt11.patch" "ab9b51cd75ac" "08jy3rbkyh934aw261ls0s87947d2mhss7xqk1xfdir9crij2g27")
f7ddf996
MW
456 (mozilla-patch "icecat-bug-1343147-pt1.patch" "971d6345bc3a" "13791cvc51i991i5qyz6gp94vwzwkx479bnr8fsf8dw7z72wrsch")
457 (mozilla-patch "icecat-bug-1343147-pt2.patch" "60df7db06669" "0r372g1zksvkzyz0qpq0mp30frilgsfxxx2xida8xc08wgxp5lh9")
6a71fa6f
MW
458 (mozilla-patch "icecat-CVE-2017-7826-pt12.patch" "df49c25e6e4c" "0j77xbkxpflqf4jlccrv61vq0jgp4lfn8kb0zw1lswp3cyd6ml4i")
459 (mozilla-patch "icecat-CVE-2017-7826-pt13.patch" "3b899f872623" "01zjcpm8yp4s8yf4mj1bzq01aylmi69kd8qv0rrcl9hmj4g3pzr2")
460 (mozilla-patch "icecat-CVE-2017-7826-pt14.patch" "3d6d558ae6a6" "17wynknvs5wi7m9g5vn43rjmivbg1l6pnv8jymz1ccidy27qgdqi")
461 (mozilla-patch "icecat-CVE-2017-7826-pt15.patch" "8426754b7130" "0bbm2294bkvld55rdbpsc8b82ljqdcxpbg6cwdzvwfhqayl2pnqm")
462 (mozilla-patch "icecat-CVE-2017-7828-pt1.patch" "5ddd5d2aa769" "12z5i8h6qwjb1h1fvp2426bgsnsxx539d8k2is9x1q4133356niy")
463 (mozilla-patch "icecat-CVE-2017-7826-pt16.patch" "dd068f4e132a" "17qy9c1vfkz3pj6y8qmqbic73wrangsbdlylk2s54nbzhhp9cj1g")
464 (mozilla-patch "icecat-CVE-2017-7826-pt17.patch" "e6bd533b57e9" "1mmqav9yhxd0j47yffcdykaqjibfwjsk0jn0f44099s87y8qn9zy")
465 (mozilla-patch "icecat-CVE-2017-7826-pt18.patch" "2a87fb6b9c07" "0z0scw4y1vqhqkbw1ag14g8xrif14l95x7fd50q2sw425lli29lc")
f1e32145
MW
466 (mozilla-patch "icecat-bug-1404910.patch" "5007f2472f64" "0ns1l4yipwbb52sps2xzg30qd1rkpwykxq4chjg3wllhmcxbvvpw")
467 (mozilla-patch "icecat-CVE-2017-7830.patch" "04e3b5c1f0b2" "0nmv3jnx94ykxg64xkiwc8kx4df8zw7y5yzjnxz1sll2v88b9hmf")
468 (mozilla-patch "icecat-CVE-2017-7828-pt2.patch" "2f48c03d9b3f" "16qdy3rahmkhsjnzqjcgzg1a4k7czd40m04gs9i75cd88kbripri")
469 (mozilla-patch "icecat-bug-1348660-pt1.patch" "a352bfcbaf55" "1j3kxnhci9fh3lj8rizbcfv8xzn5kikxwpfy8a091d51sdn20873")
470 (mozilla-patch "icecat-bug-1348660-pt2.patch" "57f43e2ab9b5" "1jva4y79zb85npak3mddrx5rsf4mxczb314kcr8yhlkwqv0nx5sp")
471 (mozilla-patch "icecat-bug-1348660-pt3.patch" "917d65bb8896" "0k29y8i96lanqjjm6vybg0s6gjbk1mz5bfnga6aj1g0hnb7c3s8d")
472 (mozilla-patch "icecat-bug-1348660-pt4.patch" "28934912eede" "1mhxw26050l3d09n8w912a86df87afcshvsk9k1k375anfk0927x")
473 (search-patch "icecat-bug-1348660-pt5.patch")
474 (mozilla-patch "icecat-bug-1348660-pt6.patch" "556ff3bfb9fc" "0kckjc8jp885xfaiwx2b9qnk1plqjhi0mwhjjcmfajvh3l3mrl8h")
475 (mozilla-patch "icecat-bug-1350564.patch" "2abf26abb2a2" "0axdzp9g9k74wpkwrsdx263h01sv9bd3rarhhl68xnvc7n6i45lx")
476 (mozilla-patch "icecat-bug-1404787.patch" "8335e1d7b140" "17d7kb8ginzflhdkrbi60vh2b907spbzmvwih7a595gqpihmnqqn")
477 (mozilla-patch "icecat-CVE-2017-7826-pt19.patch" "de336078d36b" "0gyzbap8hr1iywk0x2x0h7z7zp7q89hi56h8c03vvc7771dkvjkf")
478 (mozilla-patch "icecat-bug-1047098-pt1.patch" "088577f0c46e" "0y3sz6kx07ls7jsvhqhhrl6v69a94wqvv3lz7hnplah23y06h17z")
479 (mozilla-patch "icecat-bug-1047098-pt2.patch" "c7e3abf74023" "11dcjzx56v4yb2dvm23j2g86q8yva2hc69lmb7s5w18l6ygwwhzr")
480 (mozilla-patch "icecat-bug-1047098-pt3.patch" "36bd15d14c5a" "0cb3l3hpsgk674f08kfamxhqfga3ah5v904gpxq9ag006vzd2cxz")
481 (mozilla-patch "icecat-bug-1404105.patch" "2909ba991f31" "126vssj57dc800347f075wlnjzcwamnxxmgxl9w78jpb0hj9gf16")
482 (search-patch "icecat-bug-1415133.patch")
483 (mozilla-patch "icecat-bug-1355576.patch" "cf34a0574e58" "1z7sa1d12hypgivm5xxn32s58afpjcij97jvnafcgnfvxywrgr1m")))
90e1cdae
MW
484 (modules '((guix build utils)))
485 (snippet
486 '(begin
bfb48f4f 487 (use-modules (ice-9 ftw))
90e1cdae
MW
488 ;; Remove bundled libraries that we don't use, since they may
489 ;; contain unpatched security flaws, they waste disk space and
490 ;; network bandwidth, and may cause confusion.
491 (for-each delete-file-recursively
492 '(;; FIXME: Removing the bundled icu breaks configure.
493 ;; * The bundled icu headers are used in some places.
494 ;; * The version number is taken from the bundled copy.
495 ;;"intl/icu"
496 ;;
497 ;; FIXME: A script from the bundled nspr is used.
498 ;;"nsprpub"
499 ;;
500 ;; TODO: Use system media libraries. Waiting for:
501 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
502 ;; * libogg
503 ;; * libtheora
504 ;; * libvorbis
505 ;; * libtremor (not yet in guix)
506 ;; * libopus
507 ;; * speex
508 ;; * soundtouch (not yet in guix)
509 ;;
510 ;; TODO: Use system harfbuzz. Waiting for:
511 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=847568>
512 ;;
59d4cf1c
MW
513 ;; TODO: Use system graphite2.
514 ;;
90e1cdae
MW
515 "modules/freetype2"
516 "modules/zlib"
517 "modules/libbz2"
518 "ipc/chromium/src/third_party/libevent"
7cba7647 519 "media/libjpeg"
90e1cdae
MW
520 "media/libvpx"
521 "security/nss"
522 "gfx/cairo"
523 "js/src/ctypes/libffi"
524 "db/sqlite3"))
bfb48f4f
MW
525 ;; Delete .pyc files, typically present in icecat source tarballs
526 (for-each delete-file (find-files "." "\\.pyc$"))
5bdec7d6 527 ;; Delete obj-* directories, sometimes present in icecat tarballs
bfb48f4f
MW
528 (for-each delete-file-recursively
529 (scandir "." (lambda (name)
530 (string-prefix? "obj-" name))))
a5e55dfb 531 #t))))
be0f6112
AE
532 (build-system gnu-build-system)
533 (inputs
534 `(("alsa-lib" ,alsa-lib)
1ae6df81 535 ("bzip2" ,bzip2)
5b17fabc 536 ("cairo" ,cairo)
90e1cdae 537 ("cups" ,cups)
be0f6112 538 ("dbus-glib" ,dbus-glib)
90e1cdae
MW
539 ("gdk-pixbuf" ,gdk-pixbuf)
540 ("glib" ,glib)
002c3e6d
MW
541 ("gtk+" ,gtk+)
542 ("gtk+-2" ,gtk+-2)
74c7af9f
MW
543 ("pango" ,pango)
544 ("freetype" ,freetype)
90e1cdae
MW
545 ("hunspell" ,hunspell)
546 ("libcanberra" ,libcanberra)
547 ("libgnome" ,libgnome)
7cba7647 548 ("libjpeg-turbo" ,libjpeg-turbo)
74c7af9f 549 ("libxft" ,libxft)
e8fc1a0d 550 ("libevent" ,libevent-2.0)
90e1cdae
MW
551 ("libxinerama" ,libxinerama)
552 ("libxscrnsaver" ,libxscrnsaver)
9f7ae77f 553 ("libxcomposite" ,libxcomposite)
be0f6112 554 ("libxt" ,libxt)
1ae6df81 555 ("libffi" ,libffi)
002c3e6d 556 ("ffmpeg" ,ffmpeg)
13b284d9
MW
557 ("libvpx" ,libvpx)
558 ("icu4c" ,icu4c)
559 ("pixman" ,pixman)
74c7af9f 560 ("pulseaudio" ,pulseaudio)
be0f6112 561 ("mesa" ,mesa)
90e1cdae 562 ("mit-krb5" ,mit-krb5)
5b17fabc
MW
563 ("nspr" ,nspr)
564 ("nss" ,nss)
9bc79c11 565 ("sqlite" ,sqlite)
90e1cdae 566 ("startup-notification" ,startup-notification)
be0f6112 567 ("unzip" ,unzip)
1ae6df81
LC
568 ("zip" ,zip)
569 ("zlib" ,zlib)))
c4c4cc05
JD
570 (native-inputs
571 `(("perl" ,perl)
572 ("python" ,python-2) ; Python 3 not supported
573 ("python2-pysqlite" ,python2-pysqlite)
002c3e6d 574 ("yasm" ,yasm)
bfb48f4f 575 ("pkg-config" ,pkg-config)
002c3e6d 576 ("autoconf" ,autoconf-2.13)
bfb48f4f 577 ("which" ,which)))
be0f6112 578 (arguments
74c7af9f
MW
579 `(#:tests? #f ; no check target
580 #:out-of-source? #t ; must be built outside of the source directory
73b1b4eb
LC
581
582 ;; XXX: There are RUNPATH issues such as
583 ;; $prefix/lib/icecat-31.6.0/plugin-container NEEDing libmozalloc.so,
584 ;; which is not in its RUNPATH, but they appear to be harmless in
585 ;; practice somehow. See <http://hydra.gnu.org/build/378133>.
586 #:validate-runpath? #f
587
002c3e6d 588 #:configure-flags '("--enable-default-toolkit=cairo-gtk3"
90e1cdae 589 "--enable-gio"
90e1cdae
MW
590 "--enable-startup-notification"
591 "--enable-pulseaudio"
90e1cdae 592
90e1cdae
MW
593 "--disable-gconf"
594 "--disable-gnomeui"
595
596 ;; Building with debugging symbols takes ~5GiB, so
1ae6df81
LC
597 ;; disable it.
598 "--disable-debug"
599 "--disable-debug-symbols"
600
5bdec7d6
MW
601 ;; Hack to work around missing
602 ;; "unofficial" branding in icecat.
bfb48f4f
MW
603 "--enable-official-branding"
604
90e1cdae 605 ;; Avoid bundled libraries.
1ae6df81 606 "--with-system-zlib"
90e1cdae 607 "--with-system-bz2"
7cba7647 608 "--with-system-jpeg" ; must be libjpeg-turbo
1ae6df81 609 "--with-system-libevent"
13b284d9 610 "--with-system-libvpx"
483ab08f 611 "--with-system-icu"
5b17fabc
MW
612 "--with-system-nspr"
613 "--with-system-nss"
13b284d9 614 "--enable-system-pixman"
5b17fabc
MW
615 "--enable-system-cairo"
616 "--enable-system-ffi"
90e1cdae 617 "--enable-system-hunspell"
9128e323 618 "--enable-system-sqlite"
1ae6df81 619
98a046cd
AE
620 ;; Fails with "--with-system-png won't work because
621 ;; the system's libpng doesn't have APNG support".
622 ;; According to
623 ;; http://sourceforge.net/projects/libpng-apng/ ,
624 ;; "the Animated Portable Network Graphics (APNG)
625 ;; is an unofficial extension of the Portable
626 ;; Network Graphics (PNG) format";
627 ;; we probably do not wish to support it.
1ae6df81 628 ;; "--with-system-png"
5b17fabc 629 )
1ae6df81 630
9f7ae77f 631 #:modules ((ice-9 ftw)
6cde5c34
LC
632 (ice-9 rdelim)
633 (ice-9 match)
9f7ae77f 634 ,@%gnu-build-system-modules)
be0f6112 635 #:phases
90e1cdae 636 (modify-phases %standard-phases
9f7ae77f
MW
637 (add-after
638 'unpack 'ensure-no-mtimes-pre-1980
639 (lambda _
640 ;; Without this, the 'source/test/addons/packed.xpi' and
641 ;; 'source/test/addons/simple-prefs.xpi' targets fail while trying
642 ;; to create zip archives.
643 (let ((early-1980 315619200)) ; 1980-01-02 UTC
644 (ftw "." (lambda (file stat flag)
645 (unless (<= early-1980 (stat:mtime stat))
646 (utime file early-1980 early-1980))
647 #t))
648 #t)))
2abf6371
MW
649 (add-after
650 'unpack 'use-skia-by-default
651 (lambda _
652 ;; Use the bundled Skia library by default, since IceCat appears
653 ;; to be far more stable when using it than when using our system
654 ;; Cairo.
655 (let ((out (open "browser/app/profile/icecat.js"
656 (logior O_WRONLY O_APPEND))))
657 (format out "~%// Use Skia by default~%")
658 (format out "pref(~s, ~s);~%" "gfx.canvas.azure.backends" "skia")
659 (format out "pref(~s, ~s);~%" "gfx.content.azure.backends" "skia")
660 (close-port out))
661 #t))
90e1cdae
MW
662 (add-after
663 'unpack 'arrange-to-link-libxul-with-libraries-it-might-dlopen
664 (lambda _
665 ;; libxul.so dynamically opens libraries, so here we explicitly
666 ;; link them into libxul.so instead.
667 ;;
668 ;; TODO: It might be preferable to patch in absolute file names in
669 ;; calls to dlopen or PR_LoadLibrary, but that didn't seem to
670 ;; work. More investigation is needed.
9f7ae77f 671 (substitute* "toolkit/library/moz.build"
002c3e6d
MW
672 (("^# This library needs to be last" all)
673 (string-append "OS_LIBS += [
9f7ae77f 674 'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5',
002c3e6d
MW
675 'avcodec', 'avutil', 'pulse' ]\n\n"
676 all)))
9f7ae77f 677 #t))
90e1cdae
MW
678 (replace
679 'configure
680 ;; configure does not work followed by both "SHELL=..." and
681 ;; "CONFIG_SHELL=..."; set environment variables instead
682 (lambda* (#:key outputs configure-flags #:allow-other-keys)
683 (let* ((out (assoc-ref outputs "out"))
684 (bash (which "bash"))
685 (abs-srcdir (getcwd))
686 (srcdir (string-append "../" (basename abs-srcdir)))
687 (flags `(,(string-append "--prefix=" out)
688 ,(string-append "--with-l10n-base="
689 abs-srcdir "/l10n")
690 ,@configure-flags)))
691 (setenv "SHELL" bash)
692 (setenv "CONFIG_SHELL" bash)
002c3e6d 693 (setenv "AUTOCONF" (which "autoconf")) ; must be autoconf-2.13
90e1cdae
MW
694 (mkdir "../build")
695 (chdir "../build")
696 (format #t "build directory: ~s~%" (getcwd))
697 (format #t "configure flags: ~s~%" flags)
698 (zero? (apply system* bash
699 (string-append srcdir "/configure")
6cde5c34
LC
700 flags)))))
701 (add-before 'configure 'install-desktop-entry
702 (lambda* (#:key outputs #:allow-other-keys)
703 ;; Install the '.desktop' file.
704 (define (swallow-%%-directives input output)
705 ;; Interpret '%%ifdef' directives found in the '.desktop' file.
706 (let loop ((state 'top))
707 (match (read-line input 'concat)
708 ((? eof-object?)
709 #t)
710 ((? string? line)
711 (cond ((string-prefix? "%%ifdef" line)
712 (loop 'ifdef))
713 ((string-prefix? "%%else" line)
714 (loop 'else))
715 ((string-prefix? "%%endif" line)
716 (loop 'top))
717 (else
718 (case state
719 ((top else)
720 (display line output)
721 (loop state))
722 (else
723 (loop state)))))))))
724
725 (let* ((out (assoc-ref outputs "out"))
726 (applications (string-append out "/share/applications")))
727 (call-with-input-file "debian/icecat.desktop.in"
728 (lambda (input)
729 (call-with-output-file "debian/icecat.desktop"
730 (lambda (output)
731 (swallow-%%-directives input output)))))
732
733 (substitute* "debian/icecat.desktop"
734 (("@MOZ_DISPLAY_NAME@")
735 "GNU IceCat")
736 (("^Exec=@MOZ_APP_NAME@")
737 (string-append "Exec=" out "/bin/icecat"))
738 (("@MOZ_APP_NAME@")
739 "icecat"))
740 (install-file "debian/icecat.desktop" applications)
88a8ce87
AG
741 #t)))
742 (add-after 'install-desktop-entry 'install-icons
743 (lambda* (#:key outputs #:allow-other-keys)
744 (let ((out (assoc-ref outputs "out")))
745 (with-directory-excursion "browser/branding/official"
746 (for-each
747 (lambda (file)
748 (let* ((size (string-filter char-numeric? file))
749 (icons (string-append out "/share/icons/hicolor/"
750 size "x" size "/apps")))
751 (mkdir-p icons)
752 (copy-file file (string-append icons "/icecat.png"))))
753 '("default16.png" "default22.png" "default24.png"
754 "default32.png" "default48.png" "content/icon64.png"
6e75740f
CL
755 "mozicon128.png" "default256.png"))))))
756 ;; This fixes the file chooser crash that happens with GTK 3.
757 (add-after 'install 'wrap-program
758 (lambda* (#:key inputs outputs #:allow-other-keys)
759 (let* ((out (assoc-ref outputs "out"))
760 (lib (string-append out "/lib"))
761 (gtk (assoc-ref inputs "gtk+"))
762 (gtk-share (string-append gtk "/share")))
763 (wrap-program (car (find-files lib "^icecat$"))
764 `("XDG_DATA_DIRS" ":" prefix (,gtk-share)))))))))
6fd52309 765 (home-page "https://www.gnu.org/software/gnuzilla/")
be0f6112
AE
766 (synopsis "Entirely free browser derived from Mozilla Firefox")
767 (description
768 "IceCat is the GNU version of the Firefox browser. It is entirely free
c5779c93 769software, which does not recommend non-free plugins and addons. It also
79c311b8 770features built-in privacy-protecting features.")
63e8bb12 771 (license license:mpl2.0) ;and others, see toolkit/content/license.html
99effc8f
LC
772 (properties
773 `((ftp-directory . "/gnu/gnuzilla")
774 (cpe-name . "firefox_esr")
bfb48f4f 775 (cpe-version . ,(first (string-split version #\-)))))))