1################################################################################
2#
3# libcurl
4#
5################################################################################
6
7LIBCURL_VERSION = 8.7.1
8LIBCURL_SOURCE = curl-$(LIBCURL_VERSION).tar.xz
9LIBCURL_SITE = https://curl.se/download
10LIBCURL_DEPENDENCIES = host-pkgconf \
11	$(if $(BR2_PACKAGE_ZLIB),zlib) \
12	$(if $(BR2_PACKAGE_RTMPDUMP),rtmpdump)
13LIBCURL_LICENSE = curl
14LIBCURL_LICENSE_FILES = COPYING
15LIBCURL_CPE_ID_VENDOR = haxx
16LIBCURL_INSTALL_STAGING = YES
17
18# We disable NTLM delegation to winbinds ntlm_auth ('--disable-ntlm-wb')
19# support because it uses fork(), which doesn't work on non-MMU platforms.
20# Moreover, this authentication method is probably almost never used (see
21# https://curl.se/docs/manpage.html#--ntlm), so disable NTLM support overall.
22#
23# Likewise, there is no compiler on the target, so libcurl-option (to
24# generate C code) isn't very useful
25LIBCURL_CONF_OPTS = \
26	--disable-manual \
27	--disable-ntlm \
28	--disable-ntlm-wb \
29	--with-random=/dev/urandom \
30	--disable-curldebug \
31	--disable-libcurl-option \
32	--disable-ldap \
33	--disable-ldaps
34
35ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
36LIBCURL_CONF_OPTS += --enable-threaded-resolver
37else
38LIBCURL_CONF_OPTS += --disable-threaded-resolver
39endif
40
41ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
42LIBCURL_CONF_OPTS += LIBS=-latomic
43endif
44
45ifeq ($(BR2_TOOLCHAIN_HAS_SYNC_1),)
46# Even though stdatomic.h does exist, link fails for __atomic_exchange_1
47# Work around this by pretending atomics aren't available.
48LIBCURL_CONF_ENV += ac_cv_header_stdatomic_h=no
49endif
50
51ifeq ($(BR2_PACKAGE_LIBCURL_VERBOSE),y)
52LIBCURL_CONF_OPTS += --enable-verbose
53else
54LIBCURL_CONF_OPTS += --disable-verbose
55endif
56
57LIBCURL_CONFIG_SCRIPTS = curl-config
58
59ifeq ($(BR2_PACKAGE_LIBCURL_TLS_NONE),y)
60LIBCURL_CONF_OPTS += --without-ssl
61endif
62
63ifeq ($(BR2_PACKAGE_LIBCURL_OPENSSL),y)
64LIBCURL_DEPENDENCIES += openssl
65LIBCURL_CONF_OPTS += --with-openssl=$(STAGING_DIR)/usr \
66	--with-ca-path=/etc/ssl/certs
67else
68LIBCURL_CONF_OPTS += --without-openssl
69endif
70
71ifeq ($(BR2_PACKAGE_LIBCURL_BEARSSL),y)
72LIBCURL_CONF_OPTS += --with-bearssl=$(STAGING_DIR)/usr
73LIBCURL_DEPENDENCIES += bearssl
74else
75LIBCURL_CONF_OPTS += --without-bearssl
76endif
77
78ifeq ($(BR2_PACKAGE_LIBCURL_GNUTLS),y)
79LIBCURL_CONF_OPTS += --with-gnutls=$(STAGING_DIR)/usr \
80	--with-ca-fallback
81LIBCURL_DEPENDENCIES += gnutls
82else
83LIBCURL_CONF_OPTS += --without-gnutls
84endif
85
86ifeq ($(BR2_PACKAGE_LIBCURL_MBEDTLS),y)
87LIBCURL_CONF_OPTS += --with-mbedtls=$(STAGING_DIR)/usr
88LIBCURL_DEPENDENCIES += mbedtls
89else
90LIBCURL_CONF_OPTS += --without-mbedtls
91endif
92
93ifeq ($(BR2_PACKAGE_LIBCURL_WOLFSSL),y)
94LIBCURL_CONF_OPTS += --with-wolfssl=$(STAGING_DIR)/usr
95LIBCURL_CONF_OPTS += --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt
96LIBCURL_DEPENDENCIES += wolfssl
97else
98LIBCURL_CONF_OPTS += --without-wolfssl
99endif
100
101ifeq ($(BR2_PACKAGE_C_ARES),y)
102LIBCURL_DEPENDENCIES += c-ares
103LIBCURL_CONF_OPTS += --enable-ares
104else
105LIBCURL_CONF_OPTS += --disable-ares
106endif
107
108ifeq ($(BR2_PACKAGE_LIBIDN2),y)
109LIBCURL_DEPENDENCIES += libidn2
110LIBCURL_CONF_OPTS += --with-libidn2
111else
112LIBCURL_CONF_OPTS += --without-libidn2
113endif
114
115ifeq ($(BR2_PACKAGE_LIBPSL),y)
116LIBCURL_DEPENDENCIES += libpsl
117LIBCURL_CONF_OPTS += --with-libpsl
118else
119LIBCURL_CONF_OPTS += --without-libpsl
120endif
121
122# Configure curl to support libssh2
123ifeq ($(BR2_PACKAGE_LIBSSH2),y)
124LIBCURL_DEPENDENCIES += libssh2
125LIBCURL_CONF_OPTS += --with-libssh2
126else
127LIBCURL_CONF_OPTS += --without-libssh2
128endif
129
130ifeq ($(BR2_PACKAGE_BROTLI),y)
131LIBCURL_DEPENDENCIES += brotli
132LIBCURL_CONF_OPTS += --with-brotli
133else
134LIBCURL_CONF_OPTS += --without-brotli
135endif
136
137ifeq ($(BR2_PACKAGE_NGHTTP2),y)
138LIBCURL_DEPENDENCIES += nghttp2
139LIBCURL_CONF_OPTS += --with-nghttp2
140else
141LIBCURL_CONF_OPTS += --without-nghttp2
142endif
143
144ifeq ($(BR2_PACKAGE_LIBGSASL),y)
145LIBCURL_DEPENDENCIES += libgsasl
146LIBCURL_CONF_OPTS += --with-libgsasl
147else
148LIBCURL_CONF_OPTS += --without-libgsasl
149endif
150
151ifeq ($(BR2_PACKAGE_LIBCURL_COOKIES_SUPPORT),y)
152LIBCURL_CONF_OPTS += --enable-cookies
153else
154LIBCURL_CONF_OPTS += --disable-cookies
155endif
156
157ifeq ($(BR2_PACKAGE_LIBCURL_PROXY_SUPPORT),y)
158LIBCURL_CONF_OPTS += --enable-proxy
159else
160LIBCURL_CONF_OPTS += --disable-proxy
161endif
162
163ifeq ($(BR2_PACKAGE_LIBCURL_WEBSOCKETS_SUPPORT),y)
164LIBCURL_CONF_OPTS += --enable-websockets
165else
166LIBCURL_CONF_OPTS += --disable-websockets
167endif
168
169ifeq ($(BR2_PACKAGE_LIBCURL_EXTRA_PROTOCOLS_FEATURES),y)
170LIBCURL_CONF_OPTS += \
171	--enable-dict \
172	--enable-gopher \
173	--enable-imap \
174	--enable-pop3 \
175	--enable-rtsp \
176	--enable-smb \
177	--enable-smtp \
178	--enable-telnet \
179	--enable-tftp
180else
181LIBCURL_CONF_OPTS += \
182	--disable-dict \
183	--disable-gopher \
184	--disable-imap \
185	--disable-pop3 \
186	--disable-rtsp \
187	--disable-smb \
188	--disable-smtp \
189	--disable-telnet \
190	--disable-tftp
191endif
192
193define LIBCURL_FIX_DOT_PC
194	printf 'Requires: openssl\n' >>$(@D)/libcurl.pc.in
195endef
196LIBCURL_POST_PATCH_HOOKS += $(if $(BR2_PACKAGE_LIBCURL_OPENSSL),LIBCURL_FIX_DOT_PC)
197
198ifeq ($(BR2_PACKAGE_LIBCURL_CURL),)
199define LIBCURL_TARGET_CLEANUP
200	rm -rf $(TARGET_DIR)/usr/bin/curl
201endef
202LIBCURL_POST_INSTALL_TARGET_HOOKS += LIBCURL_TARGET_CLEANUP
203endif
204
205$(eval $(autotools-package))
206