From d4f0be152e19163fcff95b6e6d3064c8d448e8d4 Mon Sep 17 00:00:00 2001 From: Julien Lepiller 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 ;;; Copyright © 2016 Efraim Flashner ;;; Copyright © 2016 Andreas Enge +;;; Copyright © 2017 Julien Lepiller ;;; ;;; 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