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