curl: move to core packages
[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.36.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:=e6d1f9d1b59da5062109ffe14e0569a4
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         --without-krb4 \
101         --without-libidn \
102         --without-nss \
103         --without-libssh2 \
104         $(call autoconf_bool,CONFIG_IPV6,ipv6) \
105         $(if $(CONFIG_LIBCURL_AXTLS),--with-axtls="$(STAGING_DIR)/usr",--without-axtls) \
106         $(if $(CONFIG_LIBCURL_COOKIES),--enable,--disable)-cookies \
107         $(if $(CONFIG_LIBCURL_CRYPTO-AUTH),--enable,--disable)-crypto-auth \
108         $(if $(CONFIG_LIBCURL_CYASSL),--with-cyassl="$(STAGING_DIR)/usr",--without-cyassl) \
109         $(if $(CONFIG_LIBCURL_DICT),--enable,--disable)-dict \
110         $(if $(CONFIG_LIBCURL_FILE),--enable,--disable)-file \
111         $(if $(CONFIG_LIBCURL_FTP),--enable,--disable)-ftp \
112         $(if $(CONFIG_LIBCURL_GOPHER),--enable,--disable)-gopher \
113         $(if $(CONFIG_LIBCURL_GNUTLS),--with-gnutls="$(STAGING_DIR)/usr",--without-gnutls) \
114         $(if $(CONFIG_LIBCURL_HTTP),--enable,--disable)-http \
115         $(if $(CONFIG_LIBCURL_IMAP),--enable,--disable)-imap \
116         $(if $(CONFIG_LIBCURL_LDAP),--enable,--disable)-ldap \
117         $(if $(CONFIG_LIBCURL_LDAPS),--enable,--disable)-ldaps \
118         $(if $(CONFIG_LIBCURL_LIBCURL-OPTION),--enable,--disable)-libcurl-option \
119         $(if $(CONFIG_LIBCURL_OPENSSL),--with-ssl="$(STAGING_DIR)/usr",--without-ssl) \
120         $(if $(CONFIG_LIBCURL_POLARSSL),--with-polarssl="$(STAGING_DIR)/usr",--without-polarssl) \
121         $(if $(CONFIG_LIBCURL_POP3),--enable,--disable)-pop3 \
122         $(if $(CONFIG_LIBCURL_PROXY),--enable,--disable)-proxy \
123         $(if $(CONFIG_LIBCURL_RTSP),--enable,--disable)-rtsp \
124         $(if $(CONFIG_LIBCURL_TELNET),--enable,--disable)-telnet \
125         $(if $(CONFIG_LIBCURL_TFTP),--enable,--disable)-tftp \
126         $(if $(CONFIG_LIBCURL_SMTP),--enable,--disable)-smtp \
127         $(if $(CONFIG_LIBCURL_SSPI),--enable,--disable)-sspi \
128         $(if $(CONFIG_LIBCURL_THREADED_RESOLVER),--enable,--disable)-threaded-resolver \
129         $(if $(CONFIG_LIBCURL_TLS-SRP),--enable,--disable)-tls-srp \
130         $(if $(CONFIG_LIBCURL_ZLIB),--with-zlib="$(STAGING_DIR)/usr",--without-zlib) \
131
132 define Build/Compile
133         +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
134                 DESTDIR="$(PKG_INSTALL_DIR)" \
135                 CC="$(TARGET_CC)" \
136                 install
137 endef
138
139 define Build/InstallDev
140         $(INSTALL_DIR) $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib $(1)/usr/lib/pkgconfig
141         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/curl-config $(1)/usr/bin/
142         $(CP) $(PKG_INSTALL_DIR)/usr/include/curl $(1)/usr/include/
143         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcurl.{a,so*} $(1)/usr/lib/
144         $(CP) $(PKG_BUILD_DIR)/libcurl.pc $(1)/usr/lib/pkgconfig/
145         $(SED) 's,-L$$$${exec_prefix}/lib,,g' $(1)/usr/bin/curl-config
146         [ -n "$(TARGET_LDFLAGS)" ] && $(SED) 's#$(TARGET_LDFLAGS)##g' $(1)/usr/lib/pkgconfig/libcurl.pc || true
147         ln -sf $(STAGING_DIR)/usr/bin/curl-config $(2)/bin/
148 endef
149
150 define Package/curl/install
151         $(INSTALL_DIR) $(1)/usr/bin
152         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/curl $(1)/usr/bin/
153 endef
154
155 define Package/libcurl/install
156         $(INSTALL_DIR) $(1)/usr/lib
157         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcurl.so.* $(1)/usr/lib/
158 endef
159
160 $(eval $(call BuildPackage,curl))
161 $(eval $(call BuildPackage,libcurl))