gnu: redis: Update to 3.2.4.
[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>
63e8bb12 3;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
29a78014 4;;; Copyright © 2014, 2015, 2016 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)
1aaaff1a 31 #:use-module (gnu packages databases)
be0f6112
AE
32 #:use-module (gnu packages glib)
33 #:use-module (gnu packages gstreamer)
34 #:use-module (gnu packages gtk)
90e1cdae
MW
35 #:use-module (gnu packages gnome)
36 #:use-module (gnu packages libcanberra)
37 #:use-module (gnu packages cups)
38 #:use-module (gnu packages mit-krb5)
be0f6112
AE
39 #:use-module (gnu packages linux)
40 #:use-module (gnu packages perl)
41 #:use-module (gnu packages pkg-config)
1ae6df81 42 #:use-module (gnu packages compression)
74c7af9f 43 #:use-module (gnu packages fontutils)
1ae6df81 44 #:use-module (gnu packages libevent)
90e1cdae 45 #:use-module (gnu packages libreoffice) ;for hunspell
e55354b8 46 #:use-module (gnu packages image)
1ae6df81 47 #:use-module (gnu packages libffi)
74c7af9f 48 #:use-module (gnu packages pulseaudio)
be0f6112
AE
49 #:use-module (gnu packages python)
50 #:use-module (gnu packages xorg)
200726ed 51 #:use-module (gnu packages gl)
01497dfe 52 #:use-module (gnu packages assembly)
13b284d9
MW
53 #:use-module (gnu packages icu4c)
54 #:use-module (gnu packages video)
55 #:use-module (gnu packages xdisorg)
be0f6112
AE
56 #:use-module (gnu packages zip))
57
4923e06f
SB
58(define-public mozjs
59 (package
60 (name "mozjs")
61 (version "17.0.0")
62 (source (origin
63 (method url-fetch)
64 (uri (string-append
65 "https://ftp.mozilla.org/pub/mozilla.org/js/"
66 name version ".tar.gz"))
67 (sha256
68 (base32
68716289
SB
69 "1fig2wf4f10v43mqx67y68z6h77sy900d1w0pz9qarrqx57rc7ij"))
70 (modules '((guix build utils)))
71 (snippet
72 ;; Fix incompatibility with Perl 5.22+.
73 '(substitute* '("js/src/config/milestone.pl")
74 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE")))))
4923e06f
SB
75 (build-system gnu-build-system)
76 (native-inputs
b3546174 77 `(("perl" ,perl)
4923e06f
SB
78 ("python" ,python-2)))
79 (arguments
d778fa5f
LF
80 `(;; XXX: parallel build fails, lacking:
81 ;; mkdir -p "system_wrapper_js/"
82 #:parallel-build? #f
83 #:phases
4923e06f
SB
84 (alist-cons-before
85 'configure 'chdir
86 (lambda _
87 (chdir "js/src"))
88 (alist-replace
89 'configure
90 ;; configure fails if it is followed by SHELL and CONFIG_SHELL
91 (lambda* (#:key outputs #:allow-other-keys)
92 (let ((out (assoc-ref outputs "out")))
93 (setenv "SHELL" (which "sh"))
94 (setenv "CONFIG_SHELL" (which "sh"))
95 (zero? (system*
96 "./configure" (string-append "--prefix=" out)))))
97 %standard-phases))))
98 (home-page
99 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey")
100 (synopsis "Mozilla javascript engine")
101 (description "SpiderMonkey is Mozilla's JavaScript engine written
102in C/C++.")
87158e85 103 (license license:mpl2.0))) ; and others for some files
4923e06f 104
cefdcb38
SB
105(define-public mozjs-24
106 (package (inherit mozjs)
107 (name "mozjs")
108 (version "24.2.0")
109 (source (origin
110 (method url-fetch)
111 (uri (string-append
112 "https://ftp.mozilla.org/pub/mozilla.org/js/"
113 name "-" version ".tar.bz2"))
114 (sha256
115 (base32
68716289
SB
116 "1n1phk8r3l8icqrrap4czplnylawa0ddc2cc4cgdz46x3lrkybz6"))
117 (modules '((guix build utils)))
118 (snippet
119 ;; Fix incompatibility with Perl 5.22+.
120 '(substitute* '("js/src/config/milestone.pl")
121 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE")))))
cefdcb38 122 (arguments
2d02a778
SB
123 '(;; XXX: parallel build fails, lacking:
124 ;; mkdir -p "system_wrapper_js/"
125 #:parallel-build? #f
126 #:phases
cefdcb38
SB
127 (modify-phases %standard-phases
128 (replace
129 'configure
130 (lambda* (#:key outputs #:allow-other-keys)
131 (let ((out (assoc-ref outputs "out")))
132 (chdir "js/src")
133 ;; configure fails if it is follwed by SHELL and CONFIG_SHELL
134 (setenv "SHELL" (which "sh"))
135 (setenv "CONFIG_SHELL" (which "sh"))
136 (zero? (system* "./configure"
137 (string-append "--prefix=" out)
138 "--with-system-nspr"
139 "--enable-system-ffi"
140 "--enable-threadsafe"))))))))
141 (native-inputs
142 `(("perl" ,perl)
143 ("pkg-config" ,pkg-config)
144 ("python" ,python-2)))
145 (propagated-inputs
146 `(("nspr" ,nspr))) ; in the Requires.private field of mozjs-24.pc
147 (inputs
148 `(("libffi" ,libffi)
149 ("zlib" ,zlib)))))
150
4923e06f
SB
151(define-public nspr
152 (package
153 (name "nspr")
b3107888 154 (version "4.12")
4923e06f
SB
155 (source (origin
156 (method url-fetch)
157 (uri (string-append
158 "https://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v"
159 version "/src/nspr-" version ".tar.gz"))
160 (sha256
161 (base32
b3107888 162 "1pk98bmc5xzbl62q5wf2d6mryf0v95z6rsmxz27nclwiaqg0mcg0"))))
4923e06f
SB
163 (build-system gnu-build-system)
164 (native-inputs
b3546174 165 `(("perl" ,perl)))
4923e06f 166 (arguments
8550894b
LC
167 `(#:tests? #f ; no check target
168 #:configure-flags (list "--enable-64bit"
169 (string-append "LDFLAGS=-Wl,-rpath="
170 (assoc-ref %outputs "out")
171 "/lib"))
172 #:phases (alist-cons-before
173 'configure 'chdir
174 (lambda _
175 (chdir "nspr"))
176 %standard-phases)))
4923e06f
SB
177 (home-page
178 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR")
179 (synopsis "Netscape API for system level and libc-like functions")
180 (description "Netscape Portable Runtime (NSPR) provides a
181platform-neutral API for system level and libc-like functions. It is used
182in the Mozilla clients.")
183 (license license:mpl2.0)))
184
1aaaff1a
SB
185(define-public nss
186 (package
187 (name "nss")
6a4cbc6f 188 (version "3.27.1")
1aaaff1a
SB
189 (source (origin
190 (method url-fetch)
2bb9b5de
MW
191 (uri (let ((version-with-underscores
192 (string-join (string-split version #\.) "_")))
193 (string-append
fe88f636 194 "https://ftp.mozilla.org/pub/mozilla.org/security/nss/"
2bb9b5de
MW
195 "releases/NSS_" version-with-underscores "_RTM/src/"
196 "nss-" version ".tar.gz")))
1aaaff1a
SB
197 (sha256
198 (base32
6a4cbc6f 199 "0sraxk26swlgl7rl742rkfp5k251v5z3lqw9k8ikin0cjfhkfdpx"))
1aaaff1a 200 ;; Create nss.pc and nss-config.
fc1adab1 201 (patches (search-patches "nss-pkgconfig.patch"))))
1aaaff1a
SB
202 (build-system gnu-build-system)
203 (outputs '("out" "bin"))
204 (arguments
205 '(#:parallel-build? #f ; failed
206 #:make-flags
207 (let* ((out (assoc-ref %outputs "out"))
208 (nspr (string-append (assoc-ref %build-inputs "nspr")))
209 (rpath (string-append "-Wl,-rpath=" out "/lib/nss")))
210 (list "-C" "nss" (string-append "PREFIX=" out)
211 "NSDISTMODE=copy"
212 "NSS_USE_SYSTEM_SQLITE=1"
213 (string-append "NSPR_INCLUDE_DIR=" nspr "/include/nspr")
214 ;; Add $out/lib/nss to RPATH.
215 (string-append "RPATH=" rpath)
216 (string-append "LDFLAGS=" rpath)))
217 #:modules ((guix build gnu-build-system)
218 (guix build utils)
219 (ice-9 ftw)
220 (ice-9 match)
221 (srfi srfi-26))
1aaaff1a
SB
222 #:phases
223 (alist-replace
224 'configure
225 (lambda* (#:key system inputs #:allow-other-keys)
bea25ae8 226 (setenv "CC" "gcc")
1aaaff1a
SB
227 ;; Tells NSS to build for the 64-bit ABI if we are 64-bit system.
228 (when (string-prefix? "x86_64" system)
229 (setenv "USE_64" "1"))
230 #t)
231 (alist-replace
232 '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 (alist-replace
241 'install
242 (lambda* (#:key outputs #:allow-other-keys)
243 (let* ((out (assoc-ref outputs "out"))
244 (bin (string-append (assoc-ref outputs "bin") "/bin"))
245 (inc (string-append out "/include/nss"))
246 (lib (string-append out "/lib/nss"))
247 (obj (match (scandir "dist" (cut string-suffix? "OBJ" <>))
248 ((obj) (string-append "dist/" obj)))))
249 ;; Install nss-config to $out/bin.
96c46210
LC
250 (install-file (string-append obj "/bin/nss-config")
251 (string-append out "/bin"))
1aaaff1a
SB
252 (delete-file (string-append obj "/bin/nss-config"))
253 ;; Install nss.pc to $out/lib/pkgconfig.
96c46210
LC
254 (install-file (string-append obj "/lib/pkgconfig/nss.pc")
255 (string-append out "/lib/pkgconfig"))
1aaaff1a
SB
256 (delete-file (string-append obj "/lib/pkgconfig/nss.pc"))
257 (rmdir (string-append obj "/lib/pkgconfig"))
258 ;; Install other files.
259 (copy-recursively "dist/public/nss" inc)
260 (copy-recursively (string-append obj "/bin") bin)
3161f6a4
MW
261 (copy-recursively (string-append obj "/lib") lib)
262
263 ;; FIXME: libgtest1.so is installed in the above step, and it's
264 ;; (unnecessarily) linked with several NSS libraries, but
265 ;; without the needed rpaths, causing the 'validate-runpath'
266 ;; phase to fail. Here we simply delete libgtest1.so, since it
267 ;; seems to be used only during the tests.
268 (delete-file (string-append lib "/libgtest1.so"))
269
270 #t))
1aaaff1a
SB
271 %standard-phases)))))
272 (inputs
273 `(("sqlite" ,sqlite)
274 ("zlib" ,zlib)))
275 (propagated-inputs `(("nspr" ,nspr))) ; required by nss.pc.
276 (native-inputs `(("perl" ,perl)))
86e3e370 277
e9b718a0
MW
278 ;; The NSS test suite takes around 48 hours on Loongson 3A (MIPS) when
279 ;; another build is happening concurrently on the same machine.
280 (properties '((timeout . 216000))) ; 60 hours
86e3e370 281
1aaaff1a
SB
282 (home-page
283 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS")
284 (synopsis "Network Security Services")
285 (description
286 "Network Security Services (NSS) is a set of libraries designed to support
287cross-platform development of security-enabled client and server applications.
288Applications built with NSS can support SSL v2 and v3, TLS, PKCS #5, PKCS #7,
289PKCS #11, PKCS #12, S/MIME, X.509 v3 certificates, and other security
290standards.")
291 (license license:mpl2.0)))
292
be0f6112
AE
293(define-public icecat
294 (package
295 (name "icecat")
238e5642 296 (version "38.8.0-gnu2")
be0f6112
AE
297 (source
298 (origin
299 (method url-fetch)
47bc885c 300 (uri (string-append "mirror://gnu/gnuzilla/"
238e5642 301 version "/"
07d4d9b7 302 name "-" version ".tar.bz2"))
be0f6112
AE
303 (sha256
304 (base32
238e5642 305 "1yb7a1zsqpra9cgq8hrzrbm5v31drb9367cwvwiksz0ngqy342hb"))
fc1adab1 306 (patches (search-patches
98d91822
MW
307 "icecat-avoid-bundled-includes.patch"
308 "icecat-CVE-2016-2818-pt1.patch"
309 "icecat-CVE-2016-2818-pt2.patch"
310 "icecat-CVE-2016-2818-pt3.patch"
311 "icecat-CVE-2016-2818-pt4.patch"
312 "icecat-CVE-2016-2818-pt5.patch"
313 "icecat-CVE-2016-2818-pt6.patch"
314 "icecat-CVE-2016-2818-pt7.patch"
315 "icecat-CVE-2016-2818-pt8.patch"
316 "icecat-CVE-2016-2818-pt9.patch"
317 "icecat-CVE-2016-2819.patch"
318 "icecat-CVE-2016-2821.patch"
319 "icecat-CVE-2016-2824.patch"
320 "icecat-CVE-2016-2828.patch"
321 "icecat-CVE-2016-2831.patch"))
90e1cdae
MW
322 (modules '((guix build utils)))
323 (snippet
324 '(begin
325 ;; Remove bundled libraries that we don't use, since they may
326 ;; contain unpatched security flaws, they waste disk space and
327 ;; network bandwidth, and may cause confusion.
328 (for-each delete-file-recursively
329 '(;; FIXME: Removing the bundled icu breaks configure.
330 ;; * The bundled icu headers are used in some places.
331 ;; * The version number is taken from the bundled copy.
332 ;;"intl/icu"
333 ;;
334 ;; FIXME: A script from the bundled nspr is used.
335 ;;"nsprpub"
336 ;;
337 ;; TODO: Use system media libraries. Waiting for:
338 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
339 ;; * libogg
340 ;; * libtheora
341 ;; * libvorbis
342 ;; * libtremor (not yet in guix)
343 ;; * libopus
344 ;; * speex
345 ;; * soundtouch (not yet in guix)
346 ;;
347 ;; TODO: Use system harfbuzz. Waiting for:
348 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=847568>
349 ;;
59d4cf1c
MW
350 ;; TODO: Use system graphite2.
351 ;;
90e1cdae
MW
352 "modules/freetype2"
353 "modules/zlib"
354 "modules/libbz2"
355 "ipc/chromium/src/third_party/libevent"
356 "media/libvpx"
357 "security/nss"
358 "gfx/cairo"
359 "js/src/ctypes/libffi"
360 "db/sqlite3"))
a5e55dfb 361 #t))))
be0f6112
AE
362 (build-system gnu-build-system)
363 (inputs
364 `(("alsa-lib" ,alsa-lib)
1ae6df81 365 ("bzip2" ,bzip2)
5b17fabc 366 ("cairo" ,cairo)
90e1cdae 367 ("cups" ,cups)
be0f6112 368 ("dbus-glib" ,dbus-glib)
90e1cdae
MW
369 ("gdk-pixbuf" ,gdk-pixbuf)
370 ("glib" ,glib)
43cc5c5e
MW
371 ("gstreamer" ,gstreamer)
372 ("gst-plugins-base" ,gst-plugins-base)
be0f6112 373 ("gtk+" ,gtk+-2)
74c7af9f
MW
374 ("pango" ,pango)
375 ("freetype" ,freetype)
90e1cdae
MW
376 ("hunspell" ,hunspell)
377 ("libcanberra" ,libcanberra)
378 ("libgnome" ,libgnome)
74c7af9f 379 ("libxft" ,libxft)
1ae6df81 380 ("libevent" ,libevent)
90e1cdae
MW
381 ("libxinerama" ,libxinerama)
382 ("libxscrnsaver" ,libxscrnsaver)
9f7ae77f 383 ("libxcomposite" ,libxcomposite)
be0f6112 384 ("libxt" ,libxt)
1ae6df81 385 ("libffi" ,libffi)
13b284d9
MW
386 ("libvpx" ,libvpx)
387 ("icu4c" ,icu4c)
388 ("pixman" ,pixman)
74c7af9f 389 ("pulseaudio" ,pulseaudio)
be0f6112 390 ("mesa" ,mesa)
90e1cdae 391 ("mit-krb5" ,mit-krb5)
5b17fabc
MW
392 ("nspr" ,nspr)
393 ("nss" ,nss)
9128e323 394 ("sqlite" ,sqlite)
90e1cdae 395 ("startup-notification" ,startup-notification)
be0f6112
AE
396 ("unzip" ,unzip)
397 ("yasm" ,yasm)
1ae6df81
LC
398 ("zip" ,zip)
399 ("zlib" ,zlib)))
c4c4cc05
JD
400 (native-inputs
401 `(("perl" ,perl)
402 ("python" ,python-2) ; Python 3 not supported
403 ("python2-pysqlite" ,python2-pysqlite)
030daf71 404 ("pkg-config" ,pkg-config)))
be0f6112 405 (arguments
74c7af9f
MW
406 `(#:tests? #f ; no check target
407 #:out-of-source? #t ; must be built outside of the source directory
a308c233 408 #:parallel-build? #f
73b1b4eb
LC
409
410 ;; XXX: There are RUNPATH issues such as
411 ;; $prefix/lib/icecat-31.6.0/plugin-container NEEDing libmozalloc.so,
412 ;; which is not in its RUNPATH, but they appear to be harmless in
413 ;; practice somehow. See <http://hydra.gnu.org/build/378133>.
414 #:validate-runpath? #f
415
90e1cdae
MW
416 #:configure-flags '("--enable-default-toolkit=cairo-gtk2"
417 "--enable-pango"
418 "--enable-gio"
419 "--enable-svg"
420 "--enable-canvas"
421 "--enable-mathml"
422 "--enable-startup-notification"
423 "--enable-pulseaudio"
424 "--enable-gstreamer=1.0"
425
426 "--disable-gnomevfs"
427 "--disable-gconf"
428 "--disable-gnomeui"
429
430 ;; Building with debugging symbols takes ~5GiB, so
1ae6df81
LC
431 ;; disable it.
432 "--disable-debug"
433 "--disable-debug-symbols"
434
90e1cdae 435 ;; Avoid bundled libraries.
1ae6df81 436 "--with-system-zlib"
90e1cdae 437 "--with-system-bz2"
1ae6df81 438 "--with-system-libevent"
13b284d9
MW
439 "--with-system-libvpx"
440 "--with-system-icu"
5b17fabc
MW
441 "--with-system-nspr"
442 "--with-system-nss"
13b284d9 443 "--enable-system-pixman"
5b17fabc
MW
444 "--enable-system-cairo"
445 "--enable-system-ffi"
90e1cdae 446 "--enable-system-hunspell"
9128e323 447 "--enable-system-sqlite"
1ae6df81 448
98a046cd
AE
449 ;; Fails with "--with-system-png won't work because
450 ;; the system's libpng doesn't have APNG support".
451 ;; According to
452 ;; http://sourceforge.net/projects/libpng-apng/ ,
453 ;; "the Animated Portable Network Graphics (APNG)
454 ;; is an unofficial extension of the Portable
455 ;; Network Graphics (PNG) format";
456 ;; we probably do not wish to support it.
1ae6df81
LC
457 ;; "--with-system-png"
458
98a046cd
AE
459 ;; Fails with "libjpeg-turbo JCS_EXTENSIONS
460 ;; required".
461 ;; According to
462 ;; http://sourceforge.net/projects/libjpeg-turbo/ ,
463 ;; "libjpeg-turbo is a derivative of libjpeg that
464 ;; uses MMX, SSE, SSE2, and NEON SIMD instructions
465 ;; to accelerate baseline JPEG compression/
466 ;; decompression", so we had better not use it
1ae6df81 467 ;; "--with-system-jpeg"
5b17fabc 468 )
1ae6df81 469
9f7ae77f 470 #:modules ((ice-9 ftw)
6cde5c34
LC
471 (ice-9 rdelim)
472 (ice-9 match)
9f7ae77f 473 ,@%gnu-build-system-modules)
be0f6112 474 #:phases
90e1cdae 475 (modify-phases %standard-phases
9f7ae77f
MW
476 (add-after
477 'unpack 'ensure-no-mtimes-pre-1980
478 (lambda _
479 ;; Without this, the 'source/test/addons/packed.xpi' and
480 ;; 'source/test/addons/simple-prefs.xpi' targets fail while trying
481 ;; to create zip archives.
482 (let ((early-1980 315619200)) ; 1980-01-02 UTC
483 (ftw "." (lambda (file stat flag)
484 (unless (<= early-1980 (stat:mtime stat))
485 (utime file early-1980 early-1980))
486 #t))
487 #t)))
90e1cdae
MW
488 (add-after
489 'unpack 'remove-h264parse-from-blacklist
490 (lambda _
491 ;; Remove h264parse from gstreamer format helper blacklist. It
492 ;; was put there to work around a bug in a pre-1.0 version of
493 ;; gstreamer. See:
494 ;; https://www.mozilla.org/en-US/security/advisories/mfsa2015-47/
9f7ae77f 495 (substitute* "dom/media/gstreamer/GStreamerFormatHelper.cpp"
90e1cdae
MW
496 (("^ \"h264parse\",\n") ""))
497 #t))
498 (add-after
499 'unpack 'arrange-to-link-libxul-with-libraries-it-might-dlopen
500 (lambda _
501 ;; libxul.so dynamically opens libraries, so here we explicitly
502 ;; link them into libxul.so instead.
503 ;;
504 ;; TODO: It might be preferable to patch in absolute file names in
505 ;; calls to dlopen or PR_LoadLibrary, but that didn't seem to
506 ;; work. More investigation is needed.
9f7ae77f
MW
507 (substitute* "toolkit/library/moz.build"
508 (("^# This needs to be last")
509 "OS_LIBS += [
510 'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5',
511 'gstreamer-1.0', 'gstapp-1.0', 'gstvideo-1.0' ]\n\n"))
512 #t))
90e1cdae
MW
513 (replace
514 'configure
515 ;; configure does not work followed by both "SHELL=..." and
516 ;; "CONFIG_SHELL=..."; set environment variables instead
517 (lambda* (#:key outputs configure-flags #:allow-other-keys)
518 (let* ((out (assoc-ref outputs "out"))
519 (bash (which "bash"))
520 (abs-srcdir (getcwd))
521 (srcdir (string-append "../" (basename abs-srcdir)))
522 (flags `(,(string-append "--prefix=" out)
523 ,(string-append "--with-l10n-base="
524 abs-srcdir "/l10n")
525 ,@configure-flags)))
526 (setenv "SHELL" bash)
527 (setenv "CONFIG_SHELL" bash)
528 (mkdir "../build")
529 (chdir "../build")
530 (format #t "build directory: ~s~%" (getcwd))
531 (format #t "configure flags: ~s~%" flags)
532 (zero? (apply system* bash
533 (string-append srcdir "/configure")
6cde5c34
LC
534 flags)))))
535 (add-before 'configure 'install-desktop-entry
536 (lambda* (#:key outputs #:allow-other-keys)
537 ;; Install the '.desktop' file.
538 (define (swallow-%%-directives input output)
539 ;; Interpret '%%ifdef' directives found in the '.desktop' file.
540 (let loop ((state 'top))
541 (match (read-line input 'concat)
542 ((? eof-object?)
543 #t)
544 ((? string? line)
545 (cond ((string-prefix? "%%ifdef" line)
546 (loop 'ifdef))
547 ((string-prefix? "%%else" line)
548 (loop 'else))
549 ((string-prefix? "%%endif" line)
550 (loop 'top))
551 (else
552 (case state
553 ((top else)
554 (display line output)
555 (loop state))
556 (else
557 (loop state)))))))))
558
559 (let* ((out (assoc-ref outputs "out"))
560 (applications (string-append out "/share/applications")))
561 (call-with-input-file "debian/icecat.desktop.in"
562 (lambda (input)
563 (call-with-output-file "debian/icecat.desktop"
564 (lambda (output)
565 (swallow-%%-directives input output)))))
566
567 (substitute* "debian/icecat.desktop"
568 (("@MOZ_DISPLAY_NAME@")
569 "GNU IceCat")
570 (("^Exec=@MOZ_APP_NAME@")
571 (string-append "Exec=" out "/bin/icecat"))
572 (("@MOZ_APP_NAME@")
573 "icecat"))
574 (install-file "debian/icecat.desktop" applications)
88a8ce87
AG
575 #t)))
576 (add-after 'install-desktop-entry 'install-icons
577 (lambda* (#:key outputs #:allow-other-keys)
578 (let ((out (assoc-ref outputs "out")))
579 (with-directory-excursion "browser/branding/official"
580 (for-each
581 (lambda (file)
582 (let* ((size (string-filter char-numeric? file))
583 (icons (string-append out "/share/icons/hicolor/"
584 size "x" size "/apps")))
585 (mkdir-p icons)
586 (copy-file file (string-append icons "/icecat.png"))))
587 '("default16.png" "default22.png" "default24.png"
588 "default32.png" "default48.png" "content/icon64.png"
589 "mozicon128.png" "default256.png")))))))))
be0f6112
AE
590 (home-page "http://www.gnu.org/software/gnuzilla/")
591 (synopsis "Entirely free browser derived from Mozilla Firefox")
592 (description
593 "IceCat is the GNU version of the Firefox browser. It is entirely free
c5779c93 594software, which does not recommend non-free plugins and addons. It also
79c311b8 595features built-in privacy-protecting features.")
63e8bb12 596 (license license:mpl2.0) ;and others, see toolkit/content/license.html
99effc8f
LC
597 (properties
598 `((ftp-directory . "/gnu/gnuzilla")
599 (cpe-name . "firefox_esr")
600 (cpe-version . ,(string-drop-right version
601 (string-length "-gnu1")))))))