guix-more/more/packages/google.scm

google.scm

1
;;; GNU Guix --- Functional package management for GNU
2
;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
3
;;;
4
;;; This file is part of GNU Guix.
5
;;;
6
;;; GNU Guix is free software; you can redistribute it and/or modify it
7
;;; under the terms of the GNU General Public License as published by
8
;;; the Free Software Foundation; either version 3 of the License, or (at
9
;;; your option) any later version.
10
;;;
11
;;; GNU Guix is distributed in the hope that it will be useful, but
12
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
;;; GNU General Public License for more details.
15
;;;
16
;;; You should have received a copy of the GNU General Public License
17
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
18
19
(define-module (more packages google)
20
  #:use-module ((guix licenses) #:prefix license:)
21
  #:use-module (gnu packages)
22
  #:use-module (gnu packages compression)
23
  #:use-module (gnu packages fontutils)
24
  #:use-module (gnu packages gl)
25
  #:use-module (gnu packages gnuzilla)
26
  #:use-module (gnu packages icu4c)
27
  #:use-module (gnu packages image)
28
  #:use-module (gnu packages libevent)
29
  #:use-module (gnu packages ninja)
30
  #:use-module (gnu packages perl)
31
  #:use-module (gnu packages python)
32
  #:use-module (gnu packages ruby)
33
  #:use-module (gnu packages xml)
34
  #:use-module (guix packages)
35
  #:use-module (guix download)
36
  #:use-module (guix git-download)
37
  #:use-module (guix utils)
38
  #:use-module (guix build-system gnu)
39
  #:use-module (srfi srfi-1))
40
41
(define-public chromium
42
  (package
43
    (name "chromium")
44
    (version "56.0.2924.87")
45
    (source
46
      (origin
47
        (method url-fetch)
48
        (uri (string-append "https://commondatastorage.googleapis.com/"
49
                            "chromium-browser-official/" name "-" version ".tar.xz"))
50
        (sha256
51
         (base32
52
          "1q2kg85pd6lv036w7lsss5mhiiva9rx4f0410sbn9bnazhghib4s"))
53
        (patches (search-patches "chromium-gn-remove-third-party.patch"))
54
        (modules '((guix build utils)))
55
        (snippet
56
         '(begin
57
           (delete-file-recursively "base/third_party/libevent")))))
58
    (build-system gnu-build-system)
59
    (home-page "https://chromium.googlesource.com/chromium/src")
60
    (synopsis "Google web browser")
61
    (description "Google web browser.")
62
    (license "bsd-3")))
63
64
(define-public skia
65
  (package
66
    (name "skia")
67
    (version "0")
68
    (source
69
      (origin
70
        (method git-fetch)
71
        (uri (git-reference
72
               (url "https://skia.googlesource.com/skia.git")
73
               (commit "c746bc15c167bc2a22169c2211fd2e65d9e266f5")))
74
        (file-name (string-append name "-" version))
75
        (sha256
76
         (base32
77
          "1x5m8ri6hmj9pbq4amglhkwbkcvhqp4vh8njwlrnlrsaipfdy62c"))
78
        (modules '((guix build utils)))
79
        (snippet
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))))
105
    (build-system gnu-build-system)
106
    (arguments
107
     `(#:tests? #f
108
       #:phases
109
       (modify-phases %standard-phases
110
         (replace 'configure
111
           (lambda* (#:key inputs #:allow-other-keys)
112
             (zero? (system*
113
                      "gn" "gen" "out/Shared"
114
                      (string-append "--args="
115
                                     "cc=\"gcc\" "
116
                                     "cxx=\"g++\" "
117
                                     "extra_cflags=[\"-I"
118
                                      (assoc-ref inputs "freetype")
119
                                      "/include/freetype2"
120
                                     "\"]"
121
                                     "skia_use_sfntly=false "
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 "
126
                                     ;"skia_use_system_icu=true "
127
                                     ;"skia_use_system_libpng=true "
128
                                     ;"skia_use_system_libwebp=true "
129
                                     ;"skia_use_system_zlib=true "
130
                                     "is_official_build=true "
131
                                     "is_component_build=true")))))
132
         (replace 'build
133
           (lambda* (#:key outputs #:allow-other-keys)
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"))))))))
141
    (native-inputs
142
     `(("gn" ,google-gn)
143
       ("ninja" ,ninja)
144
       ("python" ,python-2)))
145
    (inputs
146
     `(("expat" ,expat)
147
       ("fontconfig" ,fontconfig)
148
       ("freetype" ,freetype)
149
       ("glu" ,glu)
150
       ("icu" ,icu4c)
151
       ("libjpeg-turbo" ,libjpeg-turbo)
152
       ("libpng" ,libpng)
153
       ("libwebp" ,libwebp)
154
       ("libz" ,zlib)
155
       ("mesa" ,mesa)))
156
    (home-page "https://skia.org")
157
    (synopsis "Graphics library")
158
    (description "Graphics library.")
159
    (license "bsd-3")))
160
161
(define-public google-gn
162
  (package
163
    (inherit chromium)
164
    (name "google-gn")
165
    (build-system gnu-build-system)
166
    (arguments
167
     `(#:tests? #f
168
       #:phases
169
       (modify-phases %standard-phases
170
         (delete 'configure)
171
         (add-before 'build 'fix-include
172
           (lambda* (#:key inputs #:allow-other-keys)
173
             (let* ((libevent (assoc-ref inputs "libevent"))
174
                    (event-h (string-append libevent "/include/event.h")))
175
               (substitute* "base/message_loop/message_pump_libevent.cc"
176
                 (("base/third_party/libevent/event.h") event-h)))))
177
         (replace 'build
178
           (lambda* (#:key outputs #:allow-other-keys)
179
             (chdir "tools/gn")
180
             (setenv "CC" (which "gcc"))
181
             (zero? (system* "python" "bootstrap/bootstrap.py" "-s"))))
182
         (replace 'install
183
           (lambda* (#:key outputs #:allow-other-keys)
184
             (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
185
               (mkdir-p bin)
186
               (copy-file "../../out/Release/gn" (string-append bin "/gn"))))))))
187
    (native-inputs
188
     `(("python" ,python-2)
189
       ("ninja" ,ninja)))
190
    (inputs
191
     `(("libevent" ,libevent)
192
       ("icu" ,icu4c)
193
       ("nspr" ,nspr)))
194
    (home-page "https://chromium.googlesource.com/chromium/buildtools.git")
195
    (synopsis "Google gn")
196
    (description "Google gn.")
197
    (license license:bsd-3)))
198