guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

80/242: gnu: Add skia.


From: guix-commits
Subject: 80/242: gnu: Add skia.
Date: Wed, 11 May 2022 18:02:55 -0400 (EDT)

apteryx pushed a commit to branch wip-ipython-polyglossia
in repository guix.

commit 74ffc7ed15f7418ea1b0e11d63fd1d870a3b2b55
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Fri Apr 8 16:41:13 2022 -0400

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

diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index b5a81ef196..e966a82dbb 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -55,6 +55,7 @@
   #:use-module (gnu packages bash)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
+  #:use-module (gnu packages build-tools)
   #:use-module (gnu packages cdrom)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
@@ -88,6 +89,7 @@
   #:use-module (gnu packages maths)
   #:use-module (gnu packages mp3)
   #:use-module (gnu packages multiprecision)
+  #:use-module (gnu packages ninja)
   #:use-module (gnu packages pciutils)
   #:use-module (gnu packages pdf)
   #:use-module (gnu packages perl)
@@ -1858,6 +1860,113 @@ library for 3D visualization and visual simulation 
software in the scientific
 and engineering community.")
       (license license:bsd-3)))
 
+(define-public skia
+  ;; Releases follow those of Chromium, about every 6 weeks.  The release
+  ;; version can be found on this page:
+  ;; https://skia.org/docs/user/release/release_notes/.  The commit used
+  ;; should be the last commit, as recommended at
+  ;; https://skia.org/docs/user/release/.
+  (let ((version "98")
+        (revision "0")
+        (commit "55c56abac381e1ae3f0116c410bed81b05e0a38a"))
+    (package
+      (name "skia")
+      (version (git-version version revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://skia.googlesource.com/skia.git";)
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "1ldns2j1g2wj2phlxr9zqkdgs5g64pisxhwxcrq9ijn8a3jhafr2"))))
+      (build-system gnu-build-system)   ;actually GN + Ninja
+      (arguments
+       (list
+        ;; Running the test suite would require 'dm'; unfortunately the tool
+        ;; can only be built for debug builds, which require fetching third
+        ;; party sources.
+        #:tests? #f
+        #:phases
+        #~(modify-phases %standard-phases
+            (replace 'configure
+              (lambda* (#:key inputs #:allow-other-keys)
+                (substitute* "BUILD.gn"
+                  ;; Workaround a bug in the zlib third_party definition, that
+                  ;; fails the build even when zlib is found from the system.
+                  (("deps = \\[ \"//third_party/zlib\" ]")
+                   "deps = []"))
+                (invoke "gn" "gen" "build"
+                        (string-append
+                         ;;
+                         "--args="
+                         "cc=\"gcc\" "              ;defaults to 'cc'
+                         "is_official_build=true "  ;to use system libraries
+                         "is_component_build=true " ;build as a shared library
+                         ;; Specify where locate the harfbuzz and freetype
+                         ;; includes.
+                         (format #f "extra_cflags=[\"-I~a\",\"-I~a\"] "
+                                 (search-input-directory inputs
+                                                         "include/harfbuzz")
+                                 (search-input-directory inputs
+                                                         "include/freetype2"))
+                         ;; Otherwise the validate-runpath phase fails.
+                         "extra_ldflags=[\"-Wl,-rpath=" #$output "/lib\"] "
+                         ;; Disabled, otherwise the build system attempts to
+                         ;; download the SDK at build time.
+                         "skia_use_dng_sdk=false "))))
+            (replace 'build
+              (lambda* (#:key parallel-build? #:allow-other-keys)
+                (let ((job-count (if parallel-build?
+                                     (number->string (parallel-job-count))
+                                     "1")))
+                  (invoke "ninja" "-j" job-count "-C" "build"))))
+            (replace 'install
+              (lambda _
+                ;; Install headers.
+                (for-each (lambda (h)
+                            (install-file h (string-append
+                                             #$output "/include/skia/"
+                                             (dirname h))))
+                          (find-files "." "\\.h$"))
+                ;; Install libraries.
+                (for-each (lambda (lib)
+                            (install-file lib (string-append #$output "/lib")))
+                          (find-files "build" "^lib.*\\.(a|so)"))
+                ;; This pkgconfig file is useful at least to the
+                ;; python-skia-pathops package.
+                (define skia.pc (string-append #$output
+                                               "/lib/pkgconfig/skia.pc"))
+                (mkdir-p (dirname skia.pc))
+                (call-with-output-file skia.pc
+                  (lambda (port)
+                    (format port "\
+prefix=~a
+exec_prefix=${prefix}
+libdir=${prefix}/lib
+includedir=${prefix}/include/skia
+
+Name: skia
+Description: 2D graphic library for drawing text, geometries and images.
+URL: https://skia.org/
+Version: ~a
+Libs: -L${libdir} -lskia
+Cflags: -I${includedir}~%" #$output #$version))))))))
+      (native-inputs (list gn libjpeg-turbo ninja pkg-config python-wrapper))
+      (inputs (list expat fontconfig freetype harfbuzz mesa libwebp zlib))
+      (home-page "https://skia.org/";)
+      (synopsis "2D graphics library")
+      (description "Skia is an open source 2D graphics library.  It can be
+used for drawing text, geometries, and images and has support for:
+@itemize
+@item 3x3 matrices with perspective
+@item antialiasing, transparency, filters
+@item shaders, xfermodes, maskfilters, patheffects
+@item subpixel text
+@end itemize")
+      (license license:bsd-3))))
+
 (define-public superfamiconv
   (package
     (name "superfamiconv")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]