replace lots of manual install commands with INSTALL_* variables
[packages.git] / net / tor / Makefile
1 #
2 # Copyright (C) 2006 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.1.1.24
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:=28dea6a77a43b6e421e1bd7b2cc3d940
20 PKG_CAT:=zcat
21
22 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
23 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
24
25 include $(INCLUDE_DIR)/package.mk
26
27 define Package/tor
28   SECTION:=net
29   CATEGORY:=Network
30   DEPENDS:=+libevent +libopenssl +libpthread +zlib
31   TITLE:=An anonymous Internet communication system
32   DESCRIPTION:=\
33         Tor is a toolset for a wide range of organizations and people that want \\\
34         to improve their safety and security on the Internet. Using Tor can \\\
35         help you anonymize web browsing and publishing, instant messaging, \\\
36         IRC, SSH, and more. Tor also provides a platform on which software \\\
37         developers can build new applications with built-in anonymity, safety, \\\
38         and privacy features.
39   URL:=http://tor.eff.org/
40 endef
41
42 define Package/tor/conffiles
43 /etc/tor/torrc
44 endef
45
46 define Package/tor/postinst
47 #!/bin/sh
48
49 name=tor
50 id=52
51
52 # do not change below
53 # # check if we are on real system
54 if [ -z "$${IPKG_INSTROOT}" ]; then
55         # create copies of passwd and group, if we use squashfs
56         rootfs=`mount |awk '/root/ { print $$5 }'`
57         if [ "$$rootfs" = "squashfs" ]; then
58                 if [ -h /etc/group ]; then
59                         rm /etc/group
60                         cp /rom/etc/group /etc/group
61                 fi
62                 if [ -h /etc/passwd ]; then
63                         rm /etc/passwd
64                         cp /rom/etc/passwd /etc/passwd
65                 fi
66         fi
67 fi
68
69 echo ""
70 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
71         echo "adding group $$name to /etc/group"
72         echo "$${name}:x:$${id}:" >> ${IPKG_INSTROOT}/etc/group
73 fi
74
75 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
76         echo "adding user $name to /etc/passwd"
77         echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
78 fi
79 endef
80
81 define Build/Configure
82         (cd $(PKG_BUILD_DIR); touch \
83                 configure.in \
84                 aclocal.m4 \
85                 Makefile.in \
86                 configure \
87         );
88         $(call Build/Configure/Default,\
89                 --with-libevent-dir="$(STAGING_DIR)/usr/" \
90                 --with-gnu-ld \
91                 , \
92                 ac_cv_libevent_normal=yes \
93                 ac_cv_openssldir="$(STAGING_DIR)/usr" \
94                 tor_cv_null_is_zero=yes \
95                 tor_cv_unaligned_ok=yes \
96                 tor_cv_time_t_signed=yes \
97                 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib -levent" \
98         )
99 endef
100
101 define Build/Compile
102         $(MAKE) -C $(PKG_BUILD_DIR) \
103                 DESTDIR="$(PKG_INSTALL_DIR)" \
104                 all install
105 endef
106
107 define Package/tor/install      
108         $(INSTALL_DIR) $(1)/usr/sbin
109         $(CP) $(PKG_INSTALL_DIR)/usr/bin/tor $(1)/usr/sbin/
110         $(INSTALL_DIR) $(1)/etc/init.d
111         $(INSTALL_BIN) ./files/tor.init $(1)/etc/init.d/tor
112         $(INSTALL_DIR) $(1)/etc/tor
113         $(INSTALL_DATA) ./files/torrc $(1)/etc/tor/torrc
114 endef
115
116 $(eval $(call BuildPackage,tor))