curl: add config option for NTLM support
[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.48.0
12 PKG_RELEASE:=1
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_MD5SUM:=d42e0fc34a5cace5739631cc040974fe
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_AXTLS \
33   CONFIG_LIBCURL_CYASSL \
34   CONFIG_LIBCURL_GNUTLS \
35   CONFIG_LIBCURL_OPENSSL \
36   CONFIG_LIBCURL_POLARSSL \
37   CONFIG_LIBCURL_MBEDTLS \
38   CONFIG_LIBCURL_NOSSL \
39   \
40   CONFIG_LIBCURL_LIBIDN \
41   CONFIG_LIBCURL_SSH2 \
42   CONFIG_LIBCURL_ZLIB \
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   \
61   CONFIG_LIBCURL_COOKIES \
62   CONFIG_LIBCURL_CRYPTO_AUTH \
63   CONFIG_LIBCURL_LIBCURL_OPTION \
64   CONFIG_LIBCURL_PROXY \
65   CONFIG_LIBCURL_THREADED_RESOLVER \
66   CONFIG_LIBCURL_TLS_SRP \
67   CONFIG_LIBCURL_UNIX_SOCKETS \
68   CONFIG_LIBCURL_VERBOSE \
69   CONFIG_LIBCURL_NTLM
70
71 include $(INCLUDE_DIR)/package.mk
72
73 define Package/curl/Default
74   SECTION:=net
75   CATEGORY:=Network
76   URL:=http://curl.haxx.se/
77   MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
78 endef
79
80 define Package/curl
81   $(call Package/curl/Default)
82   SUBMENU:=File Transfer
83   DEPENDS:=+libcurl
84   TITLE:=A client-side URL transfer utility
85 endef
86
87 define Package/libcurl
88   $(call Package/curl/Default)
89   SECTION:=libs
90   CATEGORY:=Libraries
91   DEPENDS:=+LIBCURL_POLARSSL:libpolarssl +LIBCURL_CYASSL:libcyassl +LIBCURL_AXTLS:libaxtls +LIBCURL_OPENSSL:libopenssl +LIBCURL_GNUTLS:libgnutls +LIBCURL_MBEDTLS:libmbedtls
92   DEPENDS += +LIBCURL_ZLIB:zlib +LIBCURL_THREADED_RESOLVER:libpthread +LIBCURL_LDAP:libopenldap +LIBCURL_LIBIDN:libidn +LIBCURL_SSH2:libssh2
93   TITLE:=A client-side URL transfer library
94   MENU:=1
95 endef
96
97
98 define Package/libcurl/config
99   source "$(SOURCE)/Config.in"
100 endef
101
102 TARGET_CFLAGS += $(FPIC)
103 TARGET_CPPFLAGS += $(if $(CONFIG_LIBCURL_NTLM),,-DCURL_DISABLE_NTLM)
104
105 CONFIGURE_ARGS += \
106         --disable-debug \
107         --disable-ares \
108         --enable-shared \
109         --enable-static \
110         --disable-manual \
111         --without-ca-bundle \
112         --without-nss \
113         --without-libmetalink \
114         --without-librtmp \
115         \
116         $(call autoconf_bool,CONFIG_IPV6,ipv6) \
117         \
118         $(if $(CONFIG_LIBCURL_AXTLS),--with-axtls="$(STAGING_DIR)/usr" --without-ca-path,--without-axtls) \
119         $(if $(CONFIG_LIBCURL_CYASSL),--with-cyassl="$(STAGING_DIR)/usr" --without-ca-path,--without-cyassl) \
120         $(if $(CONFIG_LIBCURL_GNUTLS),--with-gnutls="$(STAGING_DIR)/usr" --with-ca-path=/etc/ssl/certs,--without-gnutls) \
121         $(if $(CONFIG_LIBCURL_OPENSSL),--with-ssl="$(STAGING_DIR)/usr" --with-ca-path=/etc/ssl/certs,--without-ssl) \
122         $(if $(CONFIG_LIBCURL_POLARSSL),--with-polarssl="$(STAGING_DIR)/usr" --with-ca-path=/etc/ssl/certs,--without-polarssl) \
123         $(if $(CONFIG_LIBCURL_MBEDTLS),--with-mbedtls="$(STAGING_DIR)/usr" --without-ca-path,--without-mbedtls) \
124         \
125         $(if $(CONFIG_LIBCURL_LIBIDN),--with-libidn="$(STAGING_DIR)/usr",--without-libidn) \
126         $(if $(CONFIG_LIBCURL_SSH2),--with-libssh2="$(STAGING_DIR)/usr",--without-libssh2) \
127         $(if $(CONFIG_LIBCURL_ZLIB),--with-zlib="$(STAGING_DIR)/usr",--without-zlib) \
128         \
129         $(call autoconf_bool,CONFIG_LIBCURL_DICT,dict) \
130         $(call autoconf_bool,CONFIG_LIBCURL_FILE,file) \
131         $(call autoconf_bool,CONFIG_LIBCURL_FTP,ftp) \
132         $(call autoconf_bool,CONFIG_LIBCURL_GOPHER,gopher) \
133         $(call autoconf_bool,CONFIG_LIBCURL_HTTP,http) \
134         $(call autoconf_bool,CONFIG_LIBCURL_IMAP,imap) \
135         $(call autoconf_bool,CONFIG_LIBCURL_LDAP,ldap) \
136         $(call autoconf_bool,CONFIG_LIBCURL_LDAPS,ldaps) \
137         $(call autoconf_bool,CONFIG_LIBCURL_POP3,pop3) \
138         $(call autoconf_bool,CONFIG_LIBCURL_RTSP,rtsp) \
139         $(call autoconf_bool,CONFIG_LIBCURL_SMB,smb) \
140         $(call autoconf_bool,CONFIG_LIBCURL_SMTP,smtp) \
141         $(call autoconf_bool,CONFIG_LIBCURL_TELNET,telnet) \
142         $(call autoconf_bool,CONFIG_LIBCURL_TFTP,tftp) \
143         \
144         $(call autoconf_bool,CONFIG_LIBCURL_COOKIES,cookies) \
145         $(call autoconf_bool,CONFIG_LIBCURL_CRYPTO_AUTH,crypto-auth) \
146         $(call autoconf_bool,CONFIG_LIBCURL_LIBCURL_OPTION,libcurl-option) \
147         $(call autoconf_bool,CONFIG_LIBCURL_PROXY,proxy) \
148         $(call autoconf_bool,CONFIG_LIBCURL_THREADED_RESOLVER,threaded-resolver) \
149         $(call autoconf_bool,CONFIG_LIBCURL_TLS_SRP,tls-srp) \
150         $(call autoconf_bool,CONFIG_LIBCURL_UNIX_SOCKETS,unix-sockets) \
151         $(call autoconf_bool,CONFIG_LIBCURL_VERBOSE,verbose) \
152
153 define Build/Compile
154         +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
155                 DESTDIR="$(PKG_INSTALL_DIR)" \
156                 CC="$(TARGET_CC)" \
157                 install
158 endef
159
160 define Build/InstallDev
161         $(INSTALL_DIR) $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib $(1)/usr/lib/pkgconfig
162         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/curl-config $(1)/usr/bin/
163         $(CP) $(PKG_INSTALL_DIR)/usr/include/curl $(1)/usr/include/
164         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcurl.{a,so*} $(1)/usr/lib/
165         $(CP) $(PKG_BUILD_DIR)/libcurl.pc $(1)/usr/lib/pkgconfig/
166         $(SED) 's,-L$$$${exec_prefix}/lib,,g' $(1)/usr/bin/curl-config
167         [ -n "$(TARGET_LDFLAGS)" ] && $(SED) 's#$(TARGET_LDFLAGS)##g' $(1)/usr/lib/pkgconfig/libcurl.pc || true
168         $(LN) $(STAGING_DIR)/usr/bin/curl-config $(2)/bin/
169 endef
170
171 define Package/curl/install
172         $(INSTALL_DIR) $(1)/usr/bin
173         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/curl $(1)/usr/bin/
174 endef
175
176 define Package/libcurl/install
177         $(INSTALL_DIR) $(1)/usr/lib
178         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcurl.so.* $(1)/usr/lib/
179 endef
180
181 $(eval $(call BuildPackage,curl))
182 $(eval $(call BuildPackage,libcurl))