08e2f1d1e94e9492c64dabffb8dbb24b0d7ae3ce
[openwrt.git] / package / network / utils / curl / Makefile
1 #
2 # Copyright (C) 2007-2014 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.40.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:=8d30594212e65657a5c32030f0998fa9
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   LIBCURL_AXTLS \
31   LIBCURL_COOKIES \
32   LIBCURL_CRYPTO_AUTH \
33   LIBCURL_CYASSL \
34   LIBCURL_DICT \
35   LIBCURL_FILE \
36   LIBCURL_FTP \
37   LIBCURL_GNUTLS \
38   LIBCURL_GOPHER \
39   LIBCURL_HTTP \
40   LIBCURL_IMAP \
41   LIBCURL_LDAP \
42   LIBCURL_LDAPS \
43   LIBCURL_LIBCURL_OPTION \
44   LIBCURL_NOSSL \
45   LIBCURL_OPENSSL \
46   LIBCURL_POLARSSL \
47   LIBCURL_POP3 \
48   LIBCURL_PROXY \
49   LIBCURL_RTSP \
50   LIBCURL_SMTP \
51   LIBCURL_SSPI \
52   LIBCURL_TELNET \
53   LIBCURL_TFTP \
54   LIBCURL_THREADED_RESOLVER \
55   LIBCURL_TLS-SRP \
56   LIBCURL_ZLIB
57
58 include $(INCLUDE_DIR)/package.mk
59
60 define Package/curl/Default
61   SECTION:=net
62   CATEGORY:=Network
63   URL:=http://curl.haxx.se/
64   MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
65 endef
66
67 define Package/curl
68   $(call Package/curl/Default)
69   SUBMENU:=File Transfer
70   DEPENDS:=+libcurl
71   TITLE:=A client-side URL transfer utility
72 endef
73
74 define Package/libcurl
75   $(call Package/curl/Default)
76   SECTION:=libs
77   CATEGORY:=Libraries
78   DEPENDS:=+LIBCURL_POLARSSL:libpolarssl +LIBCURL_CYASSL:libcyassl +LIBCURL_AXTLS:libaxtls +LIBCURL_OPENSSL:libopenssl +LIBCURL_GNUTLS:libgnutls +LIBCURL_ZLIB:zlib +LIBCURL_THREADED_RESOLVER:libpthread
79   TITLE:=A client-side URL transfer library using $(if $(CONFIG_LIBCURL_POLARSSL),PolarSSL)$(if $(CONFIG_LIBCURL_OPENSSL),OpenSSL)$(if $(CONFIG_LIBCURL_GNUTLS),GNUTLS)$(if $(CONFIG_LIBCURL_NOSSL),no SSL)
80   MENU:=1
81 endef
82
83
84 define Package/libcurl/config
85   source "$(SOURCE)/Config.in"
86 endef
87
88 TARGET_CFLAGS += $(FPIC)
89
90 CONFIGURE_ARGS += \
91         --enable-shared \
92         --enable-static \
93         --disable-thread \
94         --enable-nonblocking \
95         --disable-ares \
96         --disable-debug \
97         --disable-manual \
98         --disable-verbose \
99         --without-ca-bundle \
100         $(if $(CONFIG_LIBCURL_NOSSL),,--with-ca-path=/etc/ssl/certs/) \
101         --without-krb4 \
102         --without-libidn \
103         --without-nss \
104         --without-libssh2 \
105         $(call autoconf_bool,CONFIG_IPV6,ipv6) \
106         $(if $(CONFIG_LIBCURL_AXTLS),--with-axtls="$(STAGING_DIR)/usr",--without-axtls) \
107         $(if $(CONFIG_LIBCURL_COOKIES),--enable,--disable)-cookies \
108         $(if $(CONFIG_LIBCURL_CRYPTO-AUTH),--enable,--disable)-crypto-auth \
109         $(if $(CONFIG_LIBCURL_CYASSL),--with-cyassl="$(STAGING_DIR)/usr",--without-cyassl) \
110         $(if $(CONFIG_LIBCURL_DICT),--enable,--disable)-dict \
111         $(if $(CONFIG_LIBCURL_FILE),--enable,--disable)-file \
112         $(if $(CONFIG_LIBCURL_FTP),--enable,--disable)-ftp \
113         $(if $(CONFIG_LIBCURL_GOPHER),--enable,--disable)-gopher \
114         $(if $(CONFIG_LIBCURL_GNUTLS),--with-gnutls="$(STAGING_DIR)/usr",--without-gnutls) \
115         $(if $(CONFIG_LIBCURL_HTTP),--enable,--disable)-http \
116         $(if $(CONFIG_LIBCURL_IMAP),--enable,--disable)-imap \
117         $(if $(CONFIG_LIBCURL_LDAP),--enable,--disable)-ldap \
118         $(if $(CONFIG_LIBCURL_LDAPS),--enable,--disable)-ldaps \
119         $(if $(CONFIG_LIBCURL_LIBCURL-OPTION),--enable,--disable)-libcurl-option \
120         $(if $(CONFIG_LIBCURL_OPENSSL),--with-ssl="$(STAGING_DIR)/usr",--without-ssl) \
121         $(if $(CONFIG_LIBCURL_POLARSSL),--with-polarssl="$(STAGING_DIR)/usr",--without-polarssl) \
122         $(if $(CONFIG_LIBCURL_POP3),--enable,--disable)-pop3 \
123         $(if $(CONFIG_LIBCURL_PROXY),--enable,--disable)-proxy \
124         $(if $(CONFIG_LIBCURL_RTSP),--enable,--disable)-rtsp \
125         $(if $(CONFIG_LIBCURL_TELNET),--enable,--disable)-telnet \
126         $(if $(CONFIG_LIBCURL_TFTP),--enable,--disable)-tftp \
127         $(if $(CONFIG_LIBCURL_SMTP),--enable,--disable)-smtp \
128         $(if $(CONFIG_LIBCURL_SSPI),--enable,--disable)-sspi \
129         $(if $(CONFIG_LIBCURL_THREADED_RESOLVER),--enable,--disable)-threaded-resolver \
130         $(if $(CONFIG_LIBCURL_TLS-SRP),--enable,--disable)-tls-srp \
131         $(if $(CONFIG_LIBCURL_ZLIB),--with-zlib="$(STAGING_DIR)/usr",--without-zlib) \
132
133 define Build/Compile
134         +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
135                 DESTDIR="$(PKG_INSTALL_DIR)" \
136                 CC="$(TARGET_CC)" \
137                 install
138 endef
139
140 define Build/InstallDev
141         $(INSTALL_DIR) $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib $(1)/usr/lib/pkgconfig
142         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/curl-config $(1)/usr/bin/
143         $(CP) $(PKG_INSTALL_DIR)/usr/include/curl $(1)/usr/include/
144         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcurl.{a,so*} $(1)/usr/lib/
145         $(CP) $(PKG_BUILD_DIR)/libcurl.pc $(1)/usr/lib/pkgconfig/
146         $(SED) 's,-L$$$${exec_prefix}/lib,,g' $(1)/usr/bin/curl-config
147         [ -n "$(TARGET_LDFLAGS)" ] && $(SED) 's#$(TARGET_LDFLAGS)##g' $(1)/usr/lib/pkgconfig/libcurl.pc || true
148         $(LN) $(STAGING_DIR)/usr/bin/curl-config $(2)/bin/
149 endef
150
151 define Package/curl/install
152         $(INSTALL_DIR) $(1)/usr/bin
153         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/curl $(1)/usr/bin/
154 endef
155
156 define Package/libcurl/install
157         $(INSTALL_DIR) $(1)/usr/lib
158         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcurl.so.* $(1)/usr/lib/
159 endef
160
161 $(eval $(call BuildPackage,curl))
162 $(eval $(call BuildPackage,libcurl))