cad225e01b1c87c350d8ffbfd79c69f4d01e5ef1
[librecmc/librecmc.git] / package / network / services / tor / Makefile
1 #
2 # Copyright (C) 2008-2019 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.4.2.7
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=https://dist.torproject.org/ \
16         https://archive.torproject.org/tor-package-archive
17 PKG_HASH:=06a1d835ddf382f6bca40a62e8fb40b71b2f73d56f0d53523c8bd5caf9b3026d
18 PKG_MAINTAINER:=Hauke Mehrtens <hauke@hauke-m.de> \
19                 Peter Wagner <tripolar@gmx.at>
20 PKG_LICENSE_FILES:=LICENSE
21 PKG_CPE_ID:=cpe:/a:torproject:tor
22
23 PKG_INSTALL:=1
24 PKG_FIXUP:=autoreconf
25 PKG_BUILD_PARALLEL:=1
26
27 include $(INCLUDE_DIR)/package.mk
28
29 define Package/tor/Default
30   SECTION:=net
31   CATEGORY:=Network
32   URL:=https://www.torproject.org/
33   USERID:=tor=52:tor=52
34 endef
35
36 define Package/tor/Default/description
37  Tor is a toolset for a wide range of organizations and people that want to
38  improve their safety and security on the Internet. Using Tor can help you
39  anonymize web browsing and publishing, instant messaging, IRC, SSH, and
40  more. Tor also provides a platform on which software developers can build
41  new applications with built-in anonymity, safety, and privacy features.
42 endef
43
44 define Package/tor
45 $(call Package/tor/Default)
46   TITLE:=An anonymous Internet communication system
47   DEPENDS:=+libevent2 +libopenssl +libpthread +librt +zlib +libcap
48 endef
49
50 define Package/tor/description
51 $(call Package/tor/Default/description)
52  This package contains the tor daemon.
53 endef
54
55 define Package/tor-gencert
56 $(call Package/tor/Default)
57   TITLE:=Tor certificate generation
58   DEPENDS:=+tor
59 endef
60
61 define Package/tor-gencert/description
62 $(call Package/tor/Default/description)
63  Generate certs and keys for Tor directory authorities
64 endef
65
66 define Package/tor-resolve
67 $(call Package/tor/Default)
68   TITLE:=tor hostname resolve
69   DEPENDS:=+tor
70 endef
71
72 define Package/tor-resolve/description
73 $(call Package/tor/Default/description)
74  Resolve a hostname to an IP address via tor
75 endef
76
77 define Package/tor-geoip
78 $(call Package/tor/Default)
79   TITLE:=GeoIP db for tor
80   DEPENDS:=+tor
81 endef
82
83 define Package/tor-geoip/description
84 $(call Package/tor/Default/description)
85  This package contains a GeoIP database mapping IP addresses to countries.
86 endef
87
88 define Package/tor/conffiles
89 /etc/tor/torrc
90 /var/lib/tor/fingerprint
91 /var/lib/tor/keys/*
92 /etc/config/tor
93 endef
94
95 CONFIGURE_ARGS += \
96         --with-libevent-dir="$(STAGING_DIR)/usr" \
97         --with-openssl-dir="$(STAGING_DIR)/usr" \
98         --with-zlib-dir="$(STAGING_DIR)/usr" \
99         --disable-asciidoc \
100         --disable-seccomp \
101         --disable-libscrypt \
102         --disable-unittests \
103         --disable-lzma \
104         --disable-zstd \
105         --with-tor-user=tor \
106         --with-tor-group=tor
107
108 TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
109 TARGET_LDFLAGS += -Wl,--gc-sections -flto
110
111 ifneq ($(CONFIG_SSP_SUPPORT),y)
112         CONFIGURE_ARGS += \
113                 --disable-gcc-hardening
114 else
115         EXTRA_CFLAGS += $(FPIC)
116 endif
117
118 CONFIGURE_VARS += \
119         CROSS_COMPILE="yes"
120
121 define Package/tor/install
122         $(INSTALL_DIR) $(1)/usr/sbin
123         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor $(1)/usr/sbin/
124         $(INSTALL_DIR) $(1)/etc/init.d
125         $(INSTALL_BIN) ./files/tor.init $(1)/etc/init.d/tor
126         $(INSTALL_DIR) $(1)/etc/tor
127         $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/tor/torrc.sample $(1)/etc/tor/torrc
128         $(INSTALL_DIR) $(1)/etc/config
129         $(INSTALL_CONF) ./files/tor.conf $(1)/etc/config/tor
130 endef
131
132 define Package/tor-gencert/install
133         $(INSTALL_DIR) $(1)/usr/sbin
134         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor-gencert $(1)/usr/sbin/
135 endef
136
137 define Package/tor-resolve/install
138         $(INSTALL_DIR) $(1)/usr/sbin
139         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor-resolve $(1)/usr/sbin/
140 endef
141
142 define Package/tor-geoip/install
143         $(INSTALL_DIR) $(1)/usr/share/tor
144         $(INSTALL_DATA) \
145           $(PKG_INSTALL_DIR)/usr/share/tor/geoip \
146           $(PKG_INSTALL_DIR)/usr/share/tor/geoip6 \
147         $(1)/usr/share/tor/
148 endef
149
150 $(eval $(call BuildPackage,tor))
151 $(eval $(call BuildPackage,tor-gencert))
152 $(eval $(call BuildPackage,tor-resolve))
153 $(eval $(call BuildPackage,tor-geoip))