gnu: nss: Increase test timeouts.
[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, 2017 Ludovic Courtès <ludo@gnu.org>
4 ;;; Copyright © 2014, 2015, 2016, 2017 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 ;;;
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 (ice-9 match)
27 #:use-module (gnu packages)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix packages)
30 #:use-module (guix download)
31 #:use-module (guix build-system gnu)
32 #:use-module (gnu packages base)
33 #:use-module (gnu packages databases)
34 #:use-module (gnu packages glib)
35 #:use-module (gnu packages gstreamer)
36 #:use-module (gnu packages gtk)
37 #:use-module (gnu packages gnome)
38 #:use-module (gnu packages libcanberra)
39 #:use-module (gnu packages cups)
40 #:use-module (gnu packages kerberos)
41 #:use-module (gnu packages linux)
42 #:use-module (gnu packages perl)
43 #:use-module (gnu packages pkg-config)
44 #:use-module (gnu packages compression)
45 #:use-module (gnu packages fontutils)
46 #:use-module (gnu packages libevent)
47 #:use-module (gnu packages libreoffice) ;for hunspell
48 #:use-module (gnu packages image)
49 #:use-module (gnu packages libffi)
50 #:use-module (gnu packages pulseaudio)
51 #:use-module (gnu packages python)
52 #:use-module (gnu packages xorg)
53 #:use-module (gnu packages gl)
54 #:use-module (gnu packages assembly)
55 #:use-module (gnu packages icu4c)
56 #:use-module (gnu packages video)
57 #:use-module (gnu packages xdisorg)
58 #:use-module (gnu packages zip))
59
60 (define-public mozjs
61 (package
62 (name "mozjs")
63 (version "17.0.0")
64 (source (origin
65 (method url-fetch)
66 (uri (string-append
67 "https://ftp.mozilla.org/pub/mozilla.org/js/"
68 name version ".tar.gz"))
69 (sha256
70 (base32
71 "1fig2wf4f10v43mqx67y68z6h77sy900d1w0pz9qarrqx57rc7ij"))
72 (modules '((guix build utils)))
73 (snippet
74 ;; Fix incompatibility with Perl 5.22+.
75 '(substitute* '("js/src/config/milestone.pl")
76 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE")))))
77 (build-system gnu-build-system)
78 (native-inputs
79 `(("perl" ,perl)
80 ("python" ,python-2)))
81 (arguments
82 `(;; XXX: parallel build fails, lacking:
83 ;; mkdir -p "system_wrapper_js/"
84 #:parallel-build? #f
85 #:phases
86 (alist-cons-before
87 'configure 'chdir
88 (lambda _
89 (chdir "js/src"))
90 (alist-replace
91 'configure
92 ;; configure fails if it is followed by SHELL and CONFIG_SHELL
93 (lambda* (#:key outputs #:allow-other-keys)
94 (let ((out (assoc-ref outputs "out")))
95 (setenv "SHELL" (which "sh"))
96 (setenv "CONFIG_SHELL" (which "sh"))
97 (zero? (system*
98 "./configure" (string-append "--prefix=" out)))))
99 %standard-phases))))
100 (home-page
101 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey")
102 (synopsis "Mozilla javascript engine")
103 (description "SpiderMonkey is Mozilla's JavaScript engine written
104 in C/C++.")
105 (license license:mpl2.0))) ; and others for some files
106
107 (define-public mozjs-24
108 (package (inherit mozjs)
109 (name "mozjs")
110 (version "24.2.0")
111 (source (origin
112 (method url-fetch)
113 (uri (string-append
114 "https://ftp.mozilla.org/pub/mozilla.org/js/"
115 name "-" version ".tar.bz2"))
116 (sha256
117 (base32
118 "1n1phk8r3l8icqrrap4czplnylawa0ddc2cc4cgdz46x3lrkybz6"))
119 (modules '((guix build utils)))
120 (snippet
121 ;; Fix incompatibility with Perl 5.22+.
122 '(substitute* '("js/src/config/milestone.pl")
123 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE")))))
124 (arguments
125 '(;; XXX: parallel build fails, lacking:
126 ;; mkdir -p "system_wrapper_js/"
127 #:parallel-build? #f
128 #:phases
129 (modify-phases %standard-phases
130 (replace
131 'configure
132 (lambda* (#:key outputs #:allow-other-keys)
133 (let ((out (assoc-ref outputs "out")))
134 (chdir "js/src")
135 ;; configure fails if it is follwed by SHELL and CONFIG_SHELL
136 (setenv "SHELL" (which "sh"))
137 (setenv "CONFIG_SHELL" (which "sh"))
138 (zero? (system* "./configure"
139 (string-append "--prefix=" out)
140 "--with-system-nspr"
141 "--enable-system-ffi"
142 "--enable-threadsafe"))))))))
143 (native-inputs
144 `(("perl" ,perl)
145 ("pkg-config" ,pkg-config)
146 ("python" ,python-2)))
147 (propagated-inputs
148 `(("nspr" ,nspr))) ; in the Requires.private field of mozjs-24.pc
149 (inputs
150 `(("libffi" ,libffi)
151 ("zlib" ,zlib)))))
152
153 (define-public nspr
154 (package
155 (name "nspr")
156 (version "4.13.1")
157 (source (origin
158 (method url-fetch)
159 (uri (string-append
160 "https://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v"
161 version "/src/nspr-" version ".tar.gz"))
162 (sha256
163 (base32
164 "1arkg08l6zlp8v44shqbk2c8qzwd913lgh60fb3yfxls6d8ifk2y"))))
165 (build-system gnu-build-system)
166 (native-inputs
167 `(("perl" ,perl)))
168 (arguments
169 `(#:tests? #f ; no check target
170 #:configure-flags (list "--enable-64bit"
171 (string-append "LDFLAGS=-Wl,-rpath="
172 (assoc-ref %outputs "out")
173 "/lib"))
174 #:phases (alist-cons-before
175 'configure 'chdir
176 (lambda _
177 (chdir "nspr"))
178 %standard-phases)))
179 (home-page
180 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR")
181 (synopsis "Netscape API for system level and libc-like functions")
182 (description "Netscape Portable Runtime (NSPR) provides a
183 platform-neutral API for system level and libc-like functions. It is used
184 in the Mozilla clients.")
185 (license license:mpl2.0)))
186
187 (define-public nss
188 (package
189 (name "nss")
190 (version "3.29.2")
191 (source (origin
192 (method url-fetch)
193 (uri (let ((version-with-underscores
194 (string-join (string-split version #\.) "_")))
195 (string-append
196 "https://ftp.mozilla.org/pub/mozilla.org/security/nss/"
197 "releases/NSS_" version-with-underscores "_RTM/src/"
198 "nss-" version ".tar.gz")))
199 (sha256
200 (base32
201 "149807rmzb76hnh48rw4m9jw83iw0168njzchz0hmbsgc8mk0i5w"))
202 ;; Create nss.pc and nss-config.
203 (patches (search-patches "nss-pkgconfig.patch"
204 "nss-increase-test-timeout.patch"))))
205 (build-system gnu-build-system)
206 (outputs '("out" "bin"))
207 (arguments
208 `(#:parallel-build? #f ; not supported
209 #:make-flags
210 (let* ((out (assoc-ref %outputs "out"))
211 (nspr (string-append (assoc-ref %build-inputs "nspr")))
212 (rpath (string-append "-Wl,-rpath=" out "/lib/nss")))
213 (list "-C" "nss" (string-append "PREFIX=" out)
214 "NSDISTMODE=copy"
215 "NSS_USE_SYSTEM_SQLITE=1"
216 (string-append "NSPR_INCLUDE_DIR=" nspr "/include/nspr")
217 ;; Add $out/lib/nss to RPATH.
218 (string-append "RPATH=" rpath)
219 (string-append "LDFLAGS=" rpath)))
220 #:modules ((guix build gnu-build-system)
221 (guix build utils)
222 (ice-9 ftw)
223 (ice-9 match)
224 (srfi srfi-26))
225 #:phases
226 (modify-phases %standard-phases
227 (replace 'configure
228 (lambda _
229 (setenv "CC" "gcc")
230 ;; Tells NSS to build for the 64-bit ABI if we are 64-bit system.
231 ,@(match (%current-system)
232 ((or "x86_64-linux" "aarch64-linux")
233 `((setenv "USE_64" "1")))
234 (_
235 '()))
236 #t))
237 (replace 'check
238 (lambda _
239 ;; Use 127.0.0.1 instead of $HOST.$DOMSUF as HOSTADDR for testing.
240 ;; The later requires a working DNS or /etc/hosts.
241 (setenv "DOMSUF" "(none)")
242 (setenv "USE_IP" "TRUE")
243 (setenv "IP_ADDRESS" "127.0.0.1")
244 (zero? (system* "./nss/tests/all.sh"))))
245 (replace 'install
246 (lambda* (#:key outputs #:allow-other-keys)
247 (let* ((out (assoc-ref outputs "out"))
248 (bin (string-append (assoc-ref outputs "bin") "/bin"))
249 (inc (string-append out "/include/nss"))
250 (lib (string-append out "/lib/nss"))
251 (obj (match (scandir "dist" (cut string-suffix? "OBJ" <>))
252 ((obj) (string-append "dist/" obj)))))
253 ;; Install nss-config to $out/bin.
254 (install-file (string-append obj "/bin/nss-config")
255 (string-append out "/bin"))
256 (delete-file (string-append obj "/bin/nss-config"))
257 ;; Install nss.pc to $out/lib/pkgconfig.
258 (install-file (string-append obj "/lib/pkgconfig/nss.pc")
259 (string-append out "/lib/pkgconfig"))
260 (delete-file (string-append obj "/lib/pkgconfig/nss.pc"))
261 (rmdir (string-append obj "/lib/pkgconfig"))
262 ;; Install other files.
263 (copy-recursively "dist/public/nss" inc)
264 (copy-recursively (string-append obj "/bin") bin)
265 (copy-recursively (string-append obj "/lib") lib)
266
267 ;; FIXME: libgtest1.so is installed in the above step, and it's
268 ;; (unnecessarily) linked with several NSS libraries, but
269 ;; without the needed rpaths, causing the 'validate-runpath'
270 ;; phase to fail. Here we simply delete libgtest1.so, since it
271 ;; seems to be used only during the tests.
272 (delete-file (string-append lib "/libgtest1.so"))
273
274 #t))))))
275 (inputs
276 `(("sqlite" ,sqlite)
277 ("zlib" ,zlib)))
278 (propagated-inputs `(("nspr" ,nspr))) ; required by nss.pc.
279 (native-inputs `(("perl" ,perl)))
280
281 ;; The NSS test suite takes around 48 hours on Loongson 3A (MIPS) when
282 ;; another build is happening concurrently on the same machine.
283 (properties '((timeout . 216000))) ; 60 hours
284
285 (home-page
286 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS")
287 (synopsis "Network Security Services")
288 (description
289 "Network Security Services (NSS) is a set of libraries designed to support
290 cross-platform development of security-enabled client and server applications.
291 Applications built with NSS can support SSL v2 and v3, TLS, PKCS #5, PKCS #7,
292 PKCS #11, PKCS #12, S/MIME, X.509 v3 certificates, and other security
293 standards.")
294 (license license:mpl2.0)))
295
296 (define (mozilla-patch file-name changeset hash)
297 "Return an origin for CHANGESET from the mozilla-esr45 repository."
298 (origin
299 (method url-fetch)
300 (uri (string-append "https://hg.mozilla.org/releases/mozilla-esr45/raw-rev/"
301 changeset))
302 (sha256 (base32 hash))
303 (file-name file-name)))
304
305 (define-public icecat
306 (package
307 (name "icecat")
308 (version "45.7.0-gnu1")
309 (source
310 (origin
311 (method url-fetch)
312 (uri (string-append "mirror://gnu/gnuzilla/"
313 (first (string-split version #\-))
314 "/" name "-" version ".tar.bz2"))
315 (sha256
316 (base32
317 "1mn73liylqzxk441f28wk326yglqs8zcwqs4zz51s8i2id2jsnv3"))
318 (patches
319 (list
320 (search-patch "icecat-avoid-bundled-libraries.patch")
321 (search-patch "icecat-binutils.patch")
322 (mozilla-patch "icecat-CVE-2017-5398-pt01.patch" "1a39a54b5fea" "0k3sbf2w2yng2rpv6wl9zrm5cbsgq3pslr19xwrk8sk753as79fp")
323 (mozilla-patch "icecat-CVE-2017-5402.patch" "9828c3bb7b73" "0zgks0v9sqhwwkmry4daswvjwk6aqln6abx0iac1vwqqpg6swff6")
324 (mozilla-patch "icecat-CVE-2017-5398-pt02.patch" "fa3268a1147e" "1jyd1hvp42pz5l15agmb1jhw74b38x8xnj9ih5v4pskv41bgmyg5")
325 (mozilla-patch "icecat-CVE-2017-5400.patch" "347c10e4d6d1" "1w6yrm97l477q4ripbj0nimc87p4jscabvihpncxqbq9xzc4km7p")
326 (mozilla-patch "icecat-CVE-2017-5410.patch" "fe4a2cda54ad" "0spcs93hpz13d8670jgvww80f0ynrbhwbh62fkv27lpr6wmqwqh1")
327 (mozilla-patch "icecat-CVE-2017-5401.patch" "c38f8546be5f" "1sa22w9kzgynsn4c6zh4d66byskk5kffzbvlzrhyzvqjddypf9p8")
328 (mozilla-patch "icecat-CVE-2017-5398-pt03.patch" "41c80ecafa99" "0r33arr5wcgl00zgncasiyl65bmm6jy45clxnbb75nzjmsd1zx1s")
329 (mozilla-patch "icecat-CVE-2017-5405.patch" "381552c888b4" "1sjhh390cx1jqx74lxk6qd8f8ccppqgagqfhc9pnbm2m67hxvkj9")
330 (mozilla-patch "icecat-CVE-2017-5407.patch" "4ba337cdb998" "0vyknizid2z9nvl31m08c7fknizhv8dh8m54apm39k8lx77vf70p")
331 (mozilla-patch "icecat-CVE-2017-5398-pt04.patch" "886650fac531" "18fsr5dmav96ja0dah7mj34n8mjpckp0bbc32zjyaj5qx0m4h5cw")
332 (mozilla-patch "icecat-CVE-2017-5409.patch" "0a22becb23cd" "19fshrq4qkj5s0mjrads6by84gy7rsq3k57gha6sw6rvx8chjaz6")
333 (mozilla-patch "icecat-CVE-2017-5398-pt05.patch" "a0ead6ef09eb" "1hpsq81hhhq2a2dcq2dfndiwx93vvp5rfq0cgv6kwk2bsrq77wqq")
334 (mozilla-patch "icecat-CVE-2017-5398-pt06.patch" "d3fede027d06" "1aw02p367cm0ayijdiiawlb7qhab6jwqwkakj317yd1cjnmkalwr")
335 (mozilla-patch "icecat-CVE-2017-5398-pt07.patch" "ffca0f060bb4" "0qwisfp7idjj5nc1vp1afrf5lj66l2gp7rllkjmrqpz6cyfc708v")
336 (mozilla-patch "icecat-CVE-2017-5398-pt08.patch" "4aa65b44dcb9" "07j6dz2b7hp1bkfvkxwgpn2wc3hqrgjgwpaz96fcpz8yadg2fssw")
337 (mozilla-patch "icecat-bug-1318914.patch" "30e2382d800f" "0w8zky5i7zc5q943x37rdvi4wbcing0q7w9fcgvnnh5li2sbrsy8")
338 (mozilla-patch "icecat-CVE-2017-5408.patch" "403d2300adc2" "06r4j48rc1fd9gvmvqy68mlqah5xfxpkvwmxk0gnqc364kpq9slk")
339 (mozilla-patch "icecat-CVE-2017-5398-pt09.patch" "546ab5e99568" "05rdb9bm3n4lj0zq5a95xnwsb0vzirb9mbc2wf9xbi4xlamsgvvw")
340 (mozilla-patch "icecat-bug-1311380.patch" "ef6eeb7f8846" "1w19is5blbrwf3wlmy6wzgabih8sxp2kmkffqcj2g4jypfwyqn73")
341 (mozilla-patch "icecat-CVE-2017-5398-pt10.patch" "eec69810d80e" "1r20abhw7b38igsrdpkhcfwx9i9gmcxikv4y3sjr4wkbp684f7av")
342 (mozilla-patch "icecat-CVE-2017-5398-pt11.patch" "fec35ce6e68b" "1imdfrs8dxz44rhsmvydh29w5j64cij6g5ggrmhvz3386xvlil2v")
343 (mozilla-patch "icecat-CVE-2017-5398-pt12.patch" "725e2a217722" "06gfhi2ich279rjnxi15fb4igimsxnv5w6bx4g91js8wbvp2r3v0")
344 (mozilla-patch "icecat-CVE-2017-5398-pt13.patch" "d905a2e3a4d9" "1ibxi2s0czj47b739zmmjzbln8lpn27hdg4b17w58vhbhzkq31cx")
345 (mozilla-patch "icecat-CVE-2017-5398-pt14.patch" "0032560ae945" "0md3p5cix6nzbj5m199awc9gk52pygy5s9lx3a38vh3xvd92lsbj")
346 (mozilla-patch "icecat-CVE-2017-5398-pt15.patch" "91dda1e79ad8" "0b5h8fhagczfqkdgby982w6qgkw9y11zxxpdbn89rwmjpyp9nghx")
347 (mozilla-patch "icecat-CVE-2017-5404.patch" "556dd9e4a9e3" "0mbdx4xn1xs67n47ys9m42lc5ny96rz21ala848yajpdlxsz680g")
348 (mozilla-patch "icecat-bug-1341137-pt1.patch" "e86e0423dad1" "0dk1v7lcs61nx76qxcibha3ygqri15ldcvwwsrsayff9fq6k0v4y")
349 (mozilla-patch "icecat-bug-1341137-pt2.patch" "9aebee8b8cb9" "0m7p5iprhhwdv89aqqg7fla5szw6v7x2sll4ns0zg60pk4vm6izq")
350 (mozilla-patch "icecat-bug-1341137-pt3.patch" "69f3d44bdb48" "1ad7rw6nmg3c49ylqxlqqkb6cm2f0ygfzrigs6b60a2zkjqhbl0h")
351 (mozilla-patch "icecat-bug-1341137-pt4.patch" "22546e2cee64" "0gbwxa3p7qkq53hwnvxcqhx8h34qmnjdxy0h3ajik4mw76vrna9s")
352 (mozilla-patch "icecat-bug-1341137-pt5.patch" "e5083d8a855a" "1247vbpqzf007nigbxxqd6nwgr1dxd4p8cd0dr45afqh19vhlapj")
353 (mozilla-patch "icecat-bug-1339122.patch" "b0d156c7445e" "026jp5bb565yvhkmmicgygcn1lmak85p0466yl1vnjlx1rc8n724")))
354 (modules '((guix build utils)))
355 (snippet
356 '(begin
357 (use-modules (ice-9 ftw))
358 ;; Remove bundled libraries that we don't use, since they may
359 ;; contain unpatched security flaws, they waste disk space and
360 ;; network bandwidth, and may cause confusion.
361 (for-each delete-file-recursively
362 '(;; FIXME: Removing the bundled icu breaks configure.
363 ;; * The bundled icu headers are used in some places.
364 ;; * The version number is taken from the bundled copy.
365 ;;"intl/icu"
366 ;;
367 ;; FIXME: A script from the bundled nspr is used.
368 ;;"nsprpub"
369 ;;
370 ;; TODO: Use system media libraries. Waiting for:
371 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
372 ;; * libogg
373 ;; * libtheora
374 ;; * libvorbis
375 ;; * libtremor (not yet in guix)
376 ;; * libopus
377 ;; * speex
378 ;; * soundtouch (not yet in guix)
379 ;;
380 ;; TODO: Use system harfbuzz. Waiting for:
381 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=847568>
382 ;;
383 ;; TODO: Use system graphite2.
384 ;;
385 "modules/freetype2"
386 "modules/zlib"
387 "modules/libbz2"
388 "ipc/chromium/src/third_party/libevent"
389 "media/libjpeg"
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, sometimes present in icecat tarballs
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 ("libjpeg-turbo" ,libjpeg-turbo)
420 ("libxft" ,libxft)
421 ("libevent" ,libevent-2.0)
422 ("libxinerama" ,libxinerama)
423 ("libxscrnsaver" ,libxscrnsaver)
424 ("libxcomposite" ,libxcomposite)
425 ("libxt" ,libxt)
426 ("libffi" ,libffi)
427 ("libvpx" ,libvpx)
428 ("icu4c" ,icu4c)
429 ("pixman" ,pixman)
430 ("pulseaudio" ,pulseaudio)
431 ("mesa" ,mesa)
432 ("mit-krb5" ,mit-krb5)
433 ("nspr" ,nspr)
434 ("nss" ,nss)
435 ("sqlite" ,sqlite)
436 ("startup-notification" ,startup-notification)
437 ("unzip" ,unzip)
438 ("yasm" ,yasm)
439 ("zip" ,zip)
440 ("zlib" ,zlib)))
441 (native-inputs
442 `(("perl" ,perl)
443 ("python" ,python-2) ; Python 3 not supported
444 ("python2-pysqlite" ,python2-pysqlite)
445 ("pkg-config" ,pkg-config)
446 ("which" ,which)))
447 (arguments
448 `(#:tests? #f ; no check target
449 #:out-of-source? #t ; must be built outside of the source directory
450 #:parallel-build? #f
451
452 ;; XXX: There are RUNPATH issues such as
453 ;; $prefix/lib/icecat-31.6.0/plugin-container NEEDing libmozalloc.so,
454 ;; which is not in its RUNPATH, but they appear to be harmless in
455 ;; practice somehow. See <http://hydra.gnu.org/build/378133>.
456 #:validate-runpath? #f
457
458 #:configure-flags '("--enable-default-toolkit=cairo-gtk2"
459 "--enable-pango"
460 "--enable-gio"
461 "--enable-svg"
462 "--enable-canvas"
463 "--enable-mathml"
464 "--enable-startup-notification"
465 "--enable-pulseaudio"
466 "--enable-gstreamer=1.0"
467
468 "--disable-gnomevfs"
469 "--disable-gconf"
470 "--disable-gnomeui"
471
472 ;; Building with debugging symbols takes ~5GiB, so
473 ;; disable it.
474 "--disable-debug"
475 "--disable-debug-symbols"
476
477 ;; Hack to work around missing
478 ;; "unofficial" branding in icecat.
479 "--enable-official-branding"
480
481 ;; Avoid bundled libraries.
482 "--with-system-zlib"
483 "--with-system-bz2"
484 "--with-system-jpeg" ; must be libjpeg-turbo
485 "--with-system-libevent"
486 "--with-system-libvpx"
487 "--with-system-icu"
488 "--with-system-nspr"
489 "--with-system-nss"
490 "--enable-system-pixman"
491 "--enable-system-cairo"
492 "--enable-system-ffi"
493 "--enable-system-hunspell"
494 "--enable-system-sqlite"
495
496 ;; Fails with "--with-system-png won't work because
497 ;; the system's libpng doesn't have APNG support".
498 ;; According to
499 ;; http://sourceforge.net/projects/libpng-apng/ ,
500 ;; "the Animated Portable Network Graphics (APNG)
501 ;; is an unofficial extension of the Portable
502 ;; Network Graphics (PNG) format";
503 ;; we probably do not wish to support it.
504 ;; "--with-system-png"
505 )
506
507 #:modules ((ice-9 ftw)
508 (ice-9 rdelim)
509 (ice-9 match)
510 ,@%gnu-build-system-modules)
511 #:phases
512 (modify-phases %standard-phases
513 (add-after
514 'unpack 'ensure-no-mtimes-pre-1980
515 (lambda _
516 ;; Without this, the 'source/test/addons/packed.xpi' and
517 ;; 'source/test/addons/simple-prefs.xpi' targets fail while trying
518 ;; to create zip archives.
519 (let ((early-1980 315619200)) ; 1980-01-02 UTC
520 (ftw "." (lambda (file stat flag)
521 (unless (<= early-1980 (stat:mtime stat))
522 (utime file early-1980 early-1980))
523 #t))
524 #t)))
525 (add-after
526 'unpack 'remove-h264parse-from-blacklist
527 (lambda _
528 ;; Remove h264parse from gstreamer format helper blacklist. It
529 ;; was put there to work around a bug in a pre-1.0 version of
530 ;; gstreamer. See:
531 ;; https://www.mozilla.org/en-US/security/advisories/mfsa2015-47/
532 (substitute* "dom/media/gstreamer/GStreamerFormatHelper.cpp"
533 (("^ \"h264parse\",\n") ""))
534 #t))
535 (add-after
536 'unpack 'arrange-to-link-libxul-with-libraries-it-might-dlopen
537 (lambda _
538 ;; libxul.so dynamically opens libraries, so here we explicitly
539 ;; link them into libxul.so instead.
540 ;;
541 ;; TODO: It might be preferable to patch in absolute file names in
542 ;; calls to dlopen or PR_LoadLibrary, but that didn't seem to
543 ;; work. More investigation is needed.
544 (substitute* "toolkit/library/moz.build"
545 (("^# This needs to be last")
546 "OS_LIBS += [
547 'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5',
548 'gstreamer-1.0', 'gstapp-1.0', 'gstvideo-1.0' ]\n\n"))
549 #t))
550 (replace
551 'configure
552 ;; configure does not work followed by both "SHELL=..." and
553 ;; "CONFIG_SHELL=..."; set environment variables instead
554 (lambda* (#:key outputs configure-flags #:allow-other-keys)
555 (let* ((out (assoc-ref outputs "out"))
556 (bash (which "bash"))
557 (abs-srcdir (getcwd))
558 (srcdir (string-append "../" (basename abs-srcdir)))
559 (flags `(,(string-append "--prefix=" out)
560 ,(string-append "--with-l10n-base="
561 abs-srcdir "/l10n")
562 ,@configure-flags)))
563 (setenv "SHELL" bash)
564 (setenv "CONFIG_SHELL" bash)
565 (mkdir "../build")
566 (chdir "../build")
567 (format #t "build directory: ~s~%" (getcwd))
568 (format #t "configure flags: ~s~%" flags)
569 (zero? (apply system* bash
570 (string-append srcdir "/configure")
571 flags)))))
572 (add-before 'configure 'install-desktop-entry
573 (lambda* (#:key outputs #:allow-other-keys)
574 ;; Install the '.desktop' file.
575 (define (swallow-%%-directives input output)
576 ;; Interpret '%%ifdef' directives found in the '.desktop' file.
577 (let loop ((state 'top))
578 (match (read-line input 'concat)
579 ((? eof-object?)
580 #t)
581 ((? string? line)
582 (cond ((string-prefix? "%%ifdef" line)
583 (loop 'ifdef))
584 ((string-prefix? "%%else" line)
585 (loop 'else))
586 ((string-prefix? "%%endif" line)
587 (loop 'top))
588 (else
589 (case state
590 ((top else)
591 (display line output)
592 (loop state))
593 (else
594 (loop state)))))))))
595
596 (let* ((out (assoc-ref outputs "out"))
597 (applications (string-append out "/share/applications")))
598 (call-with-input-file "debian/icecat.desktop.in"
599 (lambda (input)
600 (call-with-output-file "debian/icecat.desktop"
601 (lambda (output)
602 (swallow-%%-directives input output)))))
603
604 (substitute* "debian/icecat.desktop"
605 (("@MOZ_DISPLAY_NAME@")
606 "GNU IceCat")
607 (("^Exec=@MOZ_APP_NAME@")
608 (string-append "Exec=" out "/bin/icecat"))
609 (("@MOZ_APP_NAME@")
610 "icecat"))
611 (install-file "debian/icecat.desktop" applications)
612 #t)))
613 (add-after 'install-desktop-entry 'install-icons
614 (lambda* (#:key outputs #:allow-other-keys)
615 (let ((out (assoc-ref outputs "out")))
616 (with-directory-excursion "browser/branding/official"
617 (for-each
618 (lambda (file)
619 (let* ((size (string-filter char-numeric? file))
620 (icons (string-append out "/share/icons/hicolor/"
621 size "x" size "/apps")))
622 (mkdir-p icons)
623 (copy-file file (string-append icons "/icecat.png"))))
624 '("default16.png" "default22.png" "default24.png"
625 "default32.png" "default48.png" "content/icon64.png"
626 "mozicon128.png" "default256.png")))))))))
627 (home-page "http://www.gnu.org/software/gnuzilla/")
628 (synopsis "Entirely free browser derived from Mozilla Firefox")
629 (description
630 "IceCat is the GNU version of the Firefox browser. It is entirely free
631 software, which does not recommend non-free plugins and addons. It also
632 features built-in privacy-protecting features.")
633 (license license:mpl2.0) ;and others, see toolkit/content/license.html
634 (properties
635 `((ftp-directory . "/gnu/gnuzilla")
636 (cpe-name . "firefox_esr")
637 (cpe-version . ,(first (string-split version #\-)))))))