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