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