gnuzilla.scm 49 KB

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