1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
4 ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
6 ;;; Copyright © 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
8 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
9 ;;; Copyright © 2017 ng0 <ng0@n0.is>
10 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
11 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
12 ;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com>
14 ;;; This file is part of GNU Guix.
16 ;;; GNU Guix is free software; you can redistribute it and/or modify it
17 ;;; under the terms of the GNU General Public License as published by
18 ;;; the Free Software Foundation; either version 3 of the License, or (at
19 ;;; your option) any later version.
21 ;;; GNU Guix is distributed in the hope that it will be useful, but
22 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;;; GNU General Public License for more details.
26 ;;; You should have received a copy of the GNU General Public License
27 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
29 (define-module (gnu packages gnuzilla)
30 #:use-module ((srfi srfi-1) #:hide (zip))
31 #:use-module (ice-9 match)
32 #:use-module (gnu packages)
33 #:use-module ((guix licenses) #:prefix license:)
34 #:use-module (guix packages)
35 #:use-module (guix download)
36 #:use-module (guix git-download)
37 #:use-module (guix gexp)
38 #:use-module (guix store)
39 #:use-module (guix monads)
40 #:use-module (guix utils)
41 #:use-module (guix build-system gnu)
42 #:use-module (guix build-system cargo)
43 #:use-module (gnu packages admin)
44 #:use-module (gnu packages audio)
45 #:use-module (gnu packages autotools)
46 #:use-module (gnu packages base)
47 #:use-module (gnu packages bash)
48 #:use-module (gnu packages databases)
49 #:use-module (gnu packages glib)
50 #:use-module (gnu packages gtk)
51 #:use-module (gnu packages gnome)
52 #:use-module (gnu packages libcanberra)
53 #:use-module (gnu packages cups)
54 #:use-module (gnu packages kerberos)
55 #:use-module (gnu packages linux)
56 #:use-module (gnu packages perl)
57 #:use-module (gnu packages pkg-config)
58 #:use-module (gnu packages compression)
59 #:use-module (gnu packages fontutils)
60 #:use-module (gnu packages libevent)
61 #:use-module (gnu packages libreoffice) ;for hunspell
62 #:use-module (gnu packages image)
63 #:use-module (gnu packages libffi)
64 #:use-module (gnu packages pulseaudio)
65 #:use-module (gnu packages python)
66 #:use-module (gnu packages python-xyz)
67 #:use-module (gnu packages xorg)
68 #:use-module (gnu packages gl)
69 #:use-module (gnu packages assembly)
70 #:use-module (gnu packages rust)
71 #:use-module (gnu packages llvm)
72 #:use-module (gnu packages nss)
73 #:use-module (gnu packages icu4c)
74 #:use-module (gnu packages video)
75 #:use-module (gnu packages xiph)
76 #:use-module (gnu packages xdisorg)
77 #:use-module (gnu packages readline)
78 #:use-module (gnu packages sqlite))
87 "https://ftp.mozilla.org/pub/mozilla.org/js/"
88 name version ".tar.gz"))
91 "1fig2wf4f10v43mqx67y68z6h77sy900d1w0pz9qarrqx57rc7ij"))
92 (patches (search-patches "mozjs17-aarch64-support.patch"))
93 (modules '((guix build utils)))
95 ;; Fix incompatibility with Perl 5.22+.
97 (substitute* '("js/src/config/milestone.pl")
98 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE"))
100 (build-system gnu-build-system)
103 ("pkg-config" ,pkg-config)
104 ("python" ,python-2)))
106 `(("nspr" ,nspr))) ; in the Requires.private field of mozjs-17.0.pc
110 `(;; XXX: parallel build fails, lacking:
111 ;; mkdir -p "system_wrapper_js/"
114 (modify-phases %standard-phases
115 (add-after 'unpack 'delete-timedout-test
116 ;; This test times out on slower hardware.
118 (delete-file "js/src/jit-test/tests/basic/bug698584.js")
120 (add-before 'configure 'chdir
125 ;; configure fails if it is followed by SHELL and CONFIG_SHELL
126 (lambda* (#:key outputs #:allow-other-keys)
127 (let ((out (assoc-ref outputs "out")))
128 (setenv "SHELL" (which "sh"))
129 (setenv "CONFIG_SHELL" (which "sh"))
130 (invoke "./configure" (string-append "--prefix=" out)
131 ,@(if (string=? "aarch64-linux"
133 '("--host=aarch64-unknown-linux-gnu")
136 "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey")
137 (synopsis "Mozilla javascript engine")
138 (description "SpiderMonkey is Mozilla's JavaScript engine written
140 (license license:mpl2.0))) ; and others for some files
142 (define-public mozjs-24
143 (package (inherit mozjs)
149 "https://ftp.mozilla.org/pub/mozilla.org/js/"
150 name "-" version ".tar.bz2"))
153 "1n1phk8r3l8icqrrap4czplnylawa0ddc2cc4cgdz46x3lrkybz6"))
154 (modules '((guix build utils)))
155 (patches (search-patches "mozjs24-aarch64-support.patch"))
157 ;; Fix incompatibility with Perl 5.22+.
159 (substitute* '("js/src/config/milestone.pl")
160 (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE"))
163 (substitute-keyword-arguments (package-arguments mozjs)
165 `(modify-phases ,phases
167 (lambda* (#:key outputs #:allow-other-keys)
168 (let ((out (assoc-ref outputs "out")))
169 ;; configure fails if it is followed by SHELL and CONFIG_SHELL
170 (setenv "SHELL" (which "sh"))
171 (setenv "CONFIG_SHELL" (which "sh"))
172 (invoke "./configure"
173 (string-append "--prefix=" out)
175 "--enable-system-ffi"
176 "--enable-threadsafe"
177 ,@(if (string=? "aarch64-linux"
179 '("--host=aarch64-unknown-linux-gnu")
185 (define-public mozjs-38
189 (version "38.2.1.rc0")
193 "https://anduin.linuxfromscratch.org/BLFS/mozjs/"
194 name "-" version ".tar.bz2"))
197 "0p4bmbpgkfsj54xschcny0a118jdrdgg0q29rwxigg3lh5slr681"))
200 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1269317 for
201 ;; GCC 6 compatibility.
203 "mozjs38-version-detection.patch" ; for 0ad
204 "mozjs38-tracelogger.patch"
206 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1339931.
207 "mozjs38-pkg-config-version.patch"
208 "mozjs38-shell-version.patch"))
209 (modules '((guix build utils)))
212 ;; Fix incompatibility with sed 4.4.
213 (substitute* "js/src/configure"
214 (("\\^\\[:space:\\]") "^[[:space:]]"))
216 ;; The headers are symlinks to files that are in /tmp, so they
217 ;; end up broken. Copy them instead.
219 "python/mozbuild/mozbuild/backend/recursivemake.py"
220 (("\\['dist_include'\\].add_symlink")
221 "['dist_include'].add_copy"))
223 ;; Remove bundled libraries.
224 (for-each delete-file-recursively
226 "js/src/ctypes/libffi"
227 "js/src/ctypes/libffi-patches"
231 `(;; XXX: parallel build fails, lacking:
232 ;; mkdir -p "system_wrapper_js/"
234 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1008470.
237 (modify-phases %standard-phases
239 (lambda* (#:key outputs #:allow-other-keys)
240 (let ((out (assoc-ref outputs "out")))
242 (setenv "SHELL" (which "sh"))
243 (setenv "CONFIG_SHELL" (which "sh"))
244 (invoke "./configure"
245 (string-append "--prefix=" out)
247 "--enable-gcgenerational"
252 "--enable-system-ffi"
253 "--enable-threadsafe"
254 "--enable-xterm-updates"
259 ;; Intl API requires bundled ICU.
260 "--without-intl-api")))))))
263 ("pkg-config" ,pkg-config)
264 ("python-2" ,python-2)))
267 ("readline" ,readline)
271 (define-public mozjs-52
272 ;; No releases yet at <https://archive.mozilla.org/pub/spidermonkey/releases/>.
273 ;; While we could take a snapshot of the complete mozilla-esr52 repository at
274 ;; <https://treeherder.mozilla.org/#/jobs?repo=mozilla-esr52&filter-searchStr=sm-tc>,
275 ;; we take the Debian version instead, because it is easier to work with.
276 (let ((commit "6507e63cc416fd7a3269e390efe712f8b56f374a")
278 (package (inherit mozjs-38)
279 (version (git-version "52.0" revision commit))
283 (url "https://salsa.debian.org/gnome-team/mozjs52.git")
285 (file-name (git-file-name "mozjs" version))
288 "1ny0s53r8wn4byys87h784xrq1xg767akmfm6gqrbvrz57mlm3q2"))))
290 `(#:tests? #f ; depends on repository metadata
297 "--enable-system-ffi"
302 ;; Intl API requires bundled ICU.
305 ;; Without this gnome-shell will crash at runtime.
306 "--disable-jemalloc")
308 (modify-phases %standard-phases
309 (add-after 'unpack 'patch-and-chdir
310 (lambda* (#:key inputs #:allow-other-keys)
311 ;; This patch prevents a segfault when executing JS_Init().
312 ;; The build does not fail without this patch, but the
313 ;; configure phase of the gjs package would fail.
314 ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1176787
315 (make-file-writable "js/src/old-configure.in")
316 (make-file-writable "js/src/old-configure")
317 (make-file-writable "mozglue/build/moz.build")
318 (invoke "patch" "-p1" "--force"
319 "--input" "debian/patches/disable-mozglue.patch")
320 (invoke "touch" "js/src/configure")
324 (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
325 ;; The configure script does not accept environment variables
327 (let ((out (assoc-ref outputs "out")))
328 (setenv "SHELL" (which "sh"))
329 (setenv "CONFIG_SHELL" (which "sh"))
330 (setenv "AUTOCONF" (string-append (assoc-ref inputs "autoconf")
332 (apply invoke "./configure"
333 (cons (string-append "--prefix=" out)
334 configure-flags))))))))
336 `(("autoconf" ,autoconf-2.13)
337 ("automake" ,automake)
338 ,@(package-native-inputs mozjs-38))))))
340 (define-public mozjs-60
341 ;; No releases yet at <https://archive.mozilla.org/pub/spidermonkey/releases/>.
342 ;; While we could take a snapshot of the complete mozilla-esr60 repository at
343 ;; <https://treeherder.mozilla.org/#/jobs?repo=mozilla-esr60&filter-searchStr=sm-tc>,
344 ;; we take the Debian version instead, because it is easier to work with.
351 (url "https://salsa.debian.org/gnome-team/mozjs60.git")
352 (commit (string-append "debian/" version))))
353 (file-name (git-file-name "mozjs" version))
356 "091w050rwzrdcbgyi934k2viyccmlqxrp13sm2mql71mabb5dai6"))))
358 `(#:tests? #f ; FIXME: all tests pass, but then the check phase fails anyway.
359 #:test-target "check-jstests"
366 "--enable-system-ffi"
371 ;; This is important because without it gjs will segfault during the
372 ;; configure phase. With jemalloc only the standalone mozjs console
374 "--disable-jemalloc")
376 (modify-phases %standard-phases
378 (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
379 ;; The configure script does not accept environment variables as
380 ;; arguments. It also must be run from a different directory,
381 ;; but not the root directory either.
382 (let ((out (assoc-ref outputs "out")))
383 (mkdir "run-configure-from-here")
384 (chdir "run-configure-from-here")
385 (setenv "SHELL" (which "sh"))
386 (setenv "CONFIG_SHELL" (which "sh"))
387 (setenv "AUTOCONF" (string-append (assoc-ref inputs "autoconf")
389 (apply invoke "../js/src/configure"
390 (cons (string-append "--prefix=" out)
393 (add-after 'unpack 'disable-broken-tests
395 ;; This test assumes that /bin exists and contains certain
397 (delete-file "js/src/tests/shell/os.js")
400 `(("autoconf" ,autoconf)
401 ("automake" ,automake)
404 ("pkg-config" ,pkg-config)
405 ("python" ,python-2)))))
407 (define (mozilla-patch file-name changeset hash)
408 "Return an origin for CHANGESET from the mozilla-esr60 repository."
411 (uri (string-append "https://hg.mozilla.org/releases/mozilla-esr60/raw-rev/"
413 (sha256 (base32 hash))
414 (file-name file-name)))
416 (define* (computed-origin-method gexp-promise hash-algo hash
417 #:optional (name "source")
418 #:key (system (%current-system))
419 (guile (default-guile)))
420 "Return a derivation that executes the G-expression that results
421 from forcing GEXP-PROMISE."
422 (mlet %store-monad ((guile (package->derivation guile system)))
423 (gexp->derivation (or name "computed-origin")
425 #:graft? #f ;nothing to graft
427 #:guile-for-build guile)))
429 (define %icecat-version "60.6.2-guix1")
431 ;; 'icecat-source' is a "computed" origin that generates an IceCat tarball
432 ;; from the corresponding upstream Firefox ESR tarball, using the 'makeicecat'
433 ;; script from the upstream IceCat project.
434 (define icecat-source
435 (let* ((base-version (first (string-split %icecat-version #\-)))
437 (major-version (first (string-split base-version #\.)))
438 (minor-version (second (string-split base-version #\.)))
439 (sub-version (third (string-split base-version #\.)))
441 (upstream-firefox-version (string-append base-version "esr"))
442 (upstream-firefox-source
446 "https://ftp.mozilla.org/pub/firefox/releases/"
447 upstream-firefox-version "/source/"
448 "firefox-" upstream-firefox-version ".source.tar.xz"))
451 "0fvxqxg48c0xrffb720gxfjayz3xqam2xnsz5piri64dcjvxgcyd"))))
453 (upstream-icecat-base-version "60.3.0") ; maybe older than base-version
454 (upstream-icecat-gnu-version "1")
455 (upstream-icecat-version (string-append upstream-icecat-base-version
457 upstream-icecat-gnu-version))
458 (upstream-icecat-source
462 "mirror://gnu/gnuzilla/" upstream-icecat-base-version
463 "/icecat-" upstream-icecat-version ".tar.bz2"))
466 "0icnl64nxcyf7dprpdpygxhabsvyhps8c3ixysj9bcdlj9q34ib1"))))
468 (gnuzilla-commit (string-append "v" upstream-icecat-base-version))
473 (url "git://git.savannah.gnu.org/gnuzilla.git")
474 (commit gnuzilla-commit)))
475 (file-name (git-file-name "gnuzilla" upstream-icecat-base-version))
478 "19wal7hkbb4wvk40hs6d7a5paal2bfday08hwssm02srcbv48fj0"))))
481 (local-file (search-patch "icecat-makeicecat.patch"))))
484 (method computed-origin-method)
485 (file-name (string-append "icecat-" %icecat-version ".tar.xz"))
489 (with-imported-modules '((guix build utils))
491 (use-modules (guix build utils))
493 (string-append "firefox-" #$base-version))
495 (string-append "icecat-" #$%icecat-version))
497 (string-append "icecat-" #$upstream-icecat-base-version)))
500 (set-path-environment-variable
503 #+(canonical-package bash)
504 #+(canonical-package coreutils)
505 #+(canonical-package findutils)
506 #+(canonical-package patch)
507 #+(canonical-package xz)
508 #+(canonical-package sed)
509 #+(canonical-package grep)
510 #+(canonical-package bzip2)
511 #+(canonical-package gzip)
512 #+(canonical-package tar)
515 (symlink #+(file-append rename "/bin/rename")
518 ;; We copy the gnuzilla source directory because it is
519 ;; read-only in 'gnuzilla-source', and the makeicecat script
520 ;; uses "cp -a" to copy parts of it and assumes that the
521 ;; copies will be writable.
522 (copy-recursively #+gnuzilla-source "/tmp/gnuzilla"
523 #:log (%make-void-port "w"))
525 (with-directory-excursion "/tmp/gnuzilla"
526 (make-file-writable "makeicecat")
527 (invoke "patch" "--force" "--no-backup-if-mismatch"
528 "-p1" "--input" #+makeicecat-patch)
529 (patch-shebang "makeicecat")
530 (substitute* "makeicecat"
531 (("^FFMAJOR=(.*)" all ffmajor)
532 (unless (string=? #$major-version
533 (string-trim-both ffmajor))
534 ;; The makeicecat script cannot be expected to work
535 ;; properly on a different version of Firefox, even if
536 ;; no errors occur during execution.
537 (error "makeicecat major version mismatch"))
538 (string-append "FFMAJOR=" #$major-version "\n"))
540 (string-append "FFMINOR=" #$minor-version "\n"))
542 (string-append "FFSUB=" #$sub-version "\n"))
544 (string-append "GNUVERSION="
545 #$upstream-icecat-gnu-version "\n"))
547 "DATA=/tmp/gnuzilla/data\n")
548 (("^sed .* debian/" all)
549 (string-append "echo warning: skipped: " all))
550 (("^debian/rules " all)
551 (string-append "echo warning: skipped: " all))
552 (("^find extensions/gnu/ ")
553 "find extensions/gnu/ | sort ")
555 #+(file-append (canonical-package sed) "/bin/sed"))))
557 (format #t "Unpacking upstream firefox tarball...~%")
559 (invoke "tar" "xf" #+upstream-firefox-source)
560 (rename-file firefox-dir icecat-dir)
562 (with-directory-excursion icecat-dir
563 (for-each mkdir-p '("l10n" "debian/config"))
564 (call-with-output-file "debian/control" (const #t))
565 (format #t "Running makeicecat script...~%")
567 (invoke "bash" "/tmp/gnuzilla/makeicecat")
568 (for-each delete-file-recursively '("l10n" "debian")))
570 (format #t (string-append "Unpacking l10n/* and debian/* from"
571 " upstream IceCat tarball...~%"))
573 (unless (string=? icecat-dir old-icecat-dir)
574 (symlink icecat-dir old-icecat-dir))
575 (invoke "tar" "xf" #+upstream-icecat-source
576 (string-append old-icecat-dir "/l10n")
577 (string-append old-icecat-dir "/debian"))
579 (format #t "Packing new IceCat tarball...~%")
581 (invoke "tar" "cfa" #$output
582 ;; Avoid non-determinism in the archive. We set the
583 ;; mtime of files in the archive to early 1980 because
584 ;; the build process fails if the mtime of source
585 ;; files is pre-1980, due to the creation of zip
587 "--mtime=@315619200" ; 1980-01-02 UTC
595 (define-public icecat
598 (version %icecat-version)
601 (inherit icecat-source)
602 (patches (search-patches "icecat-avoid-bundled-libraries.patch"
603 "icecat-use-system-graphite2+harfbuzz.patch"
604 "icecat-use-system-media-libs.patch"))
605 (modules '((guix build utils)))
608 (use-modules (ice-9 ftw))
609 ;; Remove bundled libraries that we don't use, since they may
610 ;; contain unpatched security flaws, they waste disk space and
611 ;; network bandwidth, and may cause confusion.
612 (for-each delete-file-recursively
613 '(;; FIXME: Removing the bundled icu breaks configure.
614 ;; * The bundled icu headers are used in some places.
615 ;; * The version number is taken from the bundled copy.
618 ;; FIXME: A script from the bundled nspr is used.
621 ;; FIXME: With the update to IceCat 60, using system NSS
622 ;; broke certificate validation. See
623 ;; <https://bugs.gnu.org/32833>. For now, we use
624 ;; the bundled NSPR and NSS. TODO: Investigate,
625 ;; and try to unbundle these libraries again.
626 ;; UNBUNDLE-ME! "security/nss"
628 ;; TODO: Use more system media libraries. See:
629 ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
630 ;; * libtheora: esr60 wants v1.2, not yet released.
631 ;; * soundtouch: avoiding the bundled library would
632 ;; result in some loss of functionality. There's
633 ;; also an issue with exception handling
634 ;; configuration. It seems that this is needed in
636 ;; DEFINES['ST_NO_EXCEPTION_HANDLING'] = 1
643 "ipc/chromium/src/third_party/libevent"
648 ;; "media/libtheora" ; wants theora-1.2, not yet released
652 "js/src/ctypes/libffi"
654 ;; Delete .pyc files, typically present in icecat source tarballs
655 (for-each delete-file (find-files "." "\\.pyc$"))
656 ;; Delete obj-* directories, sometimes present in icecat tarballs
657 (for-each delete-file-recursively
658 (scandir "." (lambda (name)
659 (string-prefix? "obj-" name))))
661 (build-system gnu-build-system)
663 `(("alsa-lib" ,alsa-lib)
666 ("dbus-glib" ,dbus-glib)
667 ("gdk-pixbuf" ,gdk-pixbuf)
671 ("graphite2" ,graphite2)
673 ("freetype" ,freetype)
674 ("harfbuzz" ,harfbuzz)
675 ("hunspell" ,hunspell)
676 ("libcanberra" ,libcanberra)
677 ("libgnome" ,libgnome)
678 ("libjpeg-turbo" ,libjpeg-turbo)
680 ;; ("libtheora" ,libtheora) ; wants theora-1.2, not yet released
681 ("libvorbis" ,libvorbis)
683 ("libevent" ,libevent)
684 ("libxinerama" ,libxinerama)
685 ("libxscrnsaver" ,libxscrnsaver)
686 ("libxcomposite" ,libxcomposite)
690 ("libvpx" ,libvpx-1.7)
693 ("pulseaudio" ,pulseaudio)
695 ("mit-krb5" ,mit-krb5)
696 ;; See <https://bugs.gnu.org/32833>
697 ;; and related comments in the 'snippet' above.
698 ;; UNBUNDLE-ME! ("nspr" ,nspr)
699 ;; UNBUNDLE-ME! ("nss" ,nss)
701 ("startup-notification" ,startup-notification)
706 ;; Icecat 60 checkes for rust>=1.24
707 `(("rust" ,rust-1.24)
708 ("cargo" ,rust-1.24 "cargo")
710 ("clang" ,clang-3.9.1)
712 ("python" ,python-2) ; Python 3 not supported
713 ("python2-pysqlite" ,python2-pysqlite)
715 ("pkg-config" ,pkg-config)
716 ("autoconf" ,autoconf-2.13)
719 `(#:tests? #f ; no check target
720 #:out-of-source? #t ; must be built outside of the source directory
722 ;; XXX: There are RUNPATH issues such as
723 ;; $prefix/lib/icecat-31.6.0/plugin-container NEEDing libmozalloc.so,
724 ;; which is not in its RUNPATH, but they appear to be harmless in
725 ;; practice somehow. See <http://hydra.gnu.org/build/378133>.
726 #:validate-runpath? #f
728 #:configure-flags `("--enable-default-toolkit=cairo-gtk3"
730 "--with-distribution-id=org.gnu"
732 "--enable-startup-notification"
733 "--enable-pulseaudio"
737 "--disable-crashreporter"
738 "--disable-maintenance-service"
742 ;; Building with debugging symbols takes ~5GiB, so
745 "--disable-debug-symbols"
747 ;; Clang is needed to build Stylo, Mozilla's new
748 ;; CSS engine. We must specify the clang paths
749 ;; manually, because otherwise the Mozilla build
750 ;; system looks in the directories returned by
751 ;; llvm-config --bindir and llvm-config --libdir,
752 ;; which return paths in the llvm package where
753 ;; clang is not found.
754 ,(string-append "--with-clang-path="
755 (assoc-ref %build-inputs "clang")
757 ,(string-append "--with-libclang-path="
758 (assoc-ref %build-inputs "clang")
761 ;; Hack to work around missing
762 ;; "unofficial" branding in icecat.
763 "--enable-official-branding"
765 ;; Avoid bundled libraries.
768 "--with-system-jpeg" ; must be libjpeg-turbo
769 "--with-system-libevent"
771 "--with-system-vorbis"
772 ;; "--with-system-theora" ; wants theora-1.2, not yet released
773 "--with-system-libvpx"
776 ;; See <https://bugs.gnu.org/32833>
777 ;; and related comments in the 'snippet' above.
778 ;; UNBUNDLE-ME! "--with-system-nspr"
779 ;; UNBUNDLE-ME! "--with-system-nss"
781 "--with-system-harfbuzz"
782 "--with-system-graphite2"
783 "--enable-system-pixman"
784 "--enable-system-ffi"
785 "--enable-system-hunspell"
786 "--enable-system-sqlite"
788 ;; Fails with "--with-system-png won't work because
789 ;; the system's libpng doesn't have APNG support".
791 ;; http://sourceforge.net/projects/libpng-apng/ ,
792 ;; "the Animated Portable Network Graphics (APNG)
793 ;; is an unofficial extension of the Portable
794 ;; Network Graphics (PNG) format";
795 ;; we probably do not wish to support it.
796 ;; "--with-system-png"
799 #:imported-modules ,%cargo-utils-modules ;for `generate-checksums'
801 #:modules ((ice-9 ftw)
804 ,@%gnu-build-system-modules)
806 (modify-phases %standard-phases
808 'unpack 'ensure-no-mtimes-pre-1980
810 ;; Without this, the 'source/test/addons/packed.xpi' and
811 ;; 'source/test/addons/simple-prefs.xpi' targets fail while trying
812 ;; to create zip archives.
813 (let ((early-1980 315619200)) ; 1980-01-02 UTC
814 (ftw "." (lambda (file stat flag)
815 (unless (<= early-1980 (stat:mtime stat))
816 (utime file early-1980 early-1980))
820 'unpack 'link-libxul-with-libraries
822 ;; libxul.so dynamically opens libraries, so here we explicitly
823 ;; link them into libxul.so instead.
825 ;; TODO: It might be preferable to patch in absolute file names in
826 ;; calls to dlopen or PR_LoadLibrary, but that didn't seem to
827 ;; work. More investigation is needed.
828 (substitute* "toolkit/library/moz.build"
829 (("^# This library needs to be last" all)
830 (string-append "OS_LIBS += [
831 'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5',
832 'avcodec', 'avutil', 'pulse' ]\n\n"
837 (invoke "sh" "-c" "autoconf old-configure.in > old-configure")))
838 (add-after 'patch-source-shebangs 'patch-cargo-checksums
840 (use-modules (guix build cargo-utils))
841 (let ((null-file "/dev/null")
842 (null-hash "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))
843 (substitute* '("Cargo.lock" "servo/Cargo.lock")
844 (("(\"checksum .* = )\".*\"" all name)
845 (string-append name "\"" null-hash "\"")))
848 (delete-file filename)
849 (let ((dir (dirname filename)))
850 (display (string-append
851 "patch-cargo-checksums: generate-checksums for "
853 (generate-checksums dir null-file)))
854 (find-files "third_party/rust" ".cargo-checksum.json")))
856 (add-before 'configure 'augment-CPLUS_INCLUDE_PATH
857 (lambda* (#:key build inputs #:allow-other-keys)
858 ;; Here, we add additional entries to CPLUS_INCLUDE_PATH, to work
859 ;; around a problem that otherwise occurs when attempting to
860 ;; build Stylo, which requires Rust and Clang. Without these
861 ;; additional entries, errors occur during the build indicating
862 ;; that the <cstddef> and "c++config.h" headers cannot be found.
863 ;; Note that the 'build' keyword argument contains the GNU
864 ;; triplet, e.g. "x86_64-unknown-linux-gnu".
865 (let ((gcc (assoc-ref inputs "gcc")))
866 (setenv "CPLUS_INCLUDE_PATH"
867 (string-append gcc "/include/c++" ":"
868 gcc "/include/c++/" build ":"
869 (getenv "CPLUS_INCLUDE_PATH"))))))
872 ;; configure does not work followed by both "SHELL=..." and
873 ;; "CONFIG_SHELL=..."; set environment variables instead
874 (lambda* (#:key outputs configure-flags #:allow-other-keys)
875 (let* ((out (assoc-ref outputs "out"))
876 (bash (which "bash"))
877 (abs-srcdir (getcwd))
878 (srcdir (string-append "../" (basename abs-srcdir)))
879 (flags `(,(string-append "--prefix=" out)
880 ,(string-append "--with-l10n-base="
883 (setenv "SHELL" bash)
884 (setenv "CONFIG_SHELL" bash)
885 (setenv "AUTOCONF" (which "autoconf")) ; must be autoconf-2.13
886 (setenv "CC" "gcc") ; apparently needed when Stylo is enabled
889 (format #t "build directory: ~s~%" (getcwd))
890 (format #t "configure flags: ~s~%" flags)
892 (string-append srcdir "/configure")
894 (add-before 'configure 'install-desktop-entry
895 (lambda* (#:key outputs #:allow-other-keys)
896 ;; Install the '.desktop' file.
897 (define (swallow-%%-directives input output)
898 ;; Interpret '%%ifdef' directives found in the '.desktop' file.
899 (let loop ((state 'top))
900 (match (read-line input 'concat)
904 (cond ((string-prefix? "%%ifdef" line)
906 ((string-prefix? "%%else" line)
908 ((string-prefix? "%%endif" line)
913 (display line output)
918 (let* ((out (assoc-ref outputs "out"))
919 (applications (string-append out "/share/applications")))
920 (call-with-input-file "debian/icecat.desktop.in"
922 (call-with-output-file "debian/icecat.desktop"
924 (swallow-%%-directives input output)))))
926 (substitute* "debian/icecat.desktop"
927 (("@MOZ_DISPLAY_NAME@")
929 (("^Exec=@MOZ_APP_NAME@")
930 (string-append "Exec=" out "/bin/icecat"))
933 (install-file "debian/icecat.desktop" applications)
935 (add-after 'install-desktop-entry 'install-icons
936 (lambda* (#:key outputs #:allow-other-keys)
937 (let ((out (assoc-ref outputs "out")))
938 (with-directory-excursion "browser/branding/official"
941 (let* ((size (string-filter char-numeric? file))
942 (icons (string-append out "/share/icons/hicolor/"
943 size "x" size "/apps")))
945 (copy-file file (string-append icons "/icecat.png"))))
946 '("default16.png" "default22.png" "default24.png"
947 "default32.png" "default48.png" "content/icon64.png"
948 "mozicon128.png" "default256.png"))
950 ;; This fixes the file chooser crash that happens with GTK 3.
951 (add-after 'install 'wrap-program
952 (lambda* (#:key inputs outputs #:allow-other-keys)
953 (let* ((out (assoc-ref outputs "out"))
954 (lib (string-append out "/lib"))
955 (gtk (assoc-ref inputs "gtk+"))
956 (gtk-share (string-append gtk "/share")))
957 (wrap-program (car (find-files lib "^icecat$"))
958 `("XDG_DATA_DIRS" ":" prefix (,gtk-share)))
960 (home-page "https://www.gnu.org/software/gnuzilla/")
961 (synopsis "Entirely free browser derived from Mozilla Firefox")
963 "IceCat is the GNU version of the Firefox browser. It is entirely free
964 software, which does not recommend non-free plugins and addons. It also
965 features built-in privacy-protecting features.")
966 (license license:mpl2.0) ;and others, see toolkit/content/license.html
968 `((ftp-directory . "/gnu/gnuzilla")
969 (cpe-name . "firefox_esr")
970 (cpe-version . ,(first (string-split version #\-)))))))
972 (define-public conkeror
973 ;; The Conkeror web browser relied on XULRunner, which IceCat > 50 no longer
974 ;; provides. See <http://conkeror.org> for the original web page.
975 (deprecated-package "conkeror" icecat))