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