8ef12c7d1386f8ad0c54138a91ba75dcc2c0d282
[openwrt/svn-archive/archive.git] / net / tor-alpha / Makefile
1 #
2 # Copyright (C) 2008-2011 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-alpha
11 PKG_VERSION:=0.2.2.21-alpha
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=tor-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=https://www.torproject.org/dist
16 PKG_MD5SUM:=4543aa232eed38c80dfb1f6419807ea9
17 PKG_BUILD_DIR=$(BUILD_DIR)/tor-$(PKG_VERSION)/
18
19 PKG_INSTALL:=1
20
21 include $(INCLUDE_DIR)/package.mk
22
23 define Package/tor-alpha
24 SECTION:=net
25 CATEGORY:=Network
26 DEPENDS:=+libevent +libopenssl +libpthread +miniupnpc
27 TITLE:=An anonymous Internet communication system
28 URL:=http://www.torproject.org/
29 endef
30
31 define Package/tor-alpha/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-alpha/conffiles
40 /etc/tor/torrc
41 endef
42
43 define Package/tor-alpha/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 --enable-upnp \
82 --with-libminiupnpc-dir="$(STAGING_DIR)/usr" \
83
84 CONFIGURE_VARS += \
85 CROSS_COMPILE="yes" \
86
87 # pass CFLAGS again to override -O2 set by configure
88 MAKE_FLAGS += \
89 CFLAGS="$(TARGET_CFLAGS)" \
90
91 define Package/tor-alpha/install
92 $(INSTALL_DIR) $(1)/usr/sbin
93 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/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_CONF) $(PKG_INSTALL_DIR)/etc/tor/torrc.sample $(1)/etc/tor/torrc
98 endef
99
100 $(eval $(call BuildPackage,tor-alpha))