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