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 compression)
42
  #:use-module (gnu packages cups)
43
  #:use-module (gnu packages curl)
44
  #:use-module (gnu packages databases)
45
  #:use-module (gnu packages flex)
46
  #:use-module (gnu packages fontutils)
47
  #:use-module (gnu packages gl)
48
  #:use-module (gnu packages glib)
49
  #:use-module (gnu packages gnome)
50
  #:use-module (gnu packages gnuzilla)
51
  #:use-module (gnu packages gtk)
52
  #:use-module (gnu packages icu4c)
53
  #:use-module (gnu packages image)
54
  #:use-module (gnu packages libcanberra)
55
  #:use-module (gnu packages libevent)
56
  #:use-module (gnu packages libffi)
57
  #:use-module (gnu packages libreoffice)
58
  #:use-module (gnu packages linux)
59
  #:use-module (gnu packages llvm)
60
  #:use-module (gnu packages perl)
61
  #:use-module (gnu packages pkg-config)
62
  #:use-module (gnu packages pulseaudio)
63
  #:use-module (gnu packages python)
64
  #:use-module (gnu packages rust)
65
  #:use-module (gnu packages version-control)
66
  #:use-module (gnu packages video)
67
  #:use-module (gnu packages xdisorg)
68
  #:use-module (gnu packages xorg)
69
  #:use-module (ice-9 match))
70
71
(define-public icecat-skia
72
  (package
73
    (inherit icecat)
74
    (name "icecat-skia")
75
    (inputs
76
     `(("skia" ,skia)
77
       ,@(package-inputs icecat)))
78
    (arguments (substitute-keyword-arguments (package-arguments icecat)
79
                 ((#:configure-flags flags)
80
                  `(cons* "--enable-skia" ,flags))))))
81
82
;(define-public icu4c-for-firefox
83
;  (package
84
;   (inherit icu4c)
85
;   (name "icu4c")
86
;   (version "59.1")
87
;   (source (origin
88
;            (method url-fetch)
89
;            (uri (string-append
90
;                  "http://download.icu-project.org/files/icu4c/"
91
;                  version
92
;                  "/icu4c-"
93
;                  (string-map (lambda (x) (if (char=? x #\.) #\_ x)) version)
94
;                  "-src.tgz"))
95
;            (sha256
96
;             (base32 "1zkmbg2932ggvpgjp8pys0cj6z8bw087y8858009shkrjfpzscki"))))))
97
98
(define nss-for-firefox
99
  (package
100
    (inherit nss)
101
    (name "nss")
102
    (version "3.34.1")
103
    (source (origin
104
              (method url-fetch)
105
              (uri (let ((version-with-underscores
106
                          (string-join (string-split version #\.) "_")))
107
                     (string-append
108
                      "https://ftp.mozilla.org/pub/mozilla.org/security/nss/"
109
                      "releases/NSS_" version-with-underscores "_RTM/src/"
110
                      "nss-" version ".tar.gz")))
111
              (sha256
112
               (base32
113
                "186x33wsk4mzjz7dzbn8p0py9a0nzkgzpfkdv4rlyy5gghv5vhd3"))
114
              ;; Create nss.pc and nss-config.
115
              (patches (search-patches "nss-pkgconfig.patch"
116
                                       "nss-increase-test-timeout.patch"))))))
117
(define-public libpng-apng-for-firefox
118
  (package
119
    (inherit libpng-apng)
120
    (name "libpng-apng")
121
    (version "1.6.34")
122
    (source
123
     (origin
124
       (method url-fetch)
125
       (uri (list (string-append "mirror://sourceforge/libpng/libpng16/"
126
                                 version "/libpng-" version ".tar.xz")
127
                  (string-append
128
                   "ftp://ftp.simplesystems.org/pub/libpng/png/src"
129
                   "/libpng16/libpng-" version ".tar.xz")
130
                  (string-append
131
                   "ftp://ftp.simplesystems.org/pub/libpng/png/src/history"
132
                   "/libpng16/libpng-" version ".tar.xz")))
133
       (sha256
134
        (base32
135
         "1xjr0v34fyjgnhvaa1zixcpx5yvxcg4zwvfh0fyklfyfj86rc7ig"))))
136
    (inputs
137
     `(("apng" ,(origin
138
                  (method url-fetch)
139
                  (uri
140
                   (string-append "mirror://sourceforge/libpng-apng/libpng16/"
141
                                  version "/libpng-" version "-apng.patch.gz"))
142
                  (sha256
143
                   (base32
144
                    "1ha4npf9mfrzp0srg8a5amks5ww84xzfpjbsj8k3yjjpai798qg6"))))))))
145
146
(define-public sqlite-for-firefox
147
  (package
148
   (inherit sqlite)
149
   (name "sqlite")
150
   (version "3.21.0")
151
   (source (origin
152
            (method url-fetch)
153
            (uri (let ((numeric-version
154
                        (match (string-split version #\.)
155
                          ((first-digit other-digits ...)
156
                           (string-append first-digit
157
                                          (string-pad-right
158
                                           (string-concatenate
159
                                            (map (cut string-pad <> 2 #\0)
160
                                                 other-digits))
161
                                           6 #\0))))))
162
                   (string-append "https://sqlite.org/2017/sqlite-autoconf-"
163
                                  numeric-version ".tar.gz")))
164
            (sha256
165
             (base32
166
              "1qxvzdjwzw6k0kqjfabj86rnq87xdbwbca7laxxdhnh0fmkm3pfp"))))))
167
168
(define-public firefox
169
  (package
170
    (name "firefox")
171
    (version "59.0.2")
172
    (source (origin
173
              (method url-fetch)
174
              (uri (string-append "https://hg.mozilla.org/releases/mozilla-release/"
175
                                  "archive/239e434d6d2b8e1e2b697c3416d1e96d48fe98e5.tar.bz2"))
176
              ;(uri (string-append "https://archive.mozilla.org/pub/firefox/"
177
              ;                    "releases/" version "/source/firefox-"
178
              ;                    version ".source.tar.xz"))
179
              (sha256
180
               (base32
181
                "0cr8b6hrhr8ql31w9vjy79gzyzx4d608fwr8bv7apqlp0sn84wsv"))
182
              (file-name (string-append name "-" version ".tar.bz2"))
183
      (modules '((guix build utils)))
184
      (snippet
185
       '(begin
186
          (use-modules (ice-9 ftw))
187
          ;; Remove bundled libraries that we don't use, since they may
188
          ;; contain unpatched security flaws, they waste disk space and
189
          ;; network bandwidth, and may cause confusion.
190
          (for-each delete-file-recursively
191
                    '(;; FIXME: Removing the bundled icu breaks configure.
192
                      ;;   * The bundled icu headers are used in some places.
193
                      ;;   * The version number is taken from the bundled copy.
194
                      ;;"intl/icu"
195
                      ;;
196
                      ;; FIXME: A script from the bundled nspr is used.
197
                      ;;"nsprpub"
198
                      ;;
199
                      ;; TODO: Use system media libraries.  Waiting for:
200
                      ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
201
                      ;;   * libogg
202
                      ;;   * libtheora
203
                      ;;   * libvorbis
204
                      ;;   * libtremor (not yet in guix)
205
                      ;;   * libopus
206
                      ;;   * speex
207
                      ;;   * soundtouch (not yet in guix)
208
                      ;;
209
                      ;; TODO: Use system harfbuzz.  Waiting for:
210
                      ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=847568>
211
                      ;;
212
                      ;; TODO: Use system graphite2.
213
                      ;;
214
                      "modules/freetype2"
215
                      "modules/zlib"
216
                      "modules/libbz2"
217
                      "ipc/chromium/src/third_party/libevent"
218
                      "media/libjpeg"
219
                      "media/libvpx"
220
                      "security/nss"
221
                      "gfx/cairo"
222
                      "js/src/ctypes/libffi"
223
                      "db/sqlite3"))
224
          ;; Delete this file that has incorrect checksums
225
          (for-each delete-file (find-files "." "\\.cargo-checksum.json"))
226
          ;; Delete .pyc files, typically present in icecat source tarballs
227
          (for-each delete-file (find-files "." "\\.pyc$"))
228
          ;; Delete obj-* directories, sometimes present in icecat tarballs
229
          (for-each delete-file-recursively
230
                    (scandir "." (lambda (name)
231
                                   (string-prefix? "obj-" name))))
232
          #t))))
233
    (build-system gnu-build-system)
234
    (arguments
235
     `(#:out-of-source? #t
236
       #:tests? #f
237
       ;#:configure-flags (list "--disable-necko-wifi"
238
       ;                        "--disable-stylo"
239
       ;                        "--disable-crashreporter"
240
       ;                        "--disable-updater"
241
       ;                        "--disable-tests"; Remove if we want to test
242
       ;                        "--enable-application=browser"
243
       ;                        "--enable-optimize=-O2"
244
       ;                        "--with-pthreads"
245
       ;                        ;; use system libraries
246
       ;                        "--enable-system-hunspell"
247
       ;                        "--enable-startup-notification"
248
       ;                        "--enable-alsa" "--enable-pulseaudio"
249
       ;                        "--enable-system-sqlite"
250
       ;                        "--with-system-libevent"
251
       ;                        "--with-system-libvpx"
252
       ;                        "--with-system-nspr"
253
       ;                        "--with-system-nss"
254
       ;                        "--with-system-icu"
255
       ;                        "--enable-system-cairo"
256
       ;                        "--enable-system-ffi"
257
       ;                        "--enable-system-pixman"
258
       ;                        "--with-system-bz2"
259
       ;                        "--with-system-jpeg"
260
       ;                        "--with-system-png"
261
       ;                        "--with-system-zlib")
262
       ;                        ;; clang is not found because it is assumed to be in
263
       ;                        ;; the same location as llvm.
264
       ;                        ;(string-append "--with-clang-path="
265
       ;                        ;               (assoc-ref %build-inputs "clang-3.9.1")
266
       ;                        ;               "/bin/clang"))
267
       ;                        ;(string-append "--with-libclang-path="
268
       ;                        ;               (assoc-ref %build-inputs "clang-3.9.1")
269
       ;                        ;               "/lib"))
270
       ;; Race condition in python?
271
       ;;   EOFError: EOF read where object expected
272
       ;#:parallel-build? #f
273
       #:phases
274
       (modify-phases %standard-phases
275
         (replace 'build
276
           (lambda _
277
             (invoke (which "sh") "mach" "build" "--verbose")
278
             #t))
279
         (replace 'install
280
           (lambda _
281
             (invoke (which "sh") "mach" "install")
282
             #t))
283
         (replace 'configure
284
          (lambda* (#:key outputs configure-flags #:allow-other-keys)
285
            (setenv "SHELL" (which "bash"))
286
            (with-output-to-file "mozconfig"
287
              (lambda _
288
                (display (string-append
289
                           "ac_add_options --disable-necko-wifi
290
ac_add_options --enable-system-hunspell
291
ac_add_options --enable-startup-notification
292
ac_add_options --enable-system-sqlite
293
ac_add_options --with-system-libevent
294
ac_add_options --with-system-libvpx
295
ac_add_options --with-system-nspr
296
ac_add_options --with-system-nss
297
ac_add_options --with-system-icu
298
ac_add_options --prefix=" (assoc-ref outputs "out") "
299
ac_add_options --enable-application=browser
300
301
# For now, disable stylo: it requires clang which is not found by llvm-config
302
ac_add_options --disable-stylo
303
304
ac_add_options --disable-crashreporter
305
ac_add_options --disable-updater
306
# enabling the tests will use a lot more space and significantly
307
# increase the build time, for no obvious benefit.
308
ac_add_options --disable-tests
309
310
# Optimization for size is broken with gcc7
311
ac_add_options --enable-optimize=\"-O2\"
312
313
ac_add_options --enable-official-branding
314
315
# In firefox-59.0 system cairo breaks the build, so comment it.
316
#ac_add_options --enable-system-cairo
317
ac_add_options --enable-system-ffi
318
ac_add_options --enable-system-pixman
319
320
ac_add_options --with-pthreads
321
322
ac_add_options --with-system-bz2
323
ac_add_options --with-system-jpeg
324
ac_add_options --with-system-png
325
ac_add_options --with-system-zlib
326
327
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/firefox-build-dir
328
")))))))))
329
            ;(let* ((out (assoc-ref outputs "out"))
330
            ;       (bash (which "bash"))
331
            ;       (abs-srcdir (getcwd))
332
            ;       (srcdir (string-append "../" (basename abs-srcdir)))
333
            ;       (flags `(,(string-append "--prefix=" out)
334
            ;                ,(string-append "--with-l10n-base="
335
            ;                                abs-srcdir "/intl/l10n")
336
            ;                ,@configure-flags)))
337
            ;  ;; We removed the embedded sqlite, so don't reference it.
338
            ;  (substitute* '("storage/moz.build" "dom/indexedDB/moz.build")
339
            ;    (("'/db/sqlite3/src',") ""))
340
            ;  (setenv "SHELL" bash)
341
            ;  (setenv "CONFIG_SHELL" bash)
342
            ;  (setenv "AUTOCONF" (which "autoconf")) ; must be autoconf-2.13
343
            ;  (mkdir "../build")
344
            ;  (chdir "../build")
345
            ;  (format #t "build directory: ~s~%" (getcwd))
346
            ;  (format #t "configure flags: ~s~%" flags)
347
            ;  (zero? (apply system* bash
348
            ;                (string-append srcdir "/configure")
349
            ;                flags))))))))
350
    (inputs
351
     `(("alsa-lib" ,alsa-lib)
352
       ("bzip2" ,bzip2)
353
       ("cairo" ,cairo)
354
       ("cups" ,cups)
355
       ("dbus-glib" ,dbus-glib)
356
       ("gdk-pixbuf" ,gdk-pixbuf)
357
       ("glib" ,glib)
358
       ("gtk+" ,gtk+)
359
       ("gtk+-2" ,gtk+-2)
360
       ("pango" ,pango)
361
       ("freetype" ,freetype)
362
       ("hunspell" ,hunspell)
363
       ("libcanberra" ,libcanberra)
364
       ("libgnome" ,libgnome)
365
       ("libjpeg-turbo" ,libjpeg-turbo)
366
       ("libxft" ,libxft)
367
       ("libevent" ,libevent-2.0)
368
       ("libxinerama" ,libxinerama)
369
       ("libxscrnsaver" ,libxscrnsaver)
370
       ("libxcomposite" ,libxcomposite)
371
       ("libxt" ,libxt)
372
       ("libffi" ,libffi)
373
       ("ffmpeg" ,ffmpeg)
374
       ("libpng-apng" ,libpng-apng-for-firefox)
375
       ("libvpx" ,libvpx)
376
       ("icu4c" ,icu4c)
377
       ("pixman" ,pixman)
378
       ("pulseaudio" ,pulseaudio)
379
       ("mesa" ,mesa)
380
       ("nspr" ,nspr)
381
       ("nss" ,nss-for-firefox)
382
       ("sqlite" ,sqlite-for-firefox)
383
       ("startup-notification" ,startup-notification)
384
       ("unzip" ,unzip)
385
       ("zip" ,zip)
386
       ("zlib" ,zlib)))
387
    (native-inputs
388
     `(("perl" ,perl)
389
       ("python" ,python-2) ; Python 3 not supported
390
       ("python2-pysqlite" ,python2-pysqlite)
391
       ("yasm" ,yasm)
392
       ("pkg-config" ,pkg-config)
393
       ("autoconf" ,autoconf-2.13)
394
       ("which" ,which)
395
       ("rust" ,rust)
396
       ("cargo" ,rust "cargo")
397
       ("libtool" ,libtool)
398
       ("clang-3.9.1" ,clang-3.9.1)
399
       ("llvm-3.9.1" ,llvm-3.9.1)))
400
    (home-page "https://mozilla.org")
401
    (synopsis "Web browser")
402
    (description "")
403
    (license (package-license icecat))))
404