Skip to content

Commit

Permalink
curl: fix detection by dependents
Browse files Browse the repository at this point in the history
Install a pkg-config entry to staging so components can be detected when there's no `curl-config` available.
  • Loading branch information
benoit-pierre committed Mar 24, 2024
1 parent 5eadedf commit 40f2a20
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 7 additions & 1 deletion thirdparty/curl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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…
Expand Down Expand Up @@ -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()
Expand All @@ -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
Expand Down
10 changes: 10 additions & 0 deletions thirdparty/curl/pocketbook_lib_rename.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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@

0 comments on commit 40f2a20

Please sign in to comment.