You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

187 lines
4.5 KiB

  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. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=tor
  9. PKG_VERSION:=0.4.5.7
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=https://dist.torproject.org/ \
  13. https://archive.torproject.org/tor-package-archive
  14. PKG_HASH:=447fcaaa133e2ef22427e98098a60a9c495edf9ff3e0dd13f484b9ad0185f074
  15. PKG_MAINTAINER:=Hauke Mehrtens <hauke@hauke-m.de> \
  16. Peter Wagner <tripolar@gmx.at>
  17. PKG_LICENSE_FILES:=LICENSE
  18. PKG_CPE_ID:=cpe:/a:torproject:tor
  19. PKG_INSTALL:=1
  20. PKG_FIXUP:=autoreconf
  21. PKG_BUILD_PARALLEL:=1
  22. include $(INCLUDE_DIR)/package.mk
  23. define Package/tor/Default
  24. SECTION:=net
  25. CATEGORY:=Network
  26. URL:=https://www.torproject.org/
  27. USERID:=tor=52:tor=52
  28. DEPENDS:=+libevent2 +libopenssl +libpthread +librt +zlib +libcap
  29. TITLE:=Tor routing daemon
  30. endef
  31. define Package/tor/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. define Package/tor
  39. $(call Package/tor/Default)
  40. TITLE+= (full)
  41. CONFLICTS:=tor-basic
  42. PROVIDES:=tor-basic
  43. VARIANT:=full
  44. endef
  45. define Package/tor/description
  46. $(call Package/tor/Default/description)
  47. This package contains the full tor daemon.
  48. endef
  49. define Package/tor-basic
  50. $(call Package/tor/Default)
  51. TITLE+= (no bridge/relay support)
  52. VARIANT:=basic
  53. endef
  54. define Package/tor-basic/description
  55. $(call Package/tor/Default/description)
  56. This package contains the basic tor daemon, without bridge/relay support.
  57. endef
  58. define Package/tor-gencert
  59. $(call Package/tor/Default)
  60. TITLE:=Tor certificate generation
  61. DEPENDS:=tor
  62. endef
  63. define Package/tor-gencert/description
  64. $(call Package/tor/Default/description)
  65. Generate certs and keys for Tor directory authorities.
  66. endef
  67. define Package/tor-resolve
  68. $(call Package/tor/Default)
  69. TITLE:=tor hostname resolve
  70. DEPENDS:=tor-basic
  71. endef
  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. define Package/tor-geoip
  77. $(call Package/tor/Default)
  78. TITLE:=GeoIP db for tor
  79. DEPENDS:=tor-basic
  80. endef
  81. define Package/tor-geoip/description
  82. $(call Package/tor/Default/description)
  83. This package contains a GeoIP database mapping IP addresses to countries.
  84. endef
  85. define Package/tor/conffiles
  86. /etc/tor/torrc
  87. /var/lib/tor/fingerprint
  88. /var/lib/tor/keys/*
  89. /etc/config/tor
  90. endef
  91. Package/tor-basic/conffiles = $(Package/tor/conffiles)
  92. CONFIGURE_ARGS += \
  93. --with-libevent-dir="$(STAGING_DIR)/usr" \
  94. --with-openssl-dir="$(STAGING_DIR)/usr" \
  95. --with-zlib-dir="$(STAGING_DIR)/usr" \
  96. --disable-asciidoc \
  97. --disable-html-manual \
  98. --disable-manpage \
  99. --disable-seccomp \
  100. --disable-libscrypt \
  101. --disable-unittests \
  102. --disable-lzma \
  103. --disable-zstd \
  104. --with-tor-user=tor \
  105. --with-tor-group=tor \
  106. --enable-pic
  107. ifeq ($(BUILD_VARIANT),basic)
  108. CONFIGURE_ARGS += --disable-module-relay
  109. endif
  110. TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto \
  111. $(if $(CONFIG_OPENSSL_ENGINE),,-DDISABLE_ENGINES)
  112. TARGET_LDFLAGS += -Wl,--gc-sections -flto
  113. CONFIGURE_VARS += \
  114. CROSS_COMPILE="yes" \
  115. ac_cv_func_mallinfo=no
  116. define Package/tor/install
  117. $(INSTALL_DIR) $(1)/usr/sbin
  118. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor $(1)/usr/sbin/
  119. $(INSTALL_DIR) $(1)/etc/init.d
  120. $(INSTALL_BIN) ./files/tor.init $(1)/etc/init.d/tor
  121. $(INSTALL_DIR) $(1)/etc/tor
  122. $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/tor/torrc.sample $(1)/etc/tor/torrc
  123. $(INSTALL_DIR) $(1)/etc/config
  124. $(INSTALL_CONF) ./files/tor.conf $(1)/etc/config/tor
  125. endef
  126. Package/tor-basic/install = $(Package/tor/install)
  127. define Package/tor-gencert/install
  128. $(INSTALL_DIR) $(1)/usr/sbin
  129. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor-gencert $(1)/usr/sbin/
  130. endef
  131. define Package/tor-resolve/install
  132. $(INSTALL_DIR) $(1)/usr/sbin
  133. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor-resolve $(1)/usr/sbin/
  134. endef
  135. define Package/tor-geoip/install
  136. $(INSTALL_DIR) $(1)/usr/share/tor
  137. $(INSTALL_DATA) \
  138. $(PKG_INSTALL_DIR)/usr/share/tor/geoip \
  139. $(PKG_INSTALL_DIR)/usr/share/tor/geoip6 \
  140. $(1)/usr/share/tor/
  141. endef
  142. $(eval $(call BuildPackage,tor))
  143. $(eval $(call BuildPackage,tor-basic))
  144. $(eval $(call BuildPackage,tor-gencert))
  145. $(eval $(call BuildPackage,tor-resolve))
  146. $(eval $(call BuildPackage,tor-geoip))