From 2c22d3069aef507d6a6876a6d20616fe5e50c6a3 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 11 Aug 2026 11:19:28 +0200 Subject: [PATCH] build: strip duplicate spaces after `Libs.private:` in `libcurl.pc` When `LIBCURL_PC_LDFLAGS_PRIVATE` is empty and `LIBCURL_PC_LIBS_PRIVATE` is not. To keep it tidy. Closes #22544 --- CMakeLists.txt | 3 ++- configure.ac | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a32b657ef8..d2e2951823 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2362,9 +2362,10 @@ if(NOT CURL_DISABLE_INSTALL) configure_file( "${PROJECT_SOURCE_DIR}/libcurl.pc.in" "${PROJECT_BINARY_DIR}/libcurl.pc" @ONLY) - # Strip trailing spaces + # Strip trailing spaces, and duplicate spaces after colon file(READ "${PROJECT_BINARY_DIR}/libcurl.pc" _libcurl_pc) string(REGEX REPLACE " +\n" "\n" _libcurl_pc "${_libcurl_pc}") + string(REGEX REPLACE "\nLibs\.private: +" "\nLibs.private: " _libcurl_pc "${_libcurl_pc}") file(WRITE "${PROJECT_BINARY_DIR}/libcurl.pc" "${_libcurl_pc}") install(FILES "${PROJECT_BINARY_DIR}/libcurl.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") diff --git a/configure.ac b/configure.ac index bf40500b99..8e991dda54 100644 --- a/configure.ac +++ b/configure.ac @@ -5559,8 +5559,8 @@ AC_CONFIG_FILES([\ ]) AC_CONFIG_FILES([curl-config], [chmod +x curl-config]) AC_CONFIG_FILES([libcurl.pc], [ - dnl strip trailing spaces - "$SED" 's/ *$//g' libcurl.pc > libcurl.pc.tmp && mv libcurl.pc.tmp libcurl.pc + dnl strip trailing spaces, and duplicate spaces after colon + "$SED" -e 's/ *$//g' -e 's/^Libs\.private: */Libs.private: /g' libcurl.pc > libcurl.pc.tmp && mv libcurl.pc.tmp libcurl.pc ], [SED="$SED"]) AC_OUTPUT