gnu: Add emacs-helm-flycheck.
[guix.git] / gnu / packages / gnuzilla.scm
blobdf87700d6f8f28454017bcfcbb2bdad3cc1514b9
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
4 ;;; Copyright © 2014, 2015, 2016, 2017, 2018 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
6 ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
8 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
9 ;;; Copyright © 2017 Nils Gillmann <ng0@n0.is>
10 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
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/>.
27 (define-module (gnu packages gnuzilla)
28   #:use-module ((srfi srfi-1) #:hide (zip))
29   #:use-module (ice-9 match)
30   #:use-module (gnu packages)
31   #:use-module ((guix licenses) #:prefix license:)
32   #:use-module (guix packages)
33   #:use-module (guix download)
34   #:use-module (guix utils)
35   #:use-module (guix build-system gnu)
36   #:use-module (gnu packages autotools)
37   #:use-module (gnu packages base)
38   #:use-module (gnu packages databases)
39   #:use-module (gnu packages glib)
40   #:use-module (gnu packages gtk)
41   #:use-module (gnu packages gnome)
42   #:use-module (gnu packages libcanberra)
43   #:use-module (gnu packages cups)
44   #:use-module (gnu packages kerberos)
45   #:use-module (gnu packages linux)
46   #:use-module (gnu packages perl)
47   #:use-module (gnu packages pkg-config)
48   #:use-module (gnu packages compression)
49   #:use-module (gnu packages fontutils)
50   #:use-module (gnu packages libevent)
51   #:use-module (gnu packages libreoffice)  ;for hunspell
52   #:use-module (gnu packages image)
53   #:use-module (gnu packages libffi)
54   #:use-module (gnu packages pulseaudio)
55   #:use-module (gnu packages python)
56   #:use-module (gnu packages xorg)
57   #:use-module (gnu packages gl)
58   #:use-module (gnu packages assembly)
59   #:use-module (gnu packages icu4c)
60   #:use-module (gnu packages video)
61   #:use-module (gnu packages xdisorg)
62   #:use-module (gnu packages readline))
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
75                "1fig2wf4f10v43mqx67y68z6h77sy900d1w0pz9qarrqx57rc7ij"))
76              (patches (search-patches "mozjs17-aarch64-support.patch"))
77              (modules '((guix build utils)))
78              (snippet
79               ;; Fix incompatibility with Perl 5.22+.
80               '(begin
81                  (substitute* '("js/src/config/milestone.pl")
82                    (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE"))
83                  #t))))
84     (build-system gnu-build-system)
85     (native-inputs
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)))
93     (arguments
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
100            ;; This test times out on slower hardware.
101            (lambda _
102              (delete-file "js/src/jit-test/tests/basic/bug698584.js")
103              #t))
104          (add-before 'configure 'chdir
105            (lambda _
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"))
114                (invoke "./configure" (string-append "--prefix=" out)
115                        ,@(if (string=? "aarch64-linux"
116                                        (%current-system))
117                              '("--host=aarch64-unknown-linux-gnu")
118                              '()))))))))
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
123 in C/C++.")
124     (license license:mpl2.0))) ; and others for some files
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
137                 "1n1phk8r3l8icqrrap4czplnylawa0ddc2cc4cgdz46x3lrkybz6"))
138               (modules '((guix build utils)))
139               (patches (search-patches "mozjs24-aarch64-support.patch"))
140               (snippet
141                ;; Fix incompatibility with Perl 5.22+.
142                '(begin
143                   (substitute* '("js/src/config/milestone.pl")
144                     (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE"))
145                   #t))))
146     (arguments
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"))
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                                 '())))))))))
165     (inputs
166      `(("libffi" ,libffi)
167        ("zlib" ,zlib)))))
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.
187                 "mozjs38-version-detection.patch" ; for 0ad
188                 "mozjs38-tracelogger.patch"
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:]]"))
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"))
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                (invoke "./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"
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)))))
255 (define-public nspr
256   (package
257     (name "nspr")
258     (version "4.19")
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
266                "0agpv3f17h8kmzi0ifibaaxc1k3xc0q61wqw3l6r2xr2z8bmkn9f"))))
267     (build-system gnu-build-system)
268     (native-inputs
269      `(("perl" ,perl)))
270     (arguments
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"))
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")
280        #:phases (modify-phases %standard-phases
281                   (add-before 'configure 'chdir
282                     (lambda _ (chdir "nspr") #t)))))
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")
286     (description "Netscape Portable Runtime (@dfn{NSPR}) provides a
287 platform-neutral API for system level and libc-like functions.  It is used
288 in the Mozilla clients.")
289     (license license:mpl2.0)))
291 (define-public nss
292   (package
293     (name "nss")
294     (version "3.36.1")
295     (source (origin
296               (method url-fetch)
297               (uri (let ((version-with-underscores
298                           (string-join (string-split version #\.) "_")))
299                      (string-append
300                       "https://ftp.mozilla.org/pub/mozilla.org/security/nss/"
301                       "releases/NSS_" version-with-underscores "_RTM/src/"
302                       "nss-" version ".tar.gz")))
303               (sha256
304                (base32
305                 "1zrb49mp7cy3snnday1zv8d76h1mgppbcwxnlkqsgxlga8fl89b0"))
306               ;; Create nss.pc and nss-config.
307               (patches (search-patches "nss-pkgconfig.patch"
308                                        "nss-increase-test-timeout.patch"))))
309     (build-system gnu-build-system)
310     (outputs '("out" "bin"))
311     (arguments
312      `(#:parallel-build? #f ; not supported
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))
329        #:phases
330        (modify-phases %standard-phases
331          (replace 'configure
332            (lambda _
333              (setenv "CC" "gcc")
334              ;; Tells NSS to build for the 64-bit ABI if we are 64-bit system.
335              ,@(match (%current-system)
336                  ((or "x86_64-linux" "aarch64-linux")
337                   `((setenv "USE_64" "1")))
338                  (_
339                   '()))
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              (invoke "./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)
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"))
377                  (delete-file (string-append lib "/libgtestutil.so"))
379                  #t))))))
380     (inputs
381      `(("sqlite" ,sqlite)
382        ("zlib" ,zlib)))
383     (propagated-inputs `(("nspr" ,nspr))) ; required by nss.pc.
384     (native-inputs `(("perl" ,perl)))
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
390     (home-page
391      "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS")
392     (synopsis "Network Security Services")
393     (description
394      "Network Security Services (@dfn{NSS}) is a set of libraries designed to
395 support cross-platform development of security-enabled client and server
396 applications.  Applications built with NSS can support SSL v2 and v3, TLS,
397 PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509 v3 certificates, and other
398 security standards.")
399     (license license:mpl2.0)))
401 (define (mozilla-patch file-name changeset hash)
402   "Return an origin for CHANGESET from the mozilla-esr52 repository."
403   (origin
404     (method url-fetch)
405     (uri (string-append "https://hg.mozilla.org/releases/mozilla-esr52/raw-rev/"
406                         changeset))
407     (sha256 (base32 hash))
408     (file-name file-name)))
410 (define-public icecat
411   (package
412     (name "icecat")
413     (version "52.6.0-gnu1")
414     (source
415      (origin
416       (method url-fetch)
417       (uri (string-append "mirror://gnu/gnuzilla/"
418                           (first (string-split version #\-))
419                           "/" name "-" version ".tar.bz2"))
420       (sha256
421        (base32
422         "09fn54glqg1aa93hnz5zdcy07cps09dbni2b4200azh6nang630a"))
423       (patches
424        (list
425         (search-patch "icecat-avoid-bundled-libraries.patch")
426         (search-patch "icecat-use-system-harfbuzz.patch")
427         (search-patch "icecat-use-system-graphite2.patch")
428         (mozilla-patch "icecat-bug-546387.patch"         "d13e3fefb76e" "1b760r0bg2ydbl585wlmajljh1nlisrwxvjws5b28a3sgjy01i6k")
429         (mozilla-patch "icecat-bug-1350152.patch"        "f822bda79c28" "1wf56169ca874shr6r7qx40s17h2gwj7ngmpyylrpmd1c6hipvsj")
430         (mozilla-patch "icecat-bug-1411708.patch"        "34c968767eb7" "0l2jy201ikj3m3h66mvlsj4y0ki7cpm7x7nnfygbwnfxg42s1sip")
431         (mozilla-patch "icecat-bug-1375217.patch"        "00fc630c9a46" "17pcprp452nslk6sac6sili0p74zh8w3g0v1wsdn0ikm9xmnphhv")
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")
435         (mozilla-patch "icecat-bug-1426087.patch"        "391ea77ebfdb" "1fhkvd0z6mvdkj7m0d3jlj42rsdw5r4x122c1wb1i428228ifw6n")
436         (mozilla-patch "icecat-bug-1416307.patch"        "54f2f7f93b30" "1ncjir16mqya37wgf6fy2rqki3vl433c4grjr3fypmlig6xfgg1l")
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")
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")
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")
448         (mozilla-patch "icecat-bug-1430173-pt1.patch"    "9124c3972e2b" "13ns5yy39yzfx7lrkv4rgwdz6s6q0z4i09wkbxdvnkfsz17cd17i")
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")
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")
461         (mozilla-patch "icecat-CVE-2018-5148.patch"      "c3e447e07077" "0gmwy631f8ip4gr1mpbjk8bx1n1748wdls5zq4y8hpmpnq5g1wyx")
462         (mozilla-patch "icecat-CVE-2018-5178.patch"      "17201199b18d" "1d0hcim1fwh0bklwpmnal1mv9d9kmyif1m15aj1nqkf1n3x4xc37")
463         (mozilla-patch "icecat-bug-1361699.patch"        "a07d6c3ff262" "1z8mjg2487r8pxi0x951v6fwwr696q84f6hlzimc3r7bn5ds9r83")
464         (mozilla-patch "icecat-CVE-2018-5150-pt01.patch" "7127ccf8f88c" "0m4my7aflpp0wlqilr2m4axd7k2fyrs7jqdcz2rrz5pwivz1anvd")
465         (mozilla-patch "icecat-bug-1444231.patch"        "57bd35fa8618" "0pl6x5amc5x6nhwl7qnmnff3jjjxmbs8r365bfzj58g7q5ihqwvf")
466         (mozilla-patch "icecat-CVE-2018-5150-pt02.patch" "2f3e1ccf1661" "0azl8g81kpc0w2xpjpgm1154ll12g0a8n6i7bl3s9nnrk2i26n74")
467         (mozilla-patch "icecat-CVE-2018-5159.patch"      "8ff2c4d68e36" "0kz1rqhnz8ca4z20hnpcafidhsrwhnm0h2gmlgchni33h8pisr1f")
468         (mozilla-patch "icecat-CVE-2018-5154.patch"      "b8c430253efd" "1arjcaps9axhxh5ff84n9bydhhzrihn7hbq7v69nvqwqrjp3lgg9")
469         (mozilla-patch "icecat-CVE-2018-5155.patch"      "05cadfa3ac39" "0q0vh7vy7x0l8jp6376fn10qljfp4mnp4m9zfn90j4m19pfl86a0")
470         (mozilla-patch "icecat-CVE-2018-5168.patch"      "48a678d7cb81" "1yfh7kxxxvqck2hpn98pwag4splyc6c9brc5haq28fp8x9r9qvlk")
471         (mozilla-patch "icecat-CVE-2018-5150-pt03.patch" "112032576872" "1x1hxyggbxlnlj0n9cbp03hjnfvm6cq8nqj0jizrd8cfyd5aig8p")
472         (mozilla-patch "icecat-CVE-2018-5150-pt04.patch" "ad9a885b0df4" "1hrk1q9mk59jww55g4lqmaflznk87x3vvjn2mxfgfbbjs8l1cyz4")
473         (mozilla-patch "icecat-bug-1452416.patch"        "f89ab96a2532" "1dqchxdyznhgyxhfq0hm0vg1p597hjqflfzigc7j3s5vxf9rg2nv")
474         (mozilla-patch "icecat-CVE-2018-5150-pt05.patch" "af885a1bd293" "1wfpqhm2dp4fsx6zbrncngsqz7g2x09b625zcighixrbpvybyww3")
475         (mozilla-patch "icecat-CVE-2018-5150-pt06.patch" "666fc84ec72d" "0lml2wqd4yqidhi364x8r90f78397k2y0kq5z5bv8l8j4bhcnb9v")
476         (search-patch  "icecat-CVE-2018-5157-and-CVE-2018-5158.patch")
477         (mozilla-patch "icecat-CVE-2018-5150-pt07.patch" "1ab40761a856" "1kgwypy7k5b33jwkni4025za4kcnv5m6klsx4wsswlixmljmkbc7")
478         (mozilla-patch "icecat-bug-1453339.patch"        "0edb8dca7087" "0b30pipqryh311sc97rcmwnx9n8qdlbbz90b2hkybjnprmbhfxrm")
479         (mozilla-patch "icecat-CVE-2018-5150-pt08.patch" "134c728799c1" "16hbwx6fx1hrddsyjjbd3z954ql3pg348xs13h9riyblq8crzmam")
480         (mozilla-patch "icecat-CVE-2018-5150-pt09.patch" "14eab155eaa8" "0wr4xgblxzk4c2gvlnpl7ic1196mrhry1hgwdl1jivq0ji5cbvbd")
481         (mozilla-patch "icecat-bug-1452619.patch"        "2b75d55ccf0e" "1g87aybw6ggv6hyk385bplv0lx63n020gwyq0d6d4pqld48hsm1i")
482         (mozilla-patch "icecat-bug-1453127.patch"        "89857f35df29" "0gzi47svrw5ajdlm3i12193psm702zx70x5h1rwp4gb7gxh4m4d9")
483         (mozilla-patch "icecat-CVE-2018-5150-pt10.patch" "3f2ec03c0405" "0w02952dlxd2gmwghck2nm4rjjmc5ylg62bw6m1rvi35kcr134lr")
484         (mozilla-patch "icecat-CVE-2018-5183.patch"      "f729bf78fb3a" "0xkj6jwxwdqkvb5c7wi16b8cm8qrnlrd3s9jnd46jg03iykrx56f")
485         (mozilla-patch "icecat-bug-1437842.patch"        "eb896089db47" "10lppk4x2d3pim71a36ky1dmg08rs5ckfiljwvfnr1cw6934qxl4")
486         (mozilla-patch "icecat-bug-1458270.patch"        "2374dca97bde" "0y1g55wvj44nzb1qfkl271jcf8s1ik8lcl1785z0zim4qzn7qkpa")
487         (mozilla-patch "icecat-bug-1452576.patch"        "70b6298e0c9e" "0n5jfy6c421dkybk8m18vd61y95zz0r64g1p1zlya3fps5knfaqi")
488         (mozilla-patch "icecat-bug-1459206-pt1.patch"    "4ef79fe9b3b7" "1c32z1ki1i6xj1nbb0xlxwqnmz48ikmy8dmp37rkjz8ssn04wgfg")
489         (mozilla-patch "icecat-bug-1459206-pt2.patch"    "9ad16112044a" "0ayya67sx7avcb8bplfdxb92l9g4mjrb1s3hby283llhqv0ikg9b")
490         (mozilla-patch "icecat-bug-1459162.patch"        "11d8a87fb6d6" "1rkmdk18llw0x1jakix75hlhy0hpsmlminnflagbzrzjli81gwm1")
491         (mozilla-patch "icecat-bug-1451297.patch"        "407b10ad1273" "16qzsfirw045xag96f1qvpdlibm8lwdj9l1mlli4n1vz0db91v9q")
492         (mozilla-patch "icecat-bug-1462682.patch"        "e76e2e481b17" "0hnx13msjy28n3bpa2c24kpzalam4bdk5gnp0f9k671l48rs9yb3")
493         (mozilla-patch "icecat-bug-1450688.patch"        "2c75bfcd465c" "1pjinj8qypafqm2fk68s3hzcbzcijn09qzrpcxvzq6bl1yfc1xfd")
494         (mozilla-patch "icecat-bug-1456975.patch"        "042f80f3befd" "0av918kin4bkrq7gnjz0h9w8kkq8rk9l93250lfl5kqrinza1gsk")
495         (mozilla-patch "icecat-bugs-1442722+1455071+1433642+1456604+1458320.patch"
496                                                          "bb0451c9c4a0" "1lhm1b2a7c6jwhzsg3c830hfhp17p8j9zbcmgchpb8c5jkc3vw0x")
497         (mozilla-patch "icecat-bug-1465108-pt1.patch"    "8189b262e3b9" "13rh86ddwmj1bhv3ibbil3sv5xbqq1c9v1czgbsna5hxxkzc1y3b")
498         (mozilla-patch "icecat-bug-1465108-pt2.patch"    "9f81ae3f6e1d" "05vfg8a8jrzd93n1wvncmvdmqgf9cgsl8ryxgjs3032gbbjkga7q")
499         (mozilla-patch "icecat-bug-1459693.patch"        "face7a3dd5d7" "0jclw30mf693w8lrmvn0iankggj21nh4j3zh51q5363rj5xncdzx")
500         (mozilla-patch "icecat-bug-1464829.patch"        "7afb58c046c8" "1r0569r76712x7x1sw6xr0x06ilv6iw3fncb0f8r8b9mp6wrpx34")
501         (mozilla-patch "icecat-bug-1452375-pt1.patch"    "f1a745f8c42d" "11q73pb7a8f09xjzil4rhg5nr49zrnz1vb0prni0kqvrnppf5s40")
502         (mozilla-patch "icecat-bug-1452375-pt2.patch"    "1f9a430881cc" "0f79rv7njliqxx33z07n60b50jg0a596d1km7ayz2hivbl2d0168")))
503       (modules '((guix build utils)))
504       (snippet
505        '(begin
506           (use-modules (ice-9 ftw))
507           ;; Remove bundled libraries that we don't use, since they may
508           ;; contain unpatched security flaws, they waste disk space and
509           ;; network bandwidth, and may cause confusion.
510           (for-each delete-file-recursively
511                     '(;; FIXME: Removing the bundled icu breaks configure.
512                       ;;   * The bundled icu headers are used in some places.
513                       ;;   * The version number is taken from the bundled copy.
514                       ;;"intl/icu"
515                       ;;
516                       ;; FIXME: A script from the bundled nspr is used.
517                       ;;"nsprpub"
518                       ;;
519                       ;; TODO: Use system media libraries.  Waiting for:
520                       ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
521                       ;;   * libogg
522                       ;;   * libtheora
523                       ;;   * libvorbis
524                       ;;   * libtremor (not yet in guix)
525                       ;;   * libopus
526                       ;;   * speex
527                       ;;   * soundtouch (not yet in guix)
528                       ;;
529                       "modules/freetype2"
530                       "modules/zlib"
531                       "modules/libbz2"
532                       "ipc/chromium/src/third_party/libevent"
533                       "media/libjpeg"
534                       "media/libvpx"
535                       "security/nss"
536                       "gfx/cairo"
537                       "gfx/harfbuzz"
538                       "gfx/graphite2"
539                       "js/src/ctypes/libffi"
540                       "db/sqlite3"))
541           ;; Delete .pyc files, typically present in icecat source tarballs
542           (for-each delete-file (find-files "." "\\.pyc$"))
543           ;; Delete obj-* directories, sometimes present in icecat tarballs
544           (for-each delete-file-recursively
545                     (scandir "." (lambda (name)
546                                    (string-prefix? "obj-" name))))
547           #t))))
548     (build-system gnu-build-system)
549     (inputs
550      `(("alsa-lib" ,alsa-lib)
551        ("bzip2" ,bzip2)
552        ("cairo" ,cairo)
553        ("cups" ,cups)
554        ("dbus-glib" ,dbus-glib)
555        ("gdk-pixbuf" ,gdk-pixbuf)
556        ("glib" ,glib)
557        ("gtk+" ,gtk+)
558        ("gtk+-2" ,gtk+-2)
559        ("graphite2" ,graphite2)
560        ("pango" ,pango)
561        ("freetype" ,freetype)
562        ("harfbuzz" ,harfbuzz)
563        ("hunspell" ,hunspell)
564        ("libcanberra" ,libcanberra)
565        ("libgnome" ,libgnome)
566        ("libjpeg-turbo" ,libjpeg-turbo)
567        ("libxft" ,libxft)
568        ("libevent" ,libevent-2.0)
569        ("libxinerama" ,libxinerama)
570        ("libxscrnsaver" ,libxscrnsaver)
571        ("libxcomposite" ,libxcomposite)
572        ("libxt" ,libxt)
573        ("libffi" ,libffi)
574        ("ffmpeg" ,ffmpeg-3.4)
575        ("libvpx" ,libvpx)
576        ("icu4c" ,icu4c)
577        ("pixman" ,pixman)
578        ("pulseaudio" ,pulseaudio)
579        ("mesa" ,mesa)
580        ("mit-krb5" ,mit-krb5)
581        ("nspr" ,nspr)
582        ("nss" ,nss)
583        ("sqlite" ,sqlite)
584        ("startup-notification" ,startup-notification)
585        ("unzip" ,unzip)
586        ("zip" ,zip)
587        ("zlib" ,zlib)))
588     (native-inputs
589      `(("perl" ,perl)
590        ("python" ,python-2) ; Python 3 not supported
591        ("python2-pysqlite" ,python2-pysqlite)
592        ("yasm" ,yasm)
593        ("pkg-config" ,pkg-config)
594        ("autoconf" ,autoconf-2.13)
595        ("which" ,which)))
596     (arguments
597      `(#:tests? #f          ; no check target
598        #:out-of-source? #t  ; must be built outside of the source directory
600        ;; XXX: There are RUNPATH issues such as
601        ;; $prefix/lib/icecat-31.6.0/plugin-container NEEDing libmozalloc.so,
602        ;; which is not in its RUNPATH, but they appear to be harmless in
603        ;; practice somehow.  See <http://hydra.gnu.org/build/378133>.
604        #:validate-runpath? #f
606        #:configure-flags '("--enable-default-toolkit=cairo-gtk3"
608                            "--with-distribution-id=org.gnu"
610                            "--enable-gio"
611                            "--enable-startup-notification"
612                            "--enable-pulseaudio"
614                            "--disable-tests"
615                            "--disable-updater"
616                            "--disable-crashreporter"
617                            "--disable-maintenance-service"
618                            "--disable-eme"
619                            "--disable-gconf"
620                            "--disable-gnomeui"
622                            ;; Building with debugging symbols takes ~5GiB, so
623                            ;; disable it.
624                            "--disable-debug"
625                            "--disable-debug-symbols"
627                            ;; Hack to work around missing
628                            ;; "unofficial" branding in icecat.
629                            "--enable-official-branding"
631                            ;; Avoid bundled libraries.
632                            "--with-system-zlib"
633                            "--with-system-bz2"
634                            "--with-system-jpeg"        ; must be libjpeg-turbo
635                            "--with-system-libevent"
636                            "--with-system-libvpx"
637                            "--with-system-icu"
638                            "--with-system-nspr"
639                            "--with-system-nss"
640                            "--with-system-harfbuzz"
641                            "--with-system-graphite2"
642                            "--enable-system-pixman"
643                            "--enable-system-cairo"
644                            "--enable-system-ffi"
645                            "--enable-system-hunspell"
646                            "--enable-system-sqlite"
648                            ;; Fails with "--with-system-png won't work because
649                            ;; the system's libpng doesn't have APNG support".
650                            ;; According to
651                            ;; http://sourceforge.net/projects/libpng-apng/ ,
652                            ;; "the Animated Portable Network Graphics (APNG)
653                            ;; is an unofficial extension of the Portable
654                            ;; Network Graphics (PNG) format";
655                            ;; we probably do not wish to support it.
656                            ;; "--with-system-png"
657                            )
659        #:modules ((ice-9 ftw)
660                   (ice-9 rdelim)
661                   (ice-9 match)
662                   ,@%gnu-build-system-modules)
663        #:phases
664        (modify-phases %standard-phases
665          (add-after
666           'unpack 'ensure-no-mtimes-pre-1980
667           (lambda _
668             ;; Without this, the 'source/test/addons/packed.xpi' and
669             ;; 'source/test/addons/simple-prefs.xpi' targets fail while trying
670             ;; to create zip archives.
671             (let ((early-1980 315619200)) ; 1980-01-02 UTC
672               (ftw "." (lambda (file stat flag)
673                          (unless (<= early-1980 (stat:mtime stat))
674                            (utime file early-1980 early-1980))
675                          #t))
676               #t)))
677          (add-after
678           'unpack 'link-libxul-with-libraries
679           (lambda _
680             ;; libxul.so dynamically opens libraries, so here we explicitly
681             ;; link them into libxul.so instead.
682             ;;
683             ;; TODO: It might be preferable to patch in absolute file names in
684             ;; calls to dlopen or PR_LoadLibrary, but that didn't seem to
685             ;; work.  More investigation is needed.
686             (substitute* "toolkit/library/moz.build"
687               (("^# This library needs to be last" all)
688                (string-append "OS_LIBS += [
689     'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5',
690     'avcodec', 'avutil', 'pulse' ]\n\n"
691                               all)))
692             #t))
693          (replace
694           'configure
695           ;; configure does not work followed by both "SHELL=..." and
696           ;; "CONFIG_SHELL=..."; set environment variables instead
697           (lambda* (#:key outputs configure-flags #:allow-other-keys)
698             (let* ((out (assoc-ref outputs "out"))
699                    (bash (which "bash"))
700                    (abs-srcdir (getcwd))
701                    (srcdir (string-append "../" (basename abs-srcdir)))
702                    (flags `(,(string-append "--prefix=" out)
703                             ,(string-append "--with-l10n-base="
704                                             abs-srcdir "/l10n")
705                             ,@configure-flags)))
706               (setenv "SHELL" bash)
707               (setenv "CONFIG_SHELL" bash)
708               (setenv "AUTOCONF" (which "autoconf")) ; must be autoconf-2.13
709               (mkdir "../build")
710               (chdir "../build")
711               (format #t "build directory: ~s~%" (getcwd))
712               (format #t "configure flags: ~s~%" flags)
713               (apply invoke bash
714                      (string-append srcdir "/configure")
715                      flags))))
716          (add-before 'configure 'install-desktop-entry
717            (lambda* (#:key outputs #:allow-other-keys)
718              ;; Install the '.desktop' file.
719              (define (swallow-%%-directives input output)
720                ;; Interpret '%%ifdef' directives found in the '.desktop' file.
721                (let loop ((state 'top))
722                  (match (read-line input 'concat)
723                    ((? eof-object?)
724                     #t)
725                    ((? string? line)
726                     (cond ((string-prefix? "%%ifdef" line)
727                            (loop 'ifdef))
728                           ((string-prefix? "%%else" line)
729                            (loop 'else))
730                           ((string-prefix? "%%endif" line)
731                            (loop 'top))
732                           (else
733                            (case state
734                              ((top else)
735                               (display line output)
736                               (loop state))
737                              (else
738                               (loop state)))))))))
740              (let* ((out (assoc-ref outputs "out"))
741                     (applications (string-append out "/share/applications")))
742                (call-with-input-file "debian/icecat.desktop.in"
743                  (lambda (input)
744                    (call-with-output-file "debian/icecat.desktop"
745                      (lambda (output)
746                        (swallow-%%-directives input output)))))
748                (substitute* "debian/icecat.desktop"
749                  (("@MOZ_DISPLAY_NAME@")
750                   "GNU IceCat")
751                  (("^Exec=@MOZ_APP_NAME@")
752                   (string-append "Exec=" out "/bin/icecat"))
753                  (("@MOZ_APP_NAME@")
754                   "icecat"))
755                (install-file "debian/icecat.desktop" applications)
756                #t)))
757          (add-after 'install-desktop-entry 'install-icons
758            (lambda* (#:key outputs #:allow-other-keys)
759              (let ((out (assoc-ref outputs "out")))
760                (with-directory-excursion "browser/branding/official"
761                  (for-each
762                   (lambda (file)
763                     (let* ((size (string-filter char-numeric? file))
764                            (icons (string-append out "/share/icons/hicolor/"
765                                                  size "x" size "/apps")))
766                       (mkdir-p icons)
767                       (copy-file file (string-append icons "/icecat.png"))))
768                   '("default16.png" "default22.png" "default24.png"
769                     "default32.png" "default48.png" "content/icon64.png"
770                     "mozicon128.png" "default256.png"))
771                  #t))))
772          ;; This fixes the file chooser crash that happens with GTK 3.
773          (add-after 'install 'wrap-program
774            (lambda* (#:key inputs outputs #:allow-other-keys)
775              (let* ((out (assoc-ref outputs "out"))
776                     (lib (string-append out "/lib"))
777                     (gtk (assoc-ref inputs "gtk+"))
778                     (gtk-share (string-append gtk "/share")))
779                (wrap-program (car (find-files lib "^icecat$"))
780                  `("XDG_DATA_DIRS" ":" prefix (,gtk-share)))
781                #t))))))
782     (home-page "https://www.gnu.org/software/gnuzilla/")
783     (synopsis "Entirely free browser derived from Mozilla Firefox")
784     (description
785      "IceCat is the GNU version of the Firefox browser.  It is entirely free
786 software, which does not recommend non-free plugins and addons.  It also
787 features built-in privacy-protecting features.")
788     (license license:mpl2.0)     ;and others, see toolkit/content/license.html
789     (properties
790      `((ftp-directory . "/gnu/gnuzilla")
791        (cpe-name . "firefox_esr")
792        (cpe-version . ,(first (string-split version #\-)))))))