gnu: Add lci.
[jackhill/guix/guix.git] / gnu / packages / gnuzilla.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
4 ;;; Copyright © 2014, 2015, 2016 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
6 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
8 ;;;
9 ;;; This file is part of GNU Guix.
10 ;;;
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
15 ;;;
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
20 ;;;
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24 (define-module (gnu packages gnuzilla)
25 #:use-module ((srfi srfi-1) #:hide (zip))
26 #:use-module (gnu packages)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (guix packages)
29 #:use-module (guix download)
30 #:use-module (guix build-system gnu)
31 #:use-module (gnu packages base)
32 #:use-module (gnu packages databases)
33 #:use-module (gnu packages glib)
34 #:use-module (gnu packages gstreamer)
35 #:use-module (gnu packages gtk)
36 #:use-module (gnu packages gnome)
37 #:use-module (gnu packages libcanberra)
38 #:use-module (gnu packages cups)
39 #:use-module (gnu packages mit-krb5)
40 #:use-module (gnu packages linux)
41 #:use-module (gnu packages perl)
42 #:use-module (gnu packages pkg-config)
43 #:use-module (gnu packages compression)
44 #:use-module (gnu packages fontutils)
45 #:use-module (gnu packages libevent)
46 #:use-module (gnu packages libreoffice) ;for hunspell
47 #:use-module (gnu packages image)
48 #:use-module (gnu packages libffi)
49 #:use-module (gnu packages pulseaudio)
50 #:use-module (gnu packages python)
51 #:use-module (gnu packages xorg)
52 #:use-module (gnu packages gl)
53 #:use-module (gnu packages assembly)
54 #:use-module (gnu packages icu4c)
55 #:use-module (gnu packages video)
56 #:use-module (gnu packages xdisorg)
57 #:use-module (gnu packages zip))
58
59 (define-public mozjs
60 (package
61 (name "mozjs")
62 (version "17.0.0")
63 (source (origin
64 (method url-fetch)
65 (uri (string-append
66 "https://ftp.mozilla.org/pub/mozilla.org/js/"
67 name version ".tar.gz"))
68 (sha256
69 (base32
70 "1fig2wf4f10v43mqx67y68z6h77sy900d1w0pz9qarrqx57rc7ij"))
71 (modules '((guix build utils)))
72 (snippet
73 ;; Fix incompatibility with Perl 5.22+.
74 '(substitute* '("js/src/config/milestone.pl")
75 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE")))))
76 (build-system gnu-build-system)
77 (native-inputs
78 `(("perl" ,perl)
79 ("python" ,python-2)))
80 (arguments
81 `(;; XXX: parallel build fails, lacking:
82 ;; mkdir -p "system_wrapper_js/"
83 #:parallel-build? #f
84 #:phases
85 (alist-cons-before
86 'configure 'chdir
87 (lambda _
88 (chdir "js/src"))
89 (alist-replace
90 'configure
91 ;; configure fails if it is followed by SHELL and CONFIG_SHELL
92 (lambda* (#:key outputs #:allow-other-keys)
93 (let ((out (assoc-ref outputs "out")))
94 (setenv "SHELL" (which "sh"))
95 (setenv "CONFIG_SHELL" (which "sh"))
96 (zero? (system*
97 "./configure" (string-append "--prefix=" out)))))
98 %standard-phases))))
99 (home-page
100 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey")
101 (synopsis "Mozilla javascript engine")
102 (description "SpiderMonkey is Mozilla's JavaScript engine written
103 in C/C++.")
104 (license license:mpl2.0))) ; and others for some files
105
106 (define-public mozjs-24
107 (package (inherit mozjs)
108 (name "mozjs")
109 (version "24.2.0")
110 (source (origin
111 (method url-fetch)
112 (uri (string-append
113 "https://ftp.mozilla.org/pub/mozilla.org/js/"
114 name "-" version ".tar.bz2"))
115 (sha256
116 (base32
117 "1n1phk8r3l8icqrrap4czplnylawa0ddc2cc4cgdz46x3lrkybz6"))
118 (modules '((guix build utils)))
119 (snippet
120 ;; Fix incompatibility with Perl 5.22+.
121 '(substitute* '("js/src/config/milestone.pl")
122 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE")))))
123 (arguments
124 '(;; XXX: parallel build fails, lacking:
125 ;; mkdir -p "system_wrapper_js/"
126 #:parallel-build? #f
127 #:phases
128 (modify-phases %standard-phases
129 (replace
130 'configure
131 (lambda* (#:key outputs #:allow-other-keys)
132 (let ((out (assoc-ref outputs "out")))
133 (chdir "js/src")
134 ;; configure fails if it is follwed by SHELL and CONFIG_SHELL
135 (setenv "SHELL" (which "sh"))
136 (setenv "CONFIG_SHELL" (which "sh"))
137 (zero? (system* "./configure"
138 (string-append "--prefix=" out)
139 "--with-system-nspr"
140 "--enable-system-ffi"
141 "--enable-threadsafe"))))))))
142 (native-inputs
143 `(("perl" ,perl)
144 ("pkg-config" ,pkg-config)
145 ("python" ,python-2)))
146 (propagated-inputs
147 `(("nspr" ,nspr))) ; in the Requires.private field of mozjs-24.pc
148 (inputs
149 `(("libffi" ,libffi)
150 ("zlib" ,zlib)))))
151
152 (define-public nspr
153 (package
154 (name "nspr")
155 (version "4.12")
156 (source (origin
157 (method url-fetch)
158 (uri (string-append
159 "https://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v"
160 version "/src/nspr-" version ".tar.gz"))
161 (sha256
162 (base32
163 "1pk98bmc5xzbl62q5wf2d6mryf0v95z6rsmxz27nclwiaqg0mcg0"))))
164 (build-system gnu-build-system)
165 (native-inputs
166 `(("perl" ,perl)))
167 (arguments
168 `(#:tests? #f ; no check target
169 #:configure-flags (list "--enable-64bit"
170 (string-append "LDFLAGS=-Wl,-rpath="
171 (assoc-ref %outputs "out")
172 "/lib"))
173 #:phases (alist-cons-before
174 'configure 'chdir
175 (lambda _
176 (chdir "nspr"))
177 %standard-phases)))
178 (home-page
179 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR")
180 (synopsis "Netscape API for system level and libc-like functions")
181 (description "Netscape Portable Runtime (NSPR) provides a
182 platform-neutral API for system level and libc-like functions. It is used
183 in the Mozilla clients.")
184 (license license:mpl2.0)))
185
186 (define-public nss
187 (package
188 (name "nss")
189 (version "3.27.1")
190 (source (origin
191 (method url-fetch)
192 (uri (let ((version-with-underscores
193 (string-join (string-split version #\.) "_")))
194 (string-append
195 "https://ftp.mozilla.org/pub/mozilla.org/security/nss/"
196 "releases/NSS_" version-with-underscores "_RTM/src/"
197 "nss-" version ".tar.gz")))
198 (sha256
199 (base32
200 "0sraxk26swlgl7rl742rkfp5k251v5z3lqw9k8ikin0cjfhkfdpx"))
201 ;; Create nss.pc and nss-config.
202 (patches (search-patches "nss-pkgconfig.patch"))))
203 (build-system gnu-build-system)
204 (outputs '("out" "bin"))
205 (arguments
206 '(#:parallel-build? #f ; failed
207 #:make-flags
208 (let* ((out (assoc-ref %outputs "out"))
209 (nspr (string-append (assoc-ref %build-inputs "nspr")))
210 (rpath (string-append "-Wl,-rpath=" out "/lib/nss")))
211 (list "-C" "nss" (string-append "PREFIX=" out)
212 "NSDISTMODE=copy"
213 "NSS_USE_SYSTEM_SQLITE=1"
214 (string-append "NSPR_INCLUDE_DIR=" nspr "/include/nspr")
215 ;; Add $out/lib/nss to RPATH.
216 (string-append "RPATH=" rpath)
217 (string-append "LDFLAGS=" rpath)))
218 #:modules ((guix build gnu-build-system)
219 (guix build utils)
220 (ice-9 ftw)
221 (ice-9 match)
222 (srfi srfi-26))
223 #:phases
224 (alist-replace
225 'configure
226 (lambda* (#:key system inputs #:allow-other-keys)
227 (setenv "CC" "gcc")
228 ;; Tells NSS to build for the 64-bit ABI if we are 64-bit system.
229 (when (string-prefix? "x86_64" system)
230 (setenv "USE_64" "1"))
231 #t)
232 (alist-replace
233 'check
234 (lambda _
235 ;; Use 127.0.0.1 instead of $HOST.$DOMSUF as HOSTADDR for testing.
236 ;; The later requires a working DNS or /etc/hosts.
237 (setenv "DOMSUF" "(none)")
238 (setenv "USE_IP" "TRUE")
239 (setenv "IP_ADDRESS" "127.0.0.1")
240 (zero? (system* "./nss/tests/all.sh")))
241 (alist-replace
242 'install
243 (lambda* (#:key outputs #:allow-other-keys)
244 (let* ((out (assoc-ref outputs "out"))
245 (bin (string-append (assoc-ref outputs "bin") "/bin"))
246 (inc (string-append out "/include/nss"))
247 (lib (string-append out "/lib/nss"))
248 (obj (match (scandir "dist" (cut string-suffix? "OBJ" <>))
249 ((obj) (string-append "dist/" obj)))))
250 ;; Install nss-config to $out/bin.
251 (install-file (string-append obj "/bin/nss-config")
252 (string-append out "/bin"))
253 (delete-file (string-append obj "/bin/nss-config"))
254 ;; Install nss.pc to $out/lib/pkgconfig.
255 (install-file (string-append obj "/lib/pkgconfig/nss.pc")
256 (string-append out "/lib/pkgconfig"))
257 (delete-file (string-append obj "/lib/pkgconfig/nss.pc"))
258 (rmdir (string-append obj "/lib/pkgconfig"))
259 ;; Install other files.
260 (copy-recursively "dist/public/nss" inc)
261 (copy-recursively (string-append obj "/bin") bin)
262 (copy-recursively (string-append obj "/lib") lib)
263
264 ;; FIXME: libgtest1.so is installed in the above step, and it's
265 ;; (unnecessarily) linked with several NSS libraries, but
266 ;; without the needed rpaths, causing the 'validate-runpath'
267 ;; phase to fail. Here we simply delete libgtest1.so, since it
268 ;; seems to be used only during the tests.
269 (delete-file (string-append lib "/libgtest1.so"))
270
271 #t))
272 %standard-phases)))))
273 (inputs
274 `(("sqlite" ,sqlite)
275 ("zlib" ,zlib)))
276 (propagated-inputs `(("nspr" ,nspr))) ; required by nss.pc.
277 (native-inputs `(("perl" ,perl)))
278
279 ;; The NSS test suite takes around 48 hours on Loongson 3A (MIPS) when
280 ;; another build is happening concurrently on the same machine.
281 (properties '((timeout . 216000))) ; 60 hours
282
283 (home-page
284 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS")
285 (synopsis "Network Security Services")
286 (description
287 "Network Security Services (NSS) is a set of libraries designed to support
288 cross-platform development of security-enabled client and server applications.
289 Applications built with NSS can support SSL v2 and v3, TLS, PKCS #5, PKCS #7,
290 PKCS #11, PKCS #12, S/MIME, X.509 v3 certificates, and other security
291 standards.")
292 (license license:mpl2.0)))
293
294 (define (mozilla-patch file-name changeset hash)
295 "Return an origin for CHANGESET from the mozilla-esr45 repository."
296 (origin
297 (method url-fetch)
298 (uri (string-append "https://hg.mozilla.org/releases/mozilla-esr45/raw-rev/"
299 changeset))
300 (sha256 (base32 hash))
301 (file-name file-name)))
302
303 (define-public icecat
304 (package
305 (name "icecat")
306 (version "45.3.0-gnu1-beta")
307 (source
308 (origin
309 (method url-fetch)
310 (uri (list (string-append "mirror://gnu/gnuzilla/" version "/"
311 name "-" version ".tar.bz2")
312 ;; XXX Temporary URI for 45.3 beta release.
313 ;; Remove when no longer needed.
314 (string-append "http://jenkins.trisquel.info/icecat/binaries/"
315 "icecat-45.3.0-gnu1.tar.bz2")))
316 (sha256
317 (base32
318 "1hk5lwaqm8nkfm43sq521mzyrx0x3iiwvlcy62m7cq7grz9wixp6"))
319 (patches
320 `(,(search-patch "icecat-avoid-bundled-libraries.patch")
321 ,(mozilla-patch "icecat-CVE-2016-5250.patch" "6711ccb0184e" "1p0s91rw1j7ib6hy9gh5p0l33rja32rfgygh29jw4wq1hxfql8rk")
322 ,(mozilla-patch "icecat-CVE-2016-5257-pt1.patch" "b08f28db372e" "0fmifimavawbff700rzjibsnr16am6902gp965scvi1iy78754ia")
323 ,(mozilla-patch "icecat-CVE-2016-5257-pt2.patch" "a49fd7eb57ba" "1dyh0pjdmf64sjbj1x0mdjwfispacx9yny1kx9nzpf85myryr640")
324 ,(mozilla-patch "icecat-CVE-2016-5257-pt3.patch" "9707c3423a1e" "12nn8av0akza4ml1is9mfy8f7368mrkxsl32ly97r4irzh0iryh1")
325 ,(mozilla-patch "icecat-CVE-2016-5257-pt4.patch" "9d632865560a" "1msp1wqv0c317wqkm82hd9ajbg4a5mcr8pld5j8cx37ccv7f21g3")
326 ,(mozilla-patch "icecat-CVE-2016-5257-pt5.patch" "90697781ec9f" "1h6gcrw5ykf7r59phxqkhpfs7jsgzqn509qm43sj7mbpcvqvk5mg")
327 ,(mozilla-patch "icecat-CVE-2016-5257-pt6.patch" "dd9eb81853b9" "1lyqnn40sayziych8gqd5aj7il3zajf318y8ddj8dzz3c8id5dzc")
328 ,(mozilla-patch "icecat-CVE-2016-5257-pt7.patch" "d91fc76079e0" "022lhixa8dxa6ny9a4bh2di282i0lhyq0glqr9n4q3r8msfmf0ba")
329 ,(mozilla-patch "icecat-CVE-2016-5257-pt8.patch" "3e37ba5e0867" "1w8lncxaayq4xndhyp1hwlv00zggbayljq6rlypb8kdwgzfpi77w")
330 ,(mozilla-patch "icecat-CVE-2016-5257-pt9.patch" "3c4958a98908" "16bc6ai5qddnpm3yw24lry5s7i05xs0ycixzxiir4wmcgwcaayiy")
331 ,(mozilla-patch "icecat-CVE-2016-5261.patch" "bc2f5467b33d" "0i4b8ydmqg4blx541f56g9qrlm7gp6ih4cs7ixbds724cwk83b9f")
332 ,(mozilla-patch "icecat-CVE-2016-5270.patch" "7cd50d56bb61" "15nbp5axr59mczxgf37nli37jbw0jdknmxz7z71772pzjd2z07r9")
333 ,(mozilla-patch "icecat-CVE-2016-5272.patch" "6e43a01fee3c" "025xp1wdnz1gc5l2rsgbrwsh1pbysjiyfgz0g6rvr390r7ag1n74")
334 ,(mozilla-patch "icecat-CVE-2016-5274.patch" "10c9453407de" "1wqh6hj0dpa7r3hhlyrflcv3r3cg0xq4rb0zvhysi6l7lwb8q51r")
335 ,(mozilla-patch "icecat-CVE-2016-5276.patch" "fc818ab03f15" "1q64ipl172dcmyy9p8p3l3ljpdh1q1jg48lai0qn2xgknl7sdpks")
336 ,(mozilla-patch "icecat-CVE-2016-5277.patch" "7b668c5cec92" "1qmchn6qifgjakzac6i4hgnivy062pzgz9p1l11c1m3an1rh0isg")
337 ,(mozilla-patch "icecat-CVE-2016-5278.patch" "fd5052e343df" "1nzmzlnsz61w9aw4mjvgmlkz88aqv1w858rr0mbv07hwyrljfi84")
338 ,(mozilla-patch "icecat-CVE-2016-5280.patch" "30673bc9730b" "1qz1684v1rp86ngadcaqd68iqf472flnrnk971ryg4fbsyy8g1za")
339 ,(mozilla-patch "icecat-CVE-2016-5281-pt1.patch" "61405f1fd1df" "1fgmq67arwsl1nrl133fcb5cz6jbbcfjvbv8cd8cadhapin971a7")
340 ,(mozilla-patch "icecat-CVE-2016-5281-pt2.patch" "7776b6ec7b92" "1f7k8f4lk7nyghwajsxf6nb7yvzsaw3jwpa3316znsva12m548mn")
341 ,(mozilla-patch "icecat-CVE-2016-5284-pt1.patch" "55e768767416" "1gg7m12njbkn1jqf2gp2y7zd9ik3xhqkjb7znczna4l438h7ki83")
342 ,(mozilla-patch "icecat-CVE-2016-5284-pt2.patch" "3c42249975a5" "0gnanndkmhsp49rldv4kh0smkdcs7616v46hn567kfw8yfwqvnli")
343 ,(mozilla-patch "icecat-CVE-2016-5284-pt3.patch" "126e5d574811" "13gr08bzqy23adz0ciihb7cy9wdnkcn71i77a3y5b5apm6k54mwi")
344 ,(mozilla-patch "icecat-CVE-2016-5284-pt4.patch" "7b8bd7aae1a8" "0mq5gpq6ni8czfcs1rif4is0igh0054aw41ga0jqkq58g7lavkrf")
345 ,(mozilla-patch "icecat-CVE-2016-5284-pt5.patch" "0799490f4e6f" "1ypv6i48nabbhcqbach8fbgz9bmnhm7q5z9dnfid44z8g54l3f33")
346 ,(mozilla-patch "icecat-CVE-2016-5284-pt6.patch" "fc990e4ae8bc" "1s2cj505ajwwiy4xvn5zlmyzqpgahxmqqvis0a6xm6mjbjh02gm4")
347 ,(mozilla-patch "icecat-bug-1251088.patch" "5ffa912ed83e" "0v5lpv3c89c2d4y5acn0kyijv096axdnrvaj5ya5yypzfcaqxv24")
348 ,(mozilla-patch "icecat-bug-1292590.patch" "d4b5b8f3e373" "0w8cxn6ryhgxryy8k8i06yw4mknv509ns9ff1avd0hmgxa83mcdp")
349 ,(mozilla-patch "icecat-bug-1298169.patch" "adce603ae36d" "0mgs85cwx61bk17r7npl311l4m8yn4667wyhgjmm2ajiys6nn0yl")
350 ,(mozilla-patch "icecat-bug-1301496.patch" "97268426bb6f" "1z7hg796cgag025gm9pp2szz7w870s7naagdri1dlsilj797v8hr")
351 ,(mozilla-patch "icecat-bug-1299519.patch" "fc055950b6b8" "05iml5k3rzc653jk4imd111sh18625jxfxkcj12kjdihl0gdr4x4")
352 ,(mozilla-patch "icecat-bug-1303710.patch" "6f845c23565b" "01dlbnmpsnwr448fajs276y62gl03r74k1hxnwsg6ihwhnfdvn5a")
353 ,(mozilla-patch "icecat-bug-1301343.patch" "e5d51ca7a3c0" "0hshcz24hc6pkz5pcqxhajm17ibwrlfn1s00frfnpjjy56vacfz0")
354 ,(mozilla-patch "icecat-bug-1299686.patch" "576f1725a57e" "1lic9d3r8r1vcniw1g3ca71390lw3dmwjsw55dp6z96hyjbcq3fd")))
355 (modules '((guix build utils)))
356 (snippet
357 '(begin
358 (use-modules (ice-9 ftw))
359 ;; Remove bundled libraries that we don't use, since they may
360 ;; contain unpatched security flaws, they waste disk space and
361 ;; network bandwidth, and may cause confusion.
362 (for-each delete-file-recursively
363 '(;; FIXME: Removing the bundled icu breaks configure.
364 ;; * The bundled icu headers are used in some places.
365 ;; * The version number is taken from the bundled copy.
366 ;;"intl/icu"
367 ;;
368 ;; FIXME: A script from the bundled nspr is used.
369 ;;"nsprpub"
370 ;;
371 ;; TODO: Use system media libraries. Waiting for:
372 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
373 ;; * libogg
374 ;; * libtheora
375 ;; * libvorbis
376 ;; * libtremor (not yet in guix)
377 ;; * libopus
378 ;; * speex
379 ;; * soundtouch (not yet in guix)
380 ;;
381 ;; TODO: Use system harfbuzz. Waiting for:
382 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=847568>
383 ;;
384 ;; TODO: Use system graphite2.
385 ;;
386 "modules/freetype2"
387 "modules/zlib"
388 "modules/libbz2"
389 "ipc/chromium/src/third_party/libevent"
390 "media/libvpx"
391 "security/nss"
392 "gfx/cairo"
393 "js/src/ctypes/libffi"
394 "db/sqlite3"))
395 ;; Delete .pyc files, typically present in icecat source tarballs
396 (for-each delete-file (find-files "." "\\.pyc$"))
397 ;; Delete obj-* directories, found in icecat-45.3.0-gnu1-beta
398 (for-each delete-file-recursively
399 (scandir "." (lambda (name)
400 (string-prefix? "obj-" name))))
401 #t))))
402 (build-system gnu-build-system)
403 (inputs
404 `(("alsa-lib" ,alsa-lib)
405 ("bzip2" ,bzip2)
406 ("cairo" ,cairo)
407 ("cups" ,cups)
408 ("dbus-glib" ,dbus-glib)
409 ("gdk-pixbuf" ,gdk-pixbuf)
410 ("glib" ,glib)
411 ("gstreamer" ,gstreamer)
412 ("gst-plugins-base" ,gst-plugins-base)
413 ("gtk+" ,gtk+-2)
414 ("pango" ,pango)
415 ("freetype" ,freetype)
416 ("hunspell" ,hunspell)
417 ("libcanberra" ,libcanberra)
418 ("libgnome" ,libgnome)
419 ("libxft" ,libxft)
420 ("libevent" ,libevent)
421 ("libxinerama" ,libxinerama)
422 ("libxscrnsaver" ,libxscrnsaver)
423 ("libxcomposite" ,libxcomposite)
424 ("libxt" ,libxt)
425 ("libffi" ,libffi)
426 ("libvpx" ,libvpx)
427 ("icu4c" ,icu4c)
428 ("pixman" ,pixman)
429 ("pulseaudio" ,pulseaudio)
430 ("mesa" ,mesa)
431 ("mit-krb5" ,mit-krb5)
432 ("nspr" ,nspr)
433 ("nss" ,nss)
434
435 ;; XXX Work around the fact that our 'sqlite' package was not built
436 ;; with -DSQLITE_ENABLE_DBSTAT_VTAB.
437 ("sqlite" ,(package
438 (inherit sqlite)
439 (arguments
440 `(#:configure-flags
441 ;; Add -DSQLITE_SECURE_DELETE, -DSQLITE_ENABLE_UNLOCK_NOTIFY and
442 ;; -DSQLITE_ENABLE_DBSTAT_VTAB to CFLAGS. GNU Icecat will refuse
443 ;; to use the system SQLite unless these options are enabled.
444 (list (string-append "CFLAGS=-O2 -DSQLITE_SECURE_DELETE "
445 "-DSQLITE_ENABLE_UNLOCK_NOTIFY "
446 "-DSQLITE_ENABLE_DBSTAT_VTAB"))))))
447 ;;("sqlite" ,sqlite)
448
449 ("startup-notification" ,startup-notification)
450 ("unzip" ,unzip)
451 ("yasm" ,yasm)
452 ("zip" ,zip)
453 ("zlib" ,zlib)))
454 (native-inputs
455 `(("perl" ,perl)
456 ("python" ,python-2) ; Python 3 not supported
457 ("python2-pysqlite" ,python2-pysqlite)
458 ("pkg-config" ,pkg-config)
459 ("which" ,which)))
460 (arguments
461 `(#:tests? #f ; no check target
462 #:out-of-source? #t ; must be built outside of the source directory
463 #:parallel-build? #f
464
465 ;; XXX: There are RUNPATH issues such as
466 ;; $prefix/lib/icecat-31.6.0/plugin-container NEEDing libmozalloc.so,
467 ;; which is not in its RUNPATH, but they appear to be harmless in
468 ;; practice somehow. See <http://hydra.gnu.org/build/378133>.
469 #:validate-runpath? #f
470
471 #:configure-flags '("--enable-default-toolkit=cairo-gtk2"
472 "--enable-pango"
473 "--enable-gio"
474 "--enable-svg"
475 "--enable-canvas"
476 "--enable-mathml"
477 "--enable-startup-notification"
478 "--enable-pulseaudio"
479 "--enable-gstreamer=1.0"
480
481 "--disable-gnomevfs"
482 "--disable-gconf"
483 "--disable-gnomeui"
484
485 ;; Building with debugging symbols takes ~5GiB, so
486 ;; disable it.
487 "--disable-debug"
488 "--disable-debug-symbols"
489
490 ;; Temporary hack to work around missing
491 ;; "unofficial" branding in
492 ;; icecat-45.3.0-gnu1-beta.
493 "--enable-official-branding"
494
495 ;; Avoid bundled libraries.
496 "--with-system-zlib"
497 "--with-system-bz2"
498 "--with-system-libevent"
499 "--with-system-libvpx"
500 "--with-system-icu"
501 "--with-system-nspr"
502 "--with-system-nss"
503 "--enable-system-pixman"
504 "--enable-system-cairo"
505 "--enable-system-ffi"
506 "--enable-system-hunspell"
507 "--enable-system-sqlite"
508
509 ;; Fails with "--with-system-png won't work because
510 ;; the system's libpng doesn't have APNG support".
511 ;; According to
512 ;; http://sourceforge.net/projects/libpng-apng/ ,
513 ;; "the Animated Portable Network Graphics (APNG)
514 ;; is an unofficial extension of the Portable
515 ;; Network Graphics (PNG) format";
516 ;; we probably do not wish to support it.
517 ;; "--with-system-png"
518
519 ;; Fails with "libjpeg-turbo JCS_EXTENSIONS
520 ;; required".
521 ;; According to
522 ;; http://sourceforge.net/projects/libjpeg-turbo/ ,
523 ;; "libjpeg-turbo is a derivative of libjpeg that
524 ;; uses MMX, SSE, SSE2, and NEON SIMD instructions
525 ;; to accelerate baseline JPEG compression/
526 ;; decompression", so we had better not use it
527 ;; "--with-system-jpeg"
528 )
529
530 #:modules ((ice-9 ftw)
531 (ice-9 rdelim)
532 (ice-9 match)
533 ,@%gnu-build-system-modules)
534 #:phases
535 (modify-phases %standard-phases
536 (add-after
537 'unpack 'ensure-no-mtimes-pre-1980
538 (lambda _
539 ;; Without this, the 'source/test/addons/packed.xpi' and
540 ;; 'source/test/addons/simple-prefs.xpi' targets fail while trying
541 ;; to create zip archives.
542 (let ((early-1980 315619200)) ; 1980-01-02 UTC
543 (ftw "." (lambda (file stat flag)
544 (unless (<= early-1980 (stat:mtime stat))
545 (utime file early-1980 early-1980))
546 #t))
547 #t)))
548 (add-after
549 'unpack 'remove-h264parse-from-blacklist
550 (lambda _
551 ;; Remove h264parse from gstreamer format helper blacklist. It
552 ;; was put there to work around a bug in a pre-1.0 version of
553 ;; gstreamer. See:
554 ;; https://www.mozilla.org/en-US/security/advisories/mfsa2015-47/
555 (substitute* "dom/media/gstreamer/GStreamerFormatHelper.cpp"
556 (("^ \"h264parse\",\n") ""))
557 #t))
558 (add-after
559 'unpack 'arrange-to-link-libxul-with-libraries-it-might-dlopen
560 (lambda _
561 ;; libxul.so dynamically opens libraries, so here we explicitly
562 ;; link them into libxul.so instead.
563 ;;
564 ;; TODO: It might be preferable to patch in absolute file names in
565 ;; calls to dlopen or PR_LoadLibrary, but that didn't seem to
566 ;; work. More investigation is needed.
567 (substitute* "toolkit/library/moz.build"
568 (("^# This needs to be last")
569 "OS_LIBS += [
570 'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5',
571 'gstreamer-1.0', 'gstapp-1.0', 'gstvideo-1.0' ]\n\n"))
572 #t))
573 (replace
574 'configure
575 ;; configure does not work followed by both "SHELL=..." and
576 ;; "CONFIG_SHELL=..."; set environment variables instead
577 (lambda* (#:key outputs configure-flags #:allow-other-keys)
578 (let* ((out (assoc-ref outputs "out"))
579 (bash (which "bash"))
580 (abs-srcdir (getcwd))
581 (srcdir (string-append "../" (basename abs-srcdir)))
582 (flags `(,(string-append "--prefix=" out)
583 ,(string-append "--with-l10n-base="
584 abs-srcdir "/l10n")
585 ,@configure-flags)))
586 (setenv "SHELL" bash)
587 (setenv "CONFIG_SHELL" bash)
588 (mkdir "../build")
589 (chdir "../build")
590 (format #t "build directory: ~s~%" (getcwd))
591 (format #t "configure flags: ~s~%" flags)
592 (zero? (apply system* bash
593 (string-append srcdir "/configure")
594 flags)))))
595 (add-before 'configure 'install-desktop-entry
596 (lambda* (#:key outputs #:allow-other-keys)
597 ;; Install the '.desktop' file.
598 (define (swallow-%%-directives input output)
599 ;; Interpret '%%ifdef' directives found in the '.desktop' file.
600 (let loop ((state 'top))
601 (match (read-line input 'concat)
602 ((? eof-object?)
603 #t)
604 ((? string? line)
605 (cond ((string-prefix? "%%ifdef" line)
606 (loop 'ifdef))
607 ((string-prefix? "%%else" line)
608 (loop 'else))
609 ((string-prefix? "%%endif" line)
610 (loop 'top))
611 (else
612 (case state
613 ((top else)
614 (display line output)
615 (loop state))
616 (else
617 (loop state)))))))))
618
619 (let* ((out (assoc-ref outputs "out"))
620 (applications (string-append out "/share/applications")))
621 (call-with-input-file "debian/icecat.desktop.in"
622 (lambda (input)
623 (call-with-output-file "debian/icecat.desktop"
624 (lambda (output)
625 (swallow-%%-directives input output)))))
626
627 (substitute* "debian/icecat.desktop"
628 (("@MOZ_DISPLAY_NAME@")
629 "GNU IceCat")
630 (("^Exec=@MOZ_APP_NAME@")
631 (string-append "Exec=" out "/bin/icecat"))
632 (("@MOZ_APP_NAME@")
633 "icecat"))
634 (install-file "debian/icecat.desktop" applications)
635 #t)))
636 (add-after 'install-desktop-entry 'install-icons
637 (lambda* (#:key outputs #:allow-other-keys)
638 (let ((out (assoc-ref outputs "out")))
639 (with-directory-excursion "browser/branding/official"
640 (for-each
641 (lambda (file)
642 (let* ((size (string-filter char-numeric? file))
643 (icons (string-append out "/share/icons/hicolor/"
644 size "x" size "/apps")))
645 (mkdir-p icons)
646 (copy-file file (string-append icons "/icecat.png"))))
647 '("default16.png" "default22.png" "default24.png"
648 "default32.png" "default48.png" "content/icon64.png"
649 "mozicon128.png" "default256.png")))))))))
650 (home-page "http://www.gnu.org/software/gnuzilla/")
651 (synopsis "Entirely free browser derived from Mozilla Firefox")
652 (description
653 "IceCat is the GNU version of the Firefox browser. It is entirely free
654 software, which does not recommend non-free plugins and addons. It also
655 features built-in privacy-protecting features.")
656 (license license:mpl2.0) ;and others, see toolkit/content/license.html
657 (properties
658 `((ftp-directory . "/gnu/gnuzilla")
659 (cpe-name . "firefox_esr")
660 (cpe-version . ,(first (string-split version #\-)))))))