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