Skip to content

Commit f4af63c

Browse files
committed
plutosvg: init at 0.0.7
Signed-off-by: Marcin Serwin <marcin@serwin.dev>
1 parent 5e7e14d commit f4af63c

File tree

2 files changed

+106
-0
lines changed

2 files changed

+106
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
From 31e8aae418a1af681e389f27d3ad57b5fd7e1ba8 Mon Sep 17 00:00:00 2001
2+
From: Marcin Serwin <marcin@serwin.dev>
3+
Date: Sun, 25 May 2025 01:16:37 +0200
4+
Subject: [PATCH] Emit correct pkg-config file if paths are absolute
5+
6+
CMAKE_INSTALL_INCLUDEDIR and CMAKE_INSTALL_LIBDIR may be defined to be
7+
absolute paths. In this situation they should not be appended to the
8+
prefix.
9+
10+
Signed-off-by: Marcin Serwin <marcin@serwin.dev>
11+
---
12+
CMakeLists.txt | 15 +++++++++++++--
13+
1 file changed, 13 insertions(+), 2 deletions(-)
14+
15+
diff --git a/CMakeLists.txt b/CMakeLists.txt
16+
index 2e84761..f2219e0 100644
17+
--- a/CMakeLists.txt
18+
+++ b/CMakeLists.txt
19+
@@ -107,6 +107,17 @@ file(RELATIVE_PATH plutosvg_pc_prefix_relative
20+
set(plutosvg_pc_cflags "")
21+
set(plutosvg_pc_libs_private "")
22+
set(plutosvg_pc_requires "")
23+
+set(plutosvg_pc_requires "")
24+
+if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
25+
+ set(plutosvg_pc_includedir "${CMAKE_INSTALL_INCLUDEDIR}")
26+
+else()
27+
+ set(plutosvg_pc_includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
28+
+endif()
29+
+if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
30+
+ set(plutosvg_pc_libdir "${CMAKE_INSTALL_LIBDIR}")
31+
+else()
32+
+ set(plutosvg_pc_libdir "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
33+
+endif()
34+
35+
if(MATH_LIBRARY)
36+
string(APPEND plutosvg_pc_libs_private " -lm")
37+
@@ -123,8 +134,8 @@ endif()
38+
39+
string(CONFIGURE [[
40+
prefix=${pcfiledir}/@plutosvg_pc_prefix_relative@
41+
-includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
42+
-libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
43+
+includedir=@plutosvg_pc_includedir@
44+
+libdir=@plutosvg_pc_libdir@
45+
46+
Name: PlutoSVG
47+
Description: Tiny SVG rendering library in C
48+
--
49+
2.49.0
50+
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
lib,
3+
stdenv,
4+
fetchFromGitHub,
5+
nix-update-script,
6+
validatePkgConfig,
7+
testers,
8+
cmake,
9+
ninja,
10+
plutovg,
11+
}:
12+
stdenv.mkDerivation (finalAttrs: {
13+
pname = "plutosvg";
14+
version = "0.0.7";
15+
16+
src = fetchFromGitHub {
17+
owner = "sammycage";
18+
repo = "plutosvg";
19+
tag = "v${finalAttrs.version}";
20+
hash = "sha256-4JLk4+O9Tf8CGxMP0aDN70ak/8teZH3GWBWlrIkPQm4=";
21+
};
22+
23+
outputs = [
24+
"out"
25+
"dev"
26+
];
27+
28+
patches = [
29+
# https://github.com/sammycage/plutosvg/pull/29
30+
./0001-Emit-correct-pkg-config-file-if-paths-are-absolute.patch
31+
];
32+
33+
nativeBuildInputs = [
34+
cmake
35+
ninja
36+
validatePkgConfig
37+
];
38+
propagatedBuildInputs = [
39+
plutovg
40+
];
41+
42+
cmakeFlags = [ (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic)) ];
43+
44+
passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
45+
46+
passthru.updateScript = nix-update-script { };
47+
48+
meta = {
49+
homepage = "https://github.com/sammycage/plutosvg";
50+
changelog = "https://github.com/sammycage/plutosvg/releases/tag/${finalAttrs.src.tag}";
51+
description = "Tiny SVG rendering library in C";
52+
license = lib.licenses.mit;
53+
maintainers = with lib.maintainers; [ marcin-serwin ];
54+
pkgConfigModules = [ "plutosvg" ];
55+
};
56+
})

0 commit comments

Comments
 (0)