0e84a06b817516ef11a2bba35a59364333ad540c
[feed/packages.git] / net / curl / Makefile
1 #
2 # Copyright (C) 2007-2020 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/nls.mk
10
11 PKG_NAME:=curl
12 PKG_VERSION:=8.1.2
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
16 PKG_SOURCE_URL:=https://github.com/curl/curl/releases/download/curl-$(subst .,_,$(PKG_VERSION))/ \
17 https://dl.uxnr.de/mirror/curl/ \
18 https://curl.askapache.com/download/ \
19 https://curl.se/download/
20 PKG_HASH:=31b1118eb8bfd43cd95d9a3f146f814ff874f6ed3999b29d94f4d1e7dbac5ef6
21
22 PKG_LICENSE:=MIT
23 PKG_LICENSE_FILES:=COPYING
24 PKG_CPE_ID:=cpe:/a:haxx:libcurl
25
26 PKG_FIXUP:=autoreconf
27 PKG_INSTALL:=1
28 PKG_BUILD_PARALLEL:=1
29
30 PKG_CONFIG_DEPENDS:= \
31 CONFIG_IPV6 \
32 \
33 CONFIG_LIBCURL_WOLFSSL \
34 CONFIG_LIBCURL_GNUTLS \
35 CONFIG_LIBCURL_OPENSSL \
36 CONFIG_LIBCURL_MBEDTLS \
37 CONFIG_LIBCURL_NOSSL \
38 \
39 CONFIG_LIBCURL_LIBIDN2 \
40 CONFIG_LIBCURL_SSH2 \
41 CONFIG_LIBCURL_ZLIB \
42 CONFIG_LIBCURL_ZSTD \
43 \
44 CONFIG_LIBCURL_DICT \
45 CONFIG_LIBCURL_FILE \
46 CONFIG_LIBCURL_FTP \
47 CONFIG_LIBCURL_GOPHER \
48 CONFIG_LIBCURL_HTTP \
49 CONFIG_LIBCURL_IMAP \
50 CONFIG_LIBCURL_LDAP \
51 CONFIG_LIBCURL_LDAPS \
52 CONFIG_LIBCURL_POP3 \
53 CONFIG_LIBCURL_RTSP \
54 CONFIG_LIBCURL_NO_RTSP \
55 CONFIG_LIBCURL_SMB \
56 CONFIG_LIBCURL_NO_SMB \
57 CONFIG_LIBCURL_SMTP \
58 CONFIG_LIBCURL_TELNET \
59 CONFIG_LIBCURL_TFTP \
60 CONFIG_LIBCURL_NGHTTP2 \
61 \
62 CONFIG_LIBCURL_COOKIES \
63 CONFIG_LIBCURL_CRYPTO_AUTH \
64 CONFIG_LIBCURL_LIBCURL_OPTION \
65 CONFIG_LIBCURL_PROXY \
66 CONFIG_LIBCURL_THREADED_RESOLVER \
67 CONFIG_LIBCURL_TLS_SRP \
68 CONFIG_LIBCURL_UNIX_SOCKETS \
69 CONFIG_LIBCURL_VERBOSE \
70 CONFIG_LIBCURL_NTLM \
71 $(if $(CONFIG_LIBCURL_OPENSSL), \
72 CONFIG_OPENSSL_ENGINE \
73 CONFIG_OPENSSL_WITH_COMPRESSION \
74 CONFIG_OPENSSL_WITH_NPN)
75
76 include $(INCLUDE_DIR)/package.mk
77
78 define Package/curl/Default
79 SECTION:=net
80 CATEGORY:=Network
81 URL:=http://curl.se/
82 MAINTAINER:=Stan Grishin <stangri@melmac.ca>
83 endef
84
85 define Package/curl
86 $(call Package/curl/Default)
87 SUBMENU:=File Transfer
88 DEPENDS:=+libcurl
89 TITLE:=A client-side URL transfer utility
90 endef
91
92 define Package/libcurl
93 $(call Package/curl/Default)
94 SECTION:=libs
95 CATEGORY:=Libraries
96 DEPENDS:= +LIBCURL_WOLFSSL:libwolfssl +LIBCURL_OPENSSL:libopenssl +LIBCURL_GNUTLS:libgnutls +LIBCURL_MBEDTLS:libmbedtls
97 DEPENDS += +LIBCURL_ZLIB:zlib +LIBCURL_ZSTD:libzstd +LIBCURL_THREADED_RESOLVER:libpthread +LIBCURL_LDAP:libopenldap
98 DEPENDS += +LIBCURL_LIBIDN2:libidn2 +LIBCURL_SSH2:libssh2 +LIBCURL_NGHTTP2:libnghttp2 +ca-bundle
99 TITLE:=A client-side URL transfer library
100 MENU:=1
101 ABI_VERSION:=4
102 endef
103
104 define Package/libcurl/config
105 source "$(SOURCE)/Config.in"
106 endef
107
108 TARGET_CFLAGS += $(FPIC)
109 TARGET_CPPFLAGS += $(if $(CONFIG_LIBCURL_NTLM),,-DCURL_DISABLE_NTLM)
110 TARGET_LDFLAGS += -Wl,--gc-sections
111
112 CONFIGURE_ARGS += \
113 --disable-debug \
114 --disable-ares \
115 --enable-shared \
116 --enable-static \
117 --disable-manual \
118 --without-nss \
119 --without-librtmp \
120 --without-ca-path \
121 --without-libpsl \
122 --without-zstd \
123 --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt \
124 \
125 $(call autoconf_bool,CONFIG_IPV6,ipv6) \
126 \
127 $(if $(CONFIG_LIBCURL_WOLFSSL)$(CONFIG_LIBCURL_GNUTLS)$(CONFIG_LIBCURL_OPENSSL)$(CONFIG_LIBCURL_MBEDTLS),,--without-ssl) \
128 $(if $(CONFIG_LIBCURL_WOLFSSL),--with-wolfssl="$(STAGING_DIR)/usr",--without-wolfssl) \
129 $(if $(CONFIG_LIBCURL_GNUTLS),--with-gnutls="$(STAGING_DIR)/usr",--without-gnutls) \
130 $(if $(CONFIG_LIBCURL_OPENSSL),--with-openssl="$(STAGING_DIR)/usr",--without-openssl) \
131 $(if $(CONFIG_LIBCURL_MBEDTLS),--with-mbedtls="$(STAGING_DIR)/usr",--without-mbedtls) \
132 \
133 $(if $(CONFIG_LIBCURL_LIBIDN2),--with-libidn2="$(STAGING_DIR)/usr",--without-libidn2) \
134 $(if $(CONFIG_LIBCURL_SSH2),--with-libssh2="$(STAGING_DIR)/usr",--without-libssh2) \
135 $(if $(CONFIG_LIBCURL_ZLIB),--with-zlib="$(STAGING_DIR)/usr",--without-zlib) \
136 $(if $(CONFIG_LIBCURL_ZSTD),--with-zstd="$(STAGING_DIR)/usr",--without-zstd) \
137 $(if $(CONFIG_LIBCURL_NGHTTP2),--with-nghttp2="$(STAGING_DIR)/usr",--without-nghttp2) \
138 \
139 $(call autoconf_bool,CONFIG_LIBCURL_DICT,dict) \
140 $(call autoconf_bool,CONFIG_LIBCURL_FILE,file) \
141 $(call autoconf_bool,CONFIG_LIBCURL_FTP,ftp) \
142 $(call autoconf_bool,CONFIG_LIBCURL_GOPHER,gopher) \
143 $(call autoconf_bool,CONFIG_LIBCURL_HTTP,http) \
144 $(call autoconf_bool,CONFIG_LIBCURL_IMAP,imap) \
145 $(call autoconf_bool,CONFIG_LIBCURL_LDAP,ldap) \
146 $(call autoconf_bool,CONFIG_LIBCURL_LDAPS,ldaps) \
147 $(call autoconf_bool,CONFIG_LIBCURL_POP3,pop3) \
148 $(call autoconf_bool,CONFIG_LIBCURL_RTSP,rtsp) \
149 $(call autoconf_bool,CONFIG_LIBCURL_SMB,smb) \
150 $(call autoconf_bool,CONFIG_LIBCURL_SMTP,smtp) \
151 $(call autoconf_bool,CONFIG_LIBCURL_TELNET,telnet) \
152 $(call autoconf_bool,CONFIG_LIBCURL_TFTP,tftp) \
153 \
154 $(call autoconf_bool,CONFIG_LIBCURL_COOKIES,cookies) \
155 $(call autoconf_bool,CONFIG_LIBCURL_CRYPTO_AUTH,crypto-auth) \
156 $(call autoconf_bool,CONFIG_LIBCURL_LIBCURL_OPTION,libcurl-option) \
157 $(call autoconf_bool,CONFIG_LIBCURL_PROXY,proxy) \
158 $(call autoconf_bool,CONFIG_LIBCURL_THREADED_RESOLVER,threaded-resolver) \
159 $(call autoconf_bool,CONFIG_LIBCURL_TLS_SRP,tls-srp) \
160 $(call autoconf_bool,CONFIG_LIBCURL_UNIX_SOCKETS,unix-sockets) \
161 $(call autoconf_bool,CONFIG_LIBCURL_VERBOSE,verbose) \
162
163 define Build/InstallDev
164 $(INSTALL_DIR) $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib $(1)/usr/lib/pkgconfig
165 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/curl-config $(1)/usr/bin/
166 $(CP) $(PKG_INSTALL_DIR)/usr/include/curl $(1)/usr/include/
167 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcurl.{a,so*} $(1)/usr/lib/
168 $(CP) $(PKG_BUILD_DIR)/libcurl.pc $(1)/usr/lib/pkgconfig/
169 $(SED) 's,^\(prefix\|exec_prefix\)=.*,\1=$(STAGING_DIR)/usr,g' $(1)/usr/bin/curl-config
170 [ -n "$(TARGET_LDFLAGS)" ] && $(SED) 's#$(TARGET_LDFLAGS)##g' $(1)/usr/lib/pkgconfig/libcurl.pc || true
171 $(LN) $(STAGING_DIR)/usr/bin/curl-config $(2)/bin/
172 endef
173
174 define Package/curl/install
175 $(INSTALL_DIR) $(1)/usr/bin
176 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/curl $(1)/usr/bin/
177 endef
178
179 define Package/libcurl/install
180 $(INSTALL_DIR) $(1)/usr/lib
181 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcurl.so.* $(1)/usr/lib/
182 endef
183
184 $(eval $(call BuildPackage,libcurl))
185 $(eval $(call BuildPackage,curl))