plutosvg: init at 0.0.7

Signed-off-by: Marcin Serwin <marcin@serwin.dev>
This commit is contained in:
Marcin Serwin 2025-05-25 00:58:58 +02:00
parent 5e7e14d395
commit f4af63c986
No known key found for this signature in database
GPG key ID: DACFAC4EA0B194E0
2 changed files with 106 additions and 0 deletions

View file

@ -0,0 +1,50 @@
From 31e8aae418a1af681e389f27d3ad57b5fd7e1ba8 Mon Sep 17 00:00:00 2001
From: Marcin Serwin <marcin@serwin.dev>
Date: Sun, 25 May 2025 01:16:37 +0200
Subject: [PATCH] Emit correct pkg-config file if paths are absolute
CMAKE_INSTALL_INCLUDEDIR and CMAKE_INSTALL_LIBDIR may be defined to be
absolute paths. In this situation they should not be appended to the
prefix.
Signed-off-by: Marcin Serwin <marcin@serwin.dev>
---
CMakeLists.txt | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2e84761..f2219e0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -107,6 +107,17 @@ file(RELATIVE_PATH plutosvg_pc_prefix_relative
set(plutosvg_pc_cflags "")
set(plutosvg_pc_libs_private "")
set(plutosvg_pc_requires "")
+set(plutosvg_pc_requires "")
+if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
+ set(plutosvg_pc_includedir "${CMAKE_INSTALL_INCLUDEDIR}")
+else()
+ set(plutosvg_pc_includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
+endif()
+if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
+ set(plutosvg_pc_libdir "${CMAKE_INSTALL_LIBDIR}")
+else()
+ set(plutosvg_pc_libdir "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
+endif()
if(MATH_LIBRARY)
string(APPEND plutosvg_pc_libs_private " -lm")
@@ -123,8 +134,8 @@ endif()
string(CONFIGURE [[
prefix=${pcfiledir}/@plutosvg_pc_prefix_relative@
-includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
-libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
+includedir=@plutosvg_pc_includedir@
+libdir=@plutosvg_pc_libdir@
Name: PlutoSVG
Description: Tiny SVG rendering library in C
--
2.49.0

View file

@ -0,0 +1,56 @@
{
lib,
stdenv,
fetchFromGitHub,
nix-update-script,
validatePkgConfig,
testers,
cmake,
ninja,
plutovg,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "plutosvg";
version = "0.0.7";
src = fetchFromGitHub {
owner = "sammycage";
repo = "plutosvg";
tag = "v${finalAttrs.version}";
hash = "sha256-4JLk4+O9Tf8CGxMP0aDN70ak/8teZH3GWBWlrIkPQm4=";
};
outputs = [
"out"
"dev"
];
patches = [
# https://github.com/sammycage/plutosvg/pull/29
./0001-Emit-correct-pkg-config-file-if-paths-are-absolute.patch
];
nativeBuildInputs = [
cmake
ninja
validatePkgConfig
];
propagatedBuildInputs = [
plutovg
];
cmakeFlags = [ (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic)) ];
passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
passthru.updateScript = nix-update-script { };
meta = {
homepage = "https://github.com/sammycage/plutosvg";
changelog = "https://github.com/sammycage/plutosvg/releases/tag/${finalAttrs.src.tag}";
description = "Tiny SVG rendering library in C";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ marcin-serwin ];
pkgConfigModules = [ "plutosvg" ];
};
})