add packages_10.03.2 in preparation for the 10.03.2 interim release
[10.03/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.2.24-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:=4c1e2c7d778f813d09227433fffe3990
18
19 PKG_BUILD_DIR:=$(BUILD_DIR)/tor-$(PKG_VERSION)
20 PKG_INSTALL:=1
21
22 include $(INCLUDE_DIR)/package.mk
23
24 define Package/tor-alpha/Default
25   SECTION:=net
26   CATEGORY:=Network
27   URL:=https://www.torproject.org/
28 endef
29
30 define Package/tor-alpha/Default/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-alpha
39 $(call Package/tor-alpha/Default)
40   TITLE:=An anonymous Internet communication system
41   DEPENDS:=+libevent +libopenssl +libpthread +librt +miniupnpc
42 endef
43
44 define Package/tor-alpha/description
45 $(call Package/tor-alpha/Default/description)
46  This package contains the tor daemon.
47 endef
48
49 define Package/tor-alpha-geoip
50 $(call Package/tor-alpha/Default)
51   TITLE:=GeoIP db for tor
52   DEPENDS:=+tor-alpha
53 endef
54
55 define Package/tor-alpha-geoip/description
56 $(call Package/tor-alpha/Default/description)
57  This package contains a GeoIP database mapping IP addresses to countries.
58 endef
59
60 define Package/tor-alpha/conffiles
61 /etc/tor/torrc
62 endef
63
64 define Package/tor-alpha/postinst
65 #!/bin/sh
66
67 name=tor
68 id=52
69
70 # do not change below
71 # # check if we are on real system
72 if [ -z "$${IPKG_INSTROOT}" ]; then
73         # create copies of passwd and group, if we use squashfs
74         rootfs=`mount |awk '/root/ { print $$5 }'`
75         if [ "$$rootfs" = "squashfs" ]; then
76                 if [ -h /etc/group ]; then
77                         rm /etc/group
78                         cp /rom/etc/group /etc/group
79                 fi
80                 if [ -h /etc/passwd ]; then
81                         rm /etc/passwd
82                         cp /rom/etc/passwd /etc/passwd
83                 fi
84         fi
85 fi
86
87 echo ""
88 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
89         echo "adding group $$name to /etc/group"
90         echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
91 fi
92
93 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
94         echo "adding user $$name to /etc/passwd"
95         echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
96 fi
97 endef
98
99 CONFIGURE_ARGS += \
100         --with-libevent-dir="$(STAGING_DIR)/usr" \
101         --with-ssl-dir="$(STAGING_DIR)/usr" \
102         --enable-upnp \
103         --with-libminiupnpc-dir="$(STAGING_DIR)/usr" \
104
105 CONFIGURE_VARS += \
106         CROSS_COMPILE="yes" \
107
108 # pass CFLAGS again to override -O2 set by configure
109 MAKE_FLAGS += \
110         CFLAGS="$(TARGET_CFLAGS)" \
111
112 define Package/tor-alpha/install
113         $(INSTALL_DIR) $(1)/usr/sbin
114         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor $(1)/usr/sbin/
115         $(INSTALL_DIR) $(1)/etc/init.d
116         $(INSTALL_BIN) ./files/tor.init $(1)/etc/init.d/tor
117         $(INSTALL_DIR) $(1)/etc/tor
118         $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/tor/torrc.sample $(1)/etc/tor/torrc
119 endef
120
121 define Package/tor-alpha-geoip/install
122         $(INSTALL_DIR) $(1)/usr/share/tor
123         $(CP) $(PKG_INSTALL_DIR)/usr/share/tor/geoip $(1)/usr/share/tor/
124 endef
125
126 $(eval $(call BuildPackage,tor-alpha))
127 $(eval $(call BuildPackage,tor-alpha-geoip))