From 40f2a203002ef8563a2cc2173ce33349e7b3b3c7 Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Mon, 25 Mar 2024 00:25:43 +0100 Subject: [PATCH] curl: fix detection by dependents Install a pkg-config entry to staging so components can be detected when there's no `curl-config` available. --- thirdparty/curl/CMakeLists.txt | 8 +++++++- thirdparty/curl/pocketbook_lib_rename.patch | 10 ++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/thirdparty/curl/CMakeLists.txt b/thirdparty/curl/CMakeLists.txt index 6e786275a4..819a0a6a9e 100644 --- a/thirdparty/curl/CMakeLists.txt +++ b/thirdparty/curl/CMakeLists.txt @@ -11,6 +11,7 @@ list(APPEND PATCH_CMD COMMAND ${KO_PATCH} ${CMAKE_CURRENT_SOURCE_DIR}/ca_bundle. # Make sure the daisy-chain once again picks up our toolchain file... list(APPEND CMAKE_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TCF}") +list(APPEND CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}") # Features. # TODO: Enable ZSTD support? We currently only use cURL for zsync2, so, obviously, not necessary right now… @@ -51,7 +52,9 @@ set_libname(LIB ${LIB_SPEC}) # Install shared lib. append_shared_lib_install_command(INSTALL_CMD BYPRODUCTS lib/${LIB} ${LIB_SPEC}) -# For pocketbook, add a symlink so dependent packages find our renamed version. +# Even with after installing a patched pkg-config entry, we still need to add a symlink +# with the canonical library name or the mess that is CMake's FindCURl module will fail +# at detecting our renamed library… if(POCKETBOOK) list(APPEND INSTALL_CMD COMMAND ln -snf ${LIB} "${STAGING_DIR}/lib/libcurl${LIB_EXT}") endif() @@ -65,6 +68,9 @@ append_headers_install_command( stdcheaders.h system.h typecheck-gcc.h urlapi.h websockets.h ) +# Install pkg-config entry (needed for curl components detection by CMake's FindCURl). +append_install_commands(INSTALL_CMD BYPRODUCTS libcurl.pc DESTINATION "${STAGING_DIR}/lib/pkgconfig/") + thirdparty_project( URL https://github.com/curl/curl/releases/download/curl-8_5_0/curl-8.5.0.tar.xz URL_MD5 3e9e5c2db494e7dbd4e7024b149021c9 diff --git a/thirdparty/curl/pocketbook_lib_rename.patch b/thirdparty/curl/pocketbook_lib_rename.patch index 58bb06f66d..f99dca57bc 100644 --- a/thirdparty/curl/pocketbook_lib_rename.patch +++ b/thirdparty/curl/pocketbook_lib_rename.patch @@ -11,3 +11,13 @@ add_definitions(-DBUILDING_LIBCURL) configure_file(curl_config.h.cmake +--- i/libcurl.pc.in ++++ w/libcurl.pc.in +@@ -36,6 +36,6 @@ Name: libcurl + URL: https://curl.se/ + Description: Library to transfer files with ftp, http, etc. + Version: @CURLVERSION@ +-Libs: -L${libdir} -lcurl @LIBCURL_NO_SHARED@ ++Libs: -L${libdir} -lcurl_ko @LIBCURL_NO_SHARED@ + Libs.private: @LIBCURL_LIBS@ + Cflags: -I${includedir} @CPPFLAG_CURL_STATICLIB@