Commit | Line | Data |
---|---|---|
be0f6112 | 1 | ;;; GNU Guix --- Functional package management for GNU |
5deea4fc | 2 | ;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr> |
1b321229 | 3 | ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org> |
948879ee | 4 | ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mark H Weaver <mhw@netris.org> |
1aaaff1a | 5 | ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com> |
89f9df6c | 6 | ;;; Copyright © 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il> |
88a8ce87 | 7 | ;;; Copyright © 2016 Alex Griffin <a@ajgrf.com> |
8db94716 | 8 | ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org> |
47956fa0 | 9 | ;;; Copyright © 2017 ng0 <ng0@n0.is> |
71a96ecb | 10 | ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr> |
192a59d0 | 11 | ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net> |
7d141788 | 12 | ;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com> |
be0f6112 AE |
13 | ;;; |
14 | ;;; This file is part of GNU Guix. | |
15 | ;;; | |
16 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
17 | ;;; under the terms of the GNU General Public License as published by | |
18 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
19 | ;;; your option) any later version. | |
20 | ;;; | |
21 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
22 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
23 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
24 | ;;; GNU General Public License for more details. | |
25 | ;;; | |
26 | ;;; You should have received a copy of the GNU General Public License | |
27 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
28 | ||
29 | (define-module (gnu packages gnuzilla) | |
07d4d9b7 | 30 | #:use-module ((srfi srfi-1) #:hide (zip)) |
1461dd24 | 31 | #:use-module (ice-9 match) |
be0f6112 | 32 | #:use-module (gnu packages) |
b5b73a82 | 33 | #:use-module ((guix licenses) #:prefix license:) |
be0f6112 AE |
34 | #:use-module (guix packages) |
35 | #:use-module (guix download) | |
192a59d0 | 36 | #:use-module (guix git-download) |
948879ee MW |
37 | #:use-module (guix gexp) |
38 | #:use-module (guix store) | |
39 | #:use-module (guix monads) | |
aaac423c | 40 | #:use-module (guix utils) |
be0f6112 | 41 | #:use-module (guix build-system gnu) |
e67ad553 | 42 | #:use-module (guix build-system cargo) |
948879ee | 43 | #:use-module (gnu packages admin) |
94e96f7f | 44 | #:use-module (gnu packages audio) |
002c3e6d | 45 | #:use-module (gnu packages autotools) |
bfb48f4f | 46 | #:use-module (gnu packages base) |
948879ee | 47 | #:use-module (gnu packages bash) |
bc9aa60b | 48 | #:use-module (gnu packages check) |
1aaaff1a | 49 | #:use-module (gnu packages databases) |
be0f6112 | 50 | #:use-module (gnu packages glib) |
be0f6112 | 51 | #:use-module (gnu packages gtk) |
90e1cdae MW |
52 | #:use-module (gnu packages gnome) |
53 | #:use-module (gnu packages libcanberra) | |
54 | #:use-module (gnu packages cups) | |
89e34644 | 55 | #:use-module (gnu packages kerberos) |
be0f6112 AE |
56 | #:use-module (gnu packages linux) |
57 | #:use-module (gnu packages perl) | |
58 | #:use-module (gnu packages pkg-config) | |
1ae6df81 | 59 | #:use-module (gnu packages compression) |
74c7af9f | 60 | #:use-module (gnu packages fontutils) |
1ae6df81 | 61 | #:use-module (gnu packages libevent) |
90e1cdae | 62 | #:use-module (gnu packages libreoffice) ;for hunspell |
e55354b8 | 63 | #:use-module (gnu packages image) |
1ae6df81 | 64 | #:use-module (gnu packages libffi) |
74c7af9f | 65 | #:use-module (gnu packages pulseaudio) |
be0f6112 | 66 | #:use-module (gnu packages python) |
44d10b1f | 67 | #:use-module (gnu packages python-xyz) |
be0f6112 | 68 | #:use-module (gnu packages xorg) |
200726ed | 69 | #:use-module (gnu packages gl) |
01497dfe | 70 | #:use-module (gnu packages assembly) |
e67ad553 | 71 | #:use-module (gnu packages rust) |
8d956d86 | 72 | #:use-module (gnu packages llvm) |
13b284d9 MW |
73 | #:use-module (gnu packages icu4c) |
74 | #:use-module (gnu packages video) | |
94e96f7f | 75 | #:use-module (gnu packages xiph) |
13b284d9 | 76 | #:use-module (gnu packages xdisorg) |
cd0322a3 RW |
77 | #:use-module (gnu packages readline) |
78 | #:use-module (gnu packages sqlite)) | |
be0f6112 | 79 | |
4923e06f SB |
80 | (define-public mozjs |
81 | (package | |
82 | (name "mozjs") | |
83 | (version "17.0.0") | |
84 | (source (origin | |
85 | (method url-fetch) | |
86 | (uri (string-append | |
87 | "https://ftp.mozilla.org/pub/mozilla.org/js/" | |
88 | name version ".tar.gz")) | |
89 | (sha256 | |
90 | (base32 | |
68716289 | 91 | "1fig2wf4f10v43mqx67y68z6h77sy900d1w0pz9qarrqx57rc7ij")) |
a64b7da5 | 92 | (patches (search-patches "mozjs17-aarch64-support.patch")) |
68716289 SB |
93 | (modules '((guix build utils))) |
94 | (snippet | |
95 | ;; Fix incompatibility with Perl 5.22+. | |
6cbee49d MW |
96 | '(begin |
97 | (substitute* '("js/src/config/milestone.pl") | |
98 | (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE")) | |
99 | #t)))) | |
4923e06f SB |
100 | (build-system gnu-build-system) |
101 | (native-inputs | |
f403c676 EF |
102 | `(("perl" ,perl) |
103 | ("pkg-config" ,pkg-config) | |
104 | ("python" ,python-2))) | |
105 | (propagated-inputs | |
106 | `(("nspr" ,nspr))) ; in the Requires.private field of mozjs-17.0.pc | |
107 | (inputs | |
108 | `(("zlib" ,zlib))) | |
4923e06f | 109 | (arguments |
56486b3a EF |
110 | `(;; XXX: parallel build fails, lacking: |
111 | ;; mkdir -p "system_wrapper_js/" | |
112 | #:parallel-build? #f | |
113 | #:phases | |
114 | (modify-phases %standard-phases | |
115 | (add-after 'unpack 'delete-timedout-test | |
a64b7da5 | 116 | ;; This test times out on slower hardware. |
e15793c8 MW |
117 | (lambda _ |
118 | (delete-file "js/src/jit-test/tests/basic/bug698584.js") | |
119 | #t)) | |
56486b3a | 120 | (add-before 'configure 'chdir |
4923e06f | 121 | (lambda _ |
56486b3a EF |
122 | (chdir "js/src") |
123 | #t)) | |
124 | (replace 'configure | |
125 | ;; configure fails if it is followed by SHELL and CONFIG_SHELL | |
126 | (lambda* (#:key outputs #:allow-other-keys) | |
127 | (let ((out (assoc-ref outputs "out"))) | |
128 | (setenv "SHELL" (which "sh")) | |
129 | (setenv "CONFIG_SHELL" (which "sh")) | |
e15793c8 MW |
130 | (invoke "./configure" (string-append "--prefix=" out) |
131 | ,@(if (string=? "aarch64-linux" | |
132 | (%current-system)) | |
133 | '("--host=aarch64-unknown-linux-gnu") | |
134 | '())))))))) | |
4923e06f SB |
135 | (home-page |
136 | "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey") | |
137 | (synopsis "Mozilla javascript engine") | |
138 | (description "SpiderMonkey is Mozilla's JavaScript engine written | |
139 | in C/C++.") | |
87158e85 | 140 | (license license:mpl2.0))) ; and others for some files |
4923e06f | 141 | |
cefdcb38 SB |
142 | (define-public mozjs-24 |
143 | (package (inherit mozjs) | |
144 | (name "mozjs") | |
145 | (version "24.2.0") | |
146 | (source (origin | |
147 | (method url-fetch) | |
148 | (uri (string-append | |
149 | "https://ftp.mozilla.org/pub/mozilla.org/js/" | |
150 | name "-" version ".tar.bz2")) | |
151 | (sha256 | |
152 | (base32 | |
68716289 SB |
153 | "1n1phk8r3l8icqrrap4czplnylawa0ddc2cc4cgdz46x3lrkybz6")) |
154 | (modules '((guix build utils))) | |
26f38d31 | 155 | (patches (search-patches "mozjs24-aarch64-support.patch")) |
68716289 SB |
156 | (snippet |
157 | ;; Fix incompatibility with Perl 5.22+. | |
6cbee49d MW |
158 | '(begin |
159 | (substitute* '("js/src/config/milestone.pl") | |
160 | (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE")) | |
161 | #t)))) | |
cefdcb38 | 162 | (arguments |
aaac423c EF |
163 | (substitute-keyword-arguments (package-arguments mozjs) |
164 | ((#:phases phases) | |
165 | `(modify-phases ,phases | |
166 | (replace 'configure | |
167 | (lambda* (#:key outputs #:allow-other-keys) | |
168 | (let ((out (assoc-ref outputs "out"))) | |
169 | ;; configure fails if it is followed by SHELL and CONFIG_SHELL | |
170 | (setenv "SHELL" (which "sh")) | |
171 | (setenv "CONFIG_SHELL" (which "sh")) | |
6073ef75 MW |
172 | (invoke "./configure" |
173 | (string-append "--prefix=" out) | |
174 | "--with-system-nspr" | |
175 | "--enable-system-ffi" | |
176 | "--enable-threadsafe" | |
177 | ,@(if (string=? "aarch64-linux" | |
178 | (%current-system)) | |
179 | '("--host=aarch64-unknown-linux-gnu") | |
180 | '()))))))))) | |
cefdcb38 SB |
181 | (inputs |
182 | `(("libffi" ,libffi) | |
183 | ("zlib" ,zlib))))) | |
184 | ||
29f381ba CL |
185 | (define-public mozjs-38 |
186 | (package | |
187 | (inherit mozjs) | |
188 | (name "mozjs") | |
189 | (version "38.2.1.rc0") | |
190 | (source (origin | |
191 | (method url-fetch) | |
192 | (uri (string-append | |
193 | "https://people.mozilla.org/~sstangl/" | |
194 | name "-" version ".tar.bz2")) | |
195 | (sha256 | |
196 | (base32 | |
197 | "0p4bmbpgkfsj54xschcny0a118jdrdgg0q29rwxigg3lh5slr681")) | |
198 | (patches | |
199 | (search-patches | |
200 | ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1269317 for | |
201 | ;; GCC 6 compatibility. | |
202 | ||
203 | "mozjs38-version-detection.patch" ; for 0ad | |
204 | "mozjs38-tracelogger.patch" | |
205 | ||
206 | ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1339931. | |
207 | "mozjs38-pkg-config-version.patch" | |
208 | "mozjs38-shell-version.patch")) | |
209 | (modules '((guix build utils))) | |
210 | (snippet | |
211 | '(begin | |
212 | ;; Fix incompatibility with sed 4.4. | |
213 | (substitute* "js/src/configure" | |
214 | (("\\^\\[:space:\\]") "^[[:space:]]")) | |
215 | ||
216 | ;; The headers are symlinks to files that are in /tmp, so they | |
217 | ;; end up broken. Copy them instead. | |
218 | (substitute* | |
219 | "python/mozbuild/mozbuild/backend/recursivemake.py" | |
220 | (("\\['dist_include'\\].add_symlink") | |
221 | "['dist_include'].add_copy")) | |
222 | ||
223 | ;; Remove bundled libraries. | |
224 | (for-each delete-file-recursively | |
225 | '("intl" | |
226 | "js/src/ctypes/libffi" | |
227 | "js/src/ctypes/libffi-patches" | |
228 | "modules/zlib")) | |
229 | #t)))) | |
230 | (arguments | |
231 | `(;; XXX: parallel build fails, lacking: | |
232 | ;; mkdir -p "system_wrapper_js/" | |
233 | #:parallel-build? #f | |
234 | ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1008470. | |
235 | #:tests? #f | |
236 | #:phases | |
237 | (modify-phases %standard-phases | |
238 | (replace 'configure | |
239 | (lambda* (#:key outputs #:allow-other-keys) | |
240 | (let ((out (assoc-ref outputs "out"))) | |
241 | (chdir "js/src") | |
242 | (setenv "SHELL" (which "sh")) | |
243 | (setenv "CONFIG_SHELL" (which "sh")) | |
5f70b6d4 MW |
244 | (invoke "./configure" |
245 | (string-append "--prefix=" out) | |
246 | "--enable-ctypes" | |
247 | "--enable-gcgenerational" | |
248 | "--enable-optimize" | |
249 | "--enable-pie" | |
250 | "--enable-readline" | |
251 | "--enable-shared-js" | |
252 | "--enable-system-ffi" | |
253 | "--enable-threadsafe" | |
254 | "--enable-xterm-updates" | |
255 | "--with-system-icu" | |
256 | "--with-system-nspr" | |
257 | "--with-system-zlib" | |
29f381ba | 258 | |
5f70b6d4 MW |
259 | ;; Intl API requires bundled ICU. |
260 | "--without-intl-api"))))))) | |
29f381ba CL |
261 | (native-inputs |
262 | `(("perl" ,perl) | |
263 | ("pkg-config" ,pkg-config) | |
264 | ("python-2" ,python-2))) | |
265 | (inputs | |
266 | `(("libffi" ,libffi) | |
267 | ("readline" ,readline) | |
268 | ("icu4c" ,icu4c) | |
269 | ("zlib" ,zlib))))) | |
270 | ||
192a59d0 RW |
271 | (define-public mozjs-52 |
272 | ;; No releases yet at <https://archive.mozilla.org/pub/spidermonkey/releases/>. | |
273 | ;; While we could take a snapshot of the complete mozilla-esr52 repository at | |
274 | ;; <https://treeherder.mozilla.org/#/jobs?repo=mozilla-esr52&filter-searchStr=sm-tc>, | |
275 | ;; we take the Debian version instead, because it is easier to work with. | |
276 | (let ((commit "6507e63cc416fd7a3269e390efe712f8b56f374a") | |
277 | (revision "1")) | |
278 | (package (inherit mozjs-38) | |
279 | (version (git-version "52.0" revision commit)) | |
280 | (source (origin | |
281 | (method git-fetch) | |
282 | (uri (git-reference | |
283 | (url "https://salsa.debian.org/gnome-team/mozjs52.git") | |
284 | (commit commit))) | |
285 | (file-name (git-file-name "mozjs" version)) | |
286 | (sha256 | |
287 | (base32 | |
288 | "1ny0s53r8wn4byys87h784xrq1xg767akmfm6gqrbvrz57mlm3q2")))) | |
289 | (arguments | |
290 | `(#:tests? #f ; depends on repository metadata | |
291 | #:configure-flags | |
292 | '("--enable-ctypes" | |
293 | "--enable-optimize" | |
294 | "--enable-pie" | |
295 | "--enable-readline" | |
296 | "--enable-shared-js" | |
297 | "--enable-system-ffi" | |
298 | "--with-system-icu" | |
299 | "--with-system-nspr" | |
300 | "--with-system-zlib" | |
301 | ||
302 | ;; Intl API requires bundled ICU. | |
6cc147a3 RW |
303 | "--without-intl-api" |
304 | ||
305 | ;; Without this gnome-shell will crash at runtime. | |
306 | "--disable-jemalloc") | |
192a59d0 RW |
307 | #:phases |
308 | (modify-phases %standard-phases | |
309 | (add-after 'unpack 'patch-and-chdir | |
310 | (lambda* (#:key inputs #:allow-other-keys) | |
311 | ;; This patch prevents a segfault when executing JS_Init(). | |
312 | ;; The build does not fail without this patch, but the | |
313 | ;; configure phase of the gjs package would fail. | |
314 | ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1176787 | |
315 | (make-file-writable "js/src/old-configure.in") | |
316 | (make-file-writable "js/src/old-configure") | |
317 | (make-file-writable "mozglue/build/moz.build") | |
318 | (invoke "patch" "-p1" "--force" | |
319 | "--input" "debian/patches/disable-mozglue.patch") | |
320 | (invoke "touch" "js/src/configure") | |
321 | (chdir "js/src") | |
322 | #t)) | |
323 | (replace 'configure | |
324 | (lambda* (#:key inputs outputs configure-flags #:allow-other-keys) | |
325 | ;; The configure script does not accept environment variables | |
326 | ;; as arguments. | |
327 | (let ((out (assoc-ref outputs "out"))) | |
328 | (setenv "SHELL" (which "sh")) | |
329 | (setenv "CONFIG_SHELL" (which "sh")) | |
330 | (setenv "AUTOCONF" (string-append (assoc-ref inputs "autoconf") | |
331 | "/bin/autoconf")) | |
332 | (apply invoke "./configure" | |
333 | (cons (string-append "--prefix=" out) | |
334 | configure-flags)))))))) | |
335 | (native-inputs | |
336 | `(("autoconf" ,autoconf-2.13) | |
337 | ("automake" ,automake) | |
338 | ,@(package-native-inputs mozjs-38)))))) | |
339 | ||
204cfbe1 RW |
340 | (define-public mozjs-60 |
341 | ;; No releases yet at <https://archive.mozilla.org/pub/spidermonkey/releases/>. | |
342 | ;; While we could take a snapshot of the complete mozilla-esr60 repository at | |
343 | ;; <https://treeherder.mozilla.org/#/jobs?repo=mozilla-esr60&filter-searchStr=sm-tc>, | |
344 | ;; we take the Debian version instead, because it is easier to work with. | |
345 | (package | |
346 | (inherit mozjs-38) | |
347 | (version "60.2.3-2") | |
348 | (source (origin | |
349 | (method git-fetch) | |
350 | (uri (git-reference | |
351 | (url "https://salsa.debian.org/gnome-team/mozjs60.git") | |
352 | (commit (string-append "debian/" version)))) | |
353 | (file-name (git-file-name "mozjs" version)) | |
354 | (sha256 | |
355 | (base32 | |
356 | "091w050rwzrdcbgyi934k2viyccmlqxrp13sm2mql71mabb5dai6")))) | |
357 | (arguments | |
358 | `(#:tests? #f ; FIXME: all tests pass, but then the check phase fails anyway. | |
359 | #:test-target "check-jstests" | |
360 | #:configure-flags | |
361 | '("--enable-ctypes" | |
362 | "--enable-optimize" | |
363 | "--enable-pie" | |
364 | "--enable-readline" | |
365 | "--enable-shared-js" | |
366 | "--enable-system-ffi" | |
367 | "--with-system-nspr" | |
368 | "--with-system-zlib" | |
369 | "--with-system-icu" | |
370 | "--with-intl-api" | |
371 | ;; This is important because without it gjs will segfault during the | |
372 | ;; configure phase. With jemalloc only the standalone mozjs console | |
373 | ;; will work. | |
374 | "--disable-jemalloc") | |
375 | #:phases | |
376 | (modify-phases %standard-phases | |
377 | (replace 'configure | |
378 | (lambda* (#:key inputs outputs configure-flags #:allow-other-keys) | |
379 | ;; The configure script does not accept environment variables as | |
380 | ;; arguments. It also must be run from a different directory, | |
381 | ;; but not the root directory either. | |
382 | (let ((out (assoc-ref outputs "out"))) | |
383 | (mkdir "run-configure-from-here") | |
384 | (chdir "run-configure-from-here") | |
385 | (setenv "SHELL" (which "sh")) | |
386 | (setenv "CONFIG_SHELL" (which "sh")) | |
387 | (setenv "AUTOCONF" (string-append (assoc-ref inputs "autoconf") | |
388 | "/bin/autoconf")) | |
389 | (apply invoke "../js/src/configure" | |
390 | (cons (string-append "--prefix=" out) | |
391 | configure-flags)) | |
392 | #t))) | |
393 | (add-after 'unpack 'disable-broken-tests | |
394 | (lambda _ | |
395 | ;; This test assumes that /bin exists and contains certain | |
396 | ;; executables. | |
397 | (delete-file "js/src/tests/shell/os.js") | |
398 | #t))))) | |
399 | (native-inputs | |
400 | `(("autoconf" ,autoconf) | |
401 | ("automake" ,automake) | |
402 | ("which" ,which) | |
403 | ("perl" ,perl) | |
404 | ("pkg-config" ,pkg-config) | |
405 | ("python" ,python-2))))) | |
406 | ||
4923e06f SB |
407 | (define-public nspr |
408 | (package | |
409 | (name "nspr") | |
7ea90c21 | 410 | (version "4.20") |
4923e06f SB |
411 | (source (origin |
412 | (method url-fetch) | |
413 | (uri (string-append | |
414 | "https://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v" | |
415 | version "/src/nspr-" version ".tar.gz")) | |
416 | (sha256 | |
417 | (base32 | |
7ea90c21 | 418 | "0vjms4j75zvv5b2siyafg7hh924ysx2cwjad8spzp7x87n8n929c")))) |
4923e06f SB |
419 | (build-system gnu-build-system) |
420 | (native-inputs | |
84fb4bd9 | 421 | `(("perl" ,perl))) |
4923e06f | 422 | (arguments |
8550894b LC |
423 | `(#:tests? #f ; no check target |
424 | #:configure-flags (list "--enable-64bit" | |
425 | (string-append "LDFLAGS=-Wl,-rpath=" | |
426 | (assoc-ref %outputs "out") | |
427 | "/lib")) | |
6d7786ff MB |
428 | ;; Use fixed timestamps for reproducibility. |
429 | #:make-flags '("SH_DATE='1970-01-01 00:00:01'" | |
430 | ;; This is epoch 1 in microseconds. | |
431 | "SH_NOW=100000") | |
04952bd7 EF |
432 | #:phases (modify-phases %standard-phases |
433 | (add-before 'configure 'chdir | |
434 | (lambda _ (chdir "nspr") #t))))) | |
4923e06f SB |
435 | (home-page |
436 | "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR") | |
437 | (synopsis "Netscape API for system level and libc-like functions") | |
a440a6af | 438 | (description "Netscape Portable Runtime (@dfn{NSPR}) provides a |
4923e06f SB |
439 | platform-neutral API for system level and libc-like functions. It is used |
440 | in the Mozilla clients.") | |
441 | (license license:mpl2.0))) | |
442 | ||
1aaaff1a SB |
443 | (define-public nss |
444 | (package | |
445 | (name "nss") | |
3ce60c22 | 446 | (version "3.41") |
1aaaff1a SB |
447 | (source (origin |
448 | (method url-fetch) | |
2bb9b5de MW |
449 | (uri (let ((version-with-underscores |
450 | (string-join (string-split version #\.) "_"))) | |
451 | (string-append | |
fe88f636 | 452 | "https://ftp.mozilla.org/pub/mozilla.org/security/nss/" |
2bb9b5de MW |
453 | "releases/NSS_" version-with-underscores "_RTM/src/" |
454 | "nss-" version ".tar.gz"))) | |
1aaaff1a SB |
455 | (sha256 |
456 | (base32 | |
3ce60c22 | 457 | "0bbif42fzz5gk451sv3yphdrl7m4p6zgk5jk0307j06xs3sihbmb")) |
1aaaff1a | 458 | ;; Create nss.pc and nss-config. |
d027b001 MB |
459 | (patches (search-patches "nss-pkgconfig.patch" |
460 | "nss-increase-test-timeout.patch")))) | |
1aaaff1a SB |
461 | (build-system gnu-build-system) |
462 | (outputs '("out" "bin")) | |
463 | (arguments | |
1461dd24 | 464 | `(#:parallel-build? #f ; not supported |
1aaaff1a SB |
465 | #:make-flags |
466 | (let* ((out (assoc-ref %outputs "out")) | |
467 | (nspr (string-append (assoc-ref %build-inputs "nspr"))) | |
468 | (rpath (string-append "-Wl,-rpath=" out "/lib/nss"))) | |
469 | (list "-C" "nss" (string-append "PREFIX=" out) | |
470 | "NSDISTMODE=copy" | |
471 | "NSS_USE_SYSTEM_SQLITE=1" | |
472 | (string-append "NSPR_INCLUDE_DIR=" nspr "/include/nspr") | |
473 | ;; Add $out/lib/nss to RPATH. | |
474 | (string-append "RPATH=" rpath) | |
475 | (string-append "LDFLAGS=" rpath))) | |
476 | #:modules ((guix build gnu-build-system) | |
477 | (guix build utils) | |
478 | (ice-9 ftw) | |
479 | (ice-9 match) | |
480 | (srfi srfi-26)) | |
1aaaff1a | 481 | #:phases |
db3c06d5 MB |
482 | (modify-phases %standard-phases |
483 | (replace 'configure | |
1461dd24 | 484 | (lambda _ |
db3c06d5 MB |
485 | (setenv "CC" "gcc") |
486 | ;; Tells NSS to build for the 64-bit ABI if we are 64-bit system. | |
1461dd24 MB |
487 | ,@(match (%current-system) |
488 | ((or "x86_64-linux" "aarch64-linux") | |
489 | `((setenv "USE_64" "1"))) | |
490 | (_ | |
491 | '())) | |
db3c06d5 MB |
492 | #t)) |
493 | (replace 'check | |
494 | (lambda _ | |
495 | ;; Use 127.0.0.1 instead of $HOST.$DOMSUF as HOSTADDR for testing. | |
496 | ;; The later requires a working DNS or /etc/hosts. | |
8c62baa0 | 497 | (setenv "DOMSUF" "localdomain") |
db3c06d5 MB |
498 | (setenv "USE_IP" "TRUE") |
499 | (setenv "IP_ADDRESS" "127.0.0.1") | |
bc9aa60b LC |
500 | |
501 | ;; The "PayPalEE.cert" certificate expires every six months, | |
502 | ;; leading to test failures: | |
503 | ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=609734>. To | |
504 | ;; work around that, set the time to roughly the release date. | |
3ce60c22 | 505 | (invoke "faketime" "2018-12-01" "./nss/tests/all.sh"))) |
db3c06d5 MB |
506 | (replace 'install |
507 | (lambda* (#:key outputs #:allow-other-keys) | |
508 | (let* ((out (assoc-ref outputs "out")) | |
509 | (bin (string-append (assoc-ref outputs "bin") "/bin")) | |
510 | (inc (string-append out "/include/nss")) | |
511 | (lib (string-append out "/lib/nss")) | |
512 | (obj (match (scandir "dist" (cut string-suffix? "OBJ" <>)) | |
513 | ((obj) (string-append "dist/" obj))))) | |
514 | ;; Install nss-config to $out/bin. | |
515 | (install-file (string-append obj "/bin/nss-config") | |
516 | (string-append out "/bin")) | |
517 | (delete-file (string-append obj "/bin/nss-config")) | |
518 | ;; Install nss.pc to $out/lib/pkgconfig. | |
519 | (install-file (string-append obj "/lib/pkgconfig/nss.pc") | |
520 | (string-append out "/lib/pkgconfig")) | |
521 | (delete-file (string-append obj "/lib/pkgconfig/nss.pc")) | |
522 | (rmdir (string-append obj "/lib/pkgconfig")) | |
523 | ;; Install other files. | |
524 | (copy-recursively "dist/public/nss" inc) | |
525 | (copy-recursively (string-append obj "/bin") bin) | |
526 | (copy-recursively (string-append obj "/lib") lib) | |
3161f6a4 | 527 | |
db3c06d5 MB |
528 | ;; FIXME: libgtest1.so is installed in the above step, and it's |
529 | ;; (unnecessarily) linked with several NSS libraries, but | |
530 | ;; without the needed rpaths, causing the 'validate-runpath' | |
531 | ;; phase to fail. Here we simply delete libgtest1.so, since it | |
532 | ;; seems to be used only during the tests. | |
533 | (delete-file (string-append lib "/libgtest1.so")) | |
bd512249 | 534 | (delete-file (string-append lib "/libgtestutil.so")) |
3161f6a4 | 535 | |
db3c06d5 | 536 | #t)))))) |
1aaaff1a SB |
537 | (inputs |
538 | `(("sqlite" ,sqlite) | |
539 | ("zlib" ,zlib))) | |
540 | (propagated-inputs `(("nspr" ,nspr))) ; required by nss.pc. | |
bc9aa60b LC |
541 | (native-inputs `(("perl" ,perl) |
542 | ("libfaketime" ,libfaketime))) ;for tests | |
86e3e370 | 543 | |
e9b718a0 MW |
544 | ;; The NSS test suite takes around 48 hours on Loongson 3A (MIPS) when |
545 | ;; another build is happening concurrently on the same machine. | |
546 | (properties '((timeout . 216000))) ; 60 hours | |
86e3e370 | 547 | |
1aaaff1a SB |
548 | (home-page |
549 | "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS") | |
550 | (synopsis "Network Security Services") | |
551 | (description | |
e26e55c8 TGR |
552 | "Network Security Services (@dfn{NSS}) is a set of libraries designed to |
553 | support cross-platform development of security-enabled client and server | |
554 | applications. Applications built with NSS can support SSL v2 and v3, TLS, | |
555 | PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509 v3 certificates, and other | |
556 | security standards.") | |
1aaaff1a SB |
557 | (license license:mpl2.0))) |
558 | ||
bfb48f4f | 559 | (define (mozilla-patch file-name changeset hash) |
ae71cd8a | 560 | "Return an origin for CHANGESET from the mozilla-esr60 repository." |
bfb48f4f MW |
561 | (origin |
562 | (method url-fetch) | |
ae71cd8a | 563 | (uri (string-append "https://hg.mozilla.org/releases/mozilla-esr60/raw-rev/" |
bfb48f4f MW |
564 | changeset)) |
565 | (sha256 (base32 hash)) | |
566 | (file-name file-name))) | |
567 | ||
948879ee MW |
568 | (define* (computed-origin-method gexp-promise hash-algo hash |
569 | #:optional (name "source") | |
570 | #:key (system (%current-system)) | |
571 | (guile (default-guile))) | |
572 | "Return a derivation that executes the G-expression that results | |
573 | from forcing GEXP-PROMISE." | |
574 | (mlet %store-monad ((guile (package->derivation guile system))) | |
575 | (gexp->derivation (or name "computed-origin") | |
576 | (force gexp-promise) | |
2a1ec7bc | 577 | #:graft? #f ;nothing to graft |
948879ee MW |
578 | #:system system |
579 | #:guile-for-build guile))) | |
580 | ||
4518a9df | 581 | (define %icecat-version "60.6.1-guix1") |
948879ee MW |
582 | |
583 | ;; 'icecat-source' is a "computed" origin that generates an IceCat tarball | |
584 | ;; from the corresponding upstream Firefox ESR tarball, using the 'makeicecat' | |
585 | ;; script from the upstream IceCat project. | |
586 | (define icecat-source | |
587 | (let* ((base-version (first (string-split %icecat-version #\-))) | |
588 | ||
589 | (major-version (first (string-split base-version #\.))) | |
590 | (minor-version (second (string-split base-version #\.))) | |
591 | (sub-version (third (string-split base-version #\.))) | |
592 | ||
593 | (upstream-firefox-version (string-append base-version "esr")) | |
594 | (upstream-firefox-source | |
595 | (origin | |
596 | (method url-fetch) | |
597 | (uri (string-append | |
598 | "https://ftp.mozilla.org/pub/firefox/releases/" | |
599 | upstream-firefox-version "/source/" | |
600 | "firefox-" upstream-firefox-version ".source.tar.xz")) | |
601 | (sha256 | |
602 | (base32 | |
4518a9df | 603 | "1x8419a1yg6igsq5ij3ymf1zmnb2wpm9dqcdfkv5wy43xgf7y0wl")))) |
948879ee MW |
604 | |
605 | (upstream-icecat-base-version "60.3.0") ; maybe older than base-version | |
606 | (upstream-icecat-gnu-version "1") | |
607 | (upstream-icecat-version (string-append upstream-icecat-base-version | |
608 | "-gnu" | |
609 | upstream-icecat-gnu-version)) | |
610 | (upstream-icecat-source | |
611 | (origin | |
612 | (method url-fetch) | |
613 | (uri (string-append | |
614 | "mirror://gnu/gnuzilla/" upstream-icecat-base-version | |
615 | "/icecat-" upstream-icecat-version ".tar.bz2")) | |
616 | (sha256 | |
617 | (base32 | |
618 | "0icnl64nxcyf7dprpdpygxhabsvyhps8c3ixysj9bcdlj9q34ib1")))) | |
619 | ||
620 | (gnuzilla-commit (string-append "v" upstream-icecat-base-version)) | |
621 | (gnuzilla-source | |
622 | (origin | |
623 | (method git-fetch) | |
624 | (uri (git-reference | |
625 | (url "git://git.savannah.gnu.org/gnuzilla.git") | |
626 | (commit gnuzilla-commit))) | |
627 | (file-name (git-file-name "gnuzilla" upstream-icecat-base-version)) | |
628 | (sha256 | |
629 | (base32 | |
630 | "19wal7hkbb4wvk40hs6d7a5paal2bfday08hwssm02srcbv48fj0")))) | |
631 | ||
632 | (makeicecat-patch | |
633 | (local-file (search-patch "icecat-makeicecat.patch")))) | |
634 | ||
635 | (origin | |
636 | (method computed-origin-method) | |
637 | (file-name (string-append "icecat-" %icecat-version ".tar.xz")) | |
638 | (sha256 #f) | |
639 | (uri | |
640 | (delay | |
641 | (with-imported-modules '((guix build utils)) | |
642 | #~(begin | |
643 | (use-modules (guix build utils)) | |
644 | (let ((firefox-dir | |
645 | (string-append "firefox-" #$base-version)) | |
646 | (icecat-dir | |
647 | (string-append "icecat-" #$%icecat-version)) | |
648 | (old-icecat-dir | |
649 | (string-append "icecat-" #$upstream-icecat-base-version))) | |
650 | ||
651 | (mkdir "/tmp/bin") | |
652 | (set-path-environment-variable | |
653 | "PATH" '("bin") | |
654 | (list "/tmp" | |
655 | #+(canonical-package bash) | |
656 | #+(canonical-package coreutils) | |
657 | #+(canonical-package findutils) | |
658 | #+(canonical-package patch) | |
659 | #+(canonical-package xz) | |
660 | #+(canonical-package sed) | |
661 | #+(canonical-package grep) | |
662 | #+(canonical-package bzip2) | |
663 | #+(canonical-package gzip) | |
664 | #+(canonical-package tar) | |
665 | #+rename)) | |
666 | ||
667 | (symlink #+(file-append rename "/bin/rename") | |
668 | "/tmp/bin/prename") | |
669 | ||
670 | ;; We copy the gnuzilla source directory because it is | |
671 | ;; read-only in 'gnuzilla-source', and the makeicecat script | |
672 | ;; uses "cp -a" to copy parts of it and assumes that the | |
673 | ;; copies will be writable. | |
674 | (copy-recursively #+gnuzilla-source "/tmp/gnuzilla" | |
675 | #:log (%make-void-port "w")) | |
676 | ||
677 | (with-directory-excursion "/tmp/gnuzilla" | |
678 | (make-file-writable "makeicecat") | |
679 | (invoke "patch" "--force" "--no-backup-if-mismatch" | |
680 | "-p1" "--input" #+makeicecat-patch) | |
681 | (patch-shebang "makeicecat") | |
682 | (substitute* "makeicecat" | |
683 | (("^FFMAJOR=.*") | |
684 | (string-append "FFMAJOR=" #$major-version "\n")) | |
685 | (("^FFMINOR=.*") | |
686 | (string-append "FFMINOR=" #$minor-version "\n")) | |
687 | (("^FFSUB=.*") | |
688 | (string-append "FFSUB=" #$sub-version "\n")) | |
689 | (("^GNUVERSION=.*") | |
690 | (string-append "GNUVERSION=" | |
691 | #$upstream-icecat-gnu-version "\n")) | |
692 | (("^DATA=.*") | |
693 | "DATA=/tmp/gnuzilla/data\n") | |
694 | (("^sed .* debian/" all) | |
695 | (string-append "echo warning: skipped: " all)) | |
696 | (("^debian/rules " all) | |
697 | (string-append "echo warning: skipped: " all)) | |
698 | (("^find extensions/gnu/ ") | |
699 | "find extensions/gnu/ | sort ") | |
700 | (("/bin/sed") | |
701 | #+(file-append (canonical-package sed) "/bin/sed")))) | |
702 | ||
703 | (format #t "Unpacking upstream firefox tarball...~%") | |
704 | (force-output) | |
705 | (invoke "tar" "xf" #+upstream-firefox-source) | |
706 | (rename-file firefox-dir icecat-dir) | |
707 | ||
708 | (with-directory-excursion icecat-dir | |
709 | (for-each mkdir-p '("l10n" "debian/config")) | |
710 | (call-with-output-file "debian/control" (const #t)) | |
711 | (format #t "Running makeicecat script...~%") | |
712 | (force-output) | |
713 | (invoke "bash" "/tmp/gnuzilla/makeicecat") | |
714 | (for-each delete-file-recursively '("l10n" "debian"))) | |
715 | ||
716 | (format #t (string-append "Unpacking l10n/* and debian/* from" | |
717 | " upstream IceCat tarball...~%")) | |
718 | (force-output) | |
719 | (unless (string=? icecat-dir old-icecat-dir) | |
720 | (symlink icecat-dir old-icecat-dir)) | |
721 | (invoke "tar" "xf" #+upstream-icecat-source | |
722 | (string-append old-icecat-dir "/l10n") | |
723 | (string-append old-icecat-dir "/debian")) | |
724 | ||
8cf160e1 | 725 | (format #t "Packing new IceCat tarball...~%") |
948879ee MW |
726 | (force-output) |
727 | (invoke "tar" "cfa" #$output | |
8cf160e1 MW |
728 | ;; Avoid non-determinism in the archive. We set the |
729 | ;; mtime of files in the archive to early 1980 because | |
730 | ;; the build process fails if the mtime of source | |
731 | ;; files is pre-1980, due to the creation of zip | |
732 | ;; archives. | |
733 | "--mtime=@315619200" ; 1980-01-02 UTC | |
948879ee MW |
734 | "--owner=root:0" |
735 | "--group=root:0" | |
736 | "--sort=name" | |
737 | icecat-dir) | |
738 | ||
739 | #t)))))))) | |
740 | ||
be0f6112 AE |
741 | (define-public icecat |
742 | (package | |
743 | (name "icecat") | |
24886c13 | 744 | (version %icecat-version) |
be0f6112 AE |
745 | (source |
746 | (origin | |
24886c13 MW |
747 | (inherit icecat-source) |
748 | (patches (search-patches "icecat-avoid-bundled-libraries.patch" | |
749 | "icecat-use-system-graphite2+harfbuzz.patch" | |
750 | "icecat-use-system-media-libs.patch")) | |
90e1cdae MW |
751 | (modules '((guix build utils))) |
752 | (snippet | |
753 | '(begin | |
bfb48f4f | 754 | (use-modules (ice-9 ftw)) |
90e1cdae MW |
755 | ;; Remove bundled libraries that we don't use, since they may |
756 | ;; contain unpatched security flaws, they waste disk space and | |
757 | ;; network bandwidth, and may cause confusion. | |
758 | (for-each delete-file-recursively | |
759 | '(;; FIXME: Removing the bundled icu breaks configure. | |
760 | ;; * The bundled icu headers are used in some places. | |
761 | ;; * The version number is taken from the bundled copy. | |
762 | ;;"intl/icu" | |
763 | ;; | |
764 | ;; FIXME: A script from the bundled nspr is used. | |
765 | ;;"nsprpub" | |
766 | ;; | |
6d328879 MW |
767 | ;; FIXME: With the update to IceCat 60, using system NSS |
768 | ;; broke certificate validation. See | |
769 | ;; <https://bugs.gnu.org/32833>. For now, we use | |
770 | ;; the bundled NSPR and NSS. TODO: Investigate, | |
771 | ;; and try to unbundle these libraries again. | |
772 | ;; UNBUNDLE-ME! "security/nss" | |
773 | ;; | |
94e96f7f | 774 | ;; TODO: Use more system media libraries. See: |
90e1cdae | 775 | ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422> |
94e96f7f MW |
776 | ;; * libtheora: esr60 wants v1.2, not yet released. |
777 | ;; * soundtouch: avoiding the bundled library would | |
778 | ;; result in some loss of functionality. There's | |
779 | ;; also an issue with exception handling | |
780 | ;; configuration. It seems that this is needed in | |
781 | ;; some moz.build: | |
782 | ;; DEFINES['ST_NO_EXCEPTION_HANDLING'] = 1 | |
90e1cdae MW |
783 | ;; * libopus |
784 | ;; * speex | |
90e1cdae | 785 | ;; |
90e1cdae MW |
786 | "modules/freetype2" |
787 | "modules/zlib" | |
788 | "modules/libbz2" | |
94e96f7f | 789 | "ipc/chromium/src/third_party/libevent" |
7cba7647 | 790 | "media/libjpeg" |
90e1cdae | 791 | "media/libvpx" |
94e96f7f MW |
792 | "media/libogg" |
793 | "media/libvorbis" | |
794 | ;; "media/libtheora" ; wants theora-1.2, not yet released | |
795 | "media/libtremor" | |
257e3247 MW |
796 | "gfx/harfbuzz" |
797 | "gfx/graphite2" | |
90e1cdae MW |
798 | "js/src/ctypes/libffi" |
799 | "db/sqlite3")) | |
bfb48f4f MW |
800 | ;; Delete .pyc files, typically present in icecat source tarballs |
801 | (for-each delete-file (find-files "." "\\.pyc$")) | |
5bdec7d6 | 802 | ;; Delete obj-* directories, sometimes present in icecat tarballs |
bfb48f4f MW |
803 | (for-each delete-file-recursively |
804 | (scandir "." (lambda (name) | |
805 | (string-prefix? "obj-" name)))) | |
a5e55dfb | 806 | #t)))) |
be0f6112 AE |
807 | (build-system gnu-build-system) |
808 | (inputs | |
809 | `(("alsa-lib" ,alsa-lib) | |
1ae6df81 | 810 | ("bzip2" ,bzip2) |
90e1cdae | 811 | ("cups" ,cups) |
be0f6112 | 812 | ("dbus-glib" ,dbus-glib) |
90e1cdae MW |
813 | ("gdk-pixbuf" ,gdk-pixbuf) |
814 | ("glib" ,glib) | |
002c3e6d MW |
815 | ("gtk+" ,gtk+) |
816 | ("gtk+-2" ,gtk+-2) | |
257e3247 | 817 | ("graphite2" ,graphite2) |
74c7af9f MW |
818 | ("pango" ,pango) |
819 | ("freetype" ,freetype) | |
257e3247 | 820 | ("harfbuzz" ,harfbuzz) |
90e1cdae MW |
821 | ("hunspell" ,hunspell) |
822 | ("libcanberra" ,libcanberra) | |
823 | ("libgnome" ,libgnome) | |
7cba7647 | 824 | ("libjpeg-turbo" ,libjpeg-turbo) |
94e96f7f MW |
825 | ("libogg" ,libogg) |
826 | ;; ("libtheora" ,libtheora) ; wants theora-1.2, not yet released | |
827 | ("libvorbis" ,libvorbis) | |
74c7af9f | 828 | ("libxft" ,libxft) |
94e96f7f | 829 | ("libevent" ,libevent) |
90e1cdae MW |
830 | ("libxinerama" ,libxinerama) |
831 | ("libxscrnsaver" ,libxscrnsaver) | |
9f7ae77f | 832 | ("libxcomposite" ,libxcomposite) |
be0f6112 | 833 | ("libxt" ,libxt) |
1ae6df81 | 834 | ("libffi" ,libffi) |
e67ad553 | 835 | ("ffmpeg" ,ffmpeg) |
037d5913 | 836 | ("libvpx" ,libvpx-1.7) |
13b284d9 MW |
837 | ("icu4c" ,icu4c) |
838 | ("pixman" ,pixman) | |
74c7af9f | 839 | ("pulseaudio" ,pulseaudio) |
be0f6112 | 840 | ("mesa" ,mesa) |
90e1cdae | 841 | ("mit-krb5" ,mit-krb5) |
6d328879 MW |
842 | ;; See <https://bugs.gnu.org/32833> |
843 | ;; and related comments in the 'snippet' above. | |
844 | ;; UNBUNDLE-ME! ("nspr" ,nspr) | |
845 | ;; UNBUNDLE-ME! ("nss" ,nss) | |
9bc79c11 | 846 | ("sqlite" ,sqlite) |
90e1cdae | 847 | ("startup-notification" ,startup-notification) |
be0f6112 | 848 | ("unzip" ,unzip) |
1ae6df81 LC |
849 | ("zip" ,zip) |
850 | ("zlib" ,zlib))) | |
c4c4cc05 | 851 | (native-inputs |
89f9df6c EF |
852 | ;; Icecat 60 checkes for rust>=1.24 |
853 | `(("rust" ,rust-1.24) | |
854 | ("cargo" ,rust-1.24 "cargo") | |
8d956d86 MW |
855 | ("llvm" ,llvm-3.9.1) |
856 | ("clang" ,clang-3.9.1) | |
e67ad553 | 857 | ("perl" ,perl) |
c4c4cc05 JD |
858 | ("python" ,python-2) ; Python 3 not supported |
859 | ("python2-pysqlite" ,python2-pysqlite) | |
002c3e6d | 860 | ("yasm" ,yasm) |
bfb48f4f | 861 | ("pkg-config" ,pkg-config) |
002c3e6d | 862 | ("autoconf" ,autoconf-2.13) |
bfb48f4f | 863 | ("which" ,which))) |
be0f6112 | 864 | (arguments |
74c7af9f MW |
865 | `(#:tests? #f ; no check target |
866 | #:out-of-source? #t ; must be built outside of the source directory | |
73b1b4eb LC |
867 | |
868 | ;; XXX: There are RUNPATH issues such as | |
869 | ;; $prefix/lib/icecat-31.6.0/plugin-container NEEDing libmozalloc.so, | |
870 | ;; which is not in its RUNPATH, but they appear to be harmless in | |
871 | ;; practice somehow. See <http://hydra.gnu.org/build/378133>. | |
872 | #:validate-runpath? #f | |
873 | ||
8d956d86 | 874 | #:configure-flags `("--enable-default-toolkit=cairo-gtk3" |
9502ea3e MW |
875 | |
876 | "--with-distribution-id=org.gnu" | |
877 | ||
90e1cdae MW |
878 | "--enable-startup-notification" |
879 | "--enable-pulseaudio" | |
90e1cdae | 880 | |
9502ea3e MW |
881 | "--disable-tests" |
882 | "--disable-updater" | |
883 | "--disable-crashreporter" | |
884 | "--disable-maintenance-service" | |
885 | "--disable-eme" | |
90e1cdae | 886 | "--disable-gconf" |
e67ad553 | 887 | |
90e1cdae | 888 | ;; Building with debugging symbols takes ~5GiB, so |
1ae6df81 LC |
889 | ;; disable it. |
890 | "--disable-debug" | |
891 | "--disable-debug-symbols" | |
892 | ||
8d956d86 MW |
893 | ;; Clang is needed to build Stylo, Mozilla's new |
894 | ;; CSS engine. We must specify the clang paths | |
895 | ;; manually, because otherwise the Mozilla build | |
896 | ;; system looks in the directories returned by | |
897 | ;; llvm-config --bindir and llvm-config --libdir, | |
898 | ;; which return paths in the llvm package where | |
899 | ;; clang is not found. | |
900 | ,(string-append "--with-clang-path=" | |
901 | (assoc-ref %build-inputs "clang") | |
902 | "/bin/clang") | |
903 | ,(string-append "--with-libclang-path=" | |
904 | (assoc-ref %build-inputs "clang") | |
905 | "/lib") | |
906 | ||
5bdec7d6 MW |
907 | ;; Hack to work around missing |
908 | ;; "unofficial" branding in icecat. | |
bfb48f4f MW |
909 | "--enable-official-branding" |
910 | ||
90e1cdae | 911 | ;; Avoid bundled libraries. |
1ae6df81 | 912 | "--with-system-zlib" |
90e1cdae | 913 | "--with-system-bz2" |
7cba7647 | 914 | "--with-system-jpeg" ; must be libjpeg-turbo |
94e96f7f MW |
915 | "--with-system-libevent" |
916 | "--with-system-ogg" | |
917 | "--with-system-vorbis" | |
918 | ;; "--with-system-theora" ; wants theora-1.2, not yet released | |
13b284d9 | 919 | "--with-system-libvpx" |
483ab08f | 920 | "--with-system-icu" |
6d328879 MW |
921 | |
922 | ;; See <https://bugs.gnu.org/32833> | |
923 | ;; and related comments in the 'snippet' above. | |
924 | ;; UNBUNDLE-ME! "--with-system-nspr" | |
925 | ;; UNBUNDLE-ME! "--with-system-nss" | |
926 | ||
257e3247 MW |
927 | "--with-system-harfbuzz" |
928 | "--with-system-graphite2" | |
13b284d9 | 929 | "--enable-system-pixman" |
5b17fabc | 930 | "--enable-system-ffi" |
90e1cdae | 931 | "--enable-system-hunspell" |
9128e323 | 932 | "--enable-system-sqlite" |
1ae6df81 | 933 | |
98a046cd AE |
934 | ;; Fails with "--with-system-png won't work because |
935 | ;; the system's libpng doesn't have APNG support". | |
936 | ;; According to | |
937 | ;; http://sourceforge.net/projects/libpng-apng/ , | |
938 | ;; "the Animated Portable Network Graphics (APNG) | |
939 | ;; is an unofficial extension of the Portable | |
940 | ;; Network Graphics (PNG) format"; | |
941 | ;; we probably do not wish to support it. | |
1ae6df81 | 942 | ;; "--with-system-png" |
5b17fabc | 943 | ) |
1ae6df81 | 944 | |
7d141788 IP |
945 | #:imported-modules ,%cargo-utils-modules ;for `generate-checksums' |
946 | ||
9f7ae77f | 947 | #:modules ((ice-9 ftw) |
6cde5c34 LC |
948 | (ice-9 rdelim) |
949 | (ice-9 match) | |
9f7ae77f | 950 | ,@%gnu-build-system-modules) |
be0f6112 | 951 | #:phases |
90e1cdae | 952 | (modify-phases %standard-phases |
9f7ae77f MW |
953 | (add-after |
954 | 'unpack 'ensure-no-mtimes-pre-1980 | |
955 | (lambda _ | |
956 | ;; Without this, the 'source/test/addons/packed.xpi' and | |
957 | ;; 'source/test/addons/simple-prefs.xpi' targets fail while trying | |
958 | ;; to create zip archives. | |
959 | (let ((early-1980 315619200)) ; 1980-01-02 UTC | |
960 | (ftw "." (lambda (file stat flag) | |
961 | (unless (<= early-1980 (stat:mtime stat)) | |
962 | (utime file early-1980 early-1980)) | |
963 | #t)) | |
964 | #t))) | |
90e1cdae | 965 | (add-after |
9502ea3e | 966 | 'unpack 'link-libxul-with-libraries |
90e1cdae MW |
967 | (lambda _ |
968 | ;; libxul.so dynamically opens libraries, so here we explicitly | |
969 | ;; link them into libxul.so instead. | |
970 | ;; | |
971 | ;; TODO: It might be preferable to patch in absolute file names in | |
972 | ;; calls to dlopen or PR_LoadLibrary, but that didn't seem to | |
973 | ;; work. More investigation is needed. | |
9f7ae77f | 974 | (substitute* "toolkit/library/moz.build" |
002c3e6d MW |
975 | (("^# This library needs to be last" all) |
976 | (string-append "OS_LIBS += [ | |
9f7ae77f | 977 | 'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5', |
002c3e6d MW |
978 | 'avcodec', 'avutil', 'pulse' ]\n\n" |
979 | all))) | |
9f7ae77f | 980 | #t)) |
94e96f7f MW |
981 | (replace 'bootstrap |
982 | (lambda _ | |
983 | (invoke "sh" "-c" "autoconf old-configure.in > old-configure"))) | |
e67ad553 | 984 | (add-after 'patch-source-shebangs 'patch-cargo-checksums |
257e3247 | 985 | (lambda _ |
7d141788 | 986 | (use-modules (guix build cargo-utils)) |
e67ad553 MW |
987 | (let ((null-file "/dev/null") |
988 | (null-hash "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")) | |
989 | (substitute* '("Cargo.lock" "servo/Cargo.lock") | |
990 | (("(\"checksum .* = )\".*\"" all name) | |
991 | (string-append name "\"" null-hash "\""))) | |
992 | (for-each | |
993 | (lambda (filename) | |
994 | (delete-file filename) | |
995 | (let ((dir (dirname filename))) | |
996 | (display (string-append | |
997 | "patch-cargo-checksums: generate-checksums for " | |
998 | dir "\n")) | |
999 | (generate-checksums dir null-file))) | |
1000 | (find-files "third_party/rust" ".cargo-checksum.json"))) | |
1001 | #t)) | |
8d956d86 MW |
1002 | (add-before 'configure 'augment-CPLUS_INCLUDE_PATH |
1003 | (lambda* (#:key build inputs #:allow-other-keys) | |
1004 | ;; Here, we add additional entries to CPLUS_INCLUDE_PATH, to work | |
1005 | ;; around a problem that otherwise occurs when attempting to | |
1006 | ;; build Stylo, which requires Rust and Clang. Without these | |
1007 | ;; additional entries, errors occur during the build indicating | |
1008 | ;; that the <cstddef> and "c++config.h" headers cannot be found. | |
1009 | ;; Note that the 'build' keyword argument contains the GNU | |
1010 | ;; triplet, e.g. "x86_64-unknown-linux-gnu". | |
1011 | (let ((gcc (assoc-ref inputs "gcc"))) | |
1012 | (setenv "CPLUS_INCLUDE_PATH" | |
1013 | (string-append gcc "/include/c++" ":" | |
1014 | gcc "/include/c++/" build ":" | |
1015 | (getenv "CPLUS_INCLUDE_PATH")))))) | |
90e1cdae MW |
1016 | (replace |
1017 | 'configure | |
1018 | ;; configure does not work followed by both "SHELL=..." and | |
1019 | ;; "CONFIG_SHELL=..."; set environment variables instead | |
1020 | (lambda* (#:key outputs configure-flags #:allow-other-keys) | |
1021 | (let* ((out (assoc-ref outputs "out")) | |
1022 | (bash (which "bash")) | |
1023 | (abs-srcdir (getcwd)) | |
1024 | (srcdir (string-append "../" (basename abs-srcdir))) | |
1025 | (flags `(,(string-append "--prefix=" out) | |
1026 | ,(string-append "--with-l10n-base=" | |
1027 | abs-srcdir "/l10n") | |
1028 | ,@configure-flags))) | |
1029 | (setenv "SHELL" bash) | |
1030 | (setenv "CONFIG_SHELL" bash) | |
002c3e6d | 1031 | (setenv "AUTOCONF" (which "autoconf")) ; must be autoconf-2.13 |
8d956d86 | 1032 | (setenv "CC" "gcc") ; apparently needed when Stylo is enabled |
90e1cdae MW |
1033 | (mkdir "../build") |
1034 | (chdir "../build") | |
1035 | (format #t "build directory: ~s~%" (getcwd)) | |
1036 | (format #t "configure flags: ~s~%" flags) | |
3f27124e MW |
1037 | (apply invoke bash |
1038 | (string-append srcdir "/configure") | |
1039 | flags)))) | |
6cde5c34 LC |
1040 | (add-before 'configure 'install-desktop-entry |
1041 | (lambda* (#:key outputs #:allow-other-keys) | |
1042 | ;; Install the '.desktop' file. | |
1043 | (define (swallow-%%-directives input output) | |
1044 | ;; Interpret '%%ifdef' directives found in the '.desktop' file. | |
1045 | (let loop ((state 'top)) | |
1046 | (match (read-line input 'concat) | |
1047 | ((? eof-object?) | |
1048 | #t) | |
1049 | ((? string? line) | |
1050 | (cond ((string-prefix? "%%ifdef" line) | |
1051 | (loop 'ifdef)) | |
1052 | ((string-prefix? "%%else" line) | |
1053 | (loop 'else)) | |
1054 | ((string-prefix? "%%endif" line) | |
1055 | (loop 'top)) | |
1056 | (else | |
1057 | (case state | |
1058 | ((top else) | |
1059 | (display line output) | |
1060 | (loop state)) | |
1061 | (else | |
1062 | (loop state))))))))) | |
1063 | ||
1064 | (let* ((out (assoc-ref outputs "out")) | |
1065 | (applications (string-append out "/share/applications"))) | |
1066 | (call-with-input-file "debian/icecat.desktop.in" | |
1067 | (lambda (input) | |
1068 | (call-with-output-file "debian/icecat.desktop" | |
1069 | (lambda (output) | |
1070 | (swallow-%%-directives input output))))) | |
1071 | ||
1072 | (substitute* "debian/icecat.desktop" | |
1073 | (("@MOZ_DISPLAY_NAME@") | |
1074 | "GNU IceCat") | |
1075 | (("^Exec=@MOZ_APP_NAME@") | |
1076 | (string-append "Exec=" out "/bin/icecat")) | |
1077 | (("@MOZ_APP_NAME@") | |
1078 | "icecat")) | |
1079 | (install-file "debian/icecat.desktop" applications) | |
88a8ce87 AG |
1080 | #t))) |
1081 | (add-after 'install-desktop-entry 'install-icons | |
1082 | (lambda* (#:key outputs #:allow-other-keys) | |
1083 | (let ((out (assoc-ref outputs "out"))) | |
1084 | (with-directory-excursion "browser/branding/official" | |
1085 | (for-each | |
1086 | (lambda (file) | |
1087 | (let* ((size (string-filter char-numeric? file)) | |
1088 | (icons (string-append out "/share/icons/hicolor/" | |
1089 | size "x" size "/apps"))) | |
1090 | (mkdir-p icons) | |
1091 | (copy-file file (string-append icons "/icecat.png")))) | |
1092 | '("default16.png" "default22.png" "default24.png" | |
1093 | "default32.png" "default48.png" "content/icon64.png" | |
3f27124e MW |
1094 | "mozicon128.png" "default256.png")) |
1095 | #t)))) | |
6e75740f CL |
1096 | ;; This fixes the file chooser crash that happens with GTK 3. |
1097 | (add-after 'install 'wrap-program | |
1098 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
1099 | (let* ((out (assoc-ref outputs "out")) | |
1100 | (lib (string-append out "/lib")) | |
1101 | (gtk (assoc-ref inputs "gtk+")) | |
1102 | (gtk-share (string-append gtk "/share"))) | |
1103 | (wrap-program (car (find-files lib "^icecat$")) | |
3f27124e MW |
1104 | `("XDG_DATA_DIRS" ":" prefix (,gtk-share))) |
1105 | #t)))))) | |
6fd52309 | 1106 | (home-page "https://www.gnu.org/software/gnuzilla/") |
be0f6112 AE |
1107 | (synopsis "Entirely free browser derived from Mozilla Firefox") |
1108 | (description | |
1109 | "IceCat is the GNU version of the Firefox browser. It is entirely free | |
c5779c93 | 1110 | software, which does not recommend non-free plugins and addons. It also |
79c311b8 | 1111 | features built-in privacy-protecting features.") |
63e8bb12 | 1112 | (license license:mpl2.0) ;and others, see toolkit/content/license.html |
99effc8f LC |
1113 | (properties |
1114 | `((ftp-directory . "/gnu/gnuzilla") | |
1115 | (cpe-name . "firefox_esr") | |
bfb48f4f | 1116 | (cpe-version . ,(first (string-split version #\-))))))) |
f5301f00 LC |
1117 | |
1118 | (define-public conkeror | |
1119 | ;; The Conkeror web browser relied on XULRunner, which IceCat > 50 no longer | |
1120 | ;; provides. See <http://conkeror.org> for the original web page. | |
1121 | (deprecated-package "conkeror" icecat)) |