gpgmepp: fix installation of pkgconfig file and split outputs (#472985)
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
From b56db4b30ec696b018c04400440d0252af13990a Mon Sep 17 00:00:00 2001
|
||||
From: Marcin Serwin <marcin@serwin.dev>
|
||||
Date: Mon, 22 Dec 2025 16:44:46 +0100
|
||||
Subject: [PATCH] Don't hardcode 'include' as includedir
|
||||
|
||||
The headers are installed into the location pointed by
|
||||
CMAKE_INSTALL_INCLUDEDIR so if it's different than the default 'include'
|
||||
then the header path in the exported CMake targets is incorrect.
|
||||
|
||||
Signed-off-by: Marcin Serwin <marcin@serwin.dev>
|
||||
---
|
||||
src/CMakeLists.txt | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index 7be46cb..97d21b1 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -128,7 +128,7 @@ if(ENABLE_SHARED)
|
||||
|
||||
target_include_directories(Gpgmepp
|
||||
PRIVATE ${LibGpgError_INCLUDE_DIRS}
|
||||
- INTERFACE $<INSTALL_INTERFACE:include>
|
||||
+ INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
|
||||
target_link_libraries(Gpgmepp Gpgme::Gpgme)
|
||||
@@ -144,7 +144,7 @@ if(ENABLE_STATIC)
|
||||
|
||||
target_include_directories(GpgmeppStatic
|
||||
PRIVATE ${LibGpgError_INCLUDE_DIRS}
|
||||
- INTERFACE $<INSTALL_INTERFACE:include>
|
||||
+ INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
|
||||
target_link_libraries(GpgmeppStatic Gpgme::Gpgme)
|
||||
--
|
||||
2.51.2
|
||||
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
From 7b8b17c82b1bc672df9c50d2b002242f00bc04a4 Mon Sep 17 00:00:00 2001
|
||||
From: Marcin Serwin <marcin@serwin.dev>
|
||||
Date: Sun, 21 Dec 2025 14:51:33 +0100
|
||||
Subject: [PATCH] Fix handling of absolute install dirs in .pc installation
|
||||
|
||||
CMAKE_INSTALL_*DIRs can be absolute and in this case shouldn't be
|
||||
appended to the install prefix. This is handled automatically by CMake
|
||||
for installation but needs to be done manually when generating
|
||||
pkg-config file.
|
||||
|
||||
Signed-off-by: Marcin Serwin <marcin@serwin.dev>
|
||||
---
|
||||
src/CMakeLists.txt | 12 +++++++++++-
|
||||
src/gpgmepp.pc.in | 4 ++--
|
||||
2 files changed, 13 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index 7be46cb..913dd79 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -209,10 +209,20 @@ set(pkgconfig_host_line "")
|
||||
if(PKGCONFIG_HOST)
|
||||
set(pkgconfig_host_line "host=${PKGCONFIG_HOST}\n")
|
||||
endif()
|
||||
+if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
+ set(pkgconfig_includedir "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
+else()
|
||||
+ set(pkgconfig_includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
+endif()
|
||||
+if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
|
||||
+ set(pkgconfig_libdir "${CMAKE_INSTALL_LIBDIR}")
|
||||
+else()
|
||||
+ set(pkgconfig_libdir "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
|
||||
+endif()
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/gpgmepp.pc.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/gpgmepp.pc @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gpgmepp.pc
|
||||
- DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
|
||||
install(FILES ${Gpgmepp_HEADERS}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gpgme++)
|
||||
diff --git a/src/gpgmepp.pc.in b/src/gpgmepp.pc.in
|
||||
index 626c5fb..cf3e67b 100644
|
||||
--- a/src/gpgmepp.pc.in
|
||||
+++ b/src/gpgmepp.pc.in
|
||||
@@ -1,7 +1,7 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
-includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
|
||||
-libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
|
||||
+includedir=@pkgconfig_includedir@
|
||||
+libdir=@pkgconfig_libdir@
|
||||
@pkgconfig_host_line@
|
||||
Name: gpgmepp
|
||||
Description: GnuPG Made Easy (C++ binding)
|
||||
--
|
||||
2.51.2
|
||||
|
||||
@@ -16,11 +16,15 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
hash = "sha256-1HlgScBnCKJvMJb3SO8JU0fho8HlcFYXAf6VLD9WU4I=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace src/gpgmepp.pc.in \
|
||||
--replace-fail '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@ \
|
||||
--replace-fail '$'{exec_prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@
|
||||
'';
|
||||
outputs = [
|
||||
"out"
|
||||
"dev"
|
||||
];
|
||||
|
||||
patches = [
|
||||
./0001-Fix-handling-of-absolute-install-dirs-in-.pc-install.patch
|
||||
./0001-Don-t-hardcode-include-as-includedir.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
|
||||
Reference in New Issue
Block a user