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