[package] update tor to 0.2.0.34 (#4683)
[packages.git] / net / tor / Makefile
1 #
2 # Copyright (C) 2008 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=tor
12 PKG_VERSION:=0.2.0.34
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=http://www.torproject.org/dist/
17 PKG_MD5SUM:=f20011be23d5a76988233df12c346f41
18
19 include $(INCLUDE_DIR)/package.mk
20
21 define Package/tor
22   SECTION:=net
23   CATEGORY:=Network
24   DEPENDS:=+libevent +libopenssl +libpthread +zlib
25   TITLE:=An anonymous Internet communication system
26   URL:=http://tor.eff.org/
27 endef
28
29 define Package/tor/description
30  Tor is a toolset for a wide range of organizations and people that want to
31  improve their safety and security on the Internet. Using Tor can help you
32  anonymize web browsing and publishing, instant messaging, IRC, SSH, and
33  more. Tor also provides a platform on which software developers can build
34  new applications with built-in anonymity, safety, and privacy features.
35 endef
36
37 define Package/tor/conffiles
38 /etc/tor/torrc
39 endef
40
41 define Package/tor/postinst
42 #!/bin/sh
43
44 name=tor
45 id=52
46
47 # do not change below
48 # # check if we are on real system
49 if [ -z "$${IPKG_INSTROOT}" ]; then
50         # create copies of passwd and group, if we use squashfs
51         rootfs=`mount |awk '/root/ { print $$5 }'`
52         if [ "$$rootfs" = "squashfs" ]; then
53                 if [ -h /etc/group ]; then
54                         rm /etc/group
55                         cp /rom/etc/group /etc/group
56                 fi
57                 if [ -h /etc/passwd ]; then
58                         rm /etc/passwd
59                         cp /rom/etc/passwd /etc/passwd
60                 fi
61         fi
62 fi
63
64 echo ""
65 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
66         echo "adding group $$name to /etc/group"
67         echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
68 fi
69
70 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
71         echo "adding user $name to /etc/passwd"
72         echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
73 fi
74 endef
75
76 CONFIGURE_ARGS += \
77         --with-libevent-dir="$(STAGING_DIR)/usr" \
78         --with-ssl-dir="$(STAGING_DIR)/usr" \
79
80 CONFIGURE_VARS += \
81         CROSS_COMPILE="yes" \
82
83 # pass CFLAGS again to override -O2 set by configure
84 define Build/Compile
85         $(MAKE) -C $(PKG_BUILD_DIR) \
86                 CFLAGS="$(TARGET_CFLAGS)" \
87                 DESTDIR="$(PKG_INSTALL_DIR)" \
88                 all install
89 endef
90
91 define Package/tor/install
92         $(INSTALL_DIR) $(1)/usr/sbin
93         $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/or/tor $(1)/usr/sbin/
94         $(INSTALL_DIR) $(1)/etc/init.d
95         $(INSTALL_BIN) ./files/tor.init $(1)/etc/init.d/tor
96         $(INSTALL_DIR) $(1)/etc/tor
97         $(INSTALL_DATA) ./files/torrc $(1)/etc/tor/torrc
98 endef
99
100 $(eval $(call BuildPackage,tor))