[packages] wget: make it depend on libidn
[packages.git] / net / wget / Makefile
1 #
2 # Copyright (C) 2007-2010 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:=wget
11 PKG_VERSION:=1.12
12 PKG_RELEASE:=2
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=@GNU/$(PKG_NAME)
16 PKG_MD5SUM:=308a5476fc096a8a525d07279a6f6aa3
17
18 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
19
20 include $(INCLUDE_DIR)/package.mk
21
22 define Package/wget/Default
23   SECTION:=net
24   CATEGORY:=Network
25   DEPENDS:=+libidn
26   SUBMENU:=File Transfer
27   TITLE:=Non-interactive network downloader
28   URL:=http://www.gnu.org/software/wget/index.html
29 endef
30
31 define Package/wget/Default/description
32  Wget is a network utility to retrieve files from the Web using http
33  and ftp, the two most widely used Internet protocols. It works
34  non-interactively, so it will work in the background, after having
35  logged off. The program supports recursive retrieval of web-authoring
36  pages as well as ftp sites -- you can use wget to make mirrors of
37  archives and home pages or to travel the Web like a WWW robot.
38 endef
39
40 define Package/wget
41 $(call Package/wget/Default)
42   DEPENDS+= +libopenssl
43   TITLE+= (with SSL support)
44   VARIANT:=ssl
45 endef
46
47 define Package/wget/description
48 $(call Package/wget/Default/description)
49  This package is built with SSL support.
50 endef
51
52 define Package/wget-nossl
53 $(call Package/wget/Default)
54   TITLE+= (without SSL support)
55   VARIANT:=nossl
56 endef
57
58 define Package/wget-nossl/description
59 $(call Package/wget/Default/description)
60  This package is built without SSL support.
61 endef
62
63 CONFIGURE_ARGS+= \
64         --disable-rpath
65
66 ifeq ($(BUILD_VARIANT),ssl)
67         CONFIGURE_ARGS+= \
68                 --with-ssl \
69                 --with-libssl-prefix="$(STAGING_DIR)/usr"
70 endif
71
72 ifeq ($(BUILD_VARIANT),nossl)
73         CONFIGURE_ARGS+= \
74                 --without-ssl
75 endif
76
77 define Package/wget/install
78         $(INSTALL_DIR) $(1)/usr/bin
79         $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/wget $(1)/usr/bin/wget-ssl
80 endef
81
82 define Package/wget-nossl/install
83         $(INSTALL_DIR) $(1)/usr/bin
84         $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/wget $(1)/usr/bin/wget-nossl
85 endef
86
87 define Package/wget/postinst
88 #!/bin/sh
89 if [ -e $${IPKG_INSTROOT}/usr/bin/wget ]; then
90   rm -rf $${IPKG_INSTROOT}/usr/bin/wget;
91 fi
92 ln -sf ./wget-ssl $${IPKG_INSTROOT}/usr/bin/wget
93 endef
94
95 define Package/wget/postrm
96 #!/bin/sh
97 rm $${IPKG_INSTROOT}/usr/bin/wget
98 [ -x $${IPKG_INSTROOT}/usr/bin/wget-nossl ] && ln -s ./wget-nossl $${IPKG_INSTROOT}/usr/bin/wget || {
99   ln -s ../../bin/busybox $${IPKG_INSTROOT}/usr/bin/wget
100   $${IPKG_INSTROOT}/usr/bin/wget 2>&1 | grep 'applet not found' > /dev/null 2>&1 && rm $${IPKG_INSTROOT}/usr/bin/wget
101 }
102 exit 0
103 endef
104
105 define Package/wget-nossl/postinst
106 #!/bin/sh
107 if [ -e $${IPKG_INSTROOT}/usr/bin/wget ]; then
108   rm -rf $${IPKG_INSTROOT}/usr/bin/wget;
109 fi
110 ln -s ./wget-nossl $${IPKG_INSTROOT}/usr/bin/wget
111 endef
112
113 define Package/wget-nossl/postrm
114 #!/bin/sh
115 rm $${IPKG_INSTROOT}/usr/bin/wget
116 [ -x $${IPKG_INSTROOT}/usr/bin/wget-ssl ] && ln -s ./wget-ssl $${IPKG_INSTROOT}/usr/bin/wget || {
117   ln -s ../../bin/busybox $${IPKG_INSTROOT}/usr/bin/wget
118   $${IPKG_INSTROOT}/usr/bin/wget 2>&1 | grep 'applet not found' > /dev/null 2>&1 && rm $${IPKG_INSTROOT}/usr/bin/wget
119 }
120 exit 0
121 endef
122
123 $(eval $(call BuildPackage,wget))
124 $(eval $(call BuildPackage,wget-nossl))