gnu: Add gnome-session.
[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>
8f3c3e84 3;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
2a666e9c 4;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
1aaaff1a 5;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
be0f6112
AE
6;;;
7;;; This file is part of GNU Guix.
8;;;
9;;; GNU Guix is free software; you can redistribute it and/or modify it
10;;; under the terms of the GNU General Public License as published by
11;;; the Free Software Foundation; either version 3 of the License, or (at
12;;; your option) any later version.
13;;;
14;;; GNU Guix is distributed in the hope that it will be useful, but
15;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;;; GNU General Public License for more details.
18;;;
19;;; You should have received a copy of the GNU General Public License
20;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22(define-module (gnu packages gnuzilla)
07d4d9b7 23 #:use-module ((srfi srfi-1) #:hide (zip))
be0f6112 24 #:use-module (gnu packages)
b5b73a82 25 #:use-module ((guix licenses) #:prefix license:)
be0f6112
AE
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix build-system gnu)
1aaaff1a 29 #:use-module (gnu packages databases)
be0f6112
AE
30 #:use-module (gnu packages glib)
31 #:use-module (gnu packages gstreamer)
32 #:use-module (gnu packages gtk)
90e1cdae
MW
33 #:use-module (gnu packages gnome)
34 #:use-module (gnu packages libcanberra)
35 #:use-module (gnu packages cups)
36 #:use-module (gnu packages mit-krb5)
be0f6112
AE
37 #:use-module (gnu packages linux)
38 #:use-module (gnu packages perl)
39 #:use-module (gnu packages pkg-config)
1ae6df81 40 #:use-module (gnu packages compression)
74c7af9f 41 #:use-module (gnu packages fontutils)
1ae6df81 42 #:use-module (gnu packages libevent)
90e1cdae 43 #:use-module (gnu packages libreoffice) ;for hunspell
e55354b8 44 #:use-module (gnu packages image)
1ae6df81 45 #:use-module (gnu packages libffi)
74c7af9f 46 #:use-module (gnu packages pulseaudio)
be0f6112
AE
47 #:use-module (gnu packages python)
48 #:use-module (gnu packages xorg)
200726ed 49 #:use-module (gnu packages gl)
be0f6112 50 #:use-module (gnu packages yasm)
13b284d9
MW
51 #:use-module (gnu packages icu4c)
52 #:use-module (gnu packages video)
53 #:use-module (gnu packages xdisorg)
be0f6112
AE
54 #:use-module (gnu packages zip))
55
4923e06f
SB
56(define-public mozjs
57 (package
58 (name "mozjs")
59 (version "17.0.0")
60 (source (origin
61 (method url-fetch)
62 (uri (string-append
63 "https://ftp.mozilla.org/pub/mozilla.org/js/"
64 name version ".tar.gz"))
65 (sha256
66 (base32
67 "1fig2wf4f10v43mqx67y68z6h77sy900d1w0pz9qarrqx57rc7ij"))))
68 (build-system gnu-build-system)
69 (native-inputs
70 `(("perl", perl)
71 ("python" ,python-2)))
72 (arguments
73 `(#:phases
74 (alist-cons-before
75 'configure 'chdir
76 (lambda _
77 (chdir "js/src"))
78 (alist-replace
79 'configure
80 ;; configure fails if it is followed by SHELL and CONFIG_SHELL
81 (lambda* (#:key outputs #:allow-other-keys)
82 (let ((out (assoc-ref outputs "out")))
83 (setenv "SHELL" (which "sh"))
84 (setenv "CONFIG_SHELL" (which "sh"))
85 (zero? (system*
86 "./configure" (string-append "--prefix=" out)))))
87 %standard-phases))))
88 (home-page
89 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey")
90 (synopsis "Mozilla javascript engine")
91 (description "SpiderMonkey is Mozilla's JavaScript engine written
92in C/C++.")
87158e85 93 (license license:mpl2.0))) ; and others for some files
4923e06f
SB
94
95(define-public nspr
96 (package
97 (name "nspr")
20ed2f7a 98 (version "4.10.10")
4923e06f
SB
99 (source (origin
100 (method url-fetch)
101 (uri (string-append
102 "https://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v"
103 version "/src/nspr-" version ".tar.gz"))
104 (sha256
105 (base32
20ed2f7a 106 "01ria9wk6329hxqsy75p9dkxiqkq4nkz0jjzll7hslih3jbi8dil"))))
4923e06f
SB
107 (build-system gnu-build-system)
108 (native-inputs
109 `(("perl", perl)))
110 (arguments
8550894b
LC
111 `(#:tests? #f ; no check target
112 #:configure-flags (list "--enable-64bit"
113 (string-append "LDFLAGS=-Wl,-rpath="
114 (assoc-ref %outputs "out")
115 "/lib"))
116 #:phases (alist-cons-before
117 'configure 'chdir
118 (lambda _
119 (chdir "nspr"))
120 %standard-phases)))
4923e06f
SB
121 (home-page
122 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR")
123 (synopsis "Netscape API for system level and libc-like functions")
124 (description "Netscape Portable Runtime (NSPR) provides a
125platform-neutral API for system level and libc-like functions. It is used
126in the Mozilla clients.")
127 (license license:mpl2.0)))
128
1aaaff1a
SB
129(define-public nss
130 (package
131 (name "nss")
fe88f636 132 (version "3.20.1")
1aaaff1a
SB
133 (source (origin
134 (method url-fetch)
2bb9b5de
MW
135 (uri (let ((version-with-underscores
136 (string-join (string-split version #\.) "_")))
137 (string-append
fe88f636 138 "https://ftp.mozilla.org/pub/mozilla.org/security/nss/"
2bb9b5de
MW
139 "releases/NSS_" version-with-underscores "_RTM/src/"
140 "nss-" version ".tar.gz")))
1aaaff1a
SB
141 (sha256
142 (base32
fe88f636 143 "15wcbqd2b911hxafbjfn63zd1gf2yxg0s5560hnhqmyrvw8qyg5d"))
1aaaff1a
SB
144 ;; Create nss.pc and nss-config.
145 (patches (list (search-patch "nss-pkgconfig.patch")))))
146 (build-system gnu-build-system)
147 (outputs '("out" "bin"))
148 (arguments
149 '(#:parallel-build? #f ; failed
150 #:make-flags
151 (let* ((out (assoc-ref %outputs "out"))
152 (nspr (string-append (assoc-ref %build-inputs "nspr")))
153 (rpath (string-append "-Wl,-rpath=" out "/lib/nss")))
154 (list "-C" "nss" (string-append "PREFIX=" out)
155 "NSDISTMODE=copy"
156 "NSS_USE_SYSTEM_SQLITE=1"
157 (string-append "NSPR_INCLUDE_DIR=" nspr "/include/nspr")
158 ;; Add $out/lib/nss to RPATH.
159 (string-append "RPATH=" rpath)
160 (string-append "LDFLAGS=" rpath)))
161 #:modules ((guix build gnu-build-system)
162 (guix build utils)
163 (ice-9 ftw)
164 (ice-9 match)
165 (srfi srfi-26))
1aaaff1a
SB
166 #:phases
167 (alist-replace
168 'configure
169 (lambda* (#:key system inputs #:allow-other-keys)
170 ;; Tells NSS to build for the 64-bit ABI if we are 64-bit system.
171 (when (string-prefix? "x86_64" system)
172 (setenv "USE_64" "1"))
173 #t)
174 (alist-replace
175 'check
176 (lambda _
177 ;; Use 127.0.0.1 instead of $HOST.$DOMSUF as HOSTADDR for testing.
178 ;; The later requires a working DNS or /etc/hosts.
179 (setenv "DOMSUF" "(none)")
180 (setenv "USE_IP" "TRUE")
181 (setenv "IP_ADDRESS" "127.0.0.1")
182 (zero? (system* "./nss/tests/all.sh")))
183 (alist-replace
184 'install
185 (lambda* (#:key outputs #:allow-other-keys)
186 (let* ((out (assoc-ref outputs "out"))
187 (bin (string-append (assoc-ref outputs "bin") "/bin"))
188 (inc (string-append out "/include/nss"))
189 (lib (string-append out "/lib/nss"))
190 (obj (match (scandir "dist" (cut string-suffix? "OBJ" <>))
191 ((obj) (string-append "dist/" obj)))))
192 ;; Install nss-config to $out/bin.
96c46210
LC
193 (install-file (string-append obj "/bin/nss-config")
194 (string-append out "/bin"))
1aaaff1a
SB
195 (delete-file (string-append obj "/bin/nss-config"))
196 ;; Install nss.pc to $out/lib/pkgconfig.
96c46210
LC
197 (install-file (string-append obj "/lib/pkgconfig/nss.pc")
198 (string-append out "/lib/pkgconfig"))
1aaaff1a
SB
199 (delete-file (string-append obj "/lib/pkgconfig/nss.pc"))
200 (rmdir (string-append obj "/lib/pkgconfig"))
201 ;; Install other files.
202 (copy-recursively "dist/public/nss" inc)
203 (copy-recursively (string-append obj "/bin") bin)
204 (copy-recursively (string-append obj "/lib") lib)))
205 %standard-phases)))))
206 (inputs
207 `(("sqlite" ,sqlite)
208 ("zlib" ,zlib)))
209 (propagated-inputs `(("nspr" ,nspr))) ; required by nss.pc.
210 (native-inputs `(("perl" ,perl)))
86e3e370
MW
211
212 ;; The NSS test suite takes over 28 hours on Loongson 3A (MIPS), and
213 ;; possibly longer when another build is happening concurrently on the
214 ;; same machine.
215 (properties '((timeout . 144000))) ; 40 hours
216
1aaaff1a
SB
217 (home-page
218 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS")
219 (synopsis "Network Security Services")
220 (description
221 "Network Security Services (NSS) is a set of libraries designed to support
222cross-platform development of security-enabled client and server applications.
223Applications built with NSS can support SSL v2 and v3, TLS, PKCS #5, PKCS #7,
224PKCS #11, PKCS #12, S/MIME, X.509 v3 certificates, and other security
225standards.")
226 (license license:mpl2.0)))
227
be0f6112
AE
228(define-public icecat
229 (package
230 (name "icecat")
9f7ae77f 231 (version "38.3.0-gnu1")
be0f6112
AE
232 (source
233 (origin
234 (method url-fetch)
47bc885c 235 (uri (string-append "mirror://gnu/gnuzilla/"
07d4d9b7
MW
236 (first (string-split version #\-)) "/"
237 name "-" version ".tar.bz2"))
be0f6112
AE
238 (sha256
239 (base32
9f7ae77f
MW
240 "0vm6f7f1i5vkq2713mgzjdfnm8rpz9l0q8sv4s123vsam0j9gzh8"))
241 (patches (map search-patch '("icecat-avoid-bundled-includes.patch"
0ca1eb70
MW
242 "icecat-freetype-2.6.patch"
243 "icecat-CVE-2015-4513-pt01.patch"
244 "icecat-CVE-2015-4513-pt02.patch"
245 "icecat-CVE-2015-4513-pt03.patch"
246 "icecat-CVE-2015-4513-pt04.patch"
247 "icecat-CVE-2015-4513-pt05.patch"
248 "icecat-CVE-2015-4513-pt06.patch"
249 "icecat-CVE-2015-4513-pt07.patch"
250 "icecat-CVE-2015-4513-pt08.patch"
251 "icecat-CVE-2015-4513-pt09.patch"
252 "icecat-CVE-2015-4513-pt10.patch"
253 "icecat-CVE-2015-4513-pt11.patch"
254 "icecat-CVE-2015-7188.patch"
255 "icecat-CVE-2015-7189.patch"
256 "icecat-CVE-2015-7193.patch"
257 "icecat-CVE-2015-7194.patch"
258 "icecat-CVE-2015-7196.patch"
259 "icecat-CVE-2015-7197.patch"
260 "icecat-CVE-2015-7198.patch"
261 "icecat-CVE-2015-7199.patch")))
90e1cdae
MW
262 (modules '((guix build utils)))
263 (snippet
264 '(begin
265 ;; Remove bundled libraries that we don't use, since they may
266 ;; contain unpatched security flaws, they waste disk space and
267 ;; network bandwidth, and may cause confusion.
268 (for-each delete-file-recursively
269 '(;; FIXME: Removing the bundled icu breaks configure.
270 ;; * The bundled icu headers are used in some places.
271 ;; * The version number is taken from the bundled copy.
272 ;;"intl/icu"
273 ;;
274 ;; FIXME: A script from the bundled nspr is used.
275 ;;"nsprpub"
276 ;;
277 ;; TODO: Use system media libraries. Waiting for:
278 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
279 ;; * libogg
280 ;; * libtheora
281 ;; * libvorbis
282 ;; * libtremor (not yet in guix)
283 ;; * libopus
284 ;; * speex
285 ;; * soundtouch (not yet in guix)
286 ;;
287 ;; TODO: Use system harfbuzz. Waiting for:
288 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=847568>
289 ;;
290 "modules/freetype2"
291 "modules/zlib"
292 "modules/libbz2"
293 "ipc/chromium/src/third_party/libevent"
294 "media/libvpx"
295 "security/nss"
296 "gfx/cairo"
297 "js/src/ctypes/libffi"
298 "db/sqlite3"))
a5e55dfb 299 #t))))
be0f6112
AE
300 (build-system gnu-build-system)
301 (inputs
302 `(("alsa-lib" ,alsa-lib)
1ae6df81 303 ("bzip2" ,bzip2)
5b17fabc 304 ("cairo" ,cairo)
90e1cdae 305 ("cups" ,cups)
be0f6112 306 ("dbus-glib" ,dbus-glib)
90e1cdae
MW
307 ("gdk-pixbuf" ,gdk-pixbuf)
308 ("glib" ,glib)
43cc5c5e
MW
309 ("gstreamer" ,gstreamer)
310 ("gst-plugins-base" ,gst-plugins-base)
be0f6112 311 ("gtk+" ,gtk+-2)
74c7af9f
MW
312 ("pango" ,pango)
313 ("freetype" ,freetype)
90e1cdae
MW
314 ("hunspell" ,hunspell)
315 ("libcanberra" ,libcanberra)
316 ("libgnome" ,libgnome)
74c7af9f 317 ("libxft" ,libxft)
1ae6df81 318 ("libevent" ,libevent)
90e1cdae
MW
319 ("libxinerama" ,libxinerama)
320 ("libxscrnsaver" ,libxscrnsaver)
9f7ae77f 321 ("libxcomposite" ,libxcomposite)
be0f6112 322 ("libxt" ,libxt)
1ae6df81 323 ("libffi" ,libffi)
13b284d9
MW
324 ("libvpx" ,libvpx)
325 ("icu4c" ,icu4c)
326 ("pixman" ,pixman)
74c7af9f 327 ("pulseaudio" ,pulseaudio)
be0f6112 328 ("mesa" ,mesa)
90e1cdae 329 ("mit-krb5" ,mit-krb5)
5b17fabc
MW
330 ("nspr" ,nspr)
331 ("nss" ,nss)
9128e323 332 ("sqlite" ,sqlite)
90e1cdae 333 ("startup-notification" ,startup-notification)
be0f6112
AE
334 ("unzip" ,unzip)
335 ("yasm" ,yasm)
1ae6df81
LC
336 ("zip" ,zip)
337 ("zlib" ,zlib)))
c4c4cc05
JD
338 (native-inputs
339 `(("perl" ,perl)
340 ("python" ,python-2) ; Python 3 not supported
341 ("python2-pysqlite" ,python2-pysqlite)
030daf71 342 ("pkg-config" ,pkg-config)))
be0f6112 343 (arguments
74c7af9f
MW
344 `(#:tests? #f ; no check target
345 #:out-of-source? #t ; must be built outside of the source directory
1ae6df81 346
73b1b4eb
LC
347
348 ;; XXX: There are RUNPATH issues such as
349 ;; $prefix/lib/icecat-31.6.0/plugin-container NEEDing libmozalloc.so,
350 ;; which is not in its RUNPATH, but they appear to be harmless in
351 ;; practice somehow. See <http://hydra.gnu.org/build/378133>.
352 #:validate-runpath? #f
353
90e1cdae
MW
354 #:configure-flags '("--enable-default-toolkit=cairo-gtk2"
355 "--enable-pango"
356 "--enable-gio"
357 "--enable-svg"
358 "--enable-canvas"
359 "--enable-mathml"
360 "--enable-startup-notification"
361 "--enable-pulseaudio"
362 "--enable-gstreamer=1.0"
363
364 "--disable-gnomevfs"
365 "--disable-gconf"
366 "--disable-gnomeui"
367
368 ;; Building with debugging symbols takes ~5GiB, so
1ae6df81
LC
369 ;; disable it.
370 "--disable-debug"
371 "--disable-debug-symbols"
372
90e1cdae 373 ;; Avoid bundled libraries.
1ae6df81 374 "--with-system-zlib"
90e1cdae 375 "--with-system-bz2"
1ae6df81 376 "--with-system-libevent"
13b284d9
MW
377 "--with-system-libvpx"
378 "--with-system-icu"
5b17fabc
MW
379 "--with-system-nspr"
380 "--with-system-nss"
13b284d9 381 "--enable-system-pixman"
5b17fabc
MW
382 "--enable-system-cairo"
383 "--enable-system-ffi"
90e1cdae 384 "--enable-system-hunspell"
9128e323 385 "--enable-system-sqlite"
1ae6df81 386
98a046cd
AE
387 ;; Fails with "--with-system-png won't work because
388 ;; the system's libpng doesn't have APNG support".
389 ;; According to
390 ;; http://sourceforge.net/projects/libpng-apng/ ,
391 ;; "the Animated Portable Network Graphics (APNG)
392 ;; is an unofficial extension of the Portable
393 ;; Network Graphics (PNG) format";
394 ;; we probably do not wish to support it.
1ae6df81
LC
395 ;; "--with-system-png"
396
98a046cd
AE
397 ;; Fails with "libjpeg-turbo JCS_EXTENSIONS
398 ;; required".
399 ;; According to
400 ;; http://sourceforge.net/projects/libjpeg-turbo/ ,
401 ;; "libjpeg-turbo is a derivative of libjpeg that
402 ;; uses MMX, SSE, SSE2, and NEON SIMD instructions
403 ;; to accelerate baseline JPEG compression/
404 ;; decompression", so we had better not use it
1ae6df81 405 ;; "--with-system-jpeg"
5b17fabc 406 )
1ae6df81 407
9f7ae77f
MW
408 #:modules ((ice-9 ftw)
409 ,@%gnu-build-system-modules)
be0f6112 410 #:phases
90e1cdae 411 (modify-phases %standard-phases
9f7ae77f
MW
412 (add-after
413 'unpack 'ensure-no-mtimes-pre-1980
414 (lambda _
415 ;; Without this, the 'source/test/addons/packed.xpi' and
416 ;; 'source/test/addons/simple-prefs.xpi' targets fail while trying
417 ;; to create zip archives.
418 (let ((early-1980 315619200)) ; 1980-01-02 UTC
419 (ftw "." (lambda (file stat flag)
420 (unless (<= early-1980 (stat:mtime stat))
421 (utime file early-1980 early-1980))
422 #t))
423 #t)))
90e1cdae
MW
424 (add-after
425 'unpack 'remove-h264parse-from-blacklist
426 (lambda _
427 ;; Remove h264parse from gstreamer format helper blacklist. It
428 ;; was put there to work around a bug in a pre-1.0 version of
429 ;; gstreamer. See:
430 ;; https://www.mozilla.org/en-US/security/advisories/mfsa2015-47/
9f7ae77f 431 (substitute* "dom/media/gstreamer/GStreamerFormatHelper.cpp"
90e1cdae
MW
432 (("^ \"h264parse\",\n") ""))
433 #t))
434 (add-after
435 'unpack 'arrange-to-link-libxul-with-libraries-it-might-dlopen
436 (lambda _
437 ;; libxul.so dynamically opens libraries, so here we explicitly
438 ;; link them into libxul.so instead.
439 ;;
440 ;; TODO: It might be preferable to patch in absolute file names in
441 ;; calls to dlopen or PR_LoadLibrary, but that didn't seem to
442 ;; work. More investigation is needed.
9f7ae77f
MW
443 (substitute* "toolkit/library/moz.build"
444 (("^# This needs to be last")
445 "OS_LIBS += [
446 'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5',
447 'gstreamer-1.0', 'gstapp-1.0', 'gstvideo-1.0' ]\n\n"))
448 #t))
90e1cdae
MW
449 (replace
450 'configure
451 ;; configure does not work followed by both "SHELL=..." and
452 ;; "CONFIG_SHELL=..."; set environment variables instead
453 (lambda* (#:key outputs configure-flags #:allow-other-keys)
454 (let* ((out (assoc-ref outputs "out"))
455 (bash (which "bash"))
456 (abs-srcdir (getcwd))
457 (srcdir (string-append "../" (basename abs-srcdir)))
458 (flags `(,(string-append "--prefix=" out)
459 ,(string-append "--with-l10n-base="
460 abs-srcdir "/l10n")
461 ,@configure-flags)))
462 (setenv "SHELL" bash)
463 (setenv "CONFIG_SHELL" bash)
464 (mkdir "../build")
465 (chdir "../build")
466 (format #t "build directory: ~s~%" (getcwd))
467 (format #t "configure flags: ~s~%" flags)
468 (zero? (apply system* bash
469 (string-append srcdir "/configure")
470 flags))))))))
be0f6112
AE
471 (home-page "http://www.gnu.org/software/gnuzilla/")
472 (synopsis "Entirely free browser derived from Mozilla Firefox")
473 (description
474 "IceCat is the GNU version of the Firefox browser. It is entirely free
c5779c93 475software, which does not recommend non-free plugins and addons. It also
79c311b8 476features built-in privacy-protecting features.")
be0f6112 477 (license license:mpl2.0))) ; and others, see toolkit/content/license.html