Skip to content

Commit 5269c0f

Browse files
whyolegosipxd
authored andcommitted
Use static libcurl build with conan (#4445)
* Test libcurl build with conan * Take both curl and openssl from the same build * test no linux cache * Move K/N linux cache disabling to just `ktor-client-curl` module
1 parent 7d1ee24 commit 5269c0f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+373
-5710
lines changed

ktor-client/ktor-client-curl/build.gradle.kts

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,23 @@
11
/*
2-
* Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
2+
* Copyright 2014-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5-
val paths = listOf(
6-
"/opt/homebrew/opt/curl/include/",
7-
"/opt/local/include/",
8-
"/usr/local/include/",
9-
"/usr/include/",
10-
"/usr/local/opt/curl/include/",
11-
"/usr/include/x86_64-linux-gnu/",
12-
"/usr/local/Cellar/curl/7.62.0/include/",
13-
"/usr/local/Cellar/curl/7.63.0/include/",
14-
"/usr/local/Cellar/curl/7.65.3/include/",
15-
"/usr/local/Cellar/curl/7.66.0/include/",
16-
"/usr/local/Cellar/curl/7.80.0/include/",
17-
"/usr/local/Cellar/curl/7.80.0_1/include/",
18-
"/usr/local/Cellar/curl/7.81.0/include/",
19-
"desktop/interop/mingwX64/include/",
20-
)
5+
import org.jetbrains.kotlin.gradle.plugin.mpp.*
216

227
plugins {
238
id("kotlinx-serialization")
249
id("test-server")
2510
}
2611

2712
kotlin {
28-
createCInterop("libcurl", listOf("macosX64", "linuxX64", "mingwX64")) {
29-
definitionFile = File(projectDir, "desktop/interop/libcurl.def")
30-
includeDirs.headerFilterOnly(paths)
31-
}
32-
33-
createCInterop("libcurl", listOf("macosArm64")) {
34-
definitionFile = File(projectDir, "desktop/interop/libcurl_arm64.def")
35-
includeDirs.headerFilterOnly(paths)
36-
}
37-
38-
createCInterop("libcurl", listOf("linuxArm64")) {
39-
definitionFile = File(projectDir, "desktop/interop/libcurl_linux_arm64.def")
40-
includeDirs.headerFilterOnly(listOf("desktop/interop/linuxArm64/include/"))
13+
targets.withType<KotlinNativeTarget>().configureEach {
14+
compilations.named("main") {
15+
cinterops.create("libcurl") {
16+
definitionFile = file("desktop/interop/libcurl.def")
17+
includeDirs(file("desktop/interop/include"))
18+
extraOpts("-libraryPath", file("desktop/interop/lib/${target.name}"))
19+
}
20+
}
4121
}
4222

4323
sourceSets {

ktor-client/ktor-client-curl/desktop/interop/linuxArm64/include/curl/curl.h renamed to ktor-client/ktor-client-curl/desktop/interop/include/curl/curl.h

Lines changed: 182 additions & 136 deletions
Large diffs are not rendered by default.
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232

3333
/* This is the version number of the libcurl package from which this header
3434
file origins: */
35-
#define LIBCURL_VERSION "7.88.1"
35+
#define LIBCURL_VERSION "8.10.1"
3636

3737
/* The numeric version number is also available "in parts" by using these
3838
defines: */
39-
#define LIBCURL_VERSION_MAJOR 7
40-
#define LIBCURL_VERSION_MINOR 88
39+
#define LIBCURL_VERSION_MAJOR 8
40+
#define LIBCURL_VERSION_MINOR 10
4141
#define LIBCURL_VERSION_PATCH 1
4242

4343
/* This is the numeric version of the libcurl version number, meant for easier
@@ -48,7 +48,7 @@
4848
4949
Where XX, YY and ZZ are the main version, release and patch numbers in
5050
hexadecimal (using 8 bits each). All three numbers are always represented
51-
using two digits. 1.2 would appear as "0x010200" while version 9.11.7
51+
using two digits. 1.2 would appear as "0x010200" while version 9.11.7
5252
appears as "0x090b07".
5353
5454
This 6-digit (24 bits) hexadecimal number does not show pre-release number,
@@ -59,7 +59,7 @@
5959
CURL_VERSION_BITS() macro since curl's own configure script greps for it
6060
and needs it to contain the full number.
6161
*/
62-
#define LIBCURL_VERSION_NUM 0x075801
62+
#define LIBCURL_VERSION_NUM 0x080a01
6363

6464
/*
6565
* This is the date and time when the full source package was created. The
@@ -70,7 +70,7 @@
7070
*
7171
* "2007-11-23"
7272
*/
73-
#define LIBCURL_TIMESTAMP "2023-02-20"
73+
#define LIBCURL_TIMESTAMP "2024-09-18"
7474

7575
#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z))
7676
#define CURL_AT_LEAST_VERSION(x,y,z) \

ktor-client/ktor-client-curl/desktop/interop/linuxArm64/include/curl/easy.h renamed to ktor-client/ktor-client-curl/desktop/interop/include/curl/easy.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ CURL_EXTERN void curl_easy_cleanup(CURL *curl);
4848
*
4949
* DESCRIPTION
5050
*
51-
* Request internal information from the curl session with this function. The
52-
* third argument MUST be a pointer to a long, a pointer to a char * or a
53-
* pointer to a double (as the documentation describes elsewhere). The data
54-
* pointed to will be filled in accordingly and can be relied upon only if the
55-
* function returns CURLE_OK. This function is intended to get used *AFTER* a
56-
* performed transfer, all results from this function are undefined until the
57-
* transfer is completed.
51+
* Request internal information from the curl session with this function.
52+
* The third argument MUST be pointing to the specific type of the used option
53+
* which is documented in each manpage of the option. The data pointed to
54+
* will be filled in accordingly and can be relied upon only if the function
55+
* returns CURLE_OK. This function is intended to get used *AFTER* a performed
56+
* transfer, all results from this function are undefined until the transfer
57+
* is completed.
5858
*/
5959
CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
6060

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,51 @@
3232
extern "C" {
3333
#endif
3434

35-
CURL_EXTERN int curl_mprintf(const char *format, ...);
36-
CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...);
37-
CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...);
35+
#ifndef CURL_TEMP_PRINTF
36+
#if (defined(__GNUC__) || defined(__clang__) || \
37+
defined(__IAR_SYSTEMS_ICC__)) && \
38+
defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \
39+
!defined(CURL_NO_FMT_CHECKS)
40+
#if defined(__MINGW32__) && !defined(__clang__)
41+
#if defined(__MINGW_PRINTF_FORMAT) /* mingw-w64 3.0.0+. Needs stdio.h. */
42+
#define CURL_TEMP_PRINTF(fmt, arg) \
43+
__attribute__((format(__MINGW_PRINTF_FORMAT, fmt, arg)))
44+
#else
45+
#define CURL_TEMP_PRINTF(fmt, arg)
46+
#endif
47+
#else
48+
#define CURL_TEMP_PRINTF(fmt, arg) \
49+
__attribute__((format(printf, fmt, arg)))
50+
#endif
51+
#else
52+
#define CURL_TEMP_PRINTF(fmt, arg)
53+
#endif
54+
#endif
55+
56+
CURL_EXTERN int curl_mprintf(const char *format, ...)
57+
CURL_TEMP_PRINTF(1, 2);
58+
CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...)
59+
CURL_TEMP_PRINTF(2, 3);
60+
CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...)
61+
CURL_TEMP_PRINTF(2, 3);
3862
CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength,
39-
const char *format, ...);
40-
CURL_EXTERN int curl_mvprintf(const char *format, va_list args);
41-
CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args);
42-
CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args);
63+
const char *format, ...)
64+
CURL_TEMP_PRINTF(3, 4);
65+
CURL_EXTERN int curl_mvprintf(const char *format, va_list args)
66+
CURL_TEMP_PRINTF(1, 0);
67+
CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args)
68+
CURL_TEMP_PRINTF(2, 0);
69+
CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args)
70+
CURL_TEMP_PRINTF(2, 0);
4371
CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength,
44-
const char *format, va_list args);
45-
CURL_EXTERN char *curl_maprintf(const char *format, ...);
46-
CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);
72+
const char *format, va_list args)
73+
CURL_TEMP_PRINTF(3, 0);
74+
CURL_EXTERN char *curl_maprintf(const char *format, ...)
75+
CURL_TEMP_PRINTF(1, 2);
76+
CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args)
77+
CURL_TEMP_PRINTF(1, 0);
78+
79+
#undef CURL_TEMP_PRINTF
4780

4881
#ifdef __cplusplus
4982
} /* end of extern "C" */

ktor-client/ktor-client-curl/desktop/interop/linuxArm64/include/curl/multi.h renamed to ktor-client/ktor-client-curl/desktop/interop/include/curl/multi.h

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*
2525
***************************************************************************/
2626
/*
27-
This is an "external" header file. Don't give away any internals here!
27+
This is an "external" header file. Do not give away any internals here!
2828
2929
GOALS
3030
@@ -66,7 +66,7 @@ typedef enum {
6666
CURLM_OK,
6767
CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */
6868
CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */
69-
CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */
69+
CURLM_OUT_OF_MEMORY, /* if you ever get this, you are in deep sh*t */
7070
CURLM_INTERNAL_ERROR, /* this is a libcurl bug */
7171
CURLM_BAD_SOCKET, /* the passed in socket argument did not match */
7272
CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */
@@ -109,7 +109,7 @@ struct CURLMsg {
109109
typedef struct CURLMsg CURLMsg;
110110

111111
/* Based on poll(2) structure and values.
112-
* We don't use pollfd and POLL* constants explicitly
112+
* We do not use pollfd and POLL* constants explicitly
113113
* to cover platforms without poll(). */
114114
#define CURL_WAIT_POLLIN 0x0001
115115
#define CURL_WAIT_POLLPRI 0x0002
@@ -118,7 +118,7 @@ typedef struct CURLMsg CURLMsg;
118118
struct curl_waitfd {
119119
curl_socket_t fd;
120120
short events;
121-
short revents; /* not supported yet */
121+
short revents;
122122
};
123123

124124
/*
@@ -205,7 +205,7 @@ CURL_EXTERN CURLMcode curl_multi_wakeup(CURLM *multi_handle);
205205
/*
206206
* Name: curl_multi_perform()
207207
*
208-
* Desc: When the app thinks there's data available for curl it calls this
208+
* Desc: When the app thinks there is data available for curl it calls this
209209
* function to read/write whatever there is right now. This returns
210210
* as soon as the reads and writes are done. This function does not
211211
* require that there actually is data available for reading or that
@@ -236,7 +236,7 @@ CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle);
236236
/*
237237
* Name: curl_multi_info_read()
238238
*
239-
* Desc: Ask the multi handle if there's any messages/informationals from
239+
* Desc: Ask the multi handle if there is any messages/informationals from
240240
* the individual transfers. Messages include informationals such as
241241
* error code from the transfer or just the fact that a transfer is
242242
* completed. More details on these should be written down as well.
@@ -253,7 +253,7 @@ CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle);
253253
* we will provide the particular "transfer handle" in that struct
254254
* and that should/could/would be used in subsequent
255255
* curl_easy_getinfo() calls (or similar). The point being that we
256-
* must never expose complex structs to applications, as then we'll
256+
* must never expose complex structs to applications, as then we will
257257
* undoubtably get backwards compatibility problems in the future.
258258
*
259259
* Returns: A pointer to a filled-in struct, or NULL if it failed or ran out
@@ -268,7 +268,7 @@ CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,
268268
* Name: curl_multi_strerror()
269269
*
270270
* Desc: The curl_multi_strerror function may be used to turn a CURLMcode
271-
* value into the equivalent human readable error string. This is
271+
* value into the equivalent human readable error string. This is
272272
* useful for printing meaningful error messages.
273273
*
274274
* Returns: A pointer to a null-terminated error message.
@@ -282,7 +282,7 @@ CURL_EXTERN const char *curl_multi_strerror(CURLMcode);
282282
* Desc: An alternative version of curl_multi_perform() that allows the
283283
* application to pass in one of the file descriptors that have been
284284
* detected to have "action" on them and let libcurl perform.
285-
* See man page for details.
285+
* See manpage for details.
286286
*/
287287
#define CURL_POLL_NONE 0
288288
#define CURL_POLL_IN 1
@@ -426,6 +426,17 @@ CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle,
426426
CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,
427427
curl_socket_t sockfd, void *sockp);
428428

429+
/*
430+
* Name: curl_multi_get_handles()
431+
*
432+
* Desc: Returns an allocated array holding all handles currently added to
433+
* the multi handle. Marks the final entry with a NULL pointer. If
434+
* there is no easy handle added to the multi handle, this function
435+
* returns an array with the first entry as a NULL pointer.
436+
*
437+
* Returns: NULL on failure, otherwise a CURL **array pointer
438+
*/
439+
CURL_EXTERN CURL **curl_multi_get_handles(CURLM *multi_handle);
429440

430441
/*
431442
* Name: curl_push_callback
@@ -453,6 +464,20 @@ typedef int (*curl_push_callback)(CURL *parent,
453464
struct curl_pushheaders *headers,
454465
void *userp);
455466

467+
/*
468+
* Name: curl_multi_waitfds()
469+
*
470+
* Desc: Ask curl for fds for polling. The app can use these to poll on.
471+
* We want curl_multi_perform() called as soon as one of them are
472+
* ready. Passing zero size allows to get just a number of fds.
473+
*
474+
* Returns: CURLMcode type, general multi error code.
475+
*/
476+
CURL_EXTERN CURLMcode curl_multi_waitfds(CURLM *multi,
477+
struct curl_waitfd *ufds,
478+
unsigned int size,
479+
unsigned int *fd_count);
480+
456481
#ifdef __cplusplus
457482
} /* end of extern "C" */
458483
#endif

0 commit comments

Comments
 (0)