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 ;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
9 ;;; This file is part of GNU Guix.
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.
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.
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/>.
24 (define-module (gnu packages gnuzilla)
25 #:use-module ((srfi srfi-1) #:hide (zip))
26 #:use-module (gnu packages)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (guix packages)
29 #:use-module (guix download)
30 #:use-module (guix build-system gnu)
31 #:use-module (gnu packages databases)
32 #:use-module (gnu packages glib)
33 #:use-module (gnu packages gstreamer)
34 #:use-module (gnu packages gtk)
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)
39 #:use-module (gnu packages linux)
40 #:use-module (gnu packages perl)
41 #:use-module (gnu packages pkg-config)
42 #:use-module (gnu packages compression)
43 #:use-module (gnu packages fontutils)
44 #:use-module (gnu packages libevent)
45 #:use-module (gnu packages libreoffice) ;for hunspell
46 #:use-module (gnu packages image)
47 #:use-module (gnu packages libffi)
48 #:use-module (gnu packages pulseaudio)
49 #:use-module (gnu packages python)
50 #:use-module (gnu packages xorg)
51 #:use-module (gnu packages gl)
52 #:use-module (gnu packages assembly)
53 #:use-module (gnu packages icu4c)
54 #:use-module (gnu packages video)
55 #:use-module (gnu packages xdisorg)
56 #:use-module (gnu packages zip))
65 "https://ftp.mozilla.org/pub/mozilla.org/js/"
66 name version ".tar.gz"))
69 "1fig2wf4f10v43mqx67y68z6h77sy900d1w0pz9qarrqx57rc7ij"))
70 (modules '((guix build utils)))
72 ;; Fix incompatibility with Perl 5.22+.
73 '(substitute* '("js/src/config/milestone.pl")
74 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE")))))
75 (build-system gnu-build-system)
78 ("python" ,python-2)))
80 `(;; XXX: parallel build fails, lacking:
81 ;; mkdir -p "system_wrapper_js/"
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"))
96 "./configure" (string-append "--prefix=" out)))))
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
103 (license license:mpl2.0))) ; and others for some files
105 (define-public mozjs-24
106 (package (inherit mozjs)
112 "https://ftp.mozilla.org/pub/mozilla.org/js/"
113 name "-" version ".tar.bz2"))
116 "1n1phk8r3l8icqrrap4czplnylawa0ddc2cc4cgdz46x3lrkybz6"))
117 (modules '((guix build utils)))
119 ;; Fix incompatibility with Perl 5.22+.
120 '(substitute* '("js/src/config/milestone.pl")
121 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE")))))
123 '(;; XXX: parallel build fails, lacking:
124 ;; mkdir -p "system_wrapper_js/"
127 (modify-phases %standard-phases
130 (lambda* (#:key outputs #:allow-other-keys)
131 (let ((out (assoc-ref outputs "out")))
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)
139 "--enable-system-ffi"
140 "--enable-threadsafe"))))))))
143 ("pkg-config" ,pkg-config)
144 ("python" ,python-2)))
146 `(("nspr" ,nspr))) ; in the Requires.private field of mozjs-24.pc
158 "https://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v"
159 version "/src/nspr-" version ".tar.gz"))
162 "1pk98bmc5xzbl62q5wf2d6mryf0v95z6rsmxz27nclwiaqg0mcg0"))))
163 (build-system gnu-build-system)
167 `(#:tests? #f ; no check target
168 #:configure-flags (list "--enable-64bit"
169 (string-append "LDFLAGS=-Wl,-rpath="
170 (assoc-ref %outputs "out")
172 #:phases (alist-cons-before
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
181 platform-neutral API for system level and libc-like functions. It is used
182 in the Mozilla clients.")
183 (license license:mpl2.0)))
191 (uri (let ((version-with-underscores
192 (string-join (string-split version #\.) "_")))
194 "https://ftp.mozilla.org/pub/mozilla.org/security/nss/"
195 "releases/NSS_" version-with-underscores "_RTM/src/"
196 "nss-" version ".tar.gz")))
199 "0r65s5q8kk0vr48s0zr8xi610k7h072lgkkpp4z6jlxr19bkly4i"))
200 ;; Create nss.pc and nss-config.
201 (patches (search-patches "nss-pkgconfig.patch"))))
202 (build-system gnu-build-system)
203 (outputs '("out" "bin"))
205 '(#:parallel-build? #f ; failed
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)
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)
225 (lambda* (#:key system inputs #:allow-other-keys)
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"))
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")))
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.
250 (install-file (string-append obj "/bin/nss-config")
251 (string-append out "/bin"))
252 (delete-file (string-append obj "/bin/nss-config"))
253 ;; Install nss.pc to $out/lib/pkgconfig.
254 (install-file (string-append obj "/lib/pkgconfig/nss.pc")
255 (string-append out "/lib/pkgconfig"))
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)
261 (copy-recursively (string-append obj "/lib") lib)
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"))
271 %standard-phases)))))
275 (propagated-inputs `(("nspr" ,nspr))) ; required by nss.pc.
276 (native-inputs `(("perl" ,perl)))
278 ;; The NSS test suite takes over 28 hours on Loongson 3A (MIPS), and
279 ;; possibly longer when another build is happening concurrently on the
281 (properties '((timeout . 144000))) ; 40 hours
284 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS")
285 (synopsis "Network Security Services")
287 "Network Security Services (NSS) is a set of libraries designed to support
288 cross-platform development of security-enabled client and server applications.
289 Applications built with NSS can support SSL v2 and v3, TLS, PKCS #5, PKCS #7,
290 PKCS #11, PKCS #12, S/MIME, X.509 v3 certificates, and other security
292 (license license:mpl2.0)))
294 (define-public icecat
297 (version "38.8.0-gnu2")
301 (uri (string-append "mirror://gnu/gnuzilla/"
303 name "-" version ".tar.bz2"))
306 "1yb7a1zsqpra9cgq8hrzrbm5v31drb9367cwvwiksz0ngqy342hb"))
307 (patches (search-patches
308 "icecat-avoid-bundled-includes.patch"
309 "icecat-CVE-2016-2818-pt1.patch"
310 "icecat-CVE-2016-2818-pt2.patch"
311 "icecat-CVE-2016-2818-pt3.patch"
312 "icecat-CVE-2016-2818-pt4.patch"
313 "icecat-CVE-2016-2818-pt5.patch"
314 "icecat-CVE-2016-2818-pt6.patch"
315 "icecat-CVE-2016-2818-pt7.patch"
316 "icecat-CVE-2016-2818-pt8.patch"
317 "icecat-CVE-2016-2818-pt9.patch"
318 "icecat-CVE-2016-2819.patch"
319 "icecat-CVE-2016-2821.patch"
320 "icecat-CVE-2016-2824.patch"
321 "icecat-CVE-2016-2828.patch"
322 "icecat-CVE-2016-2831.patch"))
323 (modules '((guix build utils)))
326 ;; Remove bundled libraries that we don't use, since they may
327 ;; contain unpatched security flaws, they waste disk space and
328 ;; network bandwidth, and may cause confusion.
329 (for-each delete-file-recursively
330 '(;; FIXME: Removing the bundled icu breaks configure.
331 ;; * The bundled icu headers are used in some places.
332 ;; * The version number is taken from the bundled copy.
335 ;; FIXME: A script from the bundled nspr is used.
338 ;; TODO: Use system media libraries. Waiting for:
339 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
343 ;; * libtremor (not yet in guix)
346 ;; * soundtouch (not yet in guix)
348 ;; TODO: Use system harfbuzz. Waiting for:
349 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=847568>
351 ;; TODO: Use system graphite2.
356 "ipc/chromium/src/third_party/libevent"
360 "js/src/ctypes/libffi"
363 (build-system gnu-build-system)
365 `(("alsa-lib" ,alsa-lib)
369 ("dbus-glib" ,dbus-glib)
370 ("gdk-pixbuf" ,gdk-pixbuf)
372 ("gstreamer" ,gstreamer)
373 ("gst-plugins-base" ,gst-plugins-base)
376 ("freetype" ,freetype)
377 ("hunspell" ,hunspell)
378 ("libcanberra" ,libcanberra)
379 ("libgnome" ,libgnome)
381 ("libevent" ,libevent)
382 ("libxinerama" ,libxinerama)
383 ("libxscrnsaver" ,libxscrnsaver)
384 ("libxcomposite" ,libxcomposite)
390 ("pulseaudio" ,pulseaudio)
392 ("mit-krb5" ,mit-krb5)
396 ("startup-notification" ,startup-notification)
403 ("python" ,python-2) ; Python 3 not supported
404 ("python2-pysqlite" ,python2-pysqlite)
405 ("pkg-config" ,pkg-config)))
407 `(#:tests? #f ; no check target
408 #:out-of-source? #t ; must be built outside of the source directory
411 ;; XXX: There are RUNPATH issues such as
412 ;; $prefix/lib/icecat-31.6.0/plugin-container NEEDing libmozalloc.so,
413 ;; which is not in its RUNPATH, but they appear to be harmless in
414 ;; practice somehow. See <http://hydra.gnu.org/build/378133>.
415 #:validate-runpath? #f
417 #:configure-flags '("--enable-default-toolkit=cairo-gtk2"
423 "--enable-startup-notification"
424 "--enable-pulseaudio"
425 "--enable-gstreamer=1.0"
431 ;; Building with debugging symbols takes ~5GiB, so
434 "--disable-debug-symbols"
436 ;; Avoid bundled libraries.
439 "--with-system-libevent"
440 "--with-system-libvpx"
444 "--enable-system-pixman"
445 "--enable-system-cairo"
446 "--enable-system-ffi"
447 "--enable-system-hunspell"
448 "--enable-system-sqlite"
450 ;; Fails with "--with-system-png won't work because
451 ;; the system's libpng doesn't have APNG support".
453 ;; http://sourceforge.net/projects/libpng-apng/ ,
454 ;; "the Animated Portable Network Graphics (APNG)
455 ;; is an unofficial extension of the Portable
456 ;; Network Graphics (PNG) format";
457 ;; we probably do not wish to support it.
458 ;; "--with-system-png"
460 ;; Fails with "libjpeg-turbo JCS_EXTENSIONS
463 ;; http://sourceforge.net/projects/libjpeg-turbo/ ,
464 ;; "libjpeg-turbo is a derivative of libjpeg that
465 ;; uses MMX, SSE, SSE2, and NEON SIMD instructions
466 ;; to accelerate baseline JPEG compression/
467 ;; decompression", so we had better not use it
468 ;; "--with-system-jpeg"
471 #:modules ((ice-9 ftw)
474 ,@%gnu-build-system-modules)
476 (modify-phases %standard-phases
478 'unpack 'ensure-no-mtimes-pre-1980
480 ;; Without this, the 'source/test/addons/packed.xpi' and
481 ;; 'source/test/addons/simple-prefs.xpi' targets fail while trying
482 ;; to create zip archives.
483 (let ((early-1980 315619200)) ; 1980-01-02 UTC
484 (ftw "." (lambda (file stat flag)
485 (unless (<= early-1980 (stat:mtime stat))
486 (utime file early-1980 early-1980))
490 'unpack 'remove-h264parse-from-blacklist
492 ;; Remove h264parse from gstreamer format helper blacklist. It
493 ;; was put there to work around a bug in a pre-1.0 version of
495 ;; https://www.mozilla.org/en-US/security/advisories/mfsa2015-47/
496 (substitute* "dom/media/gstreamer/GStreamerFormatHelper.cpp"
497 (("^ \"h264parse\",\n") ""))
500 'unpack 'arrange-to-link-libxul-with-libraries-it-might-dlopen
502 ;; libxul.so dynamically opens libraries, so here we explicitly
503 ;; link them into libxul.so instead.
505 ;; TODO: It might be preferable to patch in absolute file names in
506 ;; calls to dlopen or PR_LoadLibrary, but that didn't seem to
507 ;; work. More investigation is needed.
508 (substitute* "toolkit/library/moz.build"
509 (("^# This needs to be last")
511 'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5',
512 'gstreamer-1.0', 'gstapp-1.0', 'gstvideo-1.0' ]\n\n"))
516 ;; configure does not work followed by both "SHELL=..." and
517 ;; "CONFIG_SHELL=..."; set environment variables instead
518 (lambda* (#:key outputs configure-flags #:allow-other-keys)
519 (let* ((out (assoc-ref outputs "out"))
520 (bash (which "bash"))
521 (abs-srcdir (getcwd))
522 (srcdir (string-append "../" (basename abs-srcdir)))
523 (flags `(,(string-append "--prefix=" out)
524 ,(string-append "--with-l10n-base="
527 (setenv "SHELL" bash)
528 (setenv "CONFIG_SHELL" bash)
531 (format #t "build directory: ~s~%" (getcwd))
532 (format #t "configure flags: ~s~%" flags)
533 (zero? (apply system* bash
534 (string-append srcdir "/configure")
536 (add-before 'configure 'install-desktop-entry
537 (lambda* (#:key outputs #:allow-other-keys)
538 ;; Install the '.desktop' file.
539 (define (swallow-%%-directives input output)
540 ;; Interpret '%%ifdef' directives found in the '.desktop' file.
541 (let loop ((state 'top))
542 (match (read-line input 'concat)
546 (cond ((string-prefix? "%%ifdef" line)
548 ((string-prefix? "%%else" line)
550 ((string-prefix? "%%endif" line)
555 (display line output)
560 (let* ((out (assoc-ref outputs "out"))
561 (applications (string-append out "/share/applications")))
562 (call-with-input-file "debian/icecat.desktop.in"
564 (call-with-output-file "debian/icecat.desktop"
566 (swallow-%%-directives input output)))))
568 (substitute* "debian/icecat.desktop"
569 (("@MOZ_DISPLAY_NAME@")
571 (("^Exec=@MOZ_APP_NAME@")
572 (string-append "Exec=" out "/bin/icecat"))
575 (install-file "debian/icecat.desktop" applications)
577 (add-after 'install-desktop-entry 'install-icons
578 (lambda* (#:key outputs #:allow-other-keys)
579 (let ((out (assoc-ref outputs "out")))
580 (with-directory-excursion "browser/branding/official"
583 (let* ((size (string-filter char-numeric? file))
584 (icons (string-append out "/share/icons/hicolor/"
585 size "x" size "/apps")))
587 (copy-file file (string-append icons "/icecat.png"))))
588 '("default16.png" "default22.png" "default24.png"
589 "default32.png" "default48.png" "content/icon64.png"
590 "mozicon128.png" "default256.png")))))))))
591 (home-page "http://www.gnu.org/software/gnuzilla/")
592 (synopsis "Entirely free browser derived from Mozilla Firefox")
594 "IceCat is the GNU version of the Firefox browser. It is entirely free
595 software, which does not recommend non-free plugins and addons. It also
596 features built-in privacy-protecting features.")
597 (license license:mpl2.0) ;and others, see toolkit/content/license.html
599 `((ftp-directory . "/gnu/gnuzilla")
600 (cpe-name . "firefox_esr")
601 (cpe-version . ,(string-drop-right version
602 (string-length "-gnu1")))))))