[packages_10.03.2] softflowd: merge r29100, r29199
[10.03/packages.git] / net / tor / 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
11 PKG_VERSION:=0.2.1.30
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=https://www.torproject.org/dist \
16         https://archive.torproject.org/tor-package-archive
17 PKG_MD5SUM:=6c6d61e053af5969a245d025c4cfce9d
18
19 PKG_INSTALL:=1
20
21 include $(INCLUDE_DIR)/package.mk
22
23 define Package/tor/Default
24   SECTION:=net
25   CATEGORY:=Network
26   URL:=https://www.torproject.org/
27 endef
28
29 define Package/tor/Default/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
38 $(call Package/tor/Default)
39   TITLE:=An anonymous Internet communication system
40   DEPENDS:=+libevent +libopenssl +libpthread +librt
41 endef
42
43 define Package/tor-geoip
44 $(call Package/tor/Default)
45   TITLE:=GeoIP db for tor
46   DEPENDS:=+tor
47 endef
48
49 define Package/tor/conffiles
50 /etc/tor/torrc
51 endef
52
53 define Package/tor/postinst
54 #!/bin/sh
55
56 name=tor
57 id=52
58
59 # do not change below
60 # # check if we are on real system
61 if [ -z "$${IPKG_INSTROOT}" ]; then
62         # create copies of passwd and group, if we use squashfs
63         rootfs=`mount |awk '/root/ { print $$5 }'`
64         if [ "$$rootfs" = "squashfs" ]; then
65                 if [ -h /etc/group ]; then
66                         rm /etc/group
67                         cp /rom/etc/group /etc/group
68                 fi
69                 if [ -h /etc/passwd ]; then
70                         rm /etc/passwd
71                         cp /rom/etc/passwd /etc/passwd
72                 fi
73         fi
74 fi
75
76 echo ""
77 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
78         echo "adding group $$name to /etc/group"
79         echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
80 fi
81
82 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
83         echo "adding user $$name to /etc/passwd"
84         echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
85 fi
86 endef
87
88 CONFIGURE_ARGS += \
89         --with-libevent-dir="$(STAGING_DIR)/usr" \
90         --with-ssl-dir="$(STAGING_DIR)/usr" \
91
92 CONFIGURE_VARS += \
93         CROSS_COMPILE="yes" \
94
95 # pass CFLAGS again to override -O2 set by configure
96 MAKE_FLAGS += \
97         CFLAGS="$(TARGET_CFLAGS)" \
98
99 define Package/tor/install
100         $(INSTALL_DIR) $(1)/usr/sbin
101         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor $(1)/usr/sbin/
102         $(INSTALL_DIR) $(1)/etc/init.d
103         $(INSTALL_BIN) ./files/tor.init $(1)/etc/init.d/tor
104         $(INSTALL_DIR) $(1)/etc/tor
105         $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/tor/torrc.sample $(1)/etc/tor/torrc
106 endef
107
108 define Package/tor-geoip/install
109         $(INSTALL_DIR) $(1)/usr/share/tor
110         $(CP) $(PKG_INSTALL_DIR)/usr/share/tor/geoip $(1)/usr/share/tor/
111 endef
112
113 $(eval $(call BuildPackage,tor))
114 $(eval $(call BuildPackage,tor-geoip))