Subject: [PATCH v2 2/5] gnu: Add nanovg.

From: Sughosha <[email-masked]>
Date: Thu, 04 May 2023 08:06:36 +0000

* gnu/packages/gl.scm (nanovg): New variable.
---
 gnu/packages/gl.scm | 46 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index e59d051f2e..b67215b406 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -893,6 +893,52 @@ (define-public glfw
 and surfaces, receiving input and events.")
     (license license:zlib)))
 
+(define-public nanovg
+  ;; No tags are available.
+  (let ((revision "0")
+        (commit "7544c114e83db7cf67bd1c9e012349b70caacc2f"))
+    (package
+      (name "nanovg")
+      (version (git-version "0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/memononen/nanovg")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "0n29rxdp20xnvnpsjcmg3v5n6z7ya5ji4qirp18qcyls5xdxdxkc"))))
+      (build-system gnu-build-system)
+      (arguments
+       (list #:tests? #f ;no test suite
+             #:phases
+             #~(modify-phases %standard-phases
+                 (delete 'configure) ;no configure script
+                  (replace 'build
+                    (lambda _
+                      (invoke #$(cc-for-target)
+                       "../source/src/nanovg.c" "-c" "-fPIC")
+                      (invoke #$(cc-for-target)
+                       "-shared" "-olibnanovg.so" "nanovg.o")))
+                  (replace 'install
+                    (lambda _
+                      (let ((lib (string-append #$output "/lib"))
+                            (include (string-append #$output
+                                                    "/include")))
+                        (install-file "libnanovg.so" lib)
+                        (with-directory-excursion "../source"
+                          (for-each
+                            (lambda (file)
+                              (install-file file include))
+                            (find-files "src" "nanovg.*\\.h$")))))))))
+      (home-page "https://github.com/memononen/nanovg")
+      (synopsis "2D vector drawing library on top of OpenGL")
+      (description
+       "NanoVG is an antialiased vector graphics rendering library for OpenGL.
+It is aimed for building scalable user interfaces and visualizations.")
+      (license license:zlib))))
+
 (define-public nanovg-for-extempore
   (let ((version "0.7.1")
         (revision "0")
-- 
2.39.2