Skip to content

Commit

Permalink
curl: apply upstream patch and drop local --start-group workaround …
Browse files Browse the repository at this point in the history
…[ci skip]

Please report if any untested build combinations fail due to wrong lib
order.

curl/curl@e0443a7
curl/curl#16182
  • Loading branch information
vszakats committed Feb 6, 2025
1 parent f4e0915 commit 2ed700e
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 9 deletions.
1 change: 0 additions & 1 deletion _build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ set -o xtrace -o errexit -o nounset; [ -n "${BASH:-}${ZSH_NAME:-}" ] && set -o p
# linux build Linux target (requires Linux host)
# musl build Linux target with musl CRT (for linux target) (default for Alpine)
# macuni build macOS universal (arm64 + x86_64) package (for mac target)
# nolibgroup build without the `--start-group` hack [DEBUG]
#
# CW_JOBS
# Number of parallel make jobs. Default: 2
Expand Down
57 changes: 57 additions & 0 deletions curl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ce1318c6dde..3bf2d4381c1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -623,10 +623,6 @@ elseif(NOT WIN32 AND NOT APPLE)
endif()
endif()

-if(WIN32)
- list(APPEND CURL_LIBS "ws2_32" "bcrypt")
-endif()
-
# Check SSL libraries
option(CURL_ENABLE_SSL "Enable SSL support" ON)

@@ -1308,9 +1304,9 @@ set(USE_LIBSSH2 OFF)
if(CURL_USE_LIBSSH2)
find_package(Libssh2)
if(LIBSSH2_FOUND)
- list(APPEND CURL_LIBS ${LIBSSH2_LIBRARIES})
+ set(CURL_LIBS ${LIBSSH2_LIBRARIES} ${CURL_LIBS}) # keep it before TLS-crypto, compression
list(APPEND CURL_LIBDIRS ${LIBSSH2_LIBRARY_DIRS})
- list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${LIBSSH2_PC_REQUIRES})
+ set(LIBCURL_PC_REQUIRES_PRIVATE ${LIBSSH2_PC_REQUIRES} ${LIBCURL_PC_REQUIRES_PRIVATE})
include_directories(SYSTEM ${LIBSSH2_INCLUDE_DIRS})
link_directories(${LIBSSH2_LIBRARY_DIRS})
if(LIBSSH2_CFLAGS)
@@ -1325,9 +1321,9 @@ option(CURL_USE_LIBSSH "Use libssh" OFF)
mark_as_advanced(CURL_USE_LIBSSH)
if(NOT USE_LIBSSH2 AND CURL_USE_LIBSSH)
find_package(Libssh REQUIRED)
- list(APPEND CURL_LIBS ${LIBSSH_LIBRARIES})
+ set(CURL_LIBS ${LIBSSH_LIBRARIES} ${CURL_LIBS}) # keep it before TLS-crypto, compression
list(APPEND CURL_LIBDIRS ${LIBSSH_LIBRARY_DIRS})
- list(APPEND LIBCURL_PC_REQUIRES_PRIVATE ${LIBSSH_PC_REQUIRES})
+ set(LIBCURL_PC_REQUIRES_PRIVATE ${LIBSSH_PC_REQUIRES} ${LIBCURL_PC_REQUIRES_PRIVATE})
include_directories(SYSTEM ${LIBSSH_INCLUDE_DIRS})
link_directories(${LIBSSH_LIBRARY_DIRS})
if(LIBSSH_CFLAGS)
@@ -1344,7 +1340,7 @@ if(NOT USE_LIBSSH2 AND NOT USE_LIBSSH AND CURL_USE_WOLFSSH)
if(USE_WOLFSSL)
find_package(WolfSSH)
if(WOLFSSH_FOUND)
- list(APPEND CURL_LIBS ${WOLFSSH_LIBRARIES})
+ set(CURL_LIBS ${WOLFSSH_LIBRARIES} ${CURL_LIBS}) # keep it before TLS-crypto, compression
include_directories(SYSTEM ${WOLFSSH_INCLUDE_DIRS})
set(USE_WOLFSSH ON)
endif()
@@ -1930,6 +1926,8 @@ include(CMake/OtherTests.cmake)
add_definitions("-DHAVE_CONFIG_H")

if(WIN32)
+ list(APPEND CURL_LIBS "ws2_32" "bcrypt")
+
# _fseeki64() requires VS2005
if(NOT MSVC OR (MSVC_VERSION GREATER_EQUAL 1400))
set(USE_WIN32_LARGE_FILES ON)
8 changes: 0 additions & 8 deletions curl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ _VER="$1"
fi
fi

# Ugly hack. Everything breaks without this due to the accidental ordering
# of libs and objects, and offering no universal way to (re)insert libs at
# specific positions. Linker complains about a missing --end-group, then
# adds it automatically anyway.
if [[ "${_CONFIG}" != *'nolibgroup'* ]] && [ "${_LD}" = 'ld' ]; then
LDFLAGS+=' -Wl,--start-group'
fi

if [ "${_OS}" = 'win' ]; then
# Link lib dependencies in static mode. Implied by `-static` for curl,
# but required for libcurl, which would link to shared libs by default.
Expand Down
1 change: 1 addition & 0 deletions curl.test.patch

0 comments on commit 2ed700e

Please sign in to comment.