gnu: nss: Use 'modify-phases' syntax.
[jackhill/guix/guix.git] / gnu / packages / gnuzilla.scm
CommitLineData
be0f6112 1;;; GNU Guix --- Functional package management for GNU
5deea4fc 2;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
89e34644 3;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
98986200 4;;; Copyright © 2014, 2015, 2016, 2017 Mark H Weaver <mhw@netris.org>
1aaaff1a 5;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
58e87f66 6;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
88a8ce87 7;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
be0f6112
AE
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)
07d4d9b7 25 #:use-module ((srfi srfi-1) #:hide (zip))
be0f6112 26 #:use-module (gnu packages)
b5b73a82 27 #:use-module ((guix licenses) #:prefix license:)
be0f6112
AE
28 #:use-module (guix packages)
29 #:use-module (guix download)
30 #:use-module (guix build-system gnu)
bfb48f4f 31 #:use-module (gnu packages base)
1aaaff1a 32 #:use-module (gnu packages databases)
be0f6112
AE
33 #:use-module (gnu packages glib)
34 #:use-module (gnu packages gstreamer)
35 #:use-module (gnu packages gtk)
90e1cdae
MW
36 #:use-module (gnu packages gnome)
37 #:use-module (gnu packages libcanberra)
38 #:use-module (gnu packages cups)
89e34644 39 #:use-module (gnu packages kerberos)
be0f6112
AE
40 #:use-module (gnu packages linux)
41 #:use-module (gnu packages perl)
42 #:use-module (gnu packages pkg-config)
1ae6df81 43 #:use-module (gnu packages compression)
74c7af9f 44 #:use-module (gnu packages fontutils)
1ae6df81 45 #:use-module (gnu packages libevent)
90e1cdae 46 #:use-module (gnu packages libreoffice) ;for hunspell
e55354b8 47 #:use-module (gnu packages image)
1ae6df81 48 #:use-module (gnu packages libffi)
74c7af9f 49 #:use-module (gnu packages pulseaudio)
be0f6112
AE
50 #:use-module (gnu packages python)
51 #:use-module (gnu packages xorg)
200726ed 52 #:use-module (gnu packages gl)
01497dfe 53 #:use-module (gnu packages assembly)
13b284d9
MW
54 #:use-module (gnu packages icu4c)
55 #:use-module (gnu packages video)
56 #:use-module (gnu packages xdisorg)
be0f6112
AE
57 #:use-module (gnu packages zip))
58
4923e06f
SB
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
68716289
SB
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")))))
4923e06f
SB
76 (build-system gnu-build-system)
77 (native-inputs
b3546174 78 `(("perl" ,perl)
4923e06f
SB
79 ("python" ,python-2)))
80 (arguments
d778fa5f
LF
81 `(;; XXX: parallel build fails, lacking:
82 ;; mkdir -p "system_wrapper_js/"
83 #:parallel-build? #f
84 #:phases
4923e06f
SB
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
103in C/C++.")
87158e85 104 (license license:mpl2.0))) ; and others for some files
4923e06f 105
cefdcb38
SB
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
68716289
SB
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")))))
cefdcb38 123 (arguments
2d02a778
SB
124 '(;; XXX: parallel build fails, lacking:
125 ;; mkdir -p "system_wrapper_js/"
126 #:parallel-build? #f
127 #:phases
cefdcb38
SB
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
4923e06f
SB
152(define-public nspr
153 (package
154 (name "nspr")
728f3620 155 (version "4.13.1")
4923e06f
SB
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
728f3620 163 "1arkg08l6zlp8v44shqbk2c8qzwd913lgh60fb3yfxls6d8ifk2y"))))
4923e06f
SB
164 (build-system gnu-build-system)
165 (native-inputs
b3546174 166 `(("perl" ,perl)))
4923e06f 167 (arguments
8550894b
LC
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)))
4923e06f
SB
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
182platform-neutral API for system level and libc-like functions. It is used
183in the Mozilla clients.")
184 (license license:mpl2.0)))
185
1aaaff1a
SB
186(define-public nss
187 (package
188 (name "nss")
03134907 189 (version "3.29.2")
1aaaff1a
SB
190 (source (origin
191 (method url-fetch)
2bb9b5de
MW
192 (uri (let ((version-with-underscores
193 (string-join (string-split version #\.) "_")))
194 (string-append
fe88f636 195 "https://ftp.mozilla.org/pub/mozilla.org/security/nss/"
2bb9b5de
MW
196 "releases/NSS_" version-with-underscores "_RTM/src/"
197 "nss-" version ".tar.gz")))
1aaaff1a
SB
198 (sha256
199 (base32
03134907 200 "149807rmzb76hnh48rw4m9jw83iw0168njzchz0hmbsgc8mk0i5w"))
1aaaff1a 201 ;; Create nss.pc and nss-config.
fc1adab1 202 (patches (search-patches "nss-pkgconfig.patch"))))
1aaaff1a
SB
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))
1aaaff1a 223 #:phases
db3c06d5
MB
224 (modify-phases %standard-phases
225 (replace '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 (replace 'check
233 (lambda _
234 ;; Use 127.0.0.1 instead of $HOST.$DOMSUF as HOSTADDR for testing.
235 ;; The later requires a working DNS or /etc/hosts.
236 (setenv "DOMSUF" "(none)")
237 (setenv "USE_IP" "TRUE")
238 (setenv "IP_ADDRESS" "127.0.0.1")
239 (zero? (system* "./nss/tests/all.sh"))))
240 (replace 'install
241 (lambda* (#:key outputs #:allow-other-keys)
242 (let* ((out (assoc-ref outputs "out"))
243 (bin (string-append (assoc-ref outputs "bin") "/bin"))
244 (inc (string-append out "/include/nss"))
245 (lib (string-append out "/lib/nss"))
246 (obj (match (scandir "dist" (cut string-suffix? "OBJ" <>))
247 ((obj) (string-append "dist/" obj)))))
248 ;; Install nss-config to $out/bin.
249 (install-file (string-append obj "/bin/nss-config")
250 (string-append out "/bin"))
251 (delete-file (string-append obj "/bin/nss-config"))
252 ;; Install nss.pc to $out/lib/pkgconfig.
253 (install-file (string-append obj "/lib/pkgconfig/nss.pc")
254 (string-append out "/lib/pkgconfig"))
255 (delete-file (string-append obj "/lib/pkgconfig/nss.pc"))
256 (rmdir (string-append obj "/lib/pkgconfig"))
257 ;; Install other files.
258 (copy-recursively "dist/public/nss" inc)
259 (copy-recursively (string-append obj "/bin") bin)
260 (copy-recursively (string-append obj "/lib") lib)
3161f6a4 261
db3c06d5
MB
262 ;; FIXME: libgtest1.so is installed in the above step, and it's
263 ;; (unnecessarily) linked with several NSS libraries, but
264 ;; without the needed rpaths, causing the 'validate-runpath'
265 ;; phase to fail. Here we simply delete libgtest1.so, since it
266 ;; seems to be used only during the tests.
267 (delete-file (string-append lib "/libgtest1.so"))
3161f6a4 268
db3c06d5 269 #t))))))
1aaaff1a
SB
270 (inputs
271 `(("sqlite" ,sqlite)
272 ("zlib" ,zlib)))
273 (propagated-inputs `(("nspr" ,nspr))) ; required by nss.pc.
274 (native-inputs `(("perl" ,perl)))
86e3e370 275
e9b718a0
MW
276 ;; The NSS test suite takes around 48 hours on Loongson 3A (MIPS) when
277 ;; another build is happening concurrently on the same machine.
278 (properties '((timeout . 216000))) ; 60 hours
86e3e370 279
1aaaff1a
SB
280 (home-page
281 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS")
282 (synopsis "Network Security Services")
283 (description
284 "Network Security Services (NSS) is a set of libraries designed to support
285cross-platform development of security-enabled client and server applications.
286Applications built with NSS can support SSL v2 and v3, TLS, PKCS #5, PKCS #7,
287PKCS #11, PKCS #12, S/MIME, X.509 v3 certificates, and other security
288standards.")
289 (license license:mpl2.0)))
290
bfb48f4f
MW
291(define (mozilla-patch file-name changeset hash)
292 "Return an origin for CHANGESET from the mozilla-esr45 repository."
293 (origin
294 (method url-fetch)
295 (uri (string-append "https://hg.mozilla.org/releases/mozilla-esr45/raw-rev/"
296 changeset))
297 (sha256 (base32 hash))
298 (file-name file-name)))
299
be0f6112
AE
300(define-public icecat
301 (package
302 (name "icecat")
c9b631ae 303 (version "45.7.0-gnu1")
be0f6112
AE
304 (source
305 (origin
306 (method url-fetch)
5bdec7d6
MW
307 (uri (string-append "mirror://gnu/gnuzilla/"
308 (first (string-split version #\-))
309 "/" name "-" version ".tar.bz2"))
be0f6112
AE
310 (sha256
311 (base32
c9b631ae 312 "1mn73liylqzxk441f28wk326yglqs8zcwqs4zz51s8i2id2jsnv3"))
bfb48f4f 313 (patches
5bdec7d6
MW
314 (list
315 (search-patch "icecat-avoid-bundled-libraries.patch")
1fa8a51e
MW
316 (search-patch "icecat-binutils.patch")
317 (mozilla-patch "icecat-CVE-2017-5398-pt01.patch" "1a39a54b5fea" "0k3sbf2w2yng2rpv6wl9zrm5cbsgq3pslr19xwrk8sk753as79fp")
318 (mozilla-patch "icecat-CVE-2017-5402.patch" "9828c3bb7b73" "0zgks0v9sqhwwkmry4daswvjwk6aqln6abx0iac1vwqqpg6swff6")
319 (mozilla-patch "icecat-CVE-2017-5398-pt02.patch" "fa3268a1147e" "1jyd1hvp42pz5l15agmb1jhw74b38x8xnj9ih5v4pskv41bgmyg5")
320 (mozilla-patch "icecat-CVE-2017-5400.patch" "347c10e4d6d1" "1w6yrm97l477q4ripbj0nimc87p4jscabvihpncxqbq9xzc4km7p")
321 (mozilla-patch "icecat-CVE-2017-5410.patch" "fe4a2cda54ad" "0spcs93hpz13d8670jgvww80f0ynrbhwbh62fkv27lpr6wmqwqh1")
322 (mozilla-patch "icecat-CVE-2017-5401.patch" "c38f8546be5f" "1sa22w9kzgynsn4c6zh4d66byskk5kffzbvlzrhyzvqjddypf9p8")
323 (mozilla-patch "icecat-CVE-2017-5398-pt03.patch" "41c80ecafa99" "0r33arr5wcgl00zgncasiyl65bmm6jy45clxnbb75nzjmsd1zx1s")
324 (mozilla-patch "icecat-CVE-2017-5405.patch" "381552c888b4" "1sjhh390cx1jqx74lxk6qd8f8ccppqgagqfhc9pnbm2m67hxvkj9")
325 (mozilla-patch "icecat-CVE-2017-5407.patch" "4ba337cdb998" "0vyknizid2z9nvl31m08c7fknizhv8dh8m54apm39k8lx77vf70p")
326 (mozilla-patch "icecat-CVE-2017-5398-pt04.patch" "886650fac531" "18fsr5dmav96ja0dah7mj34n8mjpckp0bbc32zjyaj5qx0m4h5cw")
327 (mozilla-patch "icecat-CVE-2017-5409.patch" "0a22becb23cd" "19fshrq4qkj5s0mjrads6by84gy7rsq3k57gha6sw6rvx8chjaz6")
328 (mozilla-patch "icecat-CVE-2017-5398-pt05.patch" "a0ead6ef09eb" "1hpsq81hhhq2a2dcq2dfndiwx93vvp5rfq0cgv6kwk2bsrq77wqq")
329 (mozilla-patch "icecat-CVE-2017-5398-pt06.patch" "d3fede027d06" "1aw02p367cm0ayijdiiawlb7qhab6jwqwkakj317yd1cjnmkalwr")
330 (mozilla-patch "icecat-CVE-2017-5398-pt07.patch" "ffca0f060bb4" "0qwisfp7idjj5nc1vp1afrf5lj66l2gp7rllkjmrqpz6cyfc708v")
331 (mozilla-patch "icecat-CVE-2017-5398-pt08.patch" "4aa65b44dcb9" "07j6dz2b7hp1bkfvkxwgpn2wc3hqrgjgwpaz96fcpz8yadg2fssw")
332 (mozilla-patch "icecat-bug-1318914.patch" "30e2382d800f" "0w8zky5i7zc5q943x37rdvi4wbcing0q7w9fcgvnnh5li2sbrsy8")
333 (mozilla-patch "icecat-CVE-2017-5408.patch" "403d2300adc2" "06r4j48rc1fd9gvmvqy68mlqah5xfxpkvwmxk0gnqc364kpq9slk")
334 (mozilla-patch "icecat-CVE-2017-5398-pt09.patch" "546ab5e99568" "05rdb9bm3n4lj0zq5a95xnwsb0vzirb9mbc2wf9xbi4xlamsgvvw")
335 (mozilla-patch "icecat-bug-1311380.patch" "ef6eeb7f8846" "1w19is5blbrwf3wlmy6wzgabih8sxp2kmkffqcj2g4jypfwyqn73")
336 (mozilla-patch "icecat-CVE-2017-5398-pt10.patch" "eec69810d80e" "1r20abhw7b38igsrdpkhcfwx9i9gmcxikv4y3sjr4wkbp684f7av")
337 (mozilla-patch "icecat-CVE-2017-5398-pt11.patch" "fec35ce6e68b" "1imdfrs8dxz44rhsmvydh29w5j64cij6g5ggrmhvz3386xvlil2v")
338 (mozilla-patch "icecat-CVE-2017-5398-pt12.patch" "725e2a217722" "06gfhi2ich279rjnxi15fb4igimsxnv5w6bx4g91js8wbvp2r3v0")
339 (mozilla-patch "icecat-CVE-2017-5398-pt13.patch" "d905a2e3a4d9" "1ibxi2s0czj47b739zmmjzbln8lpn27hdg4b17w58vhbhzkq31cx")
340 (mozilla-patch "icecat-CVE-2017-5398-pt14.patch" "0032560ae945" "0md3p5cix6nzbj5m199awc9gk52pygy5s9lx3a38vh3xvd92lsbj")
341 (mozilla-patch "icecat-CVE-2017-5398-pt15.patch" "91dda1e79ad8" "0b5h8fhagczfqkdgby982w6qgkw9y11zxxpdbn89rwmjpyp9nghx")
342 (mozilla-patch "icecat-CVE-2017-5404.patch" "556dd9e4a9e3" "0mbdx4xn1xs67n47ys9m42lc5ny96rz21ala848yajpdlxsz680g")
343 (mozilla-patch "icecat-bug-1341137-pt1.patch" "e86e0423dad1" "0dk1v7lcs61nx76qxcibha3ygqri15ldcvwwsrsayff9fq6k0v4y")
344 (mozilla-patch "icecat-bug-1341137-pt2.patch" "9aebee8b8cb9" "0m7p5iprhhwdv89aqqg7fla5szw6v7x2sll4ns0zg60pk4vm6izq")
345 (mozilla-patch "icecat-bug-1341137-pt3.patch" "69f3d44bdb48" "1ad7rw6nmg3c49ylqxlqqkb6cm2f0ygfzrigs6b60a2zkjqhbl0h")
346 (mozilla-patch "icecat-bug-1341137-pt4.patch" "22546e2cee64" "0gbwxa3p7qkq53hwnvxcqhx8h34qmnjdxy0h3ajik4mw76vrna9s")
347 (mozilla-patch "icecat-bug-1341137-pt5.patch" "e5083d8a855a" "1247vbpqzf007nigbxxqd6nwgr1dxd4p8cd0dr45afqh19vhlapj")
348 (mozilla-patch "icecat-bug-1339122.patch" "b0d156c7445e" "026jp5bb565yvhkmmicgygcn1lmak85p0466yl1vnjlx1rc8n724")))
90e1cdae
MW
349 (modules '((guix build utils)))
350 (snippet
351 '(begin
bfb48f4f 352 (use-modules (ice-9 ftw))
90e1cdae
MW
353 ;; Remove bundled libraries that we don't use, since they may
354 ;; contain unpatched security flaws, they waste disk space and
355 ;; network bandwidth, and may cause confusion.
356 (for-each delete-file-recursively
357 '(;; FIXME: Removing the bundled icu breaks configure.
358 ;; * The bundled icu headers are used in some places.
359 ;; * The version number is taken from the bundled copy.
360 ;;"intl/icu"
361 ;;
362 ;; FIXME: A script from the bundled nspr is used.
363 ;;"nsprpub"
364 ;;
365 ;; TODO: Use system media libraries. Waiting for:
366 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
367 ;; * libogg
368 ;; * libtheora
369 ;; * libvorbis
370 ;; * libtremor (not yet in guix)
371 ;; * libopus
372 ;; * speex
373 ;; * soundtouch (not yet in guix)
374 ;;
375 ;; TODO: Use system harfbuzz. Waiting for:
376 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=847568>
377 ;;
59d4cf1c
MW
378 ;; TODO: Use system graphite2.
379 ;;
90e1cdae
MW
380 "modules/freetype2"
381 "modules/zlib"
382 "modules/libbz2"
383 "ipc/chromium/src/third_party/libevent"
7cba7647 384 "media/libjpeg"
90e1cdae
MW
385 "media/libvpx"
386 "security/nss"
387 "gfx/cairo"
388 "js/src/ctypes/libffi"
389 "db/sqlite3"))
bfb48f4f
MW
390 ;; Delete .pyc files, typically present in icecat source tarballs
391 (for-each delete-file (find-files "." "\\.pyc$"))
5bdec7d6 392 ;; Delete obj-* directories, sometimes present in icecat tarballs
bfb48f4f
MW
393 (for-each delete-file-recursively
394 (scandir "." (lambda (name)
395 (string-prefix? "obj-" name))))
a5e55dfb 396 #t))))
be0f6112
AE
397 (build-system gnu-build-system)
398 (inputs
399 `(("alsa-lib" ,alsa-lib)
1ae6df81 400 ("bzip2" ,bzip2)
5b17fabc 401 ("cairo" ,cairo)
90e1cdae 402 ("cups" ,cups)
be0f6112 403 ("dbus-glib" ,dbus-glib)
90e1cdae
MW
404 ("gdk-pixbuf" ,gdk-pixbuf)
405 ("glib" ,glib)
43cc5c5e
MW
406 ("gstreamer" ,gstreamer)
407 ("gst-plugins-base" ,gst-plugins-base)
2f63e087 408 ("gtk+" ,gtk+-2)
74c7af9f
MW
409 ("pango" ,pango)
410 ("freetype" ,freetype)
90e1cdae
MW
411 ("hunspell" ,hunspell)
412 ("libcanberra" ,libcanberra)
413 ("libgnome" ,libgnome)
7cba7647 414 ("libjpeg-turbo" ,libjpeg-turbo)
74c7af9f 415 ("libxft" ,libxft)
e8fc1a0d 416 ("libevent" ,libevent-2.0)
90e1cdae
MW
417 ("libxinerama" ,libxinerama)
418 ("libxscrnsaver" ,libxscrnsaver)
9f7ae77f 419 ("libxcomposite" ,libxcomposite)
be0f6112 420 ("libxt" ,libxt)
1ae6df81 421 ("libffi" ,libffi)
13b284d9
MW
422 ("libvpx" ,libvpx)
423 ("icu4c" ,icu4c)
424 ("pixman" ,pixman)
74c7af9f 425 ("pulseaudio" ,pulseaudio)
be0f6112 426 ("mesa" ,mesa)
90e1cdae 427 ("mit-krb5" ,mit-krb5)
5b17fabc
MW
428 ("nspr" ,nspr)
429 ("nss" ,nss)
9bc79c11 430 ("sqlite" ,sqlite)
90e1cdae 431 ("startup-notification" ,startup-notification)
be0f6112
AE
432 ("unzip" ,unzip)
433 ("yasm" ,yasm)
1ae6df81
LC
434 ("zip" ,zip)
435 ("zlib" ,zlib)))
c4c4cc05
JD
436 (native-inputs
437 `(("perl" ,perl)
438 ("python" ,python-2) ; Python 3 not supported
439 ("python2-pysqlite" ,python2-pysqlite)
bfb48f4f
MW
440 ("pkg-config" ,pkg-config)
441 ("which" ,which)))
be0f6112 442 (arguments
74c7af9f
MW
443 `(#:tests? #f ; no check target
444 #:out-of-source? #t ; must be built outside of the source directory
a308c233 445 #:parallel-build? #f
73b1b4eb
LC
446
447 ;; XXX: There are RUNPATH issues such as
448 ;; $prefix/lib/icecat-31.6.0/plugin-container NEEDing libmozalloc.so,
449 ;; which is not in its RUNPATH, but they appear to be harmless in
450 ;; practice somehow. See <http://hydra.gnu.org/build/378133>.
451 #:validate-runpath? #f
452
2f63e087 453 #:configure-flags '("--enable-default-toolkit=cairo-gtk2"
90e1cdae
MW
454 "--enable-pango"
455 "--enable-gio"
456 "--enable-svg"
457 "--enable-canvas"
458 "--enable-mathml"
459 "--enable-startup-notification"
460 "--enable-pulseaudio"
461 "--enable-gstreamer=1.0"
462
463 "--disable-gnomevfs"
464 "--disable-gconf"
465 "--disable-gnomeui"
466
467 ;; Building with debugging symbols takes ~5GiB, so
1ae6df81
LC
468 ;; disable it.
469 "--disable-debug"
470 "--disable-debug-symbols"
471
5bdec7d6
MW
472 ;; Hack to work around missing
473 ;; "unofficial" branding in icecat.
bfb48f4f
MW
474 "--enable-official-branding"
475
90e1cdae 476 ;; Avoid bundled libraries.
1ae6df81 477 "--with-system-zlib"
90e1cdae 478 "--with-system-bz2"
7cba7647 479 "--with-system-jpeg" ; must be libjpeg-turbo
1ae6df81 480 "--with-system-libevent"
13b284d9
MW
481 "--with-system-libvpx"
482 "--with-system-icu"
5b17fabc
MW
483 "--with-system-nspr"
484 "--with-system-nss"
13b284d9 485 "--enable-system-pixman"
5b17fabc
MW
486 "--enable-system-cairo"
487 "--enable-system-ffi"
90e1cdae 488 "--enable-system-hunspell"
9128e323 489 "--enable-system-sqlite"
1ae6df81 490
98a046cd
AE
491 ;; Fails with "--with-system-png won't work because
492 ;; the system's libpng doesn't have APNG support".
493 ;; According to
494 ;; http://sourceforge.net/projects/libpng-apng/ ,
495 ;; "the Animated Portable Network Graphics (APNG)
496 ;; is an unofficial extension of the Portable
497 ;; Network Graphics (PNG) format";
498 ;; we probably do not wish to support it.
1ae6df81 499 ;; "--with-system-png"
5b17fabc 500 )
1ae6df81 501
9f7ae77f 502 #:modules ((ice-9 ftw)
6cde5c34
LC
503 (ice-9 rdelim)
504 (ice-9 match)
9f7ae77f 505 ,@%gnu-build-system-modules)
be0f6112 506 #:phases
90e1cdae 507 (modify-phases %standard-phases
9f7ae77f
MW
508 (add-after
509 'unpack 'ensure-no-mtimes-pre-1980
510 (lambda _
511 ;; Without this, the 'source/test/addons/packed.xpi' and
512 ;; 'source/test/addons/simple-prefs.xpi' targets fail while trying
513 ;; to create zip archives.
514 (let ((early-1980 315619200)) ; 1980-01-02 UTC
515 (ftw "." (lambda (file stat flag)
516 (unless (<= early-1980 (stat:mtime stat))
517 (utime file early-1980 early-1980))
518 #t))
519 #t)))
90e1cdae
MW
520 (add-after
521 'unpack 'remove-h264parse-from-blacklist
522 (lambda _
523 ;; Remove h264parse from gstreamer format helper blacklist. It
524 ;; was put there to work around a bug in a pre-1.0 version of
525 ;; gstreamer. See:
526 ;; https://www.mozilla.org/en-US/security/advisories/mfsa2015-47/
9f7ae77f 527 (substitute* "dom/media/gstreamer/GStreamerFormatHelper.cpp"
90e1cdae
MW
528 (("^ \"h264parse\",\n") ""))
529 #t))
530 (add-after
531 'unpack 'arrange-to-link-libxul-with-libraries-it-might-dlopen
532 (lambda _
533 ;; libxul.so dynamically opens libraries, so here we explicitly
534 ;; link them into libxul.so instead.
535 ;;
536 ;; TODO: It might be preferable to patch in absolute file names in
537 ;; calls to dlopen or PR_LoadLibrary, but that didn't seem to
538 ;; work. More investigation is needed.
9f7ae77f
MW
539 (substitute* "toolkit/library/moz.build"
540 (("^# This needs to be last")
541 "OS_LIBS += [
542 'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5',
543 'gstreamer-1.0', 'gstapp-1.0', 'gstvideo-1.0' ]\n\n"))
544 #t))
90e1cdae
MW
545 (replace
546 'configure
547 ;; configure does not work followed by both "SHELL=..." and
548 ;; "CONFIG_SHELL=..."; set environment variables instead
549 (lambda* (#:key outputs configure-flags #:allow-other-keys)
550 (let* ((out (assoc-ref outputs "out"))
551 (bash (which "bash"))
552 (abs-srcdir (getcwd))
553 (srcdir (string-append "../" (basename abs-srcdir)))
554 (flags `(,(string-append "--prefix=" out)
555 ,(string-append "--with-l10n-base="
556 abs-srcdir "/l10n")
557 ,@configure-flags)))
558 (setenv "SHELL" bash)
559 (setenv "CONFIG_SHELL" bash)
560 (mkdir "../build")
561 (chdir "../build")
562 (format #t "build directory: ~s~%" (getcwd))
563 (format #t "configure flags: ~s~%" flags)
564 (zero? (apply system* bash
565 (string-append srcdir "/configure")
6cde5c34
LC
566 flags)))))
567 (add-before 'configure 'install-desktop-entry
568 (lambda* (#:key outputs #:allow-other-keys)
569 ;; Install the '.desktop' file.
570 (define (swallow-%%-directives input output)
571 ;; Interpret '%%ifdef' directives found in the '.desktop' file.
572 (let loop ((state 'top))
573 (match (read-line input 'concat)
574 ((? eof-object?)
575 #t)
576 ((? string? line)
577 (cond ((string-prefix? "%%ifdef" line)
578 (loop 'ifdef))
579 ((string-prefix? "%%else" line)
580 (loop 'else))
581 ((string-prefix? "%%endif" line)
582 (loop 'top))
583 (else
584 (case state
585 ((top else)
586 (display line output)
587 (loop state))
588 (else
589 (loop state)))))))))
590
591 (let* ((out (assoc-ref outputs "out"))
592 (applications (string-append out "/share/applications")))
593 (call-with-input-file "debian/icecat.desktop.in"
594 (lambda (input)
595 (call-with-output-file "debian/icecat.desktop"
596 (lambda (output)
597 (swallow-%%-directives input output)))))
598
599 (substitute* "debian/icecat.desktop"
600 (("@MOZ_DISPLAY_NAME@")
601 "GNU IceCat")
602 (("^Exec=@MOZ_APP_NAME@")
603 (string-append "Exec=" out "/bin/icecat"))
604 (("@MOZ_APP_NAME@")
605 "icecat"))
606 (install-file "debian/icecat.desktop" applications)
88a8ce87
AG
607 #t)))
608 (add-after 'install-desktop-entry 'install-icons
609 (lambda* (#:key outputs #:allow-other-keys)
610 (let ((out (assoc-ref outputs "out")))
611 (with-directory-excursion "browser/branding/official"
612 (for-each
613 (lambda (file)
614 (let* ((size (string-filter char-numeric? file))
615 (icons (string-append out "/share/icons/hicolor/"
616 size "x" size "/apps")))
617 (mkdir-p icons)
618 (copy-file file (string-append icons "/icecat.png"))))
619 '("default16.png" "default22.png" "default24.png"
620 "default32.png" "default48.png" "content/icon64.png"
621 "mozicon128.png" "default256.png")))))))))
be0f6112
AE
622 (home-page "http://www.gnu.org/software/gnuzilla/")
623 (synopsis "Entirely free browser derived from Mozilla Firefox")
624 (description
625 "IceCat is the GNU version of the Firefox browser. It is entirely free
c5779c93 626software, which does not recommend non-free plugins and addons. It also
79c311b8 627features built-in privacy-protecting features.")
63e8bb12 628 (license license:mpl2.0) ;and others, see toolkit/content/license.html
99effc8f
LC
629 (properties
630 `((ftp-directory . "/gnu/gnuzilla")
631 (cpe-name . "firefox_esr")
bfb48f4f 632 (cpe-version . ,(first (string-split version #\-)))))))