Subject: [PATCH 4/5] gnu: Add plutosvg.

From: Nguyễn Gia Phong <[email-masked]>
Date: Wed, 5 Mar 2025 17:44:07 +0900

* gnu/packages/image.scm (plutosvg): New variable.
* gnu/packages/patches/plutosvg-unbundle-plutovg.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register patch.

Change-Id: Idd65e613df38fece4e742af06661ba1ee74ac6a2
---
 gnu/local.mk                                  |  1 +
 gnu/packages/image.scm                        | 26 +++++++++++++++++++
 .../patches/plutosvg-unbundle-plutovg.patch   | 13 ++++++++++
 3 files changed, 40 insertions(+)
 create mode 100644 gnu/packages/patches/plutosvg-unbundle-plutovg.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index a8c3631ada0a..b36324bee9fb 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1991,6 +1991,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/plasma-framework-fix-KF5PlasmaMacros.cmake.patch \
   %D%/packages/patches/plasp-fix-normalization.patch \
   %D%/packages/patches/plasp-include-iostream.patch \
+  %D%/packages/patches/plutosvg-unbundle-plutovg.patch		\
   %D%/packages/patches/plutovg-unbundle-stb.patch		\
   %D%/packages/patches/pocketfft-cpp-prefer-preprocessor-if.patch			\
   %D%/packages/patches/pokerth-boost.patch			\
diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index 12c9eb01bc07..d8aa3f53dc9e 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -2875,6 +2875,32 @@ (define-public plutovg
     (description "PlutoVG is a standalone 2D vector graphics library in C.")
     (license license:expat)))
 
+(define-public plutosvg
+  (package
+    (name "plutosvg")
+    (version "0.0.6")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/sammycage/plutosvg")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256 (base32 "16r6m36p1ji02gaan5i79c83nyznydw09q8blhyr9q8g7ra4g706"))
+       (patches (search-patches "plutosvg-unbundle-plutovg.patch"))))
+    (build-system meson-build-system)
+    (native-inputs (list pkg-config))
+    ;; plutosvg/plutosvg.h includes plutovg/plutovg.h
+    (propagated-inputs (list plutovg))
+    (home-page "https://github.com/sammycage/plutosvg")
+    (synopsis "Tiny SVG rendering library in C")
+    (description "PlutoSVG is a compact and efficient SVG rendering library
+written in C.  It is specifically designed for parsing and rendering
+SVG documents embedded in OpenType fonts, providing an optimal balance
+between speed and minimal memory usage.  It is also suitable
+for rendering scalable icons.")
+    (license license:expat)))
+
 (define-public spng
   (package
    (name "spng")
diff --git a/gnu/packages/patches/plutosvg-unbundle-plutovg.patch b/gnu/packages/patches/plutosvg-unbundle-plutovg.patch
new file mode 100644
index 000000000000..bcdbd83b7321
--- /dev/null
+++ b/gnu/packages/patches/plutosvg-unbundle-plutovg.patch
@@ -0,0 +1,13 @@
+diff --git a/source/plutosvg.h b/source/plutosvg.h
+index 03a79b542b7c..064ef70b6bf3 100644
+--- a/source/plutosvg.h
++++ b/source/plutosvg.h
+@@ -23,7 +23,7 @@
+ #ifndef PLUTOSVG_H
+ #define PLUTOSVG_H
+ 
+-#include <plutovg.h>
++#include <plutovg/plutovg.h>
+ 
+ #if !defined(PLUTOSVG_BUILD_STATIC) && (defined(_WIN32) || defined(__CYGWIN__))
+ #define PLUTOSVG_EXPORT __declspec(dllexport)
-- 
2.48.1