treewide: refactor to use PKG_BUILD_FLAGS:=gc-sections
[feed/packages.git] / net / 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.7.13
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:=2079172cce034556f110048e26083ce9bea751f3154b0ad2809751815b11ea9d
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 PKG_BUILD_FLAGS:=gc-sections
27
28 include $(INCLUDE_DIR)/package.mk
29
30 define Package/tor/Default
31 SECTION:=net
32 CATEGORY:=Network
33 URL:=https://www.torproject.org/
34 USERID:=tor=52:tor=52
35 DEPENDS:=+libevent2 +libopenssl +libpthread +librt +zlib +libcap
36 TITLE:=Tor routing daemon
37 endef
38
39 define Package/tor/Default/description
40 Tor is a toolset for a wide range of organizations and people that want to
41 improve their safety and security on the Internet. Using Tor can help you
42 anonymize web browsing and publishing, instant messaging, IRC, SSH, and
43 more. Tor also provides a platform on which software developers can build
44 new applications with built-in anonymity, safety, and privacy features.
45 endef
46
47 define Package/tor
48 $(call Package/tor/Default)
49 TITLE+= (full)
50 CONFLICTS:=tor-basic
51 PROVIDES:=tor-basic
52 VARIANT:=full
53 endef
54
55 define Package/tor/description
56 $(call Package/tor/Default/description)
57
58 This package contains the full tor daemon.
59
60 endef
61
62 define Package/tor-basic
63 $(call Package/tor/Default)
64 TITLE+= (no bridge/relay support)
65 VARIANT:=basic
66 endef
67
68 define Package/tor-basic/description
69 $(call Package/tor/Default/description)
70
71 This package contains the basic tor daemon, without bridge/relay support.
72
73 endef
74
75 define Package/tor-gencert
76 $(call Package/tor/Default)
77 TITLE:=Tor certificate generation
78 DEPENDS:=tor
79 endef
80
81 define Package/tor-gencert/description
82 $(call Package/tor/Default/description)
83
84 Generate certs and keys for Tor directory authorities.
85
86 endef
87
88 define Package/tor-resolve
89 $(call Package/tor/Default)
90 TITLE:=tor hostname resolve
91 DEPENDS:=tor-basic
92 endef
93
94 define Package/tor-resolve/description
95 $(call Package/tor/Default/description)
96
97 Resolve a hostname to an IP address via tor.
98
99 endef
100
101 define Package/tor-geoip
102 $(call Package/tor/Default)
103 TITLE:=GeoIP db for tor
104 DEPENDS:=tor-basic
105 endef
106
107 define Package/tor-geoip/description
108 $(call Package/tor/Default/description)
109
110 This package contains a GeoIP database mapping IP addresses to countries.
111
112 endef
113
114 define Package/tor/conffiles
115 /etc/tor/torrc
116 /var/lib/tor/fingerprint
117 /var/lib/tor/keys/*
118 /etc/config/tor
119 endef
120
121 Package/tor-basic/conffiles = $(Package/tor/conffiles)
122
123 CONFIGURE_ARGS += \
124 --with-libevent-dir="$(STAGING_DIR)/usr" \
125 --with-openssl-dir="$(STAGING_DIR)/usr" \
126 --with-zlib-dir="$(STAGING_DIR)/usr" \
127 --disable-asciidoc \
128 --disable-html-manual \
129 --disable-manpage \
130 --disable-seccomp \
131 --disable-libscrypt \
132 --disable-unittests \
133 --disable-lzma \
134 --disable-zstd \
135 --with-tor-user=tor \
136 --with-tor-group=tor \
137 --enable-pic
138
139 ifeq ($(BUILD_VARIANT),basic)
140 CONFIGURE_ARGS += --disable-module-relay
141 endif
142
143
144 TARGET_CFLAGS += -flto \
145 $(if $(CONFIG_OPENSSL_ENGINE),,-DDISABLE_ENGINES)
146
147 TARGET_LDFLAGS += -flto
148
149 CONFIGURE_VARS += \
150 CROSS_COMPILE="yes" \
151 ac_cv_func_mallinfo=no
152
153 define Package/tor/install
154 $(INSTALL_DIR) $(1)/usr/sbin
155 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor $(1)/usr/sbin/
156 $(INSTALL_DIR) $(1)/etc/init.d
157 $(INSTALL_BIN) ./files/tor.init $(1)/etc/init.d/tor
158 $(INSTALL_DIR) $(1)/etc/tor
159 $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/tor/torrc.sample $(1)/etc/tor/torrc
160 $(INSTALL_DIR) $(1)/etc/config
161 $(INSTALL_CONF) ./files/tor.conf $(1)/etc/config/tor
162 endef
163
164 Package/tor-basic/install = $(Package/tor/install)
165
166 define Package/tor-gencert/install
167 $(INSTALL_DIR) $(1)/usr/sbin
168 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor-gencert $(1)/usr/sbin/
169 endef
170
171 define Package/tor-resolve/install
172 $(INSTALL_DIR) $(1)/usr/sbin
173 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor-resolve $(1)/usr/sbin/
174 endef
175
176 define Package/tor-geoip/install
177 $(INSTALL_DIR) $(1)/usr/share/tor
178 $(INSTALL_DATA) \
179 $(PKG_INSTALL_DIR)/usr/share/tor/geoip \
180 $(PKG_INSTALL_DIR)/usr/share/tor/geoip6 \
181 $(1)/usr/share/tor/
182 endef
183
184 $(eval $(call BuildPackage,tor))
185 $(eval $(call BuildPackage,tor-basic))
186 $(eval $(call BuildPackage,tor-gencert))
187 $(eval $(call BuildPackage,tor-resolve))
188 $(eval $(call BuildPackage,tor-geoip))