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