gnu: Add skia.

* gnu/packages/graphics.scm (skia): New variable.
This commit is contained in:
Maxim Cournoyer 2022-04-08 16:41:13 -04:00
parent 7e2d11f417
commit f78ef31824
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -55,6 +55,7 @@ (define-module (gnu packages graphics)
#: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 @@ (define-module (gnu packages graphics)
#: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 @@ (define-public coin3D-4
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")