From 6c7993d4d9f8722a869207f86a31f20fa9e8780d Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 10 Aug 2026 22:49:53 +0200 Subject: [PATCH] build: strip trailing spaces from `libcurl.pc` Fixing: ``` $ pccritic libcurl.pc [...] [info ] file has trailing whitespace on one or more lines (style/PC062) ``` Closes #22536 --- CMakeLists.txt | 4 ++++ configure.ac | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ea82301d9d..a32b657ef8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2362,6 +2362,10 @@ if(NOT CURL_DISABLE_INSTALL) configure_file( "${PROJECT_SOURCE_DIR}/libcurl.pc.in" "${PROJECT_BINARY_DIR}/libcurl.pc" @ONLY) + # Strip trailing spaces + file(READ "${PROJECT_BINARY_DIR}/libcurl.pc" _libcurl_pc) + string(REGEX REPLACE " +\n" "\n" _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 d894dd48d0..bf40500b99 100644 --- a/configure.ac +++ b/configure.ac @@ -5555,10 +5555,13 @@ AC_CONFIG_FILES([\ tests/http/config.ini \ tests/http/Makefile \ projects/Makefile \ - projects/vms/Makefile \ - libcurl.pc + projects/vms/Makefile ]) 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 +], [SED="$SED"]) AC_OUTPUT SUPPORT_PROTOCOLS_LOWER=`echo "$SUPPORT_PROTOCOLS" | tr A-Z a-z`