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, 2017 Ludovic Courtès <ludo@gnu.org> |
| 4 | ;;; Copyright © 2014, 2015, 2016, 2017 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> |
| 8 | ;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu> |
| 9 | ;;; |
| 10 | ;;; This file is part of GNU Guix. |
| 11 | ;;; |
| 12 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
| 13 | ;;; under the terms of the GNU General Public License as published by |
| 14 | ;;; the Free Software Foundation; either version 3 of the License, or (at |
| 15 | ;;; your option) any later version. |
| 16 | ;;; |
| 17 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
| 18 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | ;;; GNU General Public License for more details. |
| 21 | ;;; |
| 22 | ;;; You should have received a copy of the GNU General Public License |
| 23 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
| 24 | |
| 25 | (define-module (more packages gnuzilla) |
| 26 | #:use-module ((srfi srfi-1) #:hide (zip)) |
| 27 | #:use-module ((srfi srfi-26)) |
| 28 | #:use-module (gnu packages) |
| 29 | #:use-module ((guix licenses) #:prefix license:) |
| 30 | #:use-module (guix utils) |
| 31 | #:use-module (guix packages) |
| 32 | #:use-module (guix download) |
| 33 | #:use-module (guix build-system cargo) |
| 34 | #:use-module (guix build-system gnu) |
| 35 | #:use-module (more packages google) |
| 36 | #:use-module (gnu packages assembly) |
| 37 | #:use-module (gnu packages autotools) |
| 38 | #:use-module (gnu packages base) |
| 39 | #:use-module (gnu packages bison) |
| 40 | #:use-module (gnu packages cmake) |
| 41 | #:use-module (gnu packages commencement) |
| 42 | #:use-module (gnu packages compression) |
| 43 | #:use-module (gnu packages cups) |
| 44 | #:use-module (gnu packages curl) |
| 45 | #:use-module (gnu packages databases) |
| 46 | #:use-module (gnu packages flex) |
| 47 | #:use-module (gnu packages fontutils) |
| 48 | #:use-module (gnu packages gcc) |
| 49 | #:use-module (gnu packages gl) |
| 50 | #:use-module (gnu packages glib) |
| 51 | #:use-module (gnu packages gnome) |
| 52 | #:use-module (gnu packages gnuzilla) |
| 53 | #:use-module (gnu packages gtk) |
| 54 | #:use-module (gnu packages icu4c) |
| 55 | #:use-module (gnu packages image) |
| 56 | #:use-module (gnu packages libcanberra) |
| 57 | #:use-module (gnu packages libevent) |
| 58 | #:use-module (gnu packages libffi) |
| 59 | #:use-module (gnu packages libreoffice) |
| 60 | #:use-module (gnu packages linux) |
| 61 | #:use-module (gnu packages llvm) |
| 62 | #:use-module (gnu packages perl) |
| 63 | #:use-module (gnu packages pkg-config) |
| 64 | #:use-module (gnu packages pulseaudio) |
| 65 | #:use-module (gnu packages python) |
| 66 | #:use-module (gnu packages rust) |
| 67 | #:use-module (gnu packages version-control) |
| 68 | #:use-module (gnu packages video) |
| 69 | #:use-module (gnu packages xdisorg) |
| 70 | #:use-module (gnu packages xorg) |
| 71 | #:use-module (ice-9 match)) |
| 72 | |
| 73 | ;(define-public icecat-skia |
| 74 | ; (package |
| 75 | ; (inherit icecat) |
| 76 | ; (name "icecat-skia") |
| 77 | ; (inputs |
| 78 | ; `(("skia" ,skia) |
| 79 | ; ,@(package-inputs icecat))) |
| 80 | ; (arguments (substitute-keyword-arguments (package-arguments icecat) |
| 81 | ; ((#:configure-flags flags) |
| 82 | ; `(cons* "--enable-skia" ,flags)))))) |
| 83 | |
| 84 | ;(define-public icu4c-for-firefox |
| 85 | ; (package |
| 86 | ; (inherit icu4c) |
| 87 | ; (name "icu4c") |
| 88 | ; (version "59.1") |
| 89 | ; (source (origin |
| 90 | ; (method url-fetch) |
| 91 | ; (uri (string-append |
| 92 | ; "http://download.icu-project.org/files/icu4c/" |
| 93 | ; version |
| 94 | ; "/icu4c-" |
| 95 | ; (string-map (lambda (x) (if (char=? x #\.) #\_ x)) version) |
| 96 | ; "-src.tgz")) |
| 97 | ; (sha256 |
| 98 | ; (base32 "1zkmbg2932ggvpgjp8pys0cj6z8bw087y8858009shkrjfpzscki")))))) |
| 99 | |
| 100 | ;(define nss-for-firefox |
| 101 | ; (package |
| 102 | ; (inherit nss) |
| 103 | ; (name "nss") |
| 104 | ; (version "3.34.1") |
| 105 | ; (source (origin |
| 106 | ; (method url-fetch) |
| 107 | ; (uri (let ((version-with-underscores |
| 108 | ; (string-join (string-split version #\.) "_"))) |
| 109 | ; (string-append |
| 110 | ; "https://ftp.mozilla.org/pub/mozilla.org/security/nss/" |
| 111 | ; "releases/NSS_" version-with-underscores "_RTM/src/" |
| 112 | ; "nss-" version ".tar.gz"))) |
| 113 | ; (sha256 |
| 114 | ; (base32 |
| 115 | ; "186x33wsk4mzjz7dzbn8p0py9a0nzkgzpfkdv4rlyy5gghv5vhd3")) |
| 116 | ; ;; Create nss.pc and nss-config. |
| 117 | ; (patches (search-patches "nss-pkgconfig.patch" |
| 118 | ; "nss-increase-test-timeout.patch")))))) |
| 119 | ;(define-public libpng-apng-for-firefox |
| 120 | ; (package |
| 121 | ; (inherit libpng-apng) |
| 122 | ; (name "libpng-apng") |
| 123 | ; (version "1.6.34") |
| 124 | ; (source |
| 125 | ; (origin |
| 126 | ; (method url-fetch) |
| 127 | ; (uri (list (string-append "mirror://sourceforge/libpng/libpng16/" |
| 128 | ; version "/libpng-" version ".tar.xz") |
| 129 | ; (string-append |
| 130 | ; "ftp://ftp.simplesystems.org/pub/libpng/png/src" |
| 131 | ; "/libpng16/libpng-" version ".tar.xz") |
| 132 | ; (string-append |
| 133 | ; "ftp://ftp.simplesystems.org/pub/libpng/png/src/history" |
| 134 | ; "/libpng16/libpng-" version ".tar.xz"))) |
| 135 | ; (sha256 |
| 136 | ; (base32 |
| 137 | ; "1xjr0v34fyjgnhvaa1zixcpx5yvxcg4zwvfh0fyklfyfj86rc7ig")))) |
| 138 | ; (inputs |
| 139 | ; `(("apng" ,(origin |
| 140 | ; (method url-fetch) |
| 141 | ; (uri |
| 142 | ; (string-append "mirror://sourceforge/libpng-apng/libpng16/" |
| 143 | ; version "/libpng-" version "-apng.patch.gz")) |
| 144 | ; (sha256 |
| 145 | ; (base32 |
| 146 | ; "1ha4npf9mfrzp0srg8a5amks5ww84xzfpjbsj8k3yjjpai798qg6")))))))) |
| 147 | |
| 148 | (define-public sqlite-for-firefox |
| 149 | (package |
| 150 | (inherit sqlite) |
| 151 | (name "sqlite") |
| 152 | (version "3.25.2") |
| 153 | (source (origin |
| 154 | (method url-fetch) |
| 155 | (uri (let ((numeric-version |
| 156 | (match (string-split version #\.) |
| 157 | ((first-digit other-digits ...) |
| 158 | (string-append first-digit |
| 159 | (string-pad-right |
| 160 | (string-concatenate |
| 161 | (map (cut string-pad <> 2 #\0) |
| 162 | other-digits)) |
| 163 | 6 #\0)))))) |
| 164 | (string-append "https://sqlite.org/2018/sqlite-autoconf-" |
| 165 | numeric-version ".tar.gz"))) |
| 166 | (sha256 |
| 167 | (base32 |
| 168 | "109i1sfryghrdaynkqq9s9aq4347vy653bwkqwx4slix8a2196ns")))) |
| 169 | (arguments |
| 170 | `(#:configure-flags |
| 171 | ;; Add -DSQLITE_SECURE_DELETE, -DSQLITE_ENABLE_UNLOCK_NOTIFY and |
| 172 | ;; -DSQLITE_ENABLE_DBSTAT_VTAB to CFLAGS. GNU Icecat will refuse |
| 173 | ;; to use the system SQLite unless these options are enabled. |
| 174 | (list "--enable-fts5" "--disable-static" |
| 175 | (string-append "CFLAGS=-O2 -DSQLITE_SECURE_DELETE " |
| 176 | "-DSQLITE_ENABLE_UNLOCK_NOTIFY " |
| 177 | "-DSQLITE_ENABLE_DBSTAT_VTAB " |
| 178 | "-DSQLITE_ENABLE_FTS3=1 " |
| 179 | "-DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 " |
| 180 | "-DSQLITE_ENABLE_FTS3_TOKENIZER=1")))))) |
| 181 | |
| 182 | (define-public firefox |
| 183 | (package |
| 184 | (inherit icecat) |
| 185 | (name "firefox") |
| 186 | (version "62.0.3") |
| 187 | (source (origin |
| 188 | (method url-fetch) |
| 189 | (uri (string-append "https://archive.mozilla.org/pub/firefox/" |
| 190 | "releases/" version "/source/firefox-" |
| 191 | version ".source.tar.xz")) |
| 192 | (sha256 |
| 193 | (base32 |
| 194 | "0dj6x7mbnq7f1yx2hxzhzgqzazz7hmq5ir5jk0iya98jggmhdmf1")) |
| 195 | (file-name (string-append name "-" version ".tar.bz2")) |
| 196 | (modules '((guix build utils))) |
| 197 | (snippet |
| 198 | '(begin |
| 199 | (delete-file-recursively "mobile") |
| 200 | #t)))) |
| 201 | (arguments |
| 202 | (substitute-keyword-arguments (package-arguments icecat) |
| 203 | ((#:configure-flags cf) |
| 204 | `(list "--enable-default-toolkit=cairo-gtk3" |
| 205 | "--with-distribution-id=org.gnu" |
| 206 | "--enable-startup-notification" |
| 207 | "--enable-pulseaudio" |
| 208 | "--disable-tests" |
| 209 | "--disable-updater" |
| 210 | "--disable-crashreporter" |
| 211 | "--disable-maintenance-service" |
| 212 | ;"--disable-eme" |
| 213 | "--disable-gconf" |
| 214 | |
| 215 | "--disable-debug" |
| 216 | "--disable-debug-symbols" |
| 217 | |
| 218 | (string-append "--with-clang-path=" |
| 219 | (assoc-ref %build-inputs "clang") "/bin/clang") |
| 220 | (string-append "--with-libclang-path=" |
| 221 | (assoc-ref %build-inputs "clang") "/lib") |
| 222 | "--enable-system-sqlite" |
| 223 | "--with-system-libevent" |
| 224 | "--with-system-libvpx" |
| 225 | "--with-system-nspr" |
| 226 | "--with-system-nss" |
| 227 | "--with-system-icu" |
| 228 | "CC=gcc")) |
| 229 | ((#:phases phases) |
| 230 | `(modify-phases ,phases |
| 231 | (delete 'install-desktop-entry) |
| 232 | (delete 'install-icons) |
| 233 | (replace 'patch-cargo-checksums |
| 234 | (lambda _ |
| 235 | (use-modules (guix build cargo-build-system)) |
| 236 | (let ((null-file "/dev/null") |
| 237 | (null-hash "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")) |
| 238 | (substitute* '("Cargo.lock") |
| 239 | (("(\"checksum .* = )\".*\"" all name) |
| 240 | (string-append name "\"" null-hash "\""))) |
| 241 | (let ((checksum-files (find-files "third_party/rust" |
| 242 | ".cargo-checksum.json"))) |
| 243 | (for-each delete-file checksum-files) |
| 244 | (for-each |
| 245 | (lambda (filename) |
| 246 | (let ((dir (dirname filename))) |
| 247 | (display (string-append |
| 248 | "patch-cargo-checksums: generate-checksums for " |
| 249 | dir "\n")) |
| 250 | (generate-checksums dir null-file))) |
| 251 | checksum-files))) |
| 252 | #t)) |
| 253 | (add-after 'unpack 'fix-stylo |
| 254 | (lambda* (#:key inputs #:allow-other-keys) |
| 255 | (substitute* "servo/components/style/build_gecko.rs" |
| 256 | (("builder = builder.include") |
| 257 | (string-append |
| 258 | "builder = builder.clang_arg(\"-cxx-isystem\"); |
| 259 | builder = builder.clang_arg(\"" |
| 260 | (assoc-ref inputs "gcc") "/include/c++\"); |
| 261 | builder = builder.clang_arg(\"-cxx-isystem\"); |
| 262 | builder = builder.clang_arg(\"" |
| 263 | (car (find-files (string-append |
| 264 | (assoc-ref inputs "gcc") |
| 265 | "/include/c++") |
| 266 | "-gnu$" #:directories? #t)) "\"); |
| 267 | builder = builder.include"))) |
| 268 | #t)) |
| 269 | (add-after 'unpack 'fix-isnan |
| 270 | (lambda _ |
| 271 | ;; There is a bug preventing SymbolTable_autogen.cpp from finding |
| 272 | ;; isnan and isinf, although they are defined in that same file. |
| 273 | ;; The reason seems to be that they are already defined in math.h |
| 274 | (substitute* "gfx/angle/checkout/src/compiler/translator/SymbolTable_autogen.cpp" |
| 275 | (("^namespace sh") |
| 276 | "#undef isnan |
| 277 | #undef isinf |
| 278 | |
| 279 | namespace sh")) |
| 280 | #t)) |
| 281 | (add-before 'build 'fix-cpath |
| 282 | (lambda _ |
| 283 | (setenv "CPATH" (getenv "CPLUS_INCLUDE_PATH")) |
| 284 | (unsetenv "CPLUS_INCLUDE_PATH") |
| 285 | (setenv "CC" "gcc") |
| 286 | #t)) |
| 287 | (replace |
| 288 | 'configure |
| 289 | ;; configure does not work followed by both "SHELL=..." and |
| 290 | ;; "CONFIG_SHELL=..."; set environment variables instead |
| 291 | (lambda* (#:key outputs configure-flags #:allow-other-keys) |
| 292 | (let* ((out (assoc-ref outputs "out")) |
| 293 | (bash (which "bash")) |
| 294 | (abs-srcdir (getcwd)) |
| 295 | (srcdir (string-append "../" (basename abs-srcdir))) |
| 296 | (flags `(,(string-append "--prefix=" out) |
| 297 | ;,(string-append "--with-l10n-base=" |
| 298 | ; abs-srcdir "/intl/l10n") |
| 299 | ,@configure-flags))) |
| 300 | (setenv "SHELL" bash) |
| 301 | (setenv "CONFIG_SHELL" bash) |
| 302 | (setenv "AUTOCONF" (which "autoconf")) ; must be autoconf-2.13 |
| 303 | (mkdir "../build") |
| 304 | (chdir "../build") |
| 305 | (format #t "build directory: ~s~%" (getcwd)) |
| 306 | (format #t "configure flags: ~s~%" flags) |
| 307 | (apply invoke bash |
| 308 | (string-append srcdir "/configure") |
| 309 | flags)))) |
| 310 | ;; This fixes the file chooser crash that happens with GTK 3. |
| 311 | (replace 'wrap-program |
| 312 | (lambda* (#:key inputs outputs #:allow-other-keys) |
| 313 | (let* ((out (assoc-ref outputs "out")) |
| 314 | (lib (string-append out "/lib")) |
| 315 | (gtk (assoc-ref inputs "gtk+")) |
| 316 | (gtk-share (string-append gtk "/share"))) |
| 317 | (wrap-program (car (find-files lib "^firefox$")) |
| 318 | `("XDG_DATA_DIRS" ":" prefix (,gtk-share))) |
| 319 | #t))))))) |
| 320 | (inputs |
| 321 | `(("nspr" ,nspr) |
| 322 | ("nss" ,nss) |
| 323 | ("sqlite" ,sqlite-for-firefox) |
| 324 | ,@(alist-delete "sqlite" (package-inputs icecat)))) |
| 325 | (native-inputs |
| 326 | `(("gcc" ,gcc-6) |
| 327 | ("gcc-toolchain-6" ,gcc-toolchain-6) |
| 328 | ("python-3" ,python-3) |
| 329 | ("clang" ,clang) |
| 330 | ("llvm" ,llvm) |
| 331 | ,@(package-native-inputs icecat))))) |
| 332 | ;(snippet |
| 333 | ; '(begin |
| 334 | ; (use-modules (ice-9 ftw)) |
| 335 | ; ;; Remove bundled libraries that we don't use, since they may |
| 336 | ; ;; contain unpatched security flaws, they waste disk space and |
| 337 | ; ;; network bandwidth, and may cause confusion. |
| 338 | ; (for-each delete-file-recursively |
| 339 | ; '(;; FIXME: Removing the bundled icu breaks configure. |
| 340 | ; ;; * The bundled icu headers are used in some places. |
| 341 | ; ;; * The version number is taken from the bundled copy. |
| 342 | ; ;;"intl/icu" |
| 343 | ; ;; |
| 344 | ; ;; FIXME: A script from the bundled nspr is used. |
| 345 | ; ;;"nsprpub" |
| 346 | ; ;; |
| 347 | ; ;; TODO: Use system media libraries. Waiting for: |
| 348 | ; ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422> |
| 349 | ; ;; * libogg |
| 350 | ; ;; * libtheora |
| 351 | ; ;; * libvorbis |
| 352 | ; ;; * libtremor (not yet in guix) |
| 353 | ; ;; * libopus |
| 354 | ; ;; * speex |
| 355 | ; ;; * soundtouch (not yet in guix) |
| 356 | ; ;; |
| 357 | ; ;; TODO: Use system harfbuzz. Waiting for: |
| 358 | ; ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=847568> |
| 359 | ; ;; |
| 360 | ; ;; TODO: Use system graphite2. |
| 361 | ; ;; |
| 362 | ; "modules/freetype2" |
| 363 | ; "modules/zlib" |
| 364 | ; "modules/libbz2" |
| 365 | ; "ipc/chromium/src/third_party/libevent" |
| 366 | ; "media/libjpeg" |
| 367 | ; "media/libvpx" |
| 368 | ; "security/nss" |
| 369 | ; "gfx/cairo" |
| 370 | ; "js/src/ctypes/libffi" |
| 371 | ; "db/sqlite3")) |
| 372 | ; ;; Delete this file that has incorrect checksums |
| 373 | ; (for-each delete-file (find-files "." "\\.cargo-checksum.json")) |
| 374 | ; ;; Delete .pyc files, typically present in icecat source tarballs |
| 375 | ; (for-each delete-file (find-files "." "\\.pyc$")) |
| 376 | ; ;; Delete obj-* directories, sometimes present in icecat tarballs |
| 377 | ; (for-each delete-file-recursively |
| 378 | ; (scandir "." (lambda (name) |
| 379 | ; (string-prefix? "obj-" name)))) |
| 380 | ; #t)))))) |
| 381 |