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