xref: /OK3568_Linux_fs/buildroot/package/libcurl/libcurl.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1################################################################################
2#
3# libcurl
4#
5################################################################################
6
7LIBCURL_VERSION = 7.79.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_CPE_ID_PRODUCT = libcurl
17LIBCURL_INSTALL_STAGING = YES
18
19# We disable NTLM support because it uses fork(), which doesn't work
20# on non-MMU platforms. Moreover, this authentication method is
21# probably almost never used. See
22# http://curl.se/docs/manpage.html#--ntlm.
23# Likewise, there is no compiler on the target, so libcurl-option (to
24# generate C code) isn't very useful
25LIBCURL_CONF_OPTS = --disable-manual --disable-ntlm-wb \
26	--enable-hidden-symbols --with-random=/dev/urandom --disable-curldebug \
27	--disable-libcurl-option --disable-ldap --disable-ldaps
28
29ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
30LIBCURL_CONF_OPTS += --enable-threaded-resolver
31else
32LIBCURL_CONF_OPTS += --disable-threaded-resolver
33endif
34
35ifeq ($(BR2_PACKAGE_LIBCURL_VERBOSE),y)
36LIBCURL_CONF_OPTS += --enable-verbose
37else
38LIBCURL_CONF_OPTS += --disable-verbose
39endif
40
41LIBCURL_CONFIG_SCRIPTS = curl-config
42
43ifeq ($(BR2_PACKAGE_LIBCURL_OPENSSL),y)
44LIBCURL_DEPENDENCIES += openssl
45# configure adds the cross openssl dir to LD_LIBRARY_PATH which screws up
46# native stuff during the rest of configure when target == host.
47# Fix it by setting LD_LIBRARY_PATH to something sensible so those libs
48# are found first.
49LIBCURL_CONF_ENV += LD_LIBRARY_PATH=$(if $(LD_LIBRARY_PATH),$(LD_LIBRARY_PATH):)/lib:/usr/lib
50LIBCURL_CONF_OPTS += --with-ssl=$(STAGING_DIR)/usr \
51	--with-ca-path=/etc/ssl/certs
52else
53LIBCURL_CONF_OPTS += --without-ssl
54endif
55
56ifeq ($(BR2_PACKAGE_LIBCURL_BEARSSL),y)
57LIBCURL_CONF_OPTS += --with-bearssl=$(STAGING_DIR)/usr
58LIBCURL_DEPENDENCIES += bearssl
59else
60LIBCURL_CONF_OPTS += --without-bearssl
61endif
62
63ifeq ($(BR2_PACKAGE_LIBCURL_GNUTLS),y)
64LIBCURL_CONF_OPTS += --with-gnutls=$(STAGING_DIR)/usr \
65	--with-ca-fallback
66LIBCURL_DEPENDENCIES += gnutls
67else
68LIBCURL_CONF_OPTS += --without-gnutls
69endif
70
71ifeq ($(BR2_PACKAGE_LIBCURL_LIBNSS),y)
72LIBCURL_CONF_OPTS += --with-nss=$(STAGING_DIR)/usr
73LIBCURL_CONF_ENV += CPPFLAGS="$(TARGET_CPPFLAGS) `$(PKG_CONFIG_HOST_BINARY) nspr nss --cflags`"
74LIBCURL_DEPENDENCIES += libnss
75else
76LIBCURL_CONF_OPTS += --without-nss
77endif
78
79ifeq ($(BR2_PACKAGE_LIBCURL_MBEDTLS),y)
80LIBCURL_CONF_OPTS += --with-mbedtls=$(STAGING_DIR)/usr
81LIBCURL_DEPENDENCIES += mbedtls
82else
83LIBCURL_CONF_OPTS += --without-mbedtls
84endif
85
86ifeq ($(BR2_PACKAGE_LIBCURL_WOLFSSL),y)
87LIBCURL_CONF_OPTS += --with-wolfssl=$(STAGING_DIR)/usr
88LIBCURL_DEPENDENCIES += wolfssl
89else
90LIBCURL_CONF_OPTS += --without-wolfssl
91endif
92
93ifeq ($(BR2_PACKAGE_C_ARES),y)
94LIBCURL_DEPENDENCIES += c-ares
95LIBCURL_CONF_OPTS += --enable-ares
96else
97LIBCURL_CONF_OPTS += --disable-ares
98endif
99
100ifeq ($(BR2_PACKAGE_LIBIDN2),y)
101LIBCURL_DEPENDENCIES += libidn2
102LIBCURL_CONF_OPTS += --with-libidn2
103else
104LIBCURL_CONF_OPTS += --without-libidn2
105endif
106
107# Configure curl to support libssh2
108ifeq ($(BR2_PACKAGE_LIBSSH2),y)
109LIBCURL_DEPENDENCIES += libssh2
110LIBCURL_CONF_OPTS += --with-libssh2
111else
112LIBCURL_CONF_OPTS += --without-libssh2
113endif
114
115ifeq ($(BR2_PACKAGE_BROTLI),y)
116LIBCURL_DEPENDENCIES += brotli
117LIBCURL_CONF_OPTS += --with-brotli
118else
119LIBCURL_CONF_OPTS += --without-brotli
120endif
121
122ifeq ($(BR2_PACKAGE_NGHTTP2),y)
123LIBCURL_DEPENDENCIES += nghttp2
124LIBCURL_CONF_OPTS += --with-nghttp2
125else
126LIBCURL_CONF_OPTS += --without-nghttp2
127endif
128
129ifeq ($(BR2_PACKAGE_LIBGSASL),y)
130LIBCURL_DEPENDENCIES += libgsasl
131LIBCURL_CONF_OPTS += --with-gsasl
132else
133LIBCURL_CONF_OPTS += --without-gsasl
134endif
135
136ifeq ($(BR2_PACKAGE_LIBCURL_COOKIES_SUPPORT),y)
137LIBCURL_CONF_OPTS += --enable-cookies
138else
139LIBCURL_CONF_OPTS += --disable-cookies
140endif
141
142ifeq ($(BR2_PACKAGE_LIBCURL_PROXY_SUPPORT),y)
143LIBCURL_CONF_OPTS += --enable-proxy
144else
145LIBCURL_CONF_OPTS += --disable-proxy
146endif
147
148ifeq ($(BR2_PACKAGE_LIBCURL_EXTRA_PROTOCOLS_FEATURES),y)
149LIBCURL_CONF_OPTS += \
150	--enable-dict \
151	--enable-gopher \
152	--enable-imap \
153	--enable-pop3 \
154	--enable-rtsp \
155	--enable-smb \
156	--enable-smtp \
157	--enable-telnet \
158	--enable-tftp
159else
160LIBCURL_CONF_OPTS += \
161	--disable-dict \
162	--disable-gopher \
163	--disable-imap \
164	--disable-pop3 \
165	--disable-rtsp \
166	--disable-smb \
167	--disable-smtp \
168	--disable-telnet \
169	--disable-tftp
170endif
171
172define LIBCURL_FIX_DOT_PC
173	printf 'Requires: openssl\n' >>$(@D)/libcurl.pc.in
174endef
175LIBCURL_POST_PATCH_HOOKS += $(if $(BR2_PACKAGE_LIBCURL_OPENSSL),LIBCURL_FIX_DOT_PC)
176
177ifeq ($(BR2_PACKAGE_LIBCURL_CURL),)
178define LIBCURL_TARGET_CLEANUP
179	rm -rf $(TARGET_DIR)/usr/bin/curl
180endef
181LIBCURL_POST_INSTALL_TARGET_HOOKS += LIBCURL_TARGET_CLEANUP
182endif
183
184HOST_LIBCURL_DEPENDENCIES = host-openssl
185HOST_LIBCURL_CONF_OPTS = \
186	--disable-manual \
187	--disable-ntlm-wb \
188	--disable-curldebug \
189	--with-ssl \
190	--without-gnutls \
191	--without-mbedtls \
192	--without-nss
193
194HOST_LIBCURL_POST_PATCH_HOOKS += LIBCURL_FIX_DOT_PC
195
196$(eval $(autotools-package))
197$(eval $(host-autotools-package))
198