guix-more/more/packages/gnuzilla.scm

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(\"-I" (assoc-ref inputs "clang")
259
                  "/lib/clang/6.0.1/include\");
260
builder = builder.include")))
261
             #t))
262
         (add-before 'build 'fix-cpath
263
           (lambda _
264
             (setenv "CPATH" (getenv "CPLUS_INCLUDE_PATH"))
265
             (unsetenv "CPLUS_INCLUDE_PATH")
266
             (setenv "CC" "gcc")
267
             #t))
268
         (replace
269
          'configure
270
          ;; configure does not work followed by both "SHELL=..." and
271
          ;; "CONFIG_SHELL=..."; set environment variables instead
272
          (lambda* (#:key outputs configure-flags #:allow-other-keys)
273
            (let* ((out (assoc-ref outputs "out"))
274
                   (bash (which "bash"))
275
                   (abs-srcdir (getcwd))
276
                   (srcdir (string-append "../" (basename abs-srcdir)))
277
                   (flags `(,(string-append "--prefix=" out)
278
                            ;,(string-append "--with-l10n-base="
279
                            ;                abs-srcdir "/intl/l10n")
280
                            ,@configure-flags)))
281
              (setenv "SHELL" bash)
282
              (setenv "CONFIG_SHELL" bash)
283
              (setenv "AUTOCONF" (which "autoconf")) ; must be autoconf-2.13
284
              (mkdir "../build")
285
              (chdir "../build")
286
              (format #t "build directory: ~s~%" (getcwd))
287
              (format #t "configure flags: ~s~%" flags)
288
              (apply invoke bash
289
                     (string-append srcdir "/configure")
290
                     flags))))))))
291
    (inputs
292
     `(("nspr" ,nspr)
293
       ("nss" ,nss)
294
       ("sqlite" ,sqlite-for-firefox)
295
       ,@(alist-delete "sqlite" (package-inputs icecat))))
296
    (native-inputs
297
     `(("gcc" ,gcc-6)
298
       ("gcc-toolchain-6" ,gcc-toolchain-6)
299
       ("python-3" ,python-3)
300
       ("clang" ,clang)
301
       ("llvm" ,llvm)
302
       ,@(package-native-inputs icecat)))))
303
      ;(snippet
304
      ; '(begin
305
      ;    (use-modules (ice-9 ftw))
306
      ;    ;; Remove bundled libraries that we don't use, since they may
307
      ;    ;; contain unpatched security flaws, they waste disk space and
308
      ;    ;; network bandwidth, and may cause confusion.
309
      ;    (for-each delete-file-recursively
310
      ;              '(;; FIXME: Removing the bundled icu breaks configure.
311
      ;                ;;   * The bundled icu headers are used in some places.
312
      ;                ;;   * The version number is taken from the bundled copy.
313
      ;                ;;"intl/icu"
314
      ;                ;;
315
      ;                ;; FIXME: A script from the bundled nspr is used.
316
      ;                ;;"nsprpub"
317
      ;                ;;
318
      ;                ;; TODO: Use system media libraries.  Waiting for:
319
      ;                ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
320
      ;                ;;   * libogg
321
      ;                ;;   * libtheora
322
      ;                ;;   * libvorbis
323
      ;                ;;   * libtremor (not yet in guix)
324
      ;                ;;   * libopus
325
      ;                ;;   * speex
326
      ;                ;;   * soundtouch (not yet in guix)
327
      ;                ;;
328
      ;                ;; TODO: Use system harfbuzz.  Waiting for:
329
      ;                ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=847568>
330
      ;                ;;
331
      ;                ;; TODO: Use system graphite2.
332
      ;                ;;
333
      ;                "modules/freetype2"
334
      ;                "modules/zlib"
335
      ;                "modules/libbz2"
336
      ;                "ipc/chromium/src/third_party/libevent"
337
      ;                "media/libjpeg"
338
      ;                "media/libvpx"
339
      ;                "security/nss"
340
      ;                "gfx/cairo"
341
      ;                "js/src/ctypes/libffi"
342
      ;                "db/sqlite3"))
343
      ;    ;; Delete this file that has incorrect checksums
344
      ;    (for-each delete-file (find-files "." "\\.cargo-checksum.json"))
345
      ;    ;; Delete .pyc files, typically present in icecat source tarballs
346
      ;    (for-each delete-file (find-files "." "\\.pyc$"))
347
      ;    ;; Delete obj-* directories, sometimes present in icecat tarballs
348
      ;    (for-each delete-file-recursively
349
      ;              (scandir "." (lambda (name)
350
      ;                             (string-prefix? "obj-" name))))
351
      ;    #t))))))
352