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