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