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