Makefile 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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.2.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:=06a1d835ddf382f6bca40a62e8fb40b71b2f73d56f0d53523c8bd5caf9b3026d
  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. endef
  29. define Package/tor/Default/description
  30. Tor is a toolset for a wide range of organizations and people that want to
  31. improve their safety and security on the Internet. Using Tor can help you
  32. anonymize web browsing and publishing, instant messaging, IRC, SSH, and
  33. more. Tor also provides a platform on which software developers can build
  34. new applications with built-in anonymity, safety, and privacy features.
  35. endef
  36. define Package/tor
  37. $(call Package/tor/Default)
  38. TITLE:=An anonymous Internet communication system
  39. DEPENDS:=+libevent2 +libopenssl +libpthread +librt +zlib +libcap
  40. endef
  41. define Package/tor/description
  42. $(call Package/tor/Default/description)
  43. This package contains the tor daemon.
  44. endef
  45. define Package/tor-gencert
  46. $(call Package/tor/Default)
  47. TITLE:=Tor certificate generation
  48. DEPENDS:=+tor
  49. endef
  50. define Package/tor-gencert/description
  51. $(call Package/tor/Default/description)
  52. Generate certs and keys for Tor directory authorities
  53. endef
  54. define Package/tor-resolve
  55. $(call Package/tor/Default)
  56. TITLE:=tor hostname resolve
  57. DEPENDS:=+tor
  58. endef
  59. define Package/tor-resolve/description
  60. $(call Package/tor/Default/description)
  61. Resolve a hostname to an IP address via tor
  62. endef
  63. define Package/tor-geoip
  64. $(call Package/tor/Default)
  65. TITLE:=GeoIP db for tor
  66. DEPENDS:=+tor
  67. endef
  68. define Package/tor-geoip/description
  69. $(call Package/tor/Default/description)
  70. This package contains a GeoIP database mapping IP addresses to countries.
  71. endef
  72. define Package/tor/conffiles
  73. /etc/tor/torrc
  74. /var/lib/tor/fingerprint
  75. /var/lib/tor/keys/*
  76. /etc/config/tor
  77. endef
  78. CONFIGURE_ARGS += \
  79. --with-libevent-dir="$(STAGING_DIR)/usr" \
  80. --with-openssl-dir="$(STAGING_DIR)/usr" \
  81. --with-zlib-dir="$(STAGING_DIR)/usr" \
  82. --disable-asciidoc \
  83. --disable-seccomp \
  84. --disable-libscrypt \
  85. --disable-unittests \
  86. --disable-lzma \
  87. --disable-zstd \
  88. --with-tor-user=tor \
  89. --with-tor-group=tor
  90. TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
  91. TARGET_LDFLAGS += -Wl,--gc-sections -flto
  92. ifneq ($(CONFIG_SSP_SUPPORT),y)
  93. CONFIGURE_ARGS += \
  94. --disable-gcc-hardening
  95. else
  96. EXTRA_CFLAGS += $(FPIC)
  97. endif
  98. CONFIGURE_VARS += \
  99. CROSS_COMPILE="yes"
  100. define Package/tor/install
  101. $(INSTALL_DIR) $(1)/usr/sbin
  102. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor $(1)/usr/sbin/
  103. $(INSTALL_DIR) $(1)/etc/init.d
  104. $(INSTALL_BIN) ./files/tor.init $(1)/etc/init.d/tor
  105. $(INSTALL_DIR) $(1)/etc/tor
  106. $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/tor/torrc.sample $(1)/etc/tor/torrc
  107. $(INSTALL_DIR) $(1)/etc/config
  108. $(INSTALL_CONF) ./files/tor.conf $(1)/etc/config/tor
  109. endef
  110. define Package/tor-gencert/install
  111. $(INSTALL_DIR) $(1)/usr/sbin
  112. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor-gencert $(1)/usr/sbin/
  113. endef
  114. define Package/tor-resolve/install
  115. $(INSTALL_DIR) $(1)/usr/sbin
  116. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor-resolve $(1)/usr/sbin/
  117. endef
  118. define Package/tor-geoip/install
  119. $(INSTALL_DIR) $(1)/usr/share/tor
  120. $(INSTALL_DATA) \
  121. $(PKG_INSTALL_DIR)/usr/share/tor/geoip \
  122. $(PKG_INSTALL_DIR)/usr/share/tor/geoip6 \
  123. $(1)/usr/share/tor/
  124. endef
  125. $(eval $(call BuildPackage,tor))
  126. $(eval $(call BuildPackage,tor-gencert))
  127. $(eval $(call BuildPackage,tor-resolve))
  128. $(eval $(call BuildPackage,tor-geoip))