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
                    (include (string-append (assoc-ref outputs "out")
139
                                            "/include")))
140
                (mkdir-p lib)
141
                (mkdir-p include)
142
                (copy-recursively "include" include)
143
                (copy-file "out/Shared/libskia.so"
144
                           (string-append lib "/libskia.so"))))))))
145
    (native-inputs
146
     `(("gn" ,google-gn)
147
       ("ninja" ,ninja)
148
       ("python" ,python-2)))
149
    (inputs
150
     `(("expat" ,expat)
151
       ("fontconfig" ,fontconfig)
152
       ("freetype" ,freetype)
153
       ("glu" ,glu)
154
       ("icu" ,icu4c)
155
       ("libjpeg-turbo" ,libjpeg-turbo)
156
       ("libpng" ,libpng)
157
       ("libwebp" ,libwebp)
158
       ("libz" ,zlib)
159
       ("mesa" ,mesa)))
160
    (home-page "https://skia.org")
161
    (synopsis "Graphics library")
162
    (description "Graphics library.")
163
    (license "bsd-3")))
164
165
(define-public google-gn
166
  (package
167
    (inherit chromium)
168
    (name "google-gn")
169
    (build-system gnu-build-system)
170
    (arguments
171
     `(#:tests? #f
172
       #:phases
173
       (modify-phases %standard-phases
174
         (delete 'configure)
175
         (add-before 'build 'fix-include
176
           (lambda* (#:key inputs #:allow-other-keys)
177
             (let* ((libevent (assoc-ref inputs "libevent"))
178
                    (event-h (string-append libevent "/include/event.h")))
179
               (substitute* "base/message_loop/message_pump_libevent.cc"
180
                 (("base/third_party/libevent/event.h") event-h)))))
181
         (replace 'build
182
           (lambda* (#:key outputs #:allow-other-keys)
183
             (chdir "tools/gn")
184
             (setenv "CC" (which "gcc"))
185
             (zero? (system* "python" "bootstrap/bootstrap.py" "-s"))))
186
         (replace 'install
187
           (lambda* (#:key outputs #:allow-other-keys)
188
             (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
189
               (mkdir-p bin)
190
               (copy-file "../../out/Release/gn" (string-append bin "/gn"))))))))
191
    (native-inputs
192
     `(("python" ,python-2)
193
       ("ninja" ,ninja)))
194
    (inputs
195
     `(("libevent" ,libevent)
196
       ("icu" ,icu4c)
197
       ("nspr" ,nspr)))
198
    (home-page "https://chromium.googlesource.com/chromium/buildtools.git")
199
    (synopsis "Google gn")
200
    (description "Google gn.")
201
    (license license:bsd-3)))
202