gnuzilla.scm 81 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723
  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, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
  4. ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Mark H Weaver <mhw@netris.org>
  5. ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
  6. ;;; Copyright © 2016, 2017, 2018, 2019, 2021 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, 2018 Nikita <nikita@n0.is>
  10. ;;; Copyright © 2017, 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
  11. ;;; Copyright © 2018, 2020 Ricardo Wurmus <rekado@elephly.net>
  12. ;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com>
  13. ;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
  14. ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
  15. ;;; Copyright © 2019, 2020 Adrian Malacoda <malacoda@monarch-pass.net>
  16. ;;; Copyright © 2020 Jonathan Brielmaier <jonathan.brielmaier@web.de>
  17. ;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
  18. ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
  19. ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
  20. ;;;
  21. ;;; This file is part of GNU Guix.
  22. ;;;
  23. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  24. ;;; under the terms of the GNU General Public License as published by
  25. ;;; the Free Software Foundation; either version 3 of the License, or (at
  26. ;;; your option) any later version.
  27. ;;;
  28. ;;; GNU Guix is distributed in the hope that it will be useful, but
  29. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  30. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  31. ;;; GNU General Public License for more details.
  32. ;;;
  33. ;;; You should have received a copy of the GNU General Public License
  34. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  35. (define-module (gnu packages gnuzilla)
  36. #:use-module ((srfi srfi-1) #:hide (zip))
  37. #:use-module (ice-9 match)
  38. #:use-module (gnu packages)
  39. #:use-module ((guix licenses) #:prefix license:)
  40. #:use-module (guix packages)
  41. #:use-module (guix download)
  42. #:use-module (guix git-download)
  43. #:use-module (guix hg-download)
  44. #:use-module (guix gexp)
  45. #:use-module (guix store)
  46. #:use-module (guix monads)
  47. #:use-module (guix utils)
  48. #:use-module (guix build-system gnu)
  49. #:use-module (guix build-system cargo)
  50. #:use-module (guix build-system trivial)
  51. #:use-module (gnu packages admin)
  52. #:use-module (gnu packages audio)
  53. #:use-module (gnu packages autotools)
  54. #:use-module (gnu packages base)
  55. #:use-module (gnu packages bash)
  56. #:use-module (gnu packages databases)
  57. #:use-module (gnu packages glib)
  58. #:use-module (gnu packages gtk)
  59. #:use-module (gnu packages gnome)
  60. #:use-module (gnu packages libcanberra)
  61. #:use-module (gnu packages cups)
  62. #:use-module (gnu packages kerberos)
  63. #:use-module (gnu packages linux)
  64. #:use-module (gnu packages perl)
  65. #:use-module (gnu packages pkg-config)
  66. #:use-module (gnu packages compression)
  67. #:use-module (gnu packages fontutils)
  68. #:use-module (gnu packages libevent)
  69. #:use-module (gnu packages libreoffice) ;for hunspell
  70. #:use-module (gnu packages image)
  71. #:use-module (gnu packages libffi)
  72. #:use-module (gnu packages pulseaudio)
  73. #:use-module (gnu packages python)
  74. #:use-module (gnu packages python-xyz)
  75. #:use-module (gnu packages node)
  76. #:use-module (gnu packages xorg)
  77. #:use-module (gnu packages gl)
  78. #:use-module (gnu packages assembly)
  79. #:use-module (gnu packages rust)
  80. #:use-module (gnu packages rust-apps)
  81. #:use-module (gnu packages llvm)
  82. #:use-module (gnu packages nss)
  83. #:use-module (gnu packages icu4c)
  84. #:use-module (gnu packages video)
  85. #:use-module (gnu packages xiph)
  86. #:use-module (gnu packages xdisorg)
  87. #:use-module (gnu packages readline)
  88. #:use-module (gnu packages sqlite))
  89. (define-public mozjs
  90. (package
  91. (name "mozjs")
  92. (version "17.0.0")
  93. (source (origin
  94. (method url-fetch)
  95. (uri (string-append
  96. "https://ftp.mozilla.org/pub/mozilla.org/js/"
  97. name version ".tar.gz"))
  98. (sha256
  99. (base32
  100. "1fig2wf4f10v43mqx67y68z6h77sy900d1w0pz9qarrqx57rc7ij"))
  101. (patches (search-patches "mozjs17-aarch64-support.patch"))
  102. (modules '((guix build utils)))
  103. (snippet
  104. ;; Fix incompatibility with Perl 5.22+.
  105. '(begin
  106. (substitute* '("js/src/config/milestone.pl")
  107. (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE"))
  108. #t))))
  109. (build-system gnu-build-system)
  110. (native-inputs
  111. `(("perl" ,perl)
  112. ("pkg-config" ,pkg-config)
  113. ("python" ,python-2)))
  114. (propagated-inputs
  115. `(("nspr" ,nspr))) ; in the Requires.private field of mozjs-17.0.pc
  116. (inputs
  117. `(("zlib" ,zlib)))
  118. (arguments
  119. `(;; XXX: parallel build fails, lacking:
  120. ;; mkdir -p "system_wrapper_js/"
  121. #:parallel-build? #f
  122. #:make-flags '("CXXFLAGS=-fpermissive")
  123. #:phases
  124. (modify-phases %standard-phases
  125. (add-after 'unpack 'delete-timedout-test
  126. ;; This test times out on slower hardware.
  127. (lambda _
  128. (delete-file "js/src/jit-test/tests/basic/bug698584.js")
  129. #t))
  130. (add-before 'configure 'chdir
  131. (lambda _
  132. (chdir "js/src")
  133. #t))
  134. (replace 'configure
  135. ;; configure fails if it is followed by SHELL and CONFIG_SHELL
  136. (lambda* (#:key outputs #:allow-other-keys)
  137. (let ((out (assoc-ref outputs "out")))
  138. (setenv "SHELL" (which "sh"))
  139. (setenv "CONFIG_SHELL" (which "sh"))
  140. (invoke "./configure" (string-append "--prefix=" out)
  141. ,@(if (string=? "aarch64-linux"
  142. (%current-system))
  143. '("--host=aarch64-unknown-linux-gnu")
  144. '()))))))))
  145. (home-page
  146. "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey")
  147. (synopsis "Mozilla javascript engine")
  148. (description "SpiderMonkey is Mozilla's JavaScript engine written
  149. in C/C++.")
  150. (license license:mpl2.0))) ; and others for some files
  151. (define-public mozjs-24
  152. (package (inherit mozjs)
  153. (name "mozjs")
  154. (version "24.2.0")
  155. (source (origin
  156. (method url-fetch)
  157. (uri (string-append
  158. "https://ftp.mozilla.org/pub/mozilla.org/js/"
  159. name "-" version ".tar.bz2"))
  160. (sha256
  161. (base32
  162. "1n1phk8r3l8icqrrap4czplnylawa0ddc2cc4cgdz46x3lrkybz6"))
  163. (modules '((guix build utils)))
  164. (patches (search-patches "mozjs24-aarch64-support.patch"))
  165. (snippet
  166. ;; Fix incompatibility with Perl 5.22+.
  167. '(begin
  168. (substitute* '("js/src/config/milestone.pl")
  169. (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE"))
  170. #t))))
  171. (arguments
  172. (substitute-keyword-arguments (package-arguments mozjs)
  173. ((#:phases phases)
  174. `(modify-phases ,phases
  175. (replace 'configure
  176. (lambda* (#:key outputs #:allow-other-keys)
  177. (let ((out (assoc-ref outputs "out")))
  178. ;; configure fails if it is followed by SHELL and CONFIG_SHELL
  179. (setenv "SHELL" (which "sh"))
  180. (setenv "CONFIG_SHELL" (which "sh"))
  181. (invoke "./configure"
  182. (string-append "--prefix=" out)
  183. "--with-system-nspr"
  184. "--enable-system-ffi"
  185. "--enable-threadsafe"
  186. ,@(if (string=? "aarch64-linux"
  187. (%current-system))
  188. '("--host=aarch64-unknown-linux-gnu")
  189. '())))))))))
  190. (inputs
  191. `(("libffi" ,libffi)
  192. ("zlib" ,zlib)))))
  193. (define-public mozjs-38
  194. (package
  195. (inherit mozjs)
  196. (name "mozjs")
  197. (version "38.2.1.rc0")
  198. (source (origin
  199. (method url-fetch)
  200. (uri (string-append
  201. "https://anduin.linuxfromscratch.org/BLFS/mozjs/"
  202. name "-" version ".tar.bz2"))
  203. (sha256
  204. (base32
  205. "0p4bmbpgkfsj54xschcny0a118jdrdgg0q29rwxigg3lh5slr681"))
  206. (patches
  207. (search-patches
  208. ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1269317 for
  209. ;; GCC 6 compatibility.
  210. "mozjs38-version-detection.patch" ; for 0ad
  211. "mozjs38-tracelogger.patch"
  212. ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1339931.
  213. "mozjs38-pkg-config-version.patch"
  214. "mozjs38-shell-version.patch"))
  215. (modules '((guix build utils)))
  216. (snippet
  217. '(begin
  218. ;; Fix incompatibility with sed 4.4.
  219. (substitute* "js/src/configure"
  220. (("\\^\\[:space:\\]") "^[[:space:]]"))
  221. ;; The headers are symlinks to files that are in /tmp, so they
  222. ;; end up broken. Copy them instead.
  223. (substitute*
  224. "python/mozbuild/mozbuild/backend/recursivemake.py"
  225. (("\\['dist_include'\\].add_symlink")
  226. "['dist_include'].add_copy"))
  227. ;; Remove bundled libraries.
  228. (for-each delete-file-recursively
  229. '("intl"
  230. "js/src/ctypes/libffi"
  231. "js/src/ctypes/libffi-patches"
  232. "modules/zlib"))
  233. #t))))
  234. (arguments
  235. `(;; XXX: parallel build fails, lacking:
  236. ;; mkdir -p "system_wrapper_js/"
  237. #:parallel-build? #f
  238. ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1008470.
  239. #:tests? #f
  240. #:phases
  241. (modify-phases %standard-phases
  242. (replace 'configure
  243. (lambda* (#:key outputs #:allow-other-keys)
  244. (let ((out (assoc-ref outputs "out")))
  245. (chdir "js/src")
  246. (setenv "SHELL" (which "sh"))
  247. (setenv "CONFIG_SHELL" (which "sh"))
  248. (invoke "./configure"
  249. (string-append "--prefix=" out)
  250. "--enable-ctypes"
  251. "--enable-gcgenerational"
  252. "--enable-optimize"
  253. "--enable-pie"
  254. "--enable-readline"
  255. "--enable-shared-js"
  256. "--enable-system-ffi"
  257. "--enable-threadsafe"
  258. "--enable-xterm-updates"
  259. "--with-system-icu"
  260. "--with-system-nspr"
  261. "--with-system-zlib"
  262. ;; Intl API requires bundled ICU.
  263. "--without-intl-api")))))))
  264. (native-inputs
  265. `(("perl" ,perl)
  266. ("pkg-config" ,pkg-config)
  267. ("python-2" ,python-2)))
  268. (inputs
  269. `(("libffi" ,libffi)
  270. ("readline" ,readline)
  271. ("icu4c" ,icu4c)
  272. ("zlib" ,zlib)))))
  273. (define-public mozjs-52
  274. ;; No releases yet at <https://archive.mozilla.org/pub/spidermonkey/releases/>.
  275. ;; While we could take a snapshot of the complete mozilla-esr52 repository at
  276. ;; <https://treeherder.mozilla.org/#/jobs?repo=mozilla-esr52&filter-searchStr=sm-tc>,
  277. ;; we take the Debian version instead, because it is easier to work with.
  278. (let ((commit "6507e63cc416fd7a3269e390efe712f8b56f374a")
  279. (revision "1"))
  280. (package (inherit mozjs-38)
  281. (version (git-version "52.0" revision commit))
  282. (source (origin
  283. (method git-fetch)
  284. (uri (git-reference
  285. (url "https://salsa.debian.org/gnome-team/mozjs52.git")
  286. (commit commit)))
  287. (file-name (git-file-name "mozjs" version))
  288. (sha256
  289. (base32
  290. "1ny0s53r8wn4byys87h784xrq1xg767akmfm6gqrbvrz57mlm3q2"))))
  291. (arguments
  292. `(#:tests? #f ; depends on repository metadata
  293. #:configure-flags
  294. '("--enable-ctypes"
  295. "--enable-optimize"
  296. "--enable-pie"
  297. "--enable-readline"
  298. "--enable-shared-js"
  299. "--enable-system-ffi"
  300. "--with-system-icu"
  301. "--with-system-nspr"
  302. "--with-system-zlib"
  303. ;; Intl API requires bundled ICU.
  304. "--without-intl-api"
  305. ;; Without this gnome-shell will crash at runtime.
  306. "--disable-jemalloc")
  307. #:phases
  308. (modify-phases %standard-phases
  309. (add-after 'unpack 'patch-and-chdir
  310. (lambda* (#:key inputs #:allow-other-keys)
  311. ;; This patch prevents a segfault when executing JS_Init().
  312. ;; The build does not fail without this patch, but the
  313. ;; configure phase of the gjs package would fail.
  314. ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1176787
  315. (make-file-writable "js/src/old-configure.in")
  316. (make-file-writable "js/src/old-configure")
  317. (make-file-writable "mozglue/build/moz.build")
  318. (invoke "patch" "-p1" "--force"
  319. "--input" "debian/patches/disable-mozglue.patch")
  320. (invoke "touch" "js/src/configure")
  321. (chdir "js/src")
  322. #t))
  323. (replace 'configure
  324. (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
  325. ;; The configure script does not accept environment variables
  326. ;; as arguments.
  327. (let ((out (assoc-ref outputs "out")))
  328. (setenv "SHELL" (which "sh"))
  329. (setenv "CONFIG_SHELL" (which "sh"))
  330. (setenv "AUTOCONF" (which "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. (define-public mozjs-60
  339. ;; No releases yet at <https://archive.mozilla.org/pub/spidermonkey/releases/>.
  340. ;; While we could take a snapshot of the complete mozilla-esr60 repository at
  341. ;; <https://treeherder.mozilla.org/#/jobs?repo=mozilla-esr60&filter-searchStr=sm-tc>,
  342. ;; we take the Debian version instead, because it is easier to work with.
  343. (package
  344. (inherit mozjs-38)
  345. (version "60.2.3-4")
  346. (source (origin
  347. (method git-fetch)
  348. (uri (git-reference
  349. (url "https://salsa.debian.org/gnome-team/mozjs60.git")
  350. (commit (string-append "debian/" version))))
  351. (file-name (git-file-name "mozjs" version))
  352. (sha256
  353. (base32
  354. "1xl6avsj9gkgma71p56jzs7nasc767k3n1frnmri5pad4rj94bij"))))
  355. (arguments
  356. `(#:tests? #f ; FIXME: all tests pass, but then the check phase fails anyway.
  357. #:test-target "check-jstests"
  358. #:configure-flags
  359. ;; TODO(core-updates): unconditionally use 'quasiquote
  360. ,#~(#$(if (%current-target-system)
  361. #~quasiquote
  362. #~quote)
  363. ("--enable-ctypes"
  364. "--enable-optimize"
  365. "--enable-pie"
  366. "--enable-readline"
  367. "--enable-shared-js"
  368. "--enable-system-ffi"
  369. "--with-system-nspr"
  370. #$@(if (%current-target-system)
  371. #~(,(string-append "--with-nspr-prefix="
  372. #$(this-package-input "nspr")))
  373. #~())
  374. "--with-system-zlib"
  375. "--with-system-icu"
  376. "--with-intl-api"
  377. ;; This is important because without it gjs will segfault during the
  378. ;; configure phase. With jemalloc only the standalone mozjs console
  379. ;; will work.
  380. "--disable-jemalloc"
  381. ;; Mozilla deviates from Autotools conventions due to historical
  382. ;; reasons.
  383. #$@(if (%current-target-system)
  384. #~(#$(string-append
  385. "--host="
  386. (nix-system->gnu-triplet (%current-system)))
  387. #$(string-append "--target=" (%current-target-system)))
  388. #~())))
  389. #:phases
  390. (modify-phases %standard-phases
  391. ;; Make sure pkg-config will be found.
  392. ,@(if (%current-target-system)
  393. `((add-before 'configure 'set-PKG-CONFIG
  394. (lambda _
  395. (setenv "PKG_CONFIG" ,(pkg-config-for-target)))))
  396. '())
  397. (replace 'configure
  398. (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
  399. ;; The configure script does not accept environment variables as
  400. ;; arguments. It also must be run from a different directory,
  401. ;; but not the root directory either.
  402. (let ((out (assoc-ref outputs "out")))
  403. (mkdir "run-configure-from-here")
  404. (chdir "run-configure-from-here")
  405. (setenv "SHELL" (which "sh"))
  406. (setenv "CONFIG_SHELL" (which "sh"))
  407. (setenv "AUTOCONF" (which "autoconf"))
  408. (apply invoke "../js/src/configure"
  409. (cons (string-append "--prefix=" out)
  410. configure-flags))
  411. #t)))
  412. (add-after 'unpack 'disable-broken-tests
  413. (lambda _
  414. ;; This test assumes that /bin exists and contains certain
  415. ;; executables.
  416. (delete-file "js/src/tests/shell/os.js")
  417. #t)))))
  418. (native-inputs
  419. `(("autoconf" ,autoconf)
  420. ("automake" ,automake)
  421. ("which" ,which)
  422. ("perl" ,perl)
  423. ("pkg-config" ,pkg-config)
  424. ("python" ,python-2)))))
  425. (define-public mozjs-78
  426. (package
  427. (inherit mozjs-60)
  428. (version "78.10.1")
  429. (source (origin
  430. (method url-fetch)
  431. ;; TODO: Switch to IceCat source once available on ftp.gnu.org.
  432. (uri (string-append "https://archive.mozilla.org/pub/firefox"
  433. "/releases/" version "esr/source/firefox-"
  434. version "esr.source.tar.xz"))
  435. (sha256
  436. (base32
  437. "0gyg2p6i1wmmfghwg13pp6fj8j8xz6c14f6bbnf4pf0f5c3la7y4"))))
  438. (arguments
  439. `(#:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums'
  440. #:modules ((guix build cargo-utils)
  441. ,@%gnu-build-system-modules)
  442. #:test-target "check-jstests"
  443. #:configure-flags
  444. '(;; Disable debugging symbols to save space.
  445. "--disable-debug"
  446. "--disable-debug-symbols"
  447. ;; This is important because without it gjs will segfault during the
  448. ;; configure phase. With jemalloc only the standalone mozjs console
  449. ;; will work.
  450. "--disable-jemalloc"
  451. "--enable-tests"
  452. "--enable-hardening"
  453. "--enable-optimize"
  454. "--enable-release"
  455. "--enable-rust-simd"
  456. "--enable-readline"
  457. "--enable-shared-js"
  458. "--with-system-icu"
  459. "--with-system-nspr"
  460. "--with-system-zlib"
  461. "--with-intl-api")
  462. #:phases
  463. (modify-phases %standard-phases
  464. (add-after 'patch-source-shebangs 'patch-cargo-checksums
  465. (lambda _
  466. (let ((null-hash
  467. "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))
  468. (for-each (lambda (file)
  469. (format #t "patching checksums in ~a~%" file)
  470. (substitute* file
  471. (("^checksum = \".*\"")
  472. (string-append "checksum = \"" null-hash "\""))))
  473. (find-files "." "Cargo\\.lock$"))
  474. (for-each generate-all-checksums
  475. '("js" "third_party/rust"))
  476. #t)))
  477. (replace 'configure
  478. (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
  479. ;; The configure script does not accept environment variables as
  480. ;; arguments. It also must be run from a different directory,
  481. ;; but not the root directory either.
  482. (let ((out (assoc-ref outputs "out")))
  483. (mkdir "run-configure-from-here")
  484. (chdir "run-configure-from-here")
  485. (setenv "SHELL" (which "sh"))
  486. (setenv "CONFIG_SHELL" (which "sh"))
  487. (setenv "AUTOCONF" (which "autoconf"))
  488. (apply invoke "../js/src/configure"
  489. (cons (string-append "--prefix=" out)
  490. configure-flags))
  491. #t)))
  492. (add-after 'unpack 'adjust-for-icu-68
  493. (lambda _
  494. (with-directory-excursion "js/src/tests"
  495. ;; The test suite expects a lightly patched ICU 67. Since
  496. ;; Guix is about to switch to ICU 68, massage the tests to
  497. ;; work with that instead of patching ICU. Try removing this
  498. ;; phase for newer versions of mozjs.
  499. ;; These tests look up locale names and expects to get
  500. ;; "GB" instead of "UK".
  501. (substitute* "non262/Intl/DisplayNames/language.js"
  502. (("Traditionell, GB")
  503. "Traditionell, UK"))
  504. (substitute* "non262/Intl/DisplayNames/region.js"
  505. (("\"GB\": \"GB\"")
  506. "\"GB\": \"UK\""))
  507. ;; XXX: Some localized time formats have changed, and
  508. ;; substitution fails for accented characters, even though
  509. ;; it works in the REPL(?). Just delete these for now.
  510. (delete-file "non262/Intl/Date/toLocaleString_timeZone.js")
  511. (delete-file "non262/Intl/Date/toLocaleDateString_timeZone.js")
  512. ;; Similarly, these get an unexpected "A" suffix when looking
  513. ;; up a time in the "ar-MA-u-ca-islamicc" locale, which is
  514. ;; tricky to substitute.
  515. (delete-file "non262/Intl/DateTimeFormat/format_timeZone.js")
  516. (delete-file "non262/Intl/DateTimeFormat/format.js")
  517. ;; This file compares a generated list of ICU locale names
  518. ;; with actual lookups. Some have changed slightly, i.e.
  519. ;; daf-Latn-ZZ -> daf-Latn-CI, so drop it for simplicity.
  520. (delete-file "non262/Intl/Locale/likely-subtags-generated.js"))
  521. #t))
  522. (add-before 'check 'pre-check
  523. (lambda _
  524. (with-directory-excursion "../js/src/tests"
  525. (substitute* "shell/os.js"
  526. ;; FIXME: Why does the killed process have an exit status?
  527. ((".*killed process should not have exitStatus.*")
  528. ""))
  529. ;; XXX: Delete all tests that test time zone functionality,
  530. ;; because the test suite uses /etc/localtime to figure out
  531. ;; the offset from the hardware clock, which does not work
  532. ;; in the build container. See <tests/non262/Date/shell.js>.
  533. (delete-file-recursively "non262/Date")
  534. (delete-file "non262/Intl/DateTimeFormat/tz-environment-variable.js")
  535. (setenv "JSTESTS_EXTRA_ARGS"
  536. (string-join
  537. (list
  538. ;; Do not run tests marked as "random".
  539. "--exclude-random"
  540. ;; Exclude web platform tests.
  541. "--wpt=disabled"
  542. ;; Respect the daemons configured number of jobs.
  543. (string-append "--worker-count="
  544. (number->string (parallel-job-count)))))))
  545. #t)))))
  546. (native-inputs
  547. `(("autoconf" ,autoconf-2.13)
  548. ("automake" ,automake)
  549. ("llvm" ,llvm) ;for llvm-objdump
  550. ("perl" ,perl)
  551. ("pkg-config" ,pkg-config)
  552. ("python" ,python-3)
  553. ("rust" ,rust-1.41)
  554. ("cargo" ,rust-1.41 "cargo")))
  555. (inputs
  556. `(("icu4c" ,icu4c)
  557. ("readline" ,readline)
  558. ("zlib" ,zlib)))))
  559. (define mozilla-compare-locales
  560. (origin
  561. (method hg-fetch)
  562. (uri (hg-reference
  563. (url "https://hg.mozilla.org/l10n/compare-locales/")
  564. (changeset "RELEASE_8_0_0")))
  565. (file-name "mozilla-compare-locales")
  566. (sha256 (base32 "0052wq92sg4i776x407b5838jx9h3phl9xy69m2q34f31n3gdyk2"))))
  567. (define (mozilla-locale locale changeset hash-string)
  568. (origin
  569. (method hg-fetch)
  570. (uri (hg-reference
  571. (url (string-append "https://hg.mozilla.org/l10n-central/"
  572. locale))
  573. (changeset changeset)))
  574. (file-name (string-append "mozilla-locale-" locale))
  575. (sha256 (base32 hash-string))))
  576. (define-syntax-rule (mozilla-locales (hash-string changeset locale) ...)
  577. (list (mozilla-locale locale changeset hash-string)
  578. ...))
  579. (define all-mozilla-locales
  580. (mozilla-locales
  581. ;; sha256 changeset locale
  582. ;;---------------------------------------------------------------------------
  583. ("1q1p7nl97478hkf1msbbcdh98k6fn87xwqihbw8np00ll5gk9k4v" "97cf3c155484" "ach")
  584. ("0sajpblp639l448xywx7xlybjr5dm0rfrzx511a8pa9wn7dma4mf" "46929b4dda4e" "af")
  585. ("04s756aaf1yyli1dn1vfdjymgyjs1pz2n7jvz76j27x4nzdgss7l" "96ffd2b04ba3" "an")
  586. ("16nw7slm7irsnjf81r6zl273kbzri8sdbimzgzxwm0vh6xr61rgs" "1c4231166ddf" "ar")
  587. ("0i0qrj4j8zjv55cisbmr21dp8mz933hc9wkpn3abz5k5pn84gpry" "bc4384b8be78" "ast")
  588. ("1r77mmwg9x1jfa7g5lqa31rgyfrnix1zj80ibn5rq9gyhhsdrwbd" "dd56aead51fa" "az")
  589. ("1kzjpy5bnvps8di72ksynhbhc9bpw1ml6hvphm74z8dz55ai4c18" "9d2bff64ddfb" "be")
  590. ("1fygvjgph3siknfm7l0fh9y4ava72z1rxkip1zgmcdgq7jz8wzpf" "3808f4fe4db6" "bg")
  591. ("1x9nlqia441xh04rhkmkw6qrgpwnyqw0grrf5n2qw96939wnmgl7" "5ca8752ed8df" "bn")
  592. ("18yyxqzab44bgqx7h052d5nxyhv0l5bidgr16z1b3ak2crsfyx9q" "4c5d30ca9bf2" "br")
  593. ("11bschjz7pgsm4r1qan5l4s3nkzm5jb0kivpp186wd1xsjci5bjb" "cf2478a7eae1" "bs")
  594. ("12bak64nl6qi092l55xv330vh38mfsicrrf4wi693nn7zqb3mbpw" "4aa2cc349211" "ca")
  595. ("0p97d7pnxqs971rr5c57i6cw3mx1mp3iasa0xdmdk0zpz9pjd3s4" "806914072144" "ca-valencia")
  596. ("1rligf98h9r16mw3r3n5jalzi74xn2dnh6hkiixp7s2bvhjicwa4" "db2163383129" "cak")
  597. ("18y5j8ljh72mj2nbx0m64mi3fyjbwyx992i004sv3zvs4d4z18w4" "d1d09eedddde" "cs")
  598. ("12i4m9q6f8sl8arm8ja4gs4sl9m59p3kddlqi68srpz9mk66rqxz" "1caf58c64227" "cy")
  599. ("16wacsd23zd4j0yi6vbj033wylia8hlpswx949x5hy1h9817j4vn" "9ef3b56aa243" "da")
  600. ("1ddxnqpfi1wnciwmzkvvjinb51h22bg70r0dn7db17q64p4271rk" "a050b0eaec0a" "de")
  601. ("0gw5h52rw3bc2lwffnv845sjwwj22gmabchmpa1rw2y6087dc7zk" "613135cb0759" "dsb")
  602. ("0v17da37w1kbs73i6xql4c9xng6rfachyylpy3w8hpibpvi7i30n" "903db7c76b31" "el")
  603. ("0ky1nj4kp070nriw0igsa64l39plcv2365zl8lqpbydyp6clwc3m" "6bb74673e9aa" "en-CA")
  604. ("15jck6si2l4h5lrs8zjx56y97p70njpi26nnq6xfmvj1dk5qb4g2" "c06bd83a9295" "en-GB")
  605. ("1gc400n8j8qk70vdw7fkf4m9yviia35cmj6361pxnyvsjrgm4qvm" "ae0fda5114c4" "eo")
  606. ("0y01lahdrd3krsh6nrr3iw36r2x4advh5qw54vf92w11l3aiyvfz" "0c294dc9ce40" "es-AR")
  607. ("16jjbsfa62dxk36ccziv7nmh26c1s0b05960in6zs5nnfrv4yh35" "7c30b2981fb4" "es-CL")
  608. ("0qh8c8f8dsv1v56n1mcpn84l39bpnqfl8v8iacq12zh322srr549" "ad1444f4f833" "es-ES")
  609. ("1vh3hm5r4ch6mk3ymbk12b9rppwc75fmbi0i7cml82kxsi77bzw5" "0a26cdb23536" "es-MX")
  610. ("159l92jxx48lgba1g8ig3mdzhwsf3jpg3nx1g9blq4majk5hqr6q" "65a38a830795" "et")
  611. ("1ha8y1wbgb66dqm26x1q2xwygy7bblkjz40y9vh5d2qlpr3fn0av" "21e0930b221d" "eu")
  612. ("0rq4pcw6klm0bbljm1wdfvna8bpa35cm47hh2s63i2xdax4scahf" "5a4bb020cf09" "fa")
  613. ("1py2594gsvpgrxnplz278ffb7grsf384kzjskrl1zyps0jw8fb1x" "4a4f712cd4aa" "ff")
  614. ("1dyd55ngsglp1w2gh0yaacwb0vsq23gdvnj76f2x6g39h1li9s0z" "9c51cd915e2b" "fi")
  615. ("0kimwivpq6pr63jh1k9fszsv8bi8vns3scg76mmnvbhh2ca8q7wj" "4f9e24a696ee" "fr")
  616. ("1sbbnnp12lgy5qan2kix02942830b1969bd7jxrv7piwqfch9i06" "9e21a0eeb5b1" "fy-NL")
  617. ("0dsvvyfrzkx5h44gqgdci7arb8h4lq48w20cnr8fc7j17grvnkzz" "999a995bc09d" "ga-IE")
  618. ("1487msbsgrfzmyijhf6a4wbqdjpd7b7ki9nwrjjjjlnbw0h0ljpb" "6a9ddcab3240" "gd")
  619. ("1kzc4fwr18kgisdzba2acj1ag8mxbifqpk5p30jv68nmvqfsvl8d" "51eb5e352db9" "gl")
  620. ("13gy3wn44kcxr7j3sbl69fp415875f4vb0gm91hx0fysqlvryhcs" "b9de1ffe3224" "gn")
  621. ("0w5nvzpjn5vr35c1852rlff581vpy71nc096cz125852kyqkzkc3" "5b3307475ada" "gu-IN")
  622. ("1ycakc4qpy9vcy50j3ricryjfnjr9v3a5ijj6bbfl4y6aks157fy" "c742df968ffd" "he")
  623. ("1b2jf83c500wm5wcdnijq0b7y4m8n6271smq8pygahn5nq17f0gq" "1a3039a52b8a" "hi-IN")
  624. ("19bbw8ix5m83cf4yarcmjl7jqa8xfabwqnh3nj6vi52rwvn7whk5" "8dc50e269ef3" "hr")
  625. ("12rrsvgg6bb2h8fhni7jbx8pv983q8ym5fhfjim957n9q2yp5db6" "67e40f48dec7" "hsb")
  626. ("0apyh713p3hrlj8041xwblcssahbmsqp9v9hbmb50ayf4z850kr1" "40073a597b1b" "hu")
  627. ("0q0r076lq250d3vmnz9d92wj137c2v8i362c2avmkgp5zr3mcl0z" "2ea33335afdb" "hy-AM")
  628. ("0qza33gdc1i9259dwd2f7vd78s0a6rg34aqdkhcn7f2l6ybw6xd6" "930041db15eb" "ia")
  629. ("1211h0gp7gianh3qf76w04gfzk4n2bnyc9i8dviyz0vh4cjbx11m" "08811a49b41c" "id")
  630. ("12lcr841g1j7453s7gb51vrvxmshx4ha3h1jx4vh8wr891xv8l6a" "2f7a8d31e0ba" "is")
  631. ("1x585g0r2kcv0d3phnxx85bk5g0pi1yl0hwp4idv19yc9hslr04s" "188357cc04b4" "it")
  632. ("09v35g9v7j6x0p1hggydm3a1rmq2fh4z7g1l88z3w5k6wq2nhj1b" "45cee0ba4771" "ja")
  633. ("0prs3vycfvvaffjigdgyxiq41ak2rc34lnan5a6cwdqjgy7z450s" "d60a19d9bf17" "ja-JP-mac")
  634. ("1nskzm8rgczrbgcxlzzq5zqdfd456ad0cylq27nf0wjiyq6kjzcm" "00cb00e78672" "ka")
  635. ("0g6zznmhiam172nm7g2qzfpk415mna8kiihm73z2sdns64xb3ymg" "77a293a4bced" "kab")
  636. ("17dld9lrym7rpvpvnkssivp4wx1f11zpk86wczbq1h52qgd70p55" "2c9b33a56d5d" "kk")
  637. ("1nlzl8930c8ql3yq425wyqlxvq8arrjv20xpm5g7yfxd54av89ac" "9cddd42af05c" "km")
  638. ("07hkrcdksvrqk816yimd036dlw15nc4sjk4gmw16ywbp093v0mqq" "e0c2969a8398" "kn")
  639. ("08aqggvk3qbv5bzks9i1iba9akhkpm01d2c9k0zf41mpr2r5yfg2" "827567d0dafc" "ko")
  640. ("0vagaiwy80bs1k3gkacshlzb5zchkcshx0ypwirvayc63sw4yl8l" "694b2a24e868" "lij")
  641. ("1r43kp1kzahrbza0hiyavqplk9h08pzsb6rpjy79jr6l1iqb89sy" "d6728db7e060" "lt")
  642. ("0sq2wbsj79xl7fi454k6q5xdhxyck1whjz315rv37vphqpx86b9b" "61e9b33f4d94" "lv")
  643. ("0q8jxg1af22hs9wjdf0jd3bqk4rafxyzvsjl35k75am7l2y1fl3c" "9e482f6dd72c" "mk")
  644. ("1zsfzjrzbc58d30a9yz12h5vphywgpw8xg6y6zn3677a785dvr20" "1fd2763336a4" "mr")
  645. ("1rzygkkpn1a59daygd3hdaqph2np6sqvpgh68j0xr4il958ymnsm" "67ddab62dab4" "ms")
  646. ("16jp6w5gizfxs7jvncg3ly13m59vqvh4rlmjd0q23m5g5ff9sklc" "3ed015b51bf3" "my")
  647. ("1wfv023j67lb4iyf49fsknwm4z3xy0xqcf25b2nzanggxj26n01x" "d01801233a8f" "nb-NO")
  648. ("1946vfia58vbjfippb5pfsskbjj95w7hb340smn6ry2vmza99mxp" "582defb08fb2" "ne-NP")
  649. ("12w5ywh4c3s55y3zqc48cp1gcpwwjg444yfh1bghhhb9ni1xkh5i" "05f6359a29a6" "nl")
  650. ("17jb076320cgkw1ypwmws2vjxsqlv2ww8aaisa3j334vbrw1m4zx" "50b41a1ddded" "nn-NO")
  651. ("1y840j0v5zdgj94cbacy6j1snf44rynmzxq3yk8i26arcar62akl" "a6a138531a44" "oc")
  652. ("0jq1hq4xhqxpa26r8pb1bgbaljgfkhn9l6p5pbnslkllpbh70q6l" "e70a3afaef25" "pa-IN")
  653. ("1hih138skwy2gb8q10ngg6zalrk3aa3d549mg79gqzxbi5zy19fw" "e035f33389eb" "pl")
  654. ("1hhif4hx4k351wm1bzykzycfzb5q8msxmiwh5r1cy32rh8wkxwhh" "54098495f37f" "pt-BR")
  655. ("0gkjs12rxjml1m3mljskpz1gr6aph0c31nwpwdqybfg54w9qslib" "3fdf021f624e" "pt-PT")
  656. ("0anyvwd9v6mr8y3ww33s6qnxkawqn5lz65vrxx3m3kzky63ai1xk" "794f9374eb87" "rm")
  657. ("1p4drj25gsfv7lwgm5saazh38iqrh53952n8i4bmxpn0nadbm2n5" "71ce18bcf6cc" "ro")
  658. ("17yssf4axd3zvncl4ka4wkfnwcn0z0arp3390vb9cps67na29p36" "3a9587227699" "ru")
  659. ("0xk6rksspcw1222v4rgk5a6gzrpx64k29hm7p9qkqwd70s34yj46" "c020582a72ce" "si")
  660. ("1ax5ibydyn7sj208r66zcxlcr8dxdqrw28vqyjif4jx583rp4lfp" "745a699b7f51" "sk")
  661. ("13rin7hm1dv8g0hbcv8mp2hiwpk1k5bhzvkqpqajkkik4lx523mc" "8e437e2351ef" "sl")
  662. ("0yh5jkl5zw3f7x1w2w6zfj3dyvcl4wj1zv4di7qsq2nl2yyizf7x" "2d99e2eff94f" "son")
  663. ("0vzq7s27jsdbw5k59wfykysg1kd8w229ab5d4zjdf30l59igkahh" "69bbdf07bd80" "sq")
  664. ("1mwivvs8vrk6vjq6i33kwlrlisra7dy35521ayps9p2rz2dll4rr" "215df5c5125c" "sr")
  665. ("0g97yz1rg5cfflj8vvq3sqliyvm06x818z9yldfh5rjg1y6n9fjd" "8be00a1a50d4" "sv-SE")
  666. ("0ii02jn3lh2i6d0s95whx9aj6w3x8axc7w1rlzj0lc2s9n52krz3" "170a84339dbe" "ta")
  667. ("1ss7symad2crapxjqc0xhc0n17l79r5vf7flvkgk7npjky4vb7nv" "72a79a304f7f" "te")
  668. ("11iqmg8zamgscnvs4n2xpw3g9azn6w38qs313wiwm86pyx6694ss" "8e91ce3064c5" "th")
  669. ("1zgkvn9flb8by62ip9r3gmpgxwgkww1zhml5mwa0djq3ppfdgi1c" "0f914d0cda56" "tl")
  670. ("1filkhdak6dbrd83q602x1qw1703nlm53nm9gcyab8s16gsx6ylz" "62ca6a8eaeba" "tr")
  671. ("0cgagdy0ixprk3knczdmkqxkmx4ybmshhh0956kxbd0iab0dfcf6" "f110ccac4cde" "trs")
  672. ("1f1ghk67zwnwc5x3nk82vcv94nf8glngkfya1hg074q3088sj9pa" "56c0102d5f1c" "uk")
  673. ("0iyw1b2jjylkdwxv9sxvj4ikxl64sx612b2dvvmf1di8bw86w74r" "7d53bce5ae98" "ur")
  674. ("1q83cp5pfgs8l03zirwi8r5qp8qyh4zvxdx1ilgaqqlyg42yql7c" "9b500e1a054d" "uz")
  675. ("1d4nkybz2hk64ay04k965b9lc5nhhpmzcs5ww3b6q4n93rf9c2z7" "2a000025928a" "vi")
  676. ("1cnrsfnyl3sw3sxsggmjwydvphb2diy0vzknvxdhpnvq3ln18hga" "74724087c25b" "xh")
  677. ("1j6l66v1xw27z8w78mpsnmqgv8m277mf4r0hgqcrb4zx7xc2vqyy" "527e5e090608" "zh-CN")
  678. ("1frwx35klpyz3sdwrkz7945ivb2dwaawhhyfnz4092h9hn7rc4ky" "6cd366ad2947" "zh-TW")))
  679. (define* (computed-origin-method gexp-promise hash-algo hash
  680. #:optional (name "source")
  681. #:key (system (%current-system))
  682. (guile (default-guile)))
  683. "Return a derivation that executes the G-expression that results
  684. from forcing GEXP-PROMISE."
  685. (mlet %store-monad ((guile (package->derivation guile system)))
  686. (gexp->derivation (or name "computed-origin")
  687. (force gexp-promise)
  688. #:graft? #f ;nothing to graft
  689. #:system system
  690. #:guile-for-build guile)))
  691. (define %icecat-version "78.14.0-guix0-preview1")
  692. (define %icecat-build-id "20210907000000") ;must be of the form YYYYMMDDhhmmss
  693. ;; 'icecat-source' is a "computed" origin that generates an IceCat tarball
  694. ;; from the corresponding upstream Firefox ESR tarball, using the 'makeicecat'
  695. ;; script from the upstream IceCat project.
  696. (define icecat-source
  697. (let* ((base-version (first (string-split %icecat-version #\-)))
  698. (major-version (first (string-split base-version #\.)))
  699. (minor-version (second (string-split base-version #\.)))
  700. (sub-version (third (string-split base-version #\.)))
  701. (upstream-firefox-version (string-append base-version "esr"))
  702. (upstream-firefox-source
  703. (origin
  704. (method url-fetch)
  705. (uri (string-append
  706. "https://ftp.mozilla.org/pub/firefox/releases/"
  707. upstream-firefox-version "/source/"
  708. "firefox-" upstream-firefox-version ".source.tar.xz"))
  709. (sha256
  710. (base32
  711. "1ymjlg6p23c510m764pqr4sldrvk0c7g490a29js2cqc2nj2h3ma"))))
  712. (upstream-icecat-base-version "78.7.0") ; maybe older than base-version
  713. ;;(gnuzilla-commit (string-append "v" upstream-icecat-base-version))
  714. (gnuzilla-commit "abfe5eebaca3c2787f1a9505669393674493c177")
  715. (gnuzilla-source
  716. (origin
  717. (method git-fetch)
  718. (uri (git-reference
  719. (url "git://git.savannah.gnu.org/gnuzilla.git")
  720. (commit gnuzilla-commit)))
  721. (file-name (git-file-name "gnuzilla"
  722. ;;upstream-icecat-base-version
  723. (string-take gnuzilla-commit 8)))
  724. (sha256
  725. (base32
  726. "00ws3540x5whpicc5fx4k949ff73cqvajz6jp13ahn49wqdads47"))))
  727. ;; 'search-patch' returns either a valid file name or #f, so wrap it
  728. ;; in 'assume-valid-file-name' to avoid 'local-file' warnings.
  729. (gnuzilla-fixes-patch
  730. (local-file (assume-valid-file-name
  731. (search-patch "icecat-use-older-reveal-hidden-html.patch"))))
  732. (makeicecat-patch
  733. (local-file (assume-valid-file-name
  734. (search-patch "icecat-makeicecat.patch")))))
  735. (origin
  736. (method computed-origin-method)
  737. (file-name (string-append "icecat-" %icecat-version ".tar.xz"))
  738. (sha256 #f)
  739. (uri
  740. (delay
  741. (with-imported-modules '((guix build utils))
  742. #~(begin
  743. (use-modules (guix build utils))
  744. (let ((firefox-dir
  745. (string-append "firefox-" #$base-version))
  746. (icecat-dir
  747. (string-append "icecat-" #$%icecat-version)))
  748. (mkdir "/tmp/bin")
  749. (set-path-environment-variable
  750. "PATH" '("bin")
  751. (list "/tmp"
  752. #+(canonical-package bash)
  753. #+(canonical-package coreutils)
  754. #+(canonical-package findutils)
  755. #+(canonical-package patch)
  756. #+(canonical-package xz)
  757. #+(canonical-package sed)
  758. #+(canonical-package grep)
  759. #+(canonical-package bzip2)
  760. #+(canonical-package gzip)
  761. #+(canonical-package tar)
  762. #+rename))
  763. (symlink #+(file-append rename "/bin/rename")
  764. "/tmp/bin/prename")
  765. ;; We copy the gnuzilla source directory because it is
  766. ;; read-only in 'gnuzilla-source', and the makeicecat script
  767. ;; uses "cp -a" to copy parts of it and assumes that the
  768. ;; copies will be writable.
  769. (copy-recursively #+gnuzilla-source "/tmp/gnuzilla"
  770. #:log (%make-void-port "w"))
  771. (with-directory-excursion "/tmp/gnuzilla"
  772. (make-file-writable "makeicecat")
  773. (invoke "patch" "--force" "--no-backup-if-mismatch"
  774. "-p1" "--input" #+gnuzilla-fixes-patch)
  775. (invoke "patch" "--force" "--no-backup-if-mismatch"
  776. "-p1" "--input" #+makeicecat-patch)
  777. (patch-shebang "makeicecat")
  778. (substitute* "makeicecat"
  779. (("^FFMAJOR=(.*)" all ffmajor)
  780. (unless (string=? #$major-version
  781. (string-trim-both ffmajor))
  782. ;; The makeicecat script cannot be expected to work
  783. ;; properly on a different version of Firefox, even if
  784. ;; no errors occur during execution.
  785. (error "makeicecat major version mismatch"))
  786. (string-append "FFMAJOR=" #$major-version "\n"))
  787. (("^FFMINOR=.*")
  788. (string-append "FFMINOR=" #$minor-version "\n"))
  789. (("^FFSUB=.*")
  790. (string-append "FFSUB=" #$sub-version "\n"))
  791. (("^DATA=.*")
  792. "DATA=/tmp/gnuzilla/data\n")
  793. (("/bin/sed")
  794. #+(file-append (canonical-package sed) "/bin/sed"))))
  795. (format #t "Unpacking upstream firefox tarball...~%")
  796. (force-output)
  797. (invoke "tar" "xf" #+upstream-firefox-source)
  798. (rename-file firefox-dir icecat-dir)
  799. (with-directory-excursion icecat-dir
  800. (format #t "Populating l10n directory...~%")
  801. (force-output)
  802. (mkdir "l10n")
  803. (with-directory-excursion "l10n"
  804. (for-each
  805. (lambda (locale-dir)
  806. (let ((locale
  807. (string-drop (basename locale-dir)
  808. (+ 32 ; length of hash
  809. (string-length "-mozilla-locale-")))))
  810. (format #t " ~a~%" locale)
  811. (force-output)
  812. (copy-recursively locale-dir locale
  813. #:log (%make-void-port "w"))
  814. (for-each make-file-writable (find-files locale))
  815. (with-directory-excursion locale
  816. (when (file-exists? ".hgtags")
  817. (delete-file ".hgtags"))
  818. (mkdir-p "browser/chrome/browser/preferences")
  819. (call-with-output-file
  820. "browser/chrome/browser/preferences/advanced-scripts.dtd"
  821. (lambda (port) #f)))))
  822. '#+all-mozilla-locales)
  823. (copy-recursively #+mozilla-compare-locales
  824. "compare-locales"
  825. #:log (%make-void-port "w"))
  826. (delete-file "compare-locales/.gitignore")
  827. (delete-file "compare-locales/.hgignore")
  828. (delete-file "compare-locales/.hgtags"))
  829. (format #t "Running makeicecat script...~%")
  830. (force-output)
  831. (invoke "bash" "/tmp/gnuzilla/makeicecat"))
  832. (format #t "Packing IceCat source tarball...~%")
  833. (force-output)
  834. (invoke "tar" "cfa" #$output
  835. ;; Avoid non-determinism in the archive. We set the
  836. ;; mtime of files in the archive to early 1980 because
  837. ;; the build process fails if the mtime of source
  838. ;; files is pre-1980, due to the creation of zip
  839. ;; archives.
  840. "--mtime=@315619200" ; 1980-01-02 UTC
  841. "--owner=root:0"
  842. "--group=root:0"
  843. "--sort=name"
  844. icecat-dir)
  845. #t))))))))
  846. (define-public icecat
  847. (package
  848. (name "icecat")
  849. (version %icecat-version)
  850. (source icecat-source)
  851. (build-system gnu-build-system)
  852. (inputs
  853. `(("alsa-lib" ,alsa-lib)
  854. ("bzip2" ,bzip2)
  855. ("cups" ,cups)
  856. ("dbus-glib" ,dbus-glib)
  857. ("gdk-pixbuf" ,gdk-pixbuf)
  858. ("glib" ,glib)
  859. ("gtk+" ,gtk+)
  860. ("gtk+-2" ,gtk+-2)
  861. ;; UNBUNDLE-ME! ("graphite2" ,graphite2)
  862. ("pango" ,pango)
  863. ("freetype" ,freetype)
  864. ;; UNBUNDLE-ME! ("harfbuzz" ,harfbuzz)
  865. ("libcanberra" ,libcanberra)
  866. ("libgnome" ,libgnome)
  867. ("libjpeg-turbo" ,libjpeg-turbo)
  868. ;; UNBUNDLE-ME! ("libogg" ,libogg)
  869. ;; UNBUNDLE-ME! ("libtheora" ,libtheora) ; wants theora-1.2, not yet released
  870. ;; UNBUNDLE-ME! ("libvorbis" ,libvorbis)
  871. ("libxft" ,libxft)
  872. ("libevent" ,libevent)
  873. ("libxinerama" ,libxinerama)
  874. ("libxscrnsaver" ,libxscrnsaver)
  875. ("libxcomposite" ,libxcomposite)
  876. ("libxt" ,libxt)
  877. ("libffi" ,libffi)
  878. ("ffmpeg" ,ffmpeg)
  879. ;; UNBUNDLE-ME! ("libvpx" ,libvpx)
  880. ("icu4c" ,icu4c-67)
  881. ("pixman" ,pixman)
  882. ("pulseaudio" ,pulseaudio)
  883. ("mesa" ,mesa)
  884. ("mit-krb5" ,mit-krb5)
  885. ;; See <https://bugs.gnu.org/32833>
  886. ;; and related comments in the 'remove-bundled-libraries' phase.
  887. ;; UNBUNDLE-ME! ("nspr" ,nspr)
  888. ;; UNBUNDLE-ME! ("nss" ,nss)
  889. ("shared-mime-info" ,shared-mime-info)
  890. ;; UNBUNDLE-ME! ("sqlite" ,sqlite)
  891. ("eudev" ,eudev)
  892. ("unzip" ,unzip)
  893. ("zip" ,zip)
  894. ;; UNBUNDLE-ME! ("zlib" ,zlib)
  895. ))
  896. (native-inputs
  897. ;; The following patches are specific to the Guix packaging of IceCat,
  898. ;; and therefore we prefer to leave them out of 'source', which should be
  899. ;; a tarball suitable for compilation on any system that IceCat supports.
  900. ;; (Bug fixes and security fixes, however, should go in 'source').
  901. `(;; XXX TODO: Adapt these patches to IceCat 68.
  902. ;; ("icecat-avoid-bundled-libraries.patch"
  903. ;; ,(search-patch "icecat-avoid-bundled-libraries.patch"))
  904. ;; ("icecat-use-system-graphite2+harfbuzz.patch"
  905. ;; ,(search-patch "icecat-use-system-graphite2+harfbuzz.patch"))
  906. ;; ("icecat-use-system-media-libs.patch"
  907. ;; ,(search-patch "icecat-use-system-media-libs.patch"))
  908. ("patch" ,(canonical-package patch))
  909. ("rust" ,rust)
  910. ("cargo" ,rust "cargo")
  911. ("rust-cbindgen" ,rust-cbindgen-0.14)
  912. ("llvm" ,llvm)
  913. ("clang" ,clang)
  914. ("perl" ,perl)
  915. ("node" ,node)
  916. ("python" ,python)
  917. ("python-2" ,python-2)
  918. ("python2-pysqlite" ,python2-pysqlite)
  919. ("yasm" ,yasm)
  920. ("nasm" ,nasm) ; XXX FIXME: only needed on x86_64 and i686
  921. ("pkg-config" ,pkg-config)
  922. ("autoconf" ,autoconf-2.13)
  923. ("which" ,which)))
  924. (arguments
  925. `(#:tests? #f ; no check target
  926. #:out-of-source? #t ; must be built outside of the source directory
  927. #:configure-flags `("--enable-default-toolkit=cairo-gtk3-wayland"
  928. "--with-distribution-id=org.gnu"
  929. ;; Do not require addons in the global app or
  930. ;; system directories to be signed by Mozilla.
  931. "--with-unsigned-addon-scopes=app,system"
  932. "--allow-addon-sideload"
  933. "--enable-pulseaudio"
  934. "--disable-tests"
  935. "--disable-updater"
  936. "--disable-crashreporter"
  937. "--disable-eme"
  938. ;; Building with debugging symbols takes ~5GiB, so
  939. ;; disable it.
  940. "--disable-debug"
  941. "--disable-debug-symbols"
  942. ;; Clang is needed to build Stylo, Mozilla's new
  943. ;; CSS engine. We must specify the clang paths
  944. ;; manually, because otherwise the Mozilla build
  945. ;; system looks in the directories returned by
  946. ;; llvm-config --bindir and llvm-config --libdir,
  947. ;; which return paths in the llvm package where
  948. ;; clang is not found.
  949. ,(string-append "--with-clang-path="
  950. (assoc-ref %build-inputs "clang")
  951. "/bin/clang")
  952. ,(string-append "--with-libclang-path="
  953. (assoc-ref %build-inputs "clang")
  954. "/lib")
  955. ;; Hack to work around missing
  956. ;; "unofficial" branding in icecat.
  957. "--enable-official-branding"
  958. ;; Avoid bundled libraries.
  959. "--with-system-jpeg" ; must be libjpeg-turbo
  960. ;; UNBUNDLE-ME! "--with-system-zlib"
  961. ;; UNBUNDLE-ME! "--with-system-bz2"
  962. ;; UNBUNDLE-ME! "--with-system-libevent"
  963. ;; UNBUNDLE-ME! "--with-system-ogg"
  964. ;; UNBUNDLE-ME! "--with-system-vorbis"
  965. ;; UNBUNDLE-ME! "--with-system-theora" ; wants theora-1.2, not yet released
  966. ;; UNBUNDLE-ME! "--with-system-libvpx"
  967. "--with-system-icu"
  968. ;; See <https://bugs.gnu.org/32833>
  969. ;; and related comments in the
  970. ;; 'remove-bundled-libraries' phase below.
  971. ;; UNBUNDLE-ME! "--with-system-nspr"
  972. ;; UNBUNDLE-ME! "--with-system-nss"
  973. ;; UNBUNDLE-ME! "--with-system-harfbuzz"
  974. ;; UNBUNDLE-ME! "--with-system-graphite2"
  975. "--enable-system-pixman"
  976. "--enable-system-ffi"
  977. ;; UNBUNDLE-ME! "--enable-system-sqlite"
  978. ;; Fails with "--with-system-png won't work because
  979. ;; the system's libpng doesn't have APNG support".
  980. ;; According to
  981. ;; http://sourceforge.net/projects/libpng-apng/ ,
  982. ;; "the Animated Portable Network Graphics (APNG)
  983. ;; is an unofficial extension of the Portable
  984. ;; Network Graphics (PNG) format";
  985. ;; we probably do not wish to support it.
  986. ;; "--with-system-png"
  987. )
  988. #:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums'
  989. #:modules ((ice-9 ftw)
  990. (ice-9 rdelim)
  991. (ice-9 regex)
  992. (ice-9 match)
  993. (srfi srfi-34)
  994. (srfi srfi-35)
  995. (rnrs bytevectors)
  996. (rnrs io ports)
  997. (guix elf)
  998. (guix build gremlin)
  999. ,@%gnu-build-system-modules)
  1000. #:phases
  1001. (modify-phases %standard-phases
  1002. (add-after 'unpack 'apply-guix-specific-patches
  1003. (lambda* (#:key inputs native-inputs #:allow-other-keys)
  1004. (let ((patch (string-append (assoc-ref (or native-inputs inputs)
  1005. "patch")
  1006. "/bin/patch")))
  1007. (for-each (match-lambda
  1008. ((label . file)
  1009. (when (and (string-prefix? "icecat-" label)
  1010. (string-suffix? ".patch" label))
  1011. (format #t "applying '~a'...~%" file)
  1012. (invoke patch "--force" "--no-backup-if-mismatch"
  1013. "-p1" "--input" file))))
  1014. (or native-inputs inputs)))
  1015. #t))
  1016. (add-after 'apply-guix-specific-patches 'remove-bundled-libraries
  1017. (lambda _
  1018. ;; Remove bundled libraries that we don't use, since they may
  1019. ;; contain unpatched security flaws, they waste disk space and
  1020. ;; memory, and may cause confusion.
  1021. (for-each (lambda (file)
  1022. (format #t "deleting '~a'...~%" file)
  1023. (delete-file-recursively file))
  1024. '(;; FIXME: Removing the bundled icu breaks configure.
  1025. ;; * The bundled icu headers are used in some places.
  1026. ;; * The version number is taken from the bundled copy.
  1027. ;;"intl/icu"
  1028. ;;
  1029. ;; FIXME: A script from the bundled nspr is used.
  1030. ;;"nsprpub"
  1031. ;;
  1032. ;; FIXME: With the update to IceCat 60, using system NSS
  1033. ;; broke certificate validation. See
  1034. ;; <https://bugs.gnu.org/32833>. For now, we use
  1035. ;; the bundled NSPR and NSS. TODO: Investigate,
  1036. ;; and try to unbundle these libraries again.
  1037. ;; UNBUNDLE-ME! "security/nss"
  1038. ;;
  1039. ;; TODO: Use more system media libraries. See:
  1040. ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
  1041. ;; * libtheora: esr60 wants v1.2, not yet released.
  1042. ;; * soundtouch: avoiding the bundled library would
  1043. ;; result in some loss of functionality. There's
  1044. ;; also an issue with exception handling
  1045. ;; configuration. It seems that this is needed in
  1046. ;; some moz.build:
  1047. ;; DEFINES['ST_NO_EXCEPTION_HANDLING'] = 1
  1048. ;; * libopus
  1049. ;; * speex
  1050. ;;
  1051. "modules/freetype2"
  1052. ;; "media/libjpeg" ; needed for now, because media/libjpeg/moz.build is referenced from config/external/moz.build
  1053. ;; UNBUNDLE-ME! "modules/zlib"
  1054. ;; UNBUNDLE-ME! "ipc/chromium/src/third_party/libevent"
  1055. ;; UNBUNDLE-ME! "media/libvpx"
  1056. ;; UNBUNDLE-ME! "media/libogg"
  1057. ;; UNBUNDLE-ME! "media/libvorbis"
  1058. ;; UNBUNDLE-ME! "media/libtheora" ; wants theora-1.2, not yet released
  1059. ;; UNBUNDLE-ME! "media/libtremor"
  1060. ;; UNBUNDLE-ME! "gfx/harfbuzz"
  1061. ;; UNBUNDLE-ME! "gfx/graphite2"
  1062. "js/src/ctypes/libffi"
  1063. ;; UNBUNDLE-ME! "db/sqlite3"
  1064. ))
  1065. #t))
  1066. (add-after 'remove-bundled-libraries 'link-libxul-with-libraries
  1067. (lambda _
  1068. ;; libxul.so dynamically opens libraries, so here we explicitly
  1069. ;; link them into libxul.so instead.
  1070. ;;
  1071. ;; TODO: It might be preferable to patch in absolute file names in
  1072. ;; calls to dlopen or PR_LoadLibrary, but that didn't seem to
  1073. ;; work. More investigation is needed.
  1074. (substitute* "toolkit/library/moz.build"
  1075. (("^# This library needs to be last" all)
  1076. (string-append "OS_LIBS += [
  1077. 'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5',
  1078. 'avcodec', 'avutil', 'pulse' ]\n\n"
  1079. all)))
  1080. #t))
  1081. (add-after 'link-libxul-with-libraries 'fix-ffmpeg-runtime-linker
  1082. (lambda* (#:key inputs #:allow-other-keys)
  1083. (let* ((ffmpeg (assoc-ref inputs "ffmpeg"))
  1084. (libavcodec (string-append ffmpeg "/lib/libavcodec.so")))
  1085. ;; Arrange to load libavcodec.so by its absolute file name.
  1086. (substitute* "dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp"
  1087. (("libavcodec\\.so")
  1088. libavcodec))
  1089. ;; Populate the sandbox read-path whitelist as needed by ffmpeg.
  1090. (let* ((mime-info (assoc-ref inputs "shared-mime-info"))
  1091. (libavcodec-runpath (call-with-input-file libavcodec
  1092. (compose elf-dynamic-info-runpath
  1093. elf-dynamic-info
  1094. parse-elf
  1095. get-bytevector-all)))
  1096. (whitelist (cons (string-append mime-info "/share/mime/")
  1097. (map (lambda (dir)
  1098. (string-append dir "/"))
  1099. libavcodec-runpath)))
  1100. (whitelist-string (string-join whitelist ","))
  1101. (port (open-file "browser/app/profile/icecat.js" "a")))
  1102. (format #t "setting 'security.sandbox.content.read_path_whitelist' to '~a'~%"
  1103. whitelist-string)
  1104. (format port "~%pref(\"security.sandbox.content.read_path_whitelist\", ~S);~%"
  1105. whitelist-string)
  1106. (close-output-port port))
  1107. #t)))
  1108. (replace 'bootstrap
  1109. (lambda _
  1110. (invoke "sh" "-c" "autoconf old-configure.in > old-configure")
  1111. ;; 'configure' must be newer than 'old-configure.in', or else the
  1112. ;; build system will raise an alarm and abort.
  1113. (invoke "touch" "configure")))
  1114. (add-after 'patch-source-shebangs 'patch-cargo-checksums
  1115. (lambda _
  1116. (use-modules (guix build cargo-utils))
  1117. (let ((null-hash "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))
  1118. (for-each (lambda (file)
  1119. (format #t "patching checksums in ~a~%" file)
  1120. (substitute* file
  1121. (("^checksum = \".*\"")
  1122. (string-append "checksum = \"" null-hash "\""))))
  1123. (find-files "." "Cargo.lock$"))
  1124. (for-each generate-all-checksums
  1125. '("services"
  1126. "js"
  1127. "third_party/rust"
  1128. "dom/media"
  1129. "dom/webauthn"
  1130. "toolkit"
  1131. "gfx"
  1132. "storage"
  1133. "modules"
  1134. "xpcom/rust"
  1135. "media"
  1136. "mozglue/static/rust"
  1137. "netwerk"
  1138. "remote"
  1139. "intl"
  1140. "servo"
  1141. "security/manager/ssl"
  1142. "build")))
  1143. #t))
  1144. (replace 'configure
  1145. ;; configure does not work followed by both "SHELL=..." and
  1146. ;; "CONFIG_SHELL=..."; set environment variables instead
  1147. (lambda* (#:key outputs configure-flags #:allow-other-keys)
  1148. (let* ((out (assoc-ref outputs "out"))
  1149. (bash (which "bash"))
  1150. (abs-srcdir (getcwd))
  1151. (srcdir (string-append "../" (basename abs-srcdir)))
  1152. (flags `(,(string-append "--prefix=" out)
  1153. ,(string-append "--with-l10n-base="
  1154. abs-srcdir "/l10n")
  1155. ,@configure-flags)))
  1156. (setenv "SHELL" bash)
  1157. (setenv "CONFIG_SHELL" bash)
  1158. (setenv "AUTOCONF" (which "autoconf")) ; must be autoconf-2.13
  1159. (setenv "CC" "gcc") ; apparently needed when Stylo is enabled
  1160. (setenv "MOZ_BUILD_DATE" ,%icecat-build-id) ; avoid timestamp
  1161. (setenv "LDFLAGS" (string-append "-Wl,-rpath="
  1162. (assoc-ref outputs "out")
  1163. "/lib/icecat"))
  1164. (mkdir "../build")
  1165. (chdir "../build")
  1166. (format #t "build directory: ~s~%" (getcwd))
  1167. (format #t "configure flags: ~s~%" flags)
  1168. (apply invoke bash
  1169. (string-append srcdir "/configure")
  1170. flags))))
  1171. (replace 'build
  1172. ;; The build system often spuriously fails. See
  1173. ;; <https://bugs.gentoo.org/show_bug.cgi?id=680934>. To
  1174. ;; work around this, we try the standard 'build' phase up
  1175. ;; to 5 times.
  1176. (lambda args
  1177. (let ((build (assoc-ref %standard-phases 'build)))
  1178. (let retry ((remaining-attempts 5))
  1179. (if (= remaining-attempts 1)
  1180. (apply build args)
  1181. (guard (c ((invoke-error? c)
  1182. (format #t "~%Retrying build! (~a attempts remaining)~%~%"
  1183. (- remaining-attempts 1))
  1184. (force-output)
  1185. (retry (- remaining-attempts 1))))
  1186. (apply build args)))))))
  1187. (add-after 'build 'neutralise-store-references
  1188. (lambda _
  1189. ;; Mangle the store references to compilers & other build tools in
  1190. ;; about:buildconfig, reducing IceCat's closure by 1 GiB on x86-64.
  1191. (substitute*
  1192. "dist/bin/chrome/toolkit/content/global/buildconfig.html"
  1193. (((format #f "(~a/)([0-9a-df-np-sv-z]{32})"
  1194. (regexp-quote (%store-directory)))
  1195. _ store hash)
  1196. (string-append store
  1197. (string-take hash 8)
  1198. "<!-- Guix: not a runtime dependency -->"
  1199. (string-drop hash 8))))
  1200. #t))
  1201. (add-before 'configure 'install-desktop-entry
  1202. (lambda* (#:key outputs #:allow-other-keys)
  1203. ;; Install the '.desktop' file.
  1204. (let* ((desktop-file "taskcluster/docker/icecat-snap/icecat.desktop")
  1205. (out (assoc-ref outputs "out"))
  1206. (applications (string-append out "/share/applications")))
  1207. (substitute* desktop-file
  1208. (("^Exec=icecat") (string-append "Exec=" out "/bin/icecat"))
  1209. (("IceCat") "GNU IceCat")
  1210. (("Icon=.*") "Icon=icecat\n")
  1211. (("NewWindow") "new-window")
  1212. (("NewPrivateWindow") "new-private-window"))
  1213. (install-file desktop-file applications)
  1214. #t)))
  1215. (add-after 'install-desktop-entry 'install-icons
  1216. (lambda* (#:key outputs #:allow-other-keys)
  1217. (let ((out (assoc-ref outputs "out")))
  1218. (with-directory-excursion "browser/branding/official"
  1219. (for-each
  1220. (lambda (file)
  1221. (let* ((size (string-filter char-numeric? file))
  1222. (icons (string-append out "/share/icons/hicolor/"
  1223. size "x" size "/apps")))
  1224. (mkdir-p icons)
  1225. (copy-file file (string-append icons "/icecat.png"))))
  1226. '("default16.png" "default22.png" "default24.png"
  1227. "default32.png" "default48.png" "content/icon64.png"
  1228. "mozicon128.png" "default256.png"))
  1229. #t))))
  1230. ;; This fixes the file chooser crash that happens with GTK 3.
  1231. (add-after 'install 'wrap-program
  1232. (lambda* (#:key inputs outputs #:allow-other-keys)
  1233. (let* ((out (assoc-ref outputs "out"))
  1234. (lib (string-append out "/lib"))
  1235. (gtk (assoc-ref inputs "gtk+"))
  1236. (gtk-share (string-append gtk "/share"))
  1237. (ld-libs (map (lambda (lib)
  1238. (string-append (assoc-ref inputs lib)
  1239. "/lib"))
  1240. '("libxscrnsaver"
  1241. "mesa"
  1242. "mit-krb5"
  1243. "eudev"
  1244. "pulseaudio"))))
  1245. (wrap-program (car (find-files lib "^icecat$"))
  1246. `("XDG_DATA_DIRS" prefix (,gtk-share))
  1247. ;; The following line is commented out because the icecat
  1248. ;; package on guix has been observed to be unstable when
  1249. ;; using wayland, and the bundled extensions stop working.
  1250. ;; `("MOZ_ENABLE_WAYLAND" = ("1"))
  1251. `("LD_LIBRARY_PATH" prefix ,ld-libs))
  1252. #t))))))
  1253. (home-page "https://www.gnu.org/software/gnuzilla/")
  1254. (synopsis "Entirely free browser derived from Mozilla Firefox")
  1255. (description
  1256. "IceCat is the GNU version of the Firefox browser. It is entirely free
  1257. software, which does not recommend non-free plugins and addons. It also
  1258. features built-in privacy-protecting features.
  1259. WARNING: IceCat 78 has not yet been released by the upstream IceCat project.
  1260. This is a preview release, and does not currently meet the privacy-respecting
  1261. standards of the IceCat project.")
  1262. (license license:mpl2.0) ;and others, see toolkit/content/license.html
  1263. (properties
  1264. `((ftp-directory . "/gnu/gnuzilla")
  1265. (cpe-name . "firefox_esr")
  1266. (cpe-version . ,(first (string-split version #\-)))))))
  1267. ;; Update this together with icecat!
  1268. (define %icedove-build-id "20210810000000") ;must be of the form YYYYMMDDhhmmss
  1269. (define-public icedove
  1270. (package
  1271. (name "icedove")
  1272. (version "78.13.0")
  1273. (source icecat-source)
  1274. (properties
  1275. `((cpe-name . "thunderbird_esr")))
  1276. (build-system gnu-build-system)
  1277. (arguments
  1278. `(#:tests? #f ; no check target
  1279. #:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums'
  1280. #:modules ((guix build utils) ;find-files
  1281. (sxml simple)
  1282. (ice-9 regex)
  1283. ,@%gnu-build-system-modules)
  1284. #:phases
  1285. (modify-phases %standard-phases
  1286. (add-after 'unpack 'prepare-thunderbird-sources
  1287. (lambda* (#:key inputs #:allow-other-keys)
  1288. (mkdir "comm")
  1289. (copy-recursively (assoc-ref inputs "thunderbird-sources")
  1290. "comm")
  1291. (delete-file-recursively "obj-x86_64-pc-linux-gnu")
  1292. (delete-file "sourcestamp.txt")
  1293. #t))
  1294. (add-after 'patch-source-shebangs 'patch-cargo-checksums
  1295. (lambda _
  1296. (use-modules (guix build cargo-utils))
  1297. (let ((null-hash "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))
  1298. (for-each (lambda (file)
  1299. (format #t "patching checksums in ~a~%" file)
  1300. (substitute* file
  1301. (("^checksum = \".*\"")
  1302. (string-append "checksum = \"" null-hash "\""))))
  1303. (find-files "." "Cargo.lock$"))
  1304. (for-each generate-all-checksums
  1305. '("third_party/rust"
  1306. "toolkit/library/rust")))
  1307. #t))
  1308. ;; Fixes issue where each installation directory generates its own profile.
  1309. ;; See e.g. https://trac.torproject.org/projects/tor/ticket/31457
  1310. (add-after 'patch-source-shebangs 'fix-profile-setting
  1311. (lambda _
  1312. (substitute* "comm/mail/moz.configure"
  1313. (("'MOZ_DEDICATED_PROFILES', True")
  1314. "'MOZ_DEDICATED_PROFILES', False"))
  1315. #t))
  1316. (add-after 'prepare-thunderbird-sources 'rename-to-icedove
  1317. (lambda _
  1318. (substitute* "comm/mail/confvars.sh"
  1319. (("MOZ_APP_BASENAME=Thunderbird")
  1320. "MOZ_APP_BASENAME=Icedove\nMOZ_APP_DISPLAYNAME=Icedove")
  1321. (("MOZ_APP_NAME=thunderbird")
  1322. "MOZ_APP_NAME=icedove")
  1323. (("MOZ_UPDATER=1")
  1324. "MOZ_UPDATER=0"))
  1325. ;; Remove branding to comply with Mozilla's trademark policy
  1326. (with-directory-excursion "comm/mail/branding/nightly"
  1327. (delete-file "content/about-wordmark.svg")
  1328. (call-with-output-file "content/about-wordmark.svg"
  1329. (lambda (port)
  1330. (sxml->xml '(svg (@ (xmlns "http://www.w3.org/2000/svg")
  1331. (viewBox "0 0 789.1 90.78")
  1332. (width "333")
  1333. (height "48")
  1334. (fill "#fff"))
  1335. (text (@ (x "400") (y "70")
  1336. (text-anchor "middle")
  1337. (font-size "90"))
  1338. "Icedove Daily"))
  1339. port)))
  1340. (substitute* '("locales/en-US/brand.properties"
  1341. "locales/en-US/brand.ftl"
  1342. "locales/en-US/brand.dtd"
  1343. "configure.sh")
  1344. (("Thunderbird") "Icedove")
  1345. (("mozilla.org") "guix.gnu.org")))
  1346. ;; Remove other mentions of Thunderbird in user-visible text.
  1347. (with-directory-excursion "comm/mail/base/content"
  1348. (substitute* '("overrides/app-license-name.html")
  1349. (("Thunderbird") "Icedove")))
  1350. (with-directory-excursion "comm/mail/components/"
  1351. (substitute* '("MailGlue.jsm"
  1352. "extensions/schemas/addressBook.json"
  1353. "extensions/schemas/tabs.json"
  1354. "extensions/schemas/cloudFile.json"
  1355. "extensions/schemas/chrome_settings_overrides.json"
  1356. "extensions/schemas/windows.json"
  1357. "extensions/parent/ext-mail.js"
  1358. "im/messages/mail/Info.plist"
  1359. "enterprisepolicies/moz.build"
  1360. "enterprisepolicies/helpers/moz.build"
  1361. "enterprisepolicies/schemas/moz.build")
  1362. (("Thunderbird") "Icedove")))
  1363. (substitute* '("comm/mailnews/base/prefs/content/accountUtils.js"
  1364. "comm/common/src/customizeToolbar.js")
  1365. (("AppConstants.MOZ_APP_NAME (.)= \"thunderbird" _ e)
  1366. (format #f "AppConstants.MOZ_APP_NAME ~a= \"icedove" e)))
  1367. ;; Override addon URLs and settings
  1368. (substitute* "comm/mail/app/profile/all-thunderbird.js"
  1369. (("(pref\\(\"extensions.webservice.discoverURL\").*" _ m)
  1370. (string-append m ", \"https://directory.fsf.org/wiki/Icedove\");"))
  1371. (("(pref\\(\"extensions.getAddons.search.url\").*" _ m)
  1372. (string-append m ", \"https://guix.gnu.org/packages\");"))
  1373. (("(pref\\(\"extensions.update.enabled\").*" _ m)
  1374. (string-append m ", false);"))
  1375. (("(pref\\(\"extensions.systemAddon.update.enabled\").*" _ m)
  1376. (string-append m ", false);"))
  1377. (("(pref\\(\"lightweightThemes.update.enabled\").*" _ m)
  1378. (string-append m ", false);")))
  1379. #t))
  1380. (add-after 'build 'neutralize-store-references
  1381. (lambda _
  1382. ;; Mangle the store references to compilers & other build tools in
  1383. ;; about:buildconfig, reducing Icedove's closure significant.
  1384. ;; The resulting files are saved in lib/thunderbird/omni.ja
  1385. (substitute*
  1386. ;; Use find because the path "obj-x86_64-pc-linux-gnu" contains
  1387. ;; the architecture and the system -> more complicated.
  1388. (find-files "." "buildconfig.html")
  1389. (((format #f "(~a/)([0-9a-df-np-sv-z]{32})"
  1390. (regexp-quote (%store-directory)))
  1391. _ store hash)
  1392. (string-append store
  1393. (string-take hash 8)
  1394. "<!-- Guix: not a runtime dependency -->"
  1395. (string-drop hash 8))))
  1396. #t))
  1397. (replace 'configure
  1398. (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
  1399. (let* ((out (assoc-ref outputs "out"))
  1400. (bash (which "bash"))
  1401. (abs-srcdir (getcwd))
  1402. (srcdir (string-append "../" (basename abs-srcdir)))
  1403. (flags `(,(string-append "--prefix=" out)
  1404. ,@configure-flags))
  1405. (mozconfig (string-append (getcwd) "/.mozconfig")))
  1406. (setenv "SHELL" bash)
  1407. (setenv "AUTOCONF"
  1408. (string-append (assoc-ref %build-inputs
  1409. "autoconf")
  1410. "/bin/autoconf"))
  1411. (setenv "CONFIG_SHELL" bash)
  1412. (setenv "QA_CONFIGURE_OPTIONS" ".*")
  1413. (setenv "MOZBUILD_STATE_PATH"
  1414. (string-append (getcwd) "/mach_state"))
  1415. (setenv "MOZCONFIG"
  1416. (string-append (getcwd) "/.mozconfig"))
  1417. (setenv "CC" "gcc")
  1418. (setenv "MOZ_NOSPAM" "1")
  1419. (setenv "PYTHON"
  1420. (search-input-file inputs "/bin/python"))
  1421. (setenv "MOZ_BUILD_DATE" ,%icedove-build-id) ; avoid timestamp
  1422. (setenv "LDFLAGS" (string-append "-Wl,-rpath="
  1423. (assoc-ref outputs "out")
  1424. "/lib/icedove"))
  1425. (mkdir-p (string-append (getcwd) "/builddir"))
  1426. (with-output-to-file mozconfig
  1427. (lambda ()
  1428. (display
  1429. (string-append
  1430. "ac_add_options --disable-crashreporter\n"
  1431. "ac_add_options --disable-debug\n"
  1432. "ac_add_options --disable-debug-symbols\n"
  1433. "ac_add_options --disable-elf-hack\n"
  1434. "ac_add_options --disable-jit\n"
  1435. "ac_add_options --disable-necko-wifi\n"
  1436. "ac_add_options --disable-official-branding\n"
  1437. "ac_add_options --disable-tests\n"
  1438. "ac_add_options --disable-updater\n"
  1439. "ac_add_options --disable-webrtc\n"
  1440. "ac_add_options --enable-application=comm/mail\n"
  1441. "ac_add_options --enable-calendar\n"
  1442. "ac_add_options --enable-default-toolkit=\"cairo-gtk3\"\n"
  1443. "ac_add_options --enable-optimize\n"
  1444. "ac_add_options --enable-pulseaudio\n"
  1445. "ac_add_options --enable-release\n"
  1446. "ac_add_options --enable-strip\n"
  1447. "ac_add_options --enable-system-ffi\n"
  1448. "ac_add_options --enable-system-pixman\n"
  1449. "ac_add_options --prefix=" out "\n"
  1450. "ac_add_options --with-clang-path=" (assoc-ref %build-inputs "clang") "/bin/clang\n"
  1451. "ac_add_options --with-distribution-id=org.gnu\n"
  1452. "ac_add_options --with-libclang-path=" (assoc-ref %build-inputs "clang") "/lib\n"
  1453. "ac_add_options --with-system-bz2\n"
  1454. "ac_add_options --with-system-icu\n"
  1455. "ac_add_options --with-system-jpeg\n"
  1456. "ac_add_options --with-system-libevent\n"
  1457. "ac_add_options --with-system-nspr\n"
  1458. "ac_add_options --with-system-nss\n"
  1459. "ac_add_options --with-system-zlib\n"
  1460. "ac_add_options --with-user-appdir=\\.icedove\n"
  1461. "mk_add_options MOZ_MAKE_FLAGS=-j"
  1462. (number->string (parallel-job-count)) "\n"))))
  1463. (display (getcwd))
  1464. (newline)
  1465. (display "mach configure")
  1466. (invoke "./mach" "configure"))))
  1467. (replace 'build
  1468. (lambda _ (invoke "./mach" "build")))
  1469. (replace 'install
  1470. (lambda _ (invoke "./mach" "install")))
  1471. ;; Thunderbird doesn't provide any .desktop file.
  1472. ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1637575
  1473. (add-after 'install 'install-desktop-file
  1474. (lambda* (#:key outputs #:allow-other-keys)
  1475. (let* ((out (assoc-ref outputs "out"))
  1476. (apps (string-append out "/share/applications")))
  1477. (mkdir-p apps)
  1478. (with-output-to-file (string-append apps "/icedove.desktop")
  1479. (lambda _
  1480. (format #t
  1481. "[Desktop Entry]~@
  1482. Name=Icedove~@
  1483. Exec=~a/bin/icedove~@
  1484. Icon=icedove~@
  1485. GenericName=Mail/News Client~@
  1486. Categories=Network;Email;~@
  1487. Terminal=false~@
  1488. StartupNotify=true~@
  1489. MimeType=x-scheme-handler/mailto;~@
  1490. Type=Application~@
  1491. Actions=ComposeMessage;~@
  1492. [Desktop Action ComposeMessage]~@
  1493. Name=Write new message~@
  1494. Exec=~@*~a/bin/icedove -compose~%"
  1495. out))))
  1496. #t))
  1497. (add-after 'install 'wrap-program
  1498. (lambda* (#:key inputs outputs #:allow-other-keys)
  1499. (let* ((out (assoc-ref outputs "out"))
  1500. (lib (string-append out "/lib"))
  1501. (gtk (assoc-ref inputs "gtk+"))
  1502. (gtk-share (string-append gtk "/share"))
  1503. (pulseaudio (assoc-ref inputs "pulseaudio"))
  1504. (pulseaudio-lib (string-append pulseaudio "/lib"))
  1505. (eudev (assoc-ref inputs "eudev"))
  1506. (eudev-lib (string-append eudev "/lib")))
  1507. (wrap-program (car (find-files lib "^icedove$"))
  1508. `("XDG_DATA_DIRS" prefix (,gtk-share))
  1509. `("LD_LIBRARY_PATH" prefix (,pulseaudio-lib ,eudev-lib)))
  1510. #t))))))
  1511. (inputs
  1512. `(("bzip2" ,bzip2)
  1513. ("cairo" ,cairo)
  1514. ("cups" ,cups)
  1515. ("dbus-glib" ,dbus-glib)
  1516. ("ffmpeg" ,ffmpeg)
  1517. ("freetype" ,freetype)
  1518. ("gdk-pixbuf" ,gdk-pixbuf)
  1519. ("glib" ,glib)
  1520. ("gtk+" ,gtk+)
  1521. ("gtk+-2" ,gtk+-2)
  1522. ("hunspell" ,hunspell)
  1523. ("icu4c" ,icu4c-67)
  1524. ("libcanberra" ,libcanberra)
  1525. ("libevent" ,libevent)
  1526. ("libffi" ,libffi)
  1527. ("libgnome" ,libgnome)
  1528. ("libjpeg-turbo" ,libjpeg-turbo)
  1529. ("libpng-apng" ,libpng-apng)
  1530. ("libvpx" ,libvpx)
  1531. ("libxcomposite" ,libxcomposite)
  1532. ("libxft" ,libxft)
  1533. ("libxinerama" ,libxinerama)
  1534. ("libxscrnsaver" ,libxscrnsaver)
  1535. ("libxt" ,libxt)
  1536. ("mesa" ,mesa)
  1537. ("mit-krb5" ,mit-krb5)
  1538. ("nspr" ,nspr)
  1539. ("nss" ,nss)
  1540. ("pango" ,pango)
  1541. ("pixman" ,pixman)
  1542. ("pulseaudio" ,pulseaudio)
  1543. ("sqlite" ,sqlite)
  1544. ("startup-notification" ,startup-notification)
  1545. ("eudev" ,eudev)
  1546. ("unzip" ,unzip)
  1547. ("zip" ,zip)
  1548. ("zlib" ,zlib)))
  1549. (native-inputs
  1550. `(("thunderbird-sources"
  1551. ;; The changeset identifier is taken from the file "sourcestamp.txt"
  1552. ;; in the Thunderbird release tarball. We don't use the release
  1553. ;; tarball because it duplicates the Icecat sources and only adds the
  1554. ;; "comm" directory, which is provided by this repository.
  1555. ,(let ((changeset "adcfedf831da719455116546865f9a5faea848a6"))
  1556. (origin
  1557. (method hg-fetch)
  1558. (uri (hg-reference
  1559. (url "https://hg.mozilla.org/releases/comm-esr78")
  1560. (changeset changeset)))
  1561. (file-name (string-append "thunderbird-" version "-checkout"))
  1562. (sha256
  1563. (base32
  1564. "1dahf3y8bm3kh7amf341wnmh82a2r0ksqihc6dwiakh6x86a94cm")))))
  1565. ("autoconf" ,autoconf-2.13)
  1566. ("cargo" ,rust "cargo")
  1567. ("clang" ,clang)
  1568. ("llvm" ,llvm)
  1569. ("nasm" ,nasm)
  1570. ("node" ,node)
  1571. ("perl" ,perl)
  1572. ("pkg-config" ,pkg-config)
  1573. ("python" ,python)
  1574. ("python2" ,python-2.7)
  1575. ("rust" ,rust)
  1576. ("rust-cbindgen" ,rust-cbindgen-0.14)
  1577. ("which" ,which)
  1578. ("yasm" ,yasm)))
  1579. (home-page "https://www.thunderbird.net")
  1580. (synopsis "Rebranded Mozilla Thunderbird email client")
  1581. (description
  1582. "This package provides an email client built based on Mozilla
  1583. Thunderbird. It supports email, news feeds, chat, calendar and contacts.")
  1584. (license license:mpl2.0)))
  1585. (define-public icedove/wayland
  1586. (package
  1587. (inherit icedove)
  1588. (name "icedove-wayland")
  1589. (native-inputs '())
  1590. (inputs
  1591. `(("bash" ,bash-minimal)
  1592. ("icedove" ,icedove)))
  1593. (build-system trivial-build-system)
  1594. (arguments
  1595. '(#:modules ((guix build utils))
  1596. #:builder
  1597. (begin
  1598. (use-modules (guix build utils))
  1599. (let* ((bash (assoc-ref %build-inputs "bash"))
  1600. (icedove (assoc-ref %build-inputs "icedove"))
  1601. (out (assoc-ref %outputs "out"))
  1602. (exe (string-append out "/bin/icedove")))
  1603. (mkdir-p (dirname exe))
  1604. (call-with-output-file exe
  1605. (lambda (port)
  1606. (format port "#!~a
  1607. MOZ_ENABLE_WAYLAND=1 exec ~a $@"
  1608. (string-append bash "/bin/bash")
  1609. (string-append icedove "/bin/icedove"))))
  1610. (chmod exe #o555)
  1611. ;; Provide the manual and .desktop file.
  1612. (copy-recursively (string-append icedove "/share")
  1613. (string-append out "/share"))
  1614. (substitute* (string-append
  1615. out "/share/applications/icedove.desktop")
  1616. ((icedove) out))
  1617. #t))))))
  1618. (define-public firefox-decrypt
  1619. (package
  1620. (name "firefox-decrypt")
  1621. (version "0.7.0")
  1622. (source (origin
  1623. (method git-fetch)
  1624. (uri (git-reference
  1625. (url "https://github.com/Unode/firefox_decrypt")
  1626. (commit version)))
  1627. (file-name (git-file-name name version))
  1628. (sha256
  1629. (base32
  1630. "17yyyxp47z4m8hnflcq34rc1y871515kr3f1y42j1l0yx3g0il07"))))
  1631. (build-system trivial-build-system)
  1632. (inputs
  1633. `(("nss" ,nss)
  1634. ("python" ,python)))
  1635. (arguments
  1636. `(#:modules ((guix build utils))
  1637. #:builder
  1638. (begin
  1639. (use-modules (guix build utils))
  1640. (setenv "PATH"
  1641. (string-append
  1642. (assoc-ref %build-inputs "python") "/bin"))
  1643. (copy-file (string-append (assoc-ref %build-inputs "source")
  1644. "/firefox_decrypt.py")
  1645. "firefox_decrypt.py")
  1646. (substitute* "firefox_decrypt.py"
  1647. (("/usr/bin/env python") (which "python3"))
  1648. (("libnss3.so") (string-append (assoc-ref %build-inputs "nss")
  1649. "/lib/nss/libnss3.so")))
  1650. (install-file "firefox_decrypt.py" (string-append %output "/bin"))
  1651. #t)))
  1652. (home-page "https://github.com/Unode/firefox_decrypt/")
  1653. (synopsis "Tool to extract passwords from Mozilla profiles")
  1654. (description "Firefox Decrypt is a tool to extract passwords from
  1655. Mozilla (Firefox, Waterfox, Thunderbird, SeaMonkey) profiles.")
  1656. (license license:gpl3+)))