From 13ff9c7001f9a986f903d54c4ce1a7af6d1e7eaa Mon Sep 17 00:00:00 2001 From: Marcin Serwin Date: Sun, 21 Dec 2025 14:52:40 +0100 Subject: [PATCH 1/3] gpgmepp: install .pc file in the correct location --- ...absolute-install-dirs-in-.pc-install.patch | 59 +++++++++++++++++++ pkgs/by-name/gp/gpgmepp/package.nix | 6 +- 2 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 pkgs/by-name/gp/gpgmepp/0001-Fix-handling-of-absolute-install-dirs-in-.pc-install.patch diff --git a/pkgs/by-name/gp/gpgmepp/0001-Fix-handling-of-absolute-install-dirs-in-.pc-install.patch b/pkgs/by-name/gp/gpgmepp/0001-Fix-handling-of-absolute-install-dirs-in-.pc-install.patch new file mode 100644 index 000000000000..4773cb0d082b --- /dev/null +++ b/pkgs/by-name/gp/gpgmepp/0001-Fix-handling-of-absolute-install-dirs-in-.pc-install.patch @@ -0,0 +1,59 @@ +From 7b8b17c82b1bc672df9c50d2b002242f00bc04a4 Mon Sep 17 00:00:00 2001 +From: Marcin Serwin +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 +--- + 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 + diff --git a/pkgs/by-name/gp/gpgmepp/package.nix b/pkgs/by-name/gp/gpgmepp/package.nix index 2d8312a8dd60..b595fecb593f 100644 --- a/pkgs/by-name/gp/gpgmepp/package.nix +++ b/pkgs/by-name/gp/gpgmepp/package.nix @@ -16,11 +16,7 @@ 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@ - ''; + patches = [ ./0001-Fix-handling-of-absolute-install-dirs-in-.pc-install.patch ]; nativeBuildInputs = [ cmake From 3e2fee2a5ef9be617972bb3a2c6bed0a52dae5c7 Mon Sep 17 00:00:00 2001 From: Marcin Serwin Date: Mon, 22 Dec 2025 16:47:38 +0100 Subject: [PATCH 2/3] gpgmepp: fix includedir path in the exported CMake target Signed-off-by: Marcin Serwin --- ...Don-t-hardcode-include-as-includedir.patch | 39 +++++++++++++++++++ pkgs/by-name/gp/gpgmepp/package.nix | 5 ++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 pkgs/by-name/gp/gpgmepp/0001-Don-t-hardcode-include-as-includedir.patch diff --git a/pkgs/by-name/gp/gpgmepp/0001-Don-t-hardcode-include-as-includedir.patch b/pkgs/by-name/gp/gpgmepp/0001-Don-t-hardcode-include-as-includedir.patch new file mode 100644 index 000000000000..3109da1af152 --- /dev/null +++ b/pkgs/by-name/gp/gpgmepp/0001-Don-t-hardcode-include-as-includedir.patch @@ -0,0 +1,39 @@ +From b56db4b30ec696b018c04400440d0252af13990a Mon Sep 17 00:00:00 2001 +From: Marcin Serwin +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 +--- + 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 $ ++ INTERFACE $ + ) + + target_link_libraries(Gpgmepp Gpgme::Gpgme) +@@ -144,7 +144,7 @@ if(ENABLE_STATIC) + + target_include_directories(GpgmeppStatic + PRIVATE ${LibGpgError_INCLUDE_DIRS} +- INTERFACE $ ++ INTERFACE $ + ) + + target_link_libraries(GpgmeppStatic Gpgme::Gpgme) +-- +2.51.2 + diff --git a/pkgs/by-name/gp/gpgmepp/package.nix b/pkgs/by-name/gp/gpgmepp/package.nix index b595fecb593f..c802a7a3a015 100644 --- a/pkgs/by-name/gp/gpgmepp/package.nix +++ b/pkgs/by-name/gp/gpgmepp/package.nix @@ -16,7 +16,10 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-1HlgScBnCKJvMJb3SO8JU0fho8HlcFYXAf6VLD9WU4I="; }; - patches = [ ./0001-Fix-handling-of-absolute-install-dirs-in-.pc-install.patch ]; + patches = [ + ./0001-Fix-handling-of-absolute-install-dirs-in-.pc-install.patch + ./0001-Don-t-hardcode-include-as-includedir.patch + ]; nativeBuildInputs = [ cmake From fa233c97dc423a169882eb41c0f66cfd13aa62df Mon Sep 17 00:00:00 2001 From: Marcin Serwin Date: Sun, 21 Dec 2025 14:52:40 +0100 Subject: [PATCH 3/3] gpgmepp: split outputs Signed-off-by: Marcin Serwin --- pkgs/by-name/gp/gpgmepp/package.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/by-name/gp/gpgmepp/package.nix b/pkgs/by-name/gp/gpgmepp/package.nix index c802a7a3a015..1c8225759bd1 100644 --- a/pkgs/by-name/gp/gpgmepp/package.nix +++ b/pkgs/by-name/gp/gpgmepp/package.nix @@ -16,6 +16,11 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-1HlgScBnCKJvMJb3SO8JU0fho8HlcFYXAf6VLD9WU4I="; }; + outputs = [ + "out" + "dev" + ]; + patches = [ ./0001-Fix-handling-of-absolute-install-dirs-in-.pc-install.patch ./0001-Don-t-hardcode-include-as-includedir.patch