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