Control: tags -1 patch
On 2024-06-23 Andreas Tille <andr...@an3as.eu> wrote:
> Control: tags -1 help

> Hi Andreas,

> strange, it has build for me.

Very strange, perhaps you did not build against the libgcrypt package in
experimental.

> Am Sun, Jun 23, 2024 at 08:03:30AM +0200 schrieb Andreas Metzler:
> > Control: reopen 1071860
> > ...
> > CMake Error at CMakeLists.txt:529 (message):
> >   FATAL: libgcrypt-config not found (LIBGCRYPT_CONFIG_SCRIPT-NOTFOUND)
> > [...]

> I admit I currently have no time to track this down.  It might make
> sense to upgrade to latest upstream which might have been adapted to
> work without libgcrypt-config.   Tagging the bug help since I have no
> capacity to work on this.

Fair enough.

The respective part of the CMake setup is unchanged in 7.1-003.
Attached patch works for me.

Upstream's build system is rather strange. - It requires libgcrypt itself
to be in the standard search but allows the headers to be hidden away:

8X----------------
# Iterate over the list of GPG related libraries
foreach(gpglib gpg-error gpgme gcrypt config)
  # For each library, we need a new CMake variable, hence GPGLIB_${gpglib}
  find_library(GPGLIB_${gpglib} NAME ${gpglib} PATHS ${CMAKE_LIBRARY_PATH})
  # Append the found library to the list
  set(GPG_LIBRARIES ${GPG_LIBRARIES} ${GPGLIB_${gpglib}})
endforeach()
[...]
# Locate libgcrypt's header files (assumption: all others headers are found in 
the same location)
find_program(LIBGCRYPT_CONFIG_SCRIPT NAMES libgcrypt-config)
if (LIBGCRYPT_CONFIG_SCRIPT MATCHES ".+-NOTFOUND")
        message(FATAL_ERROR "FATAL: libgcrypt-config not found 
(${LIBGCRYPT_CONFIG_SCRIPT})")
else()
[...]
8X----------------

A Debian specific patch could simply drop the whole block
find_program(LIBGCRYPT_CONFIG_SCRIPT NAMES libgcrypt-config)
if (LIBGCRYPT_CONFIG_SCRIPT MATCHES ".+-NOTFOUND")
[...]
endif()

I will give it a litte bit of time to check whether somebody else from
-med picks this up and will NMU otherwise.

cu Andreas

-- 
`What a good friend you are to him, Dr. Maturin. His other friends are
so grateful to you.'
`I sew his ears on from time to time, sure'
From: Andreas Metzler <ametz...@bebt.de>
Date: Sun, 23 Jun 2024 13:26:46 +0200
Subject: Use pkg-config to locate gcrypt include path instead of
 libgcrypt-config

---
 CMakeLists.txt | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index cd06044..c9e57f4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -524,19 +524,9 @@ add_custom_target(gen_tls_options
   DEPENDS ${GTM_BINARY_DIR}/gen_tls_options.h ${GTM_BINARY_DIR}/gen_tls_verify_options.h)
 
 # Locate libgcrypt's header files (assumption: all others headers are found in the same location)
-find_program(LIBGCRYPT_CONFIG_SCRIPT NAMES libgcrypt-config)
-if (LIBGCRYPT_CONFIG_SCRIPT MATCHES ".+-NOTFOUND")
-	message(FATAL_ERROR "FATAL: libgcrypt-config not found (${LIBGCRYPT_CONFIG_SCRIPT})")
-else()
-	# libgcrypt-config --cflags returns "\n" when the includes are located in the default search path
-	exec_program(${LIBGCRYPT_CONFIG_SCRIPT} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE LIBGCRYPT_CFLAGS)
-	# If a path is returned, it is preceded by '-I' for use as CFLAG directive
-	string(REGEX REPLACE "^-I" "" LIBGCRYPT_INCLUDES "${LIBGCRYPT_CFLAGS}")
-	if (NOT (${LIBGCRYPT_INCLUDES} MATCHES "\n"))
-		message("INFO: ${LIBGCRYPT_CONFIG_SCRIPT} ${_return_VALUE} '${LIBGCRYPT_INCLUDES}'")
-		include_directories(${LIBGCRYPT_INCLUDES})
-	endif()
-endif()
+include(FindPkgConfig)
+pkg_check_modules(LIBGCRYPT REQUIRED libgcrypt)
+include_directories(${LIBGCRYPT_INCLUDE_DIRS})
 
 # Building the three encryption libraries could by a loop of some sort, but
 # manually creating each target is way easier.

Reply via email to