diff --git a/pkgs/by-name/pl/plutosvg/0001-Emit-correct-pkg-config-file-if-paths-are-absolute.patch b/pkgs/by-name/pl/plutosvg/0001-Emit-correct-pkg-config-file-if-paths-are-absolute.patch new file mode 100644 index 000000000000..01846f8e6921 --- /dev/null +++ b/pkgs/by-name/pl/plutosvg/0001-Emit-correct-pkg-config-file-if-paths-are-absolute.patch @@ -0,0 +1,50 @@ +From 31e8aae418a1af681e389f27d3ad57b5fd7e1ba8 Mon Sep 17 00:00:00 2001 +From: Marcin Serwin +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 +--- + 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 + diff --git a/pkgs/by-name/pl/plutosvg/package.nix b/pkgs/by-name/pl/plutosvg/package.nix new file mode 100644 index 000000000000..acc3a99b837f --- /dev/null +++ b/pkgs/by-name/pl/plutosvg/package.nix @@ -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" ]; + }; +})