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