all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] gnu: icecat: Add skia support.
@ 2017-03-06 18:09 Julien Lepiller
  2017-03-06 19:19 ` Leo Famulari
  0 siblings, 1 reply; 2+ messages in thread
From: Julien Lepiller @ 2017-03-06 18:09 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 331 bytes --]

Hi,

Here are three patches to add skia, a graphics library and add support
for it in icecat. It is not made the default graphics engine, so to
enable it, you need to go in about:config and change
`gfx.content.azure.backends' and `gfx.canvas.azure.backends' to `skia'
instead of cairo. Doing this seems to solve the random crashes.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-google-gn.patch --]
[-- Type: text/x-patch, Size: 8459 bytes --]

From a0dab7d185393d3698c7305cd39429e360ca1a37 Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Sun, 5 Mar 2017 09:01:58 +0100
Subject: [PATCH 1/3] gnu: Add google-gn.

* gnu/packages/google.scm: New file.
* gnu/packages/patches/google-gn-remove-third-party.patch: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES, dist_patch_DATA): Add them.
---
 gnu/local.mk                                       |  2 +
 gnu/packages/google.scm                            | 83 ++++++++++++++++++++++
 .../patches/google-gn-remove-third-party.patch     | 76 ++++++++++++++++++++
 3 files changed, 161 insertions(+)
 create mode 100644 gnu/packages/google.scm
 create mode 100644 gnu/packages/patches/google-gn-remove-third-party.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index c88892df5..3e5e5f804 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -165,6 +165,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/packages/gnu-pw-mgr.scm			\
   %D%/packages/gobby.scm			\
   %D%/packages/golang.scm			\
+  %D%/packages/google.scm			\
   %D%/packages/gperf.scm			\
   %D%/packages/gprolog.scm			\
   %D%/packages/gps.scm				\
@@ -599,6 +600,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/gobject-introspection-absolute-shlib-path.patch \
   %D%/packages/patches/gobject-introspection-cc.patch		\
   %D%/packages/patches/gobject-introspection-girepository.patch	\
+  %D%/packages/patches/google-gn-remove-third-party.patch \
   %D%/packages/patches/grep-timing-sensitive-test.patch		\
   %D%/packages/patches/grub-CVE-2015-8370.patch			\
   %D%/packages/patches/grub-gets-undeclared.patch		\
diff --git a/gnu/packages/google.scm b/gnu/packages/google.scm
new file mode 100644
index 000000000..6bc75d000
--- /dev/null
+++ b/gnu/packages/google.scm
@@ -0,0 +1,83 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages google)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages gnuzilla)
+  #:use-module (gnu packages icu4c)
+  #:use-module (gnu packages libevent)
+  #:use-module (gnu packages python)
+  #:use-module (gnu packages ninja)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix git-download)
+  #:use-module (guix utils)
+  #:use-module (guix build-system gnu)
+  #:use-module (srfi srfi-1))
+
+(define-public google-gn
+  (package
+    (name "google-gn")
+    (version "56.0.2924.87")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append "https://commondatastorage.googleapis.com/"
+                            "chromium-browser-official/chromium-" version ".tar.xz"))
+        (sha256
+         (base32
+          "1q2kg85pd6lv036w7lsss5mhiiva9rx4f0410sbn9bnazhghib4s"))
+        (patches (search-patches "google-gn-remove-third-party.patch"))
+        (modules '((guix build utils)))
+        (snippet
+         '(begin
+           (delete-file-recursively "base/third_party/libevent")))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-before 'build 'fix-include
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let* ((libevent (assoc-ref inputs "libevent"))
+                    (event-h (string-append libevent "/include/event.h")))
+               (substitute* "base/message_loop/message_pump_libevent.cc"
+                 (("base/third_party/libevent/event.h") event-h)))))
+         (replace 'build
+           (lambda* (#:key outputs #:allow-other-keys)
+             (chdir "tools/gn")
+             (setenv "CC" (which "gcc"))
+             (zero? (system* "python" "bootstrap/bootstrap.py" "-s"))))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
+               (mkdir-p bin)
+               (copy-file "../../out/Release/gn" (string-append bin "/gn"))))))))
+    (native-inputs
+     `(("python" ,python-2)
+       ("ninja" ,ninja)))
+    (inputs
+     `(("libevent" ,libevent)
+       ("icu" ,icu4c)
+       ("nspr" ,nspr)))
+    (home-page "https://chromium.googlesource.com/chromium/buildtools.git")
+    (synopsis "Google gn")
+    (description "Google gn.")
+    (license license:bsd-3)))
diff --git a/gnu/packages/patches/google-gn-remove-third-party.patch b/gnu/packages/patches/google-gn-remove-third-party.patch
new file mode 100644
index 000000000..742583861
--- /dev/null
+++ b/gnu/packages/patches/google-gn-remove-third-party.patch
@@ -0,0 +1,76 @@
+From 36f44a39630a329b79432836ec6aecb8ab54a6e5 Mon Sep 17 00:00:00 2001
+From: Julien Lepiller <julien@lepiller.eu>
+Date: Tue, 28 Feb 2017 13:39:58 +0100
+Subject: [PATCH] remove third party
+
+This patch removes references to the bundled libevent from the gn build
+script and allows usage of the system libevent.
+
+---
+ tools/gn/bootstrap/bootstrap.py | 34 +---------------------------------
+ 1 file changed, 1 insertion(+), 33 deletions(-)
+
+diff --git a/tools/gn/bootstrap/bootstrap.py b/tools/gn/bootstrap/bootstrap.py
+index 90adca2..0c790a2 100755
+--- a/tools/gn/bootstrap/bootstrap.py
++++ b/tools/gn/bootstrap/bootstrap.py
+@@ -541,29 +541,9 @@ def write_gn_ninja(path, root_gen_dir, options):
+         'base/time/time_posix.cc',
+         'base/trace_event/heap_profiler_allocation_register_posix.cc',
+     ])
+-    static_libraries['libevent'] = {
+-        'sources': [
+-            'base/third_party/libevent/buffer.c',
+-            'base/third_party/libevent/evbuffer.c',
+-            'base/third_party/libevent/evdns.c',
+-            'base/third_party/libevent/event.c',
+-            'base/third_party/libevent/event_tagging.c',
+-            'base/third_party/libevent/evrpc.c',
+-            'base/third_party/libevent/evutil.c',
+-            'base/third_party/libevent/http.c',
+-            'base/third_party/libevent/log.c',
+-            'base/third_party/libevent/poll.c',
+-            'base/third_party/libevent/select.c',
+-            'base/third_party/libevent/signal.c',
+-            'base/third_party/libevent/strlcpy.c',
+-        ],
+-        'tool': 'cc',
+-        'include_dirs': [],
+-        'cflags': cflags + ['-DHAVE_CONFIG_H'],
+-    }
+ 
+   if is_linux:
+-    libs.extend(['-lrt', '-latomic'])
++    libs.extend(['-lrt', '-latomic', '-levent'])
+     ldflags.extend(['-pthread'])
+ 
+     static_libraries['xdg_user_dirs'] = {
+@@ -587,12 +567,6 @@ def write_gn_ninja(path, root_gen_dir, options):
+         'base/threading/platform_thread_linux.cc',
+         'base/trace_event/malloc_dump_provider.cc',
+     ])
+-    static_libraries['libevent']['include_dirs'].extend([
+-        os.path.join(SRC_ROOT, 'base', 'third_party', 'libevent', 'linux')
+-    ])
+-    static_libraries['libevent']['sources'].extend([
+-        'base/third_party/libevent/epoll.c',
+-    ])
+ 
+ 
+   if is_mac:
+@@ -622,12 +596,6 @@ def write_gn_ninja(path, root_gen_dir, options):
+         'base/threading/platform_thread_mac.mm',
+         'base/trace_event/malloc_dump_provider.cc',
+     ])
+-    static_libraries['libevent']['include_dirs'].extend([
+-        os.path.join(SRC_ROOT, 'base', 'third_party', 'libevent', 'mac')
+-    ])
+-    static_libraries['libevent']['sources'].extend([
+-        'base/third_party/libevent/kqueue.c',
+-    ])
+ 
+     libs.extend([
+         '-framework', 'AppKit',
+-- 
+2.7.4
+
-- 
2.12.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-gnu-Add-skia.patch --]
[-- Type: text/x-patch, Size: 6687 bytes --]

From d4f0be152e19163fcff95b6e6d3064c8d448e8d4 Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Sun, 5 Mar 2017 18:45:39 +0100
Subject: [PATCH 2/3] gnu: Add skia.

* gnu/packages/graphics.scm (skia): New variable.
---
 gnu/packages/graphics.scm | 105 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 105 insertions(+)

diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index b55285707..c7ddd9e81 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Andreas Enge <andreas@enge.fr>
+;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -24,6 +25,7 @@
 (define-module (gnu packages graphics)
   #:use-module (guix download)
   #:use-module (guix svn-download)
+  #:use-module (guix git-download)
   #:use-module (guix packages)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system cmake)
@@ -37,6 +39,7 @@
   #:use-module (gnu packages boost)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages haskell)
+  #:use-module (gnu packages icu4c)
   #:use-module (gnu packages image)
   #:use-module (gnu packages python)
   #:use-module (gnu packages flex)
@@ -45,9 +48,11 @@
   #:use-module (gnu packages pulseaudio)  ;libsndfile, libsamplerate
   #:use-module (gnu packages compression)
   #:use-module (gnu packages multiprecision)
+  #:use-module (gnu packages ninja)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
+  #:use-module (gnu packages google)
   #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages gnome)
@@ -537,3 +542,103 @@ and understanding different BRDFs (and other component functions).")
 It supports sub-pixel resolutions and anti-aliasing.  It is also library for
 rendering SVG graphics.")
     (license license:gpl2+)))
+
+(define-public skia
+  (package
+    (name "skia")
+    (version "0")
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+               (url "https://skia.googlesource.com/skia.git")
+               (commit "c746bc15c167bc2a22169c2211fd2e65d9e266f5")))
+        (file-name (string-append name "-" version))
+        (sha256
+         (base32
+          "1x5m8ri6hmj9pbq4amglhkwbkcvhqp4vh8njwlrnlrsaipfdy62c"))
+        (modules '((guix build utils)))
+        (snippet
+         `(begin
+            (chdir "third_party")
+            (delete-file-recursively "expat")
+            (delete-file-recursively "libjpeg-turbo")
+            (delete-file-recursively "freetype2")
+            (delete-file-recursively "libpng")
+            (delete-file-recursively "libwebp")
+            (delete-file-recursively "zlib")
+            (for-each (lambda (dir)
+                        (for-each (lambda (f)
+                                    (mkdir-p (dirname (string-append "externals/" f)))
+                                    (copy-file f (string-append "externals/" f)))
+                                  (find-files dir)))
+                      '("icu" "sfntly"))
+            (chdir "..")
+            (for-each (lambda (f)
+                        (substitute* f
+                          ((".*//third_party/expat.*") "")
+                          ((".*//third_party/freetype2.*") "")
+                          ((".*//third_party/libjpeg-turbo:libjpeg.*") "")
+                          ((".*//third_party/libpng.*") "")
+                          ((".*//third_party/libwebp.*") "")
+                          ((".*//third_party/zlib.*") "")))
+                      '("BUILD.gn" "third_party/dng_sdk/BUILD.gn"))
+            #t))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'configure
+           (lambda* (#:key inputs #:allow-other-keys)
+             (zero? (system*
+                      "gn" "gen" "out/Shared"
+                      (string-append "--args="
+                                     "cc=\"gcc\" "
+                                     "cxx=\"g++\" "
+                                     "extra_cflags=[\"-I"
+                                      (assoc-ref inputs "freetype")
+                                      "/include/freetype2"
+                                     "\"]"
+                                     "skia_use_sfntly=false "
+                                     "skia_use_dng_sdk=false "
+                                     ;"skia_use_system_expat=true "
+                                     ;"skia_use_system_libjpeg_turbo=true "
+                                     ;"skia_use_system_freetype2=true "
+                                     ;"skia_use_system_icu=true "
+                                     ;"skia_use_system_libpng=true "
+                                     ;"skia_use_system_libwebp=true "
+                                     ;"skia_use_system_zlib=true "
+                                     "is_official_build=true "
+                                     "is_component_build=true")))))
+         (replace 'build
+           (lambda* (#:key outputs #:allow-other-keys)
+             (zero? (system* "ninja" "-C" "out/Shared"))))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+              (let ((lib (string-append (assoc-ref outputs "out") "/lib")))
+                (mkdir-p lib)
+                (copy-file "out/Shared/libskia.so"
+                           (string-append lib "/libskia.so"))))))))
+    (native-inputs
+     `(("gn" ,google-gn)
+       ("ninja" ,ninja)
+       ("python" ,python-2)))
+    (inputs
+     `(("expat" ,expat)
+       ("fontconfig" ,fontconfig)
+       ("freetype" ,freetype)
+       ("glu" ,glu)
+       ("icu" ,icu4c)
+       ("libjpeg-turbo" ,libjpeg-turbo)
+       ("libpng" ,libpng)
+       ("libwebp" ,libwebp)
+       ("libz" ,zlib)
+       ("mesa" ,mesa)))
+    (home-page "https://skia.org")
+    (synopsis "2D graphics library")
+    (description "2D graphics library which provides common APIs that work
+across a variety of hardware and software platforms.  It serves as the graphics
+engine for Google Chrome and Chrome OS, Android, Mozilla Firefox and Firefox OS,
+and many other products.")
+    (license license:bsd-3)))
-- 
2.12.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-gnu-icecat-Add-skia-support.patch --]
[-- Type: text/x-patch, Size: 1462 bytes --]

From 7de4430cfae88b3f100e474fd62399e8001c0873 Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Sun, 5 Mar 2017 18:55:43 +0100
Subject: [PATCH 3/3] gnu: icecat: Add skia support.

* gnu/packages/gnuzilla.scm (icecat)[inputs]: Add skia.
---
 gnu/packages/gnuzilla.scm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index c4543aa7d..4533f5ec6 100644
--- a/gnu/packages/gnuzilla.scm
+++ b/gnu/packages/gnuzilla.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
+;;; Copyright © 2016 Julien Lepiller <julien@lepiller.eu>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -49,6 +50,7 @@
   #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages python)
   #:use-module (gnu packages xorg)
+  #:use-module (gnu packages graphics)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages assembly)
   #:use-module (gnu packages icu4c)
@@ -487,6 +489,7 @@ standards.")
                            "--enable-startup-notification"
                            "--enable-pulseaudio"
                            "--enable-gstreamer=1.0"
+                           "--enable-skia"
 
                            "--disable-gnomevfs"
                            "--disable-gconf"
-- 
2.12.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-06 19:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-06 18:09 [PATCH] gnu: icecat: Add skia support Julien Lepiller
2017-03-06 19:19 ` Leo Famulari

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.