build skia and use it in icecat

Julien LepillerThu Mar 02 17:37:59+0100 2017

e2fc856

build skia and use it in icecat

more/packages/gnuzilla.scm unknown status 1

1+
;;; GNU Guix --- Functional package management for GNU
2+
;;; Copyright ?? 2013, 2015 Andreas Enge <andreas@enge.fr>
3+
;;; Copyright ?? 2013, 2014, 2015, 2016, 2017 Ludovic Court??s <ludo@gnu.org>
4+
;;; Copyright ?? 2014, 2015, 2016, 2017 Mark H Weaver <mhw@netris.org>
5+
;;; Copyright ?? 2015 Sou Bunnbu <iyzsong@gmail.com>
6+
;;; Copyright ?? 2016 Efraim Flashner <efraim@flashner.co.il>
7+
;;; Copyright ?? 2016 Alex Griffin <a@ajgrf.com>
8+
;;; Copyright ?? 2017 Julien Lepiller <julien@lepiller.eu>
9+
;;;
10+
;;; This file is part of GNU Guix.
11+
;;;
12+
;;; GNU Guix is free software; you can redistribute it and/or modify it
13+
;;; under the terms of the GNU General Public License as published by
14+
;;; the Free Software Foundation; either version 3 of the License, or (at
15+
;;; your option) any later version.
16+
;;;
17+
;;; GNU Guix is distributed in the hope that it will be useful, but
18+
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19+
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20+
;;; GNU General Public License for more details.
21+
;;;
22+
;;; You should have received a copy of the GNU General Public License
23+
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
24+
25+
(define-module (more packages gnuzilla)
26+
  #:use-module ((srfi srfi-1) #:hide (zip))
27+
  #:use-module (gnu packages)
28+
  #:use-module ((guix licenses) #:prefix license:)
29+
  #:use-module (guix packages)
30+
  #:use-module (guix download)
31+
  #:use-module (guix build-system gnu)
32+
  #:use-module (more packages google)
33+
  #:use-module (gnu packages base)
34+
  #:use-module (gnu packages databases)
35+
  #:use-module (gnu packages glib)
36+
  #:use-module (gnu packages gstreamer)
37+
  #:use-module (gnu packages gtk)
38+
  #:use-module (gnu packages gnome)
39+
  #:use-module (gnu packages gnuzilla)
40+
  #:use-module (gnu packages libcanberra)
41+
  #:use-module (gnu packages cups)
42+
  #:use-module (gnu packages kerberos)
43+
  #:use-module (gnu packages linux)
44+
  #:use-module (gnu packages perl)
45+
  #:use-module (gnu packages pkg-config)
46+
  #:use-module (gnu packages compression)
47+
  #:use-module (gnu packages fontutils)
48+
  #:use-module (gnu packages libevent)
49+
  #:use-module (gnu packages libreoffice)  ;for hunspell
50+
  #:use-module (gnu packages image)
51+
  #:use-module (gnu packages libffi)
52+
  #:use-module (gnu packages pulseaudio)
53+
  #:use-module (gnu packages python)
54+
  #:use-module (gnu packages xorg)
55+
  #:use-module (gnu packages gl)
56+
  #:use-module (gnu packages assembly)
57+
  #:use-module (gnu packages icu4c)
58+
  #:use-module (gnu packages video)
59+
  #:use-module (gnu packages xdisorg)
60+
  #:use-module (gnu packages zip))
61+
62+
(define (mozilla-patch file-name changeset hash)
63+
  "Return an origin for CHANGESET from the mozilla-esr45 repository."
64+
  (origin
65+
    (method url-fetch)
66+
    (uri (string-append "https://hg.mozilla.org/releases/mozilla-esr45/raw-rev/"
67+
                        changeset))
68+
    (sha256 (base32 hash))
69+
    (file-name file-name)))
70+
71+
(define-public icecat-skia
72+
  (package
73+
    (name "icecat-skia")
74+
    (version "45.5.1-gnu1")
75+
    (source
76+
     (origin
77+
      (method url-fetch)
78+
      (uri (string-append "mirror://gnu/gnuzilla/"
79+
                          (first (string-split version #\-))
80+
                          "/" "icecat" "-" version ".tar.bz2"))
81+
      (sha256
82+
       (base32
83+
        "1sbfgsibmb8wfmb2g40gmqwq3nikmrgzksf51ydrz7gnafyfaqw1"))
84+
      (patches
85+
       (list
86+
        (search-patch "icecat-avoid-bundled-libraries.patch")
87+
        (search-patch "icecat-binutils.patch")
88+
        (mozilla-patch "icecat-CVE-2016-9897.patch"      "2e5438a92617" "0pyjbzyy04759ldpcar8q8cccv67j1jkxsg46rkq7a3rbhmwmw4p")
89+
        (mozilla-patch "icecat-CVE-2016-9899.patch"      "7391f60fb790" "1hydggpmmm2cs9lb15micnkxn4wl4cda9g74hkn3zmks805vjz3h")
90+
        (mozilla-patch "icecat-CVE-2016-9893-pt1.patch"  "744e01001e6e" "0z2fq765kap3ll9as5rvjpnbj3pw26074alw7df0zi215qz47nxr")
91+
        (mozilla-patch "icecat-CVE-2016-9904-pt1.patch"  "8ae673f34a5b" "1rlbihckl9afa0y91lqs7gpnv6a7zxzrmxjv95y3yrl03kibqp76")
92+
        (mozilla-patch "icecat-CVE-2016-9904-pt2.patch"  "409c23c144fe" "05kgs16y8s5pxmg2dxp93247zagnj6zgj3209qpm5hz3an7gr13h")
93+
        (mozilla-patch "icecat-CVE-2016-9900.patch"      "994d9bd0e28d" "007wifyx3b2ln4fwv1i8n24yz5ngjf4mkzd7sqr5bpd3q88ff293")
94+
        (mozilla-patch "icecat-CVE-2016-9893-pt2.patch"  "0fc43af8982e" "0pc8q9knzq2knj723mwkay1lnzbzysb07ygxnc16mcb6f7vl2mw8")
95+
        (mozilla-patch "icecat-CVE-2016-9893-pt3.patch"  "19f9a4643d77" "0w5yxj1l0hvs66q9agjp4m5sfby7fj05lx33gaqf899bw4hn4vcf")
96+
        (mozilla-patch "icecat-CVE-2016-9893-pt4.patch"  "c58442c414f5" "1z1w1v8xagkhrwgp51ij1k2gx0ripslia09vm78812n7gcwddaas")
97+
        (mozilla-patch "icecat-CVE-2016-9898.patch"      "5054047b7328" "0xlw8irymfp3bcaa5jpf7clf7bq6qxp3i8zapp8jya8lzr1nf868")
98+
        (mozilla-patch "icecat-bug-881832-pt1.patch"     "1123263318a3" "1qkxwva3zrcs1zhga8ncmndq03988dx75i896g53gbvpskj06915")
99+
        (mozilla-patch "icecat-bug-881832-pt2.patch"     "dc87c0a39adf" "01rapf14f3r2wk0cjd16dn1rll4ipgs33cnjmjck48nvk67ikz6h")
100+
        (mozilla-patch "icecat-bug-881832-pt3.patch"     "f20e5f488368" "15ql9ywifb3gm2g1057k63f821dbs3wqsh3zhndprzf3dn6aha4i")
101+
        (mozilla-patch "icecat-bug-881832-pt4.patch"     "7950c4d5bd7c" "0jhkg5hq5yfy7rh21k1mpbsbr81ql85aazym30zy3n2cf28xxhd7")
102+
        (mozilla-patch "icecat-bug-881832-pt5.patch"     "972734ec21b6" "073i4v1f1ydy49i57pvzscz95sjr5bbk9s5sajxvmmcsmwhpjdfy")
103+
        (mozilla-patch "icecat-CVE-2016-9905-pt1.patch"  "aebd3687e05e" "1qz6hdgflcrqyg7fv66cbg23v4b7q5bc2yxzrgjxs4j1d7jy1s0s")
104+
        (mozilla-patch "icecat-CVE-2016-9905-pt2.patch"  "63d8e5cd27cb" "11fsgyngy7v59ma30xdbmycwf4izwikzvaljngm3ks4534inpl4a")
105+
        (mozilla-patch "icecat-bug-1279202.patch"        "e560997291af" "1hn35slasfcj3ryka4fsarx4l9r99z0iwj67fmbv6zxz4z133kks")
106+
        (mozilla-patch "icecat-CVE-2016-9902.patch"      "21c615b65048" "0ibgsxa36x9ajn2jqbhxxvrfvj6x6iyspsmzzn4brdz11n93skhr")
107+
        (mozilla-patch "icecat-CVE-2016-9901.patch"      "c15e5afc0430" "17gj32agqs94548z8lvz0l6zz3kbwajn8as0y4iw5nb6jsll4c66")
108+
        (mozilla-patch "icecat-CVE-2016-9893-pt5.patch"  "46163fb1cb34" "1yikayczfgfla3aka0159apq3149d52sgvlca0sivx4myd0lvjm7")
109+
        (mozilla-patch "icecat-CVE-2016-9893-pt6.patch"  "cde2a37100f5" "100abggnhwyw84almxrkxqfpyfkd4pqkcrh5y9g4d3jd2h16asvl")
110+
        (mozilla-patch "icecat-CVE-2016-9893-pt7.patch"  "9b78ab1e6d07" "19ib6bp96xk000ll40b8qxvizkncyzclz2rsb9w5fa42qs9978ff")
111+
        (mozilla-patch "icecat-CVE-2016-9893-pt8.patch"  "78ebf9c9dfb0" "1shgr4rk6r2zxr1qqk1j3qnnqzqxnbi093qhlrfh8q5q1ivqf6k1")
112+
        (mozilla-patch "icecat-CVE-2016-9893-pt9.patch"  "a46a9f16823c" "0dwkyz3kcqnfcbhbfh2lss7s0yh87rgzb871qxx3x4ynyqph9mnz")
113+
        (mozilla-patch "icecat-CVE-2017-5376.patch"      "6bc7cc7a33a6" "1wggcqv84n8mp7xps7hy4rwy61fkh45imfqzc0b46s3w5hyhypn2")
114+
        (mozilla-patch "icecat-CVE-2016-9893-pt10.patch" "778f65148b40" "0j2a153sk0654vv2lnxjib4lwml3mlqn6vs46c2pp82iba8nyfrm")
115+
        (mozilla-patch "icecat-CVE-2016-9895.patch"      "94bd2b43c766" "10h0qpr6m9cqyqxxnkbb6mzb3cagavzlynkxgd7a4izyq1bv28rk")
116+
        (mozilla-patch "icecat-CVE-2016-9893-pt11.patch" "893de7431d51" "11gyik8mwipl6ipypkvdq519pw7ccbg0g0bnvxb7271n44cqqcq5")
117+
        (mozilla-patch "icecat-CVE-2017-5383-pt1.patch"  "b21dee058b2c" "005khpimffqzas7slajid4dd2c15nyk7rjk6fsps87bgnx0gx0s4")
118+
        (mozilla-patch "icecat-bug-1258410-pt1.patch"    "cd23c5d74be8" "1myzkpzg6pmjacjz8az06m9kz84in1mwsiaw5sgx47pm02598wm5")
119+
        (mozilla-patch "icecat-bug-1258410-pt2.patch"    "b83594617d15" "171cqflc9jh47az96im1whwhyq4ayicspqsczsmn2x5ll9lqw5fq")
120+
        (mozilla-patch "icecat-CVE-2017-5380.patch"      "d6c6f5e4e641" "10x9f46ylm2q3i669hj1csd6agdm8w7xa0iln691z8ayg2hcrxdz")
121+
        (mozilla-patch "icecat-CVE-2017-5373-pt1.patch"  "122f5fbfc563" "05pp2f4pg4j8a8pdgjhfrc8g2chhkhsarn9n8sbyag0fy3ig1cvd")
122+
        (mozilla-patch "icecat-CVE-2017-5390.patch"      "297c675ddadc" "1jc1b5i69vq1fvz3qfnnv52c9cj17bjbmfyzmqlw5ywna0wfvabz")
123+
        (mozilla-patch "icecat-CVE-2017-5373-pt2.patch"  "3cff736e3bb6" "1nxqwnl9zksvkfkmis7zica4xrhwfndjyy2sxc1dvrh9rshk1swq")
124+
        (mozilla-patch "icecat-CVE-2017-5373-pt3.patch"  "2732280adabc" "0zrpq3aybaw2yy38vs6883a4nw01x4kxn3lfqn9yhcgjvngmmyia")
125+
        (mozilla-patch "icecat-CVE-2017-5373-pt4.patch"  "81c9fdbd96e8" "0scv1zyi4vbsjdsyj4w70n5jd50baq0dzw3qpxqf1n69nfb9k214")
126+
        (mozilla-patch "icecat-CVE-2017-5373-pt5.patch"  "a386ca6a3013" "1m1scz2pxzmg9wya8is5dcr3mgvkx3g1xlykgigmw2mqs5zcdg9s")
127+
        (mozilla-patch "icecat-CVE-2017-5373-pt6.patch"  "0521b0e4707c" "1mv057p4hcvapibpbd9apryag19aiqdzafc6df2angl97m4mcbjx")
128+
        (mozilla-patch "icecat-bug-1290037.patch"        "bf0dd9ae6807" "02iw5ngsvvij95arnn69a744d6si27g1x41ixg16l51dbn900b3r")
129+
        (mozilla-patch "icecat-bug-1322666.patch"        "576f03e362c5" "0m88xs0jwhzx2lg12cvimxjknp7rpsvvhxxblhiqqjwnqip0pyc0")
130+
        (mozilla-patch "icecat-bug-1304266.patch"        "4d82e7314a72" "1rrrw4rw0xv7c2myiypcqh1fk47rk3fvic79zh6m04bl3knclr1r")
131+
        (mozilla-patch "icecat-CVE-2017-5373-pt7.patch"  "0617dd4b444d" "1ipags2cl2p521pm0qx110h5di2mgif6h1r3g8l9b0rc5m9b1y2j")
132+
        (mozilla-patch "icecat-CVE-2017-5375.patch"      "ead08c2a6c57" "1nnnwdr7411xpz6n9j869g6sz447cq6xsmds9cw6d24iprcinp5m")
133+
        (mozilla-patch "icecat-CVE-2017-5378-pt1.patch"  "c5e67d41bdd0" "05kwn5zv381lsiw9vbzm8fh6s1lddx47l8f4pwg487h9dj7vbdfq")
134+
        (mozilla-patch "icecat-CVE-2017-5373-pt8.patch"  "2ce94f2ea797" "1yrnjqpafjns68z99s1m6jins3agid7c1z3v9qgk5xzfcddl31pn")
135+
        (mozilla-patch "icecat-CVE-2017-5373-pt9.patch"  "e4ac8a66d3db" "1ggbh6nk005plm7kvp7qznbnlpidqkipxc5hlaqbjc3m0z9mypzl")
136+
        (mozilla-patch "icecat-CVE-2017-5386.patch"      "8c171b75a0c6" "1cplkgwkhqvb62q7s8cya2drjdswnlicv5d9a60fxvnp6m7a3z02")
137+
        (mozilla-patch "icecat-CVE-2017-5383-pt2.patch"  "79a31d8153bf" "0dzwk2hc741c0jr8xya4y8q59lk8mcgnvfdrdk0vzq1gby16b9zi")
138+
        (mozilla-patch "icecat-CVE-2017-5378-pt2.patch"  "747085a1cd93" "0rpc8hl0jka4akdjnlwya4x9v4pqa1r5vc4pkmxsgvqpp2vkq4m2")
139+
        (mozilla-patch "icecat-bug-1331606.patch"        "f0329536734b" "1br5shyfwp009y623wgjq60vhcp5k5zpzkgy4r3s5yrm5xyfcprf")
140+
        (mozilla-patch "icecat-bug-1328642.patch"        "237c1ca6e035" "0808g5j17var6wv6ivj08i43fwkga9abmmgmz5w3hb8mhajkjw58")
141+
        (mozilla-patch "icecat-CVE-2017-5396.patch"      "910ad552cbf5" "1qss3gc6n4myzwvwanc09xvyiq3hwhixn2xvpbk9xkfz2apdlfa6")
142+
        (mozilla-patch "icecat-bug-1312827.patch"        "5c894801eb1e" "03xyjwx9rfx5w7q6wq9if83fcfgrlvvbyxpsawzxxgybnizyy7g8")
143+
        (mozilla-patch "icecat-bug-1191841.patch"        "83ee87b301bd" "1kd9z4py372a2f1jg7jwvwri43vipf0k7lcvsg7b0cqr5p70zwcg")
144+
        (mozilla-patch "icecat-bug-1234317.patch"        "eb6f18dbfe8d" "1dh3263fvg3dxav09g6fn41ax4q1jmwp5fk6pl6shn16mrfha1qq")))
145+
      (modules '((guix build utils)))
146+
      (snippet
147+
       '(begin
148+
          (use-modules (ice-9 ftw))
149+
          ;; Remove bundled libraries that we don't use, since they may
150+
          ;; contain unpatched security flaws, they waste disk space and
151+
          ;; network bandwidth, and may cause confusion.
152+
          (for-each delete-file-recursively
153+
                    '(;; FIXME: Removing the bundled icu breaks configure.
154+
                      ;;   * The bundled icu headers are used in some places.
155+
                      ;;   * The version number is taken from the bundled copy.
156+
                      ;;"intl/icu"
157+
                      ;;
158+
                      ;; FIXME: A script from the bundled nspr is used.
159+
                      ;;"nsprpub"
160+
                      ;;
161+
                      ;; TODO: Use system media libraries.  Waiting for:
162+
                      ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
163+
                      ;;   * libogg
164+
                      ;;   * libtheora
165+
                      ;;   * libvorbis
166+
                      ;;   * libtremor (not yet in guix)
167+
                      ;;   * libopus
168+
                      ;;   * speex
169+
                      ;;   * soundtouch (not yet in guix)
170+
                      ;;
171+
                      ;; TODO: Use system harfbuzz.  Waiting for:
172+
                      ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=847568>
173+
                      ;;
174+
                      ;; TODO: Use system graphite2.
175+
                      ;;
176+
                      "modules/freetype2"
177+
                      "modules/zlib"
178+
                      "modules/libbz2"
179+
                      "ipc/chromium/src/third_party/libevent"
180+
                      "media/libjpeg"
181+
                      "media/libvpx"
182+
                      "security/nss"
183+
                      "gfx/cairo"
184+
                      "js/src/ctypes/libffi"
185+
                      "db/sqlite3"))
186+
          ;; Delete .pyc files, typically present in icecat source tarballs
187+
          (for-each delete-file (find-files "." "\\.pyc$"))
188+
          ;; Delete obj-* directories, sometimes present in icecat tarballs
189+
          (for-each delete-file-recursively
190+
                    (scandir "." (lambda (name)
191+
                                   (string-prefix? "obj-" name))))
192+
          #t))))
193+
    (build-system gnu-build-system)
194+
    (inputs
195+
     `(("alsa-lib" ,alsa-lib)
196+
       ("bzip2" ,bzip2)
197+
       ("cairo" ,cairo)
198+
       ("cups" ,cups)
199+
       ("dbus-glib" ,dbus-glib)
200+
       ("gdk-pixbuf" ,gdk-pixbuf)
201+
       ("glib" ,glib)
202+
       ("gstreamer" ,gstreamer)
203+
       ("gst-plugins-base" ,gst-plugins-base)
204+
       ("gtk+" ,gtk+-2)
205+
       ("pango" ,pango)
206+
       ("freetype" ,freetype)
207+
       ("hunspell" ,hunspell)
208+
       ("libcanberra" ,libcanberra)
209+
       ("libgnome" ,libgnome)
210+
       ("libjpeg-turbo" ,libjpeg-turbo)
211+
       ("libxft" ,libxft)
212+
       ("libevent" ,libevent-2.0)
213+
       ("libxinerama" ,libxinerama)
214+
       ("libxscrnsaver" ,libxscrnsaver)
215+
       ("libxcomposite" ,libxcomposite)
216+
       ("libxt" ,libxt)
217+
       ("libffi" ,libffi)
218+
       ("libvpx" ,libvpx)
219+
       ("icu4c" ,icu4c)
220+
       ("pixman" ,pixman)
221+
       ("pulseaudio" ,pulseaudio)
222+
       ("mesa" ,mesa)
223+
       ("mit-krb5" ,mit-krb5)
224+
       ("nspr" ,nspr)
225+
       ("nss" ,nss)
226+
       ("skia" ,skia)
227+
       ("sqlite" ,sqlite)
228+
       ("startup-notification" ,startup-notification)
229+
       ("unzip" ,unzip)
230+
       ("yasm" ,yasm)
231+
       ("zip" ,zip)
232+
       ("zlib" ,zlib)))
233+
    (native-inputs
234+
     `(("perl" ,perl)
235+
       ("python" ,python-2) ; Python 3 not supported
236+
       ("python2-pysqlite" ,python2-pysqlite)
237+
       ("pkg-config" ,pkg-config)
238+
       ("which" ,which)))
239+
    (arguments
240+
     `(#:tests? #f          ; no check target
241+
       #:out-of-source? #t  ; must be built outside of the source directory
242+
       #:parallel-build? #f
243+
244+
       ;; XXX: There are RUNPATH issues such as
245+
       ;; $prefix/lib/icecat-31.6.0/plugin-container NEEDing libmozalloc.so,
246+
       ;; which is not in its RUNPATH, but they appear to be harmless in
247+
       ;; practice somehow.  See <http://hydra.gnu.org/build/378133>.
248+
       #:validate-runpath? #f
249+
250+
       #:configure-flags '("--enable-default-toolkit=cairo-gtk2"
251+
                           "--enable-pango"
252+
                           "--enable-gio"
253+
                           "--enable-svg"
254+
                           "--enable-canvas"
255+
                           "--enable-mathml"
256+
                           "--enable-startup-notification"
257+
                           "--enable-pulseaudio"
258+
                           "--enable-gstreamer=1.0"
259+
                           "--enable-skia"
260+
261+
                           "--disable-gnomevfs"
262+
                           "--disable-gconf"
263+
                           "--disable-gnomeui"
264+
265+
                           ;; Building with debugging symbols takes ~5GiB, so
266+
                           ;; disable it.
267+
                           "--disable-debug"
268+
                           "--disable-debug-symbols"
269+
270+
                           ;; Hack to work around missing
271+
                           ;; "unofficial" branding in icecat.
272+
                           "--enable-official-branding"
273+
274+
                           ;; Avoid bundled libraries.
275+
                           "--with-system-zlib"
276+
                           "--with-system-bz2"
277+
                           "--with-system-jpeg"        ; must be libjpeg-turbo
278+
                           "--with-system-libevent"
279+
                           "--with-system-libvpx"
280+
                           "--with-system-icu"
281+
                           "--with-system-nspr"
282+
                           "--with-system-nss"
283+
                           "--enable-system-pixman"
284+
                           "--enable-system-cairo"
285+
                           "--enable-system-ffi"
286+
                           "--enable-system-hunspell"
287+
                           "--enable-system-sqlite"
288+
289+
                           ;; Fails with "--with-system-png won't work because
290+
                           ;; the system's libpng doesn't have APNG support".
291+
                           ;; According to
292+
                           ;; http://sourceforge.net/projects/libpng-apng/ ,
293+
                           ;; "the Animated Portable Network Graphics (APNG)
294+
                           ;; is an unofficial extension of the Portable
295+
                           ;; Network Graphics (PNG) format";
296+
                           ;; we probably do not wish to support it.
297+
                           ;; "--with-system-png"
298+
                           )
299+
300+
       #:modules ((ice-9 ftw)
301+
                  (ice-9 rdelim)
302+
                  (ice-9 match)
303+
                  ,@%gnu-build-system-modules)
304+
       #:phases
305+
       (modify-phases %standard-phases
306+
         (add-after
307+
          'unpack 'ensure-no-mtimes-pre-1980
308+
          (lambda _
309+
            ;; Without this, the 'source/test/addons/packed.xpi' and
310+
            ;; 'source/test/addons/simple-prefs.xpi' targets fail while trying
311+
            ;; to create zip archives.
312+
            (let ((early-1980 315619200)) ; 1980-01-02 UTC
313+
              (ftw "." (lambda (file stat flag)
314+
                         (unless (<= early-1980 (stat:mtime stat))
315+
                           (utime file early-1980 early-1980))
316+
                         #t))
317+
              #t)))
318+
         (add-after
319+
          'unpack 'remove-h264parse-from-blacklist
320+
          (lambda _
321+
            ;; Remove h264parse from gstreamer format helper blacklist.  It
322+
            ;; was put there to work around a bug in a pre-1.0 version of
323+
            ;; gstreamer.  See:
324+
            ;; https://www.mozilla.org/en-US/security/advisories/mfsa2015-47/
325+
            (substitute* "dom/media/gstreamer/GStreamerFormatHelper.cpp"
326+
              (("^  \"h264parse\",\n") ""))
327+
            #t))
328+
         (add-after
329+
          'unpack 'arrange-to-link-libxul-with-libraries-it-might-dlopen
330+
          (lambda _
331+
            ;; libxul.so dynamically opens libraries, so here we explicitly
332+
            ;; link them into libxul.so instead.
333+
            ;;
334+
            ;; TODO: It might be preferable to patch in absolute file names in
335+
            ;; calls to dlopen or PR_LoadLibrary, but that didn't seem to
336+
            ;; work.  More investigation is needed.
337+
            (substitute* "toolkit/library/moz.build"
338+
              (("^# This needs to be last")
339+
               "OS_LIBS += [
340+
    'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5',
341+
    'gstreamer-1.0', 'gstapp-1.0', 'gstvideo-1.0' ]\n\n"))
342+
            #t))
343+
         (replace
344+
          'configure
345+
          ;; configure does not work followed by both "SHELL=..." and
346+
          ;; "CONFIG_SHELL=..."; set environment variables instead
347+
          (lambda* (#:key outputs configure-flags #:allow-other-keys)
348+
            (let* ((out (assoc-ref outputs "out"))
349+
                   (bash (which "bash"))
350+
                   (abs-srcdir (getcwd))
351+
                   (srcdir (string-append "../" (basename abs-srcdir)))
352+
                   (flags `(,(string-append "--prefix=" out)
353+
                            ,(string-append "--with-l10n-base="
354+
                                            abs-srcdir "/l10n")
355+
                            ,@configure-flags)))
356+
              (setenv "SHELL" bash)
357+
              (setenv "CONFIG_SHELL" bash)
358+
              (mkdir "../build")
359+
              (chdir "../build")
360+
              (format #t "build directory: ~s~%" (getcwd))
361+
              (format #t "configure flags: ~s~%" flags)
362+
              (zero? (apply system* bash
363+
                            (string-append srcdir "/configure")
364+
                            flags)))))
365+
         (add-before 'configure 'install-desktop-entry
366+
           (lambda* (#:key outputs #:allow-other-keys)
367+
             ;; Install the '.desktop' file.
368+
             (define (swallow-%%-directives input output)
369+
               ;; Interpret '%%ifdef' directives found in the '.desktop' file.
370+
               (let loop ((state 'top))
371+
                 (match (read-line input 'concat)
372+
                   ((? eof-object?)
373+
                    #t)
374+
                   ((? string? line)
375+
                    (cond ((string-prefix? "%%ifdef" line)
376+
                           (loop 'ifdef))
377+
                          ((string-prefix? "%%else" line)
378+
                           (loop 'else))
379+
                          ((string-prefix? "%%endif" line)
380+
                           (loop 'top))
381+
                          (else
382+
                           (case state
383+
                             ((top else)
384+
                              (display line output)
385+
                              (loop state))
386+
                             (else
387+
                              (loop state)))))))))
388+
389+
             (let* ((out (assoc-ref outputs "out"))
390+
                    (applications (string-append out "/share/applications")))
391+
               (call-with-input-file "debian/icecat.desktop.in"
392+
                 (lambda (input)
393+
                   (call-with-output-file "debian/icecat.desktop"
394+
                     (lambda (output)
395+
                       (swallow-%%-directives input output)))))
396+
397+
               (substitute* "debian/icecat.desktop"
398+
                 (("@MOZ_DISPLAY_NAME@")
399+
                  "GNU IceCat")
400+
                 (("^Exec=@MOZ_APP_NAME@")
401+
                  (string-append "Exec=" out "/bin/icecat"))
402+
                 (("@MOZ_APP_NAME@")
403+
                  "icecat"))
404+
               (install-file "debian/icecat.desktop" applications)
405+
               #t)))
406+
         (add-after 'install-desktop-entry 'install-icons
407+
           (lambda* (#:key outputs #:allow-other-keys)
408+
             (let ((out (assoc-ref outputs "out")))
409+
               (with-directory-excursion "browser/branding/official"
410+
                 (for-each
411+
                  (lambda (file)
412+
                    (let* ((size (string-filter char-numeric? file))
413+
                           (icons (string-append out "/share/icons/hicolor/"
414+
                                                 size "x" size "/apps")))
415+
                      (mkdir-p icons)
416+
                      (copy-file file (string-append icons "/icecat.png"))))
417+
                  '("default16.png" "default22.png" "default24.png"
418+
                    "default32.png" "default48.png" "content/icon64.png"
419+
                    "mozicon128.png" "default256.png")))))))))
420+
    (home-page "http://www.gnu.org/software/gnuzilla/")
421+
    (synopsis "Entirely free browser derived from Mozilla Firefox")
422+
    (description
423+
     "IceCat is the GNU version of the Firefox browser.  It is entirely free
424+
software, which does not recommend non-free plugins and addons.  It also
425+
features built-in privacy-protecting features.")
426+
    (license license:mpl2.0)     ;and others, see toolkit/content/license.html
427+
    (properties
428+
     `((ftp-directory . "/gnu/gnuzilla")
429+
       (cpe-name . "firefox_esr")
430+
       (cpe-version . ,(first (string-split version #\-)))))))

more/packages/google.scm

2020
  #:use-module ((guix licenses) #:prefix license:)
2121
  #:use-module (gnu packages)
2222
  #:use-module (gnu packages compression)
23-
  #:use-module (gnu packages icu4c)
2423
  #:use-module (gnu packages fontutils)
24+
  #:use-module (gnu packages gl)
2525
  #:use-module (gnu packages gnuzilla)
26+
  #:use-module (gnu packages icu4c)
2627
  #:use-module (gnu packages image)
2728
  #:use-module (gnu packages libevent)
28-
  #:use-module (gnu packages python)
29+
  #:use-module (gnu packages ninja)
2930
  #:use-module (gnu packages perl)
31+
  #:use-module (gnu packages python)
3032
  #:use-module (gnu packages ruby)
31-
  #:use-module (gnu packages ninja)
3233
  #:use-module (gnu packages xml)
3334
  #:use-module (guix packages)
3435
  #:use-module (guix download)

7677
          "1x5m8ri6hmj9pbq4amglhkwbkcvhqp4vh8njwlrnlrsaipfdy62c"))
7778
        (modules '((guix build utils)))
7879
        (snippet
79-
         `(delete-file-recursively "third_party"))))
80+
         `(begin
81+
            (chdir "third_party")
82+
            (delete-file-recursively "expat")
83+
            (delete-file-recursively "libjpeg-turbo")
84+
            (delete-file-recursively "freetype2")
85+
            (delete-file-recursively "libpng")
86+
            (delete-file-recursively "libwebp")
87+
            (delete-file-recursively "zlib")
88+
            (for-each (lambda (dir)
89+
                        (for-each (lambda (f)
90+
                                    (mkdir-p (dirname (string-append "externals/" f)))
91+
                                    (copy-file f (string-append "externals/" f)))
92+
                                  (find-files dir)))
93+
                      '("icu" "sfntly"))
94+
            (chdir "..")
95+
            (for-each (lambda (f)
96+
                        (substitute* f
97+
                          ((".*//third_party/expat.*") "")
98+
                          ((".*//third_party/freetype2.*") "")
99+
                          ((".*//third_party/libjpeg-turbo:libjpeg.*") "")
100+
                          ((".*//third_party/libpng.*") "")
101+
                          ((".*//third_party/libwebp.*") "")
102+
                          ((".*//third_party/zlib.*") "")))
103+
                      '("BUILD.gn" "third_party/dng_sdk/BUILD.gn"))
104+
            #t))))
80105
    (build-system gnu-build-system)
81106
    (arguments
82107
     `(#:tests? #f
83108
       #:phases
84109
       (modify-phases %standard-phases
85110
         (replace 'configure
86-
           (lambda* (#:key outputs #:allow-other-keys)
111+
           (lambda* (#:key inputs #:allow-other-keys)
87112
             (zero? (system*
88113
                      "gn" "gen" "out/Shared"
89114
                      (string-append "--args="
90115
                                     "cc=\"gcc\" "
91116
                                     "cxx=\"g++\" "
117+
                                     "extra_cflags=[\"-I"
118+
                                      (assoc-ref inputs "freetype")
119+
                                      "/include/freetype2"
120+
                                     "\"]"
92121
                                     "skia_use_sfntly=false "
93-
                                     "skia_use_system_expat=true "
94-
                                     "skia_use_system_libjpeg_turbo=true "
95-
                                     "skia_use_system_freetype2=true "
122+
                                     "skia_use_dng_sdk=false "
123+
                                     ;"skia_use_system_expat=true "
124+
                                     ;"skia_use_system_libjpeg_turbo=true "
125+
                                     ;"skia_use_system_freetype2=true "
96126
                                     ;"skia_use_system_icu=true "
97-
                                     "skia_use_system_libpng=true "
98-
                                     "skia_use_system_libwebp=true "
99-
                                     "skia_use_system_zlib=true "
127+
                                     ;"skia_use_system_libpng=true "
128+
                                     ;"skia_use_system_libwebp=true "
129+
                                     ;"skia_use_system_zlib=true "
100130
                                     "is_official_build=true "
101131
                                     "is_component_build=true")))))
102132
         (replace 'build
103133
           (lambda* (#:key outputs #:allow-other-keys)
104-
             (zero? (system* "ninja" "-C" "out/Shared")))))))
134+
             (zero? (system* "ninja" "-C" "out/Shared"))))
135+
         (replace 'install
136+
           (lambda* (#:key outputs #:allow-other-keys)
137+
              (let ((lib (string-append (assoc-ref outputs "out") "/lib")))
138+
                (mkdir-p lib)
139+
                (copy-file "out/Shared/libskia.so"
140+
                           (string-append lib "/libskia.so"))))))))
105141
    (native-inputs
106142
     `(("gn" ,google-gn)
107143
       ("ninja" ,ninja)
108144
       ("python" ,python-2)))
109145
    (inputs
110146
     `(("expat" ,expat)
147+
       ("fontconfig" ,fontconfig)
111148
       ("freetype" ,freetype)
112-
       ("libpng" ,libpng)
113-
       ("libz" ,zlib)
149+
       ("glu" ,glu)
114150
       ("icu" ,icu4c)
151+
       ("libjpeg-turbo" ,libjpeg-turbo)
152+
       ("libpng" ,libpng)
115153
       ("libwebp" ,libwebp)
116-
       ("libjpeg-turbo" ,libjpeg-turbo)))
154+
       ("libz" ,zlib)
155+
       ("mesa" ,mesa)))
117156
    (home-page "https://skia.org")
118157
    (synopsis "Graphics library")
119158
    (description "Graphics library.")