f153da14d4bc5a39b7dc31b840def8ea0bcb7a86
[packages.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.3.3-alpha
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=tor-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=https://www.torproject.org/dist \
16         https://archive.torproject.org/tor-package-archive
17 PKG_MD5SUM:=982feab67723b50cbad31dc73f0e3e16
18
19 PKG_BUILD_DEPENDS:=libminiupnpc libnatpmp
20 PKG_BUILD_DIR:=$(BUILD_DIR)/tor-$(PKG_VERSION)
21 PKG_INSTALL:=1
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Package/tor-alpha/Default
26   SECTION:=net
27   CATEGORY:=Network
28   URL:=https://www.torproject.org/
29 endef
30
31 define Package/tor-alpha/Default/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
40 $(call Package/tor-alpha/Default)
41   TITLE:=An anonymous Internet communication system
42   DEPENDS:=+libevent2 +libevent2-openssl +libpthread +librt
43 endef
44
45 define Package/tor-alpha/description
46 $(call Package/tor-alpha/Default/description)
47  This package contains the tor daemon.
48 endef
49
50 define Package/tor-alpha-fw-helper
51 $(call Package/tor-alpha/Default)
52   TITLE:=Firewall helper for tor
53   DEPENDS:=+tor-alpha +libminiupnpc +libnatpmp
54 endef
55
56 define Package/tor-alpha-fw-helper/description
57 $(call Package/tor-alpha/Default/description)
58  This package contains a helper for automatically configuring port forwarding.
59 endef
60
61 define Package/tor-alpha-geoip
62 $(call Package/tor-alpha/Default)
63   TITLE:=GeoIP db for tor
64   DEPENDS:=+tor-alpha
65 endef
66
67 define Package/tor-alpha-geoip/description
68 $(call Package/tor-alpha/Default/description)
69  This package contains a GeoIP database mapping IP addresses to countries.
70 endef
71
72 define Package/tor-alpha/conffiles
73 /etc/tor/torrc
74 endef
75
76 define Package/tor-alpha/postinst
77 #!/bin/sh
78
79 name=tor
80 id=52
81
82 # do not change below
83 # # check if we are on real system
84 if [ -z "$${IPKG_INSTROOT}" ]; then
85         # create copies of passwd and group, if we use squashfs
86         rootfs=`mount |awk '/root/ { print $$5 }'`
87         if [ "$$rootfs" = "squashfs" ]; then
88                 if [ -h /etc/group ]; then
89                         rm /etc/group
90                         cp /rom/etc/group /etc/group
91                 fi
92                 if [ -h /etc/passwd ]; then
93                         rm /etc/passwd
94                         cp /rom/etc/passwd /etc/passwd
95                 fi
96         fi
97 fi
98
99 echo ""
100 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
101         echo "adding group $$name to /etc/group"
102         echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
103 fi
104
105 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
106         echo "adding user $$name to /etc/passwd"
107         echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
108 fi
109 endef
110
111 CONFIGURE_ARGS += \
112         --with-libevent-dir="$(STAGING_DIR)/usr" \
113         --with-ssl-dir="$(STAGING_DIR)/usr" \
114         --enable-upnp \
115         --with-libminiupnpc-dir="$(STAGING_DIR)/usr" \
116         --enable-nat-pmp \
117         --with-libnatpmp-dir="$(STAGING_DIR)/usr" \
118         --enable-bufferevents \
119         --disable-asciidoc
120
121 CONFIGURE_VARS += \
122         CROSS_COMPILE="yes"
123
124 # pass CFLAGS again to override -O2 set by configure
125 MAKE_FLAGS += \
126         CFLAGS="$(TARGET_CFLAGS)"
127
128 define Package/tor-alpha/install
129         $(INSTALL_DIR) $(1)/usr/sbin
130         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor $(1)/usr/sbin/
131         $(INSTALL_DIR) $(1)/etc/init.d
132         $(INSTALL_BIN) ./files/tor.init $(1)/etc/init.d/tor
133         $(INSTALL_DIR) $(1)/etc/tor
134         $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/tor/torrc.sample $(1)/etc/tor/torrc
135 endef
136
137 define Package/tor-alpha-fw-helper/install
138         $(INSTALL_DIR) $(1)/usr/bin
139         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor-fw-helper $(1)/usr/bin/
140 endef
141
142 define Package/tor-alpha-geoip/install
143         $(INSTALL_DIR) $(1)/usr/share/tor
144         $(CP) $(PKG_INSTALL_DIR)/usr/share/tor/geoip $(1)/usr/share/tor/
145 endef
146
147 $(eval $(call BuildPackage,tor-alpha))
148 $(eval $(call BuildPackage,tor-alpha-fw-helper))
149 $(eval $(call BuildPackage,tor-alpha-geoip))