nixpkgs/pkgs/by-name/pl/plutosvg/0001-Emit-correct-pkg-config-file-if-paths-are-absolute.patch
Marcin Serwin f4af63c986
plutosvg: init at 0.0.7
Signed-off-by: Marcin Serwin <marcin@serwin.dev>
2025-05-26 20:06:27 +02:00

51 lines
1.6 KiB
Diff

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