Makefile 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. #
  2. # Copyright (C) 2020 Project OpenWrt
  3. #
  4. # This is free software, licensed under the GNU General Public License v3.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=naiveproxy
  9. PKG_VERSION:=86.0.4240.75-1
  10. PKG_RELEASE:=3
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=https://codeload.github.com/klzgrad/naiveproxy/tar.gz/v$(PKG_VERSION)?
  13. PKG_HASH:=91f946e137565115649bc5787788a6889d84e0a20e9878553a832b89c0cb161f
  14. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
  15. PKG_LICENSE:=BSD 3-Clause
  16. PKG_LICENSE_FILES:=LICENSE
  17. PKG_MAINTAINER:=CN_SZTL <[email protected]>
  18. PKG_BUILD_DEPENDS:=ncurses/host ninja/host python3/host
  19. PKG_USE_MIPS16:=0
  20. PKG_BUILD_PARALLEL:=1
  21. ifneq ($(CONFIG_CPU_TYPE)," ")
  22. CPU_TYPE:=$(word 1, $(subst +," ,$(CONFIG_CPU_TYPE)))
  23. CPU_SUBTYPE:=$(word 2, $(subst +, ",$(CONFIG_CPU_TYPE)))
  24. ifeq ($(CPU_SUBTYPE),)
  25. CPU_SUBTYPE:=""
  26. endif
  27. else
  28. CPU_TYPE:=""
  29. CPU_SUBTYPE:=""
  30. endif
  31. include $(INCLUDE_DIR)/package.mk
  32. define Package/naiveproxy/config
  33. depends on !(arc||armeb||mips||mips64||powerpc)
  34. endef
  35. define Package/naiveproxy
  36. SECTION:=net
  37. CATEGORY:=Network
  38. SUBMENU:=Web Servers/Proxies
  39. URL:=https://github.com/klzgrad/naiveproxy
  40. TITLE:=Make a fortune quietly
  41. DEPENDS:=+libatomic +libnss
  42. endef
  43. define Package/naiveproxy/description
  44. NaïveProxy uses Chrome's network stack to camouflage traffic with strong
  45. censorship resistance and low detectability. Reusing Chrome's stack also
  46. ensures best practices in performance and security.
  47. endef
  48. ifneq ($(CONFIG_CCACHE),)
  49. export CCACHE_SLOPPINESS=time_macros
  50. export CCACHE_BASEDIR=$(PKG_BUILD_DIR)/src
  51. export CCACHE_CPP2=yes
  52. export naive_ccache_flags=cc_wrapper="ccache"
  53. endif
  54. AFDO_VER:=86.0.4237.0_rc-r1-merged
  55. AFDO_FILE:=chromeos-chrome-amd64-$$(AFDO_VER).afdo.bz2
  56. define Download/AFDO_PROF
  57. URL:=https://storage.googleapis.com.cnpmjs.org/chromeos-prebuilt/afdo-job/llvm \
  58. https://storage.googleapis.com/chromeos-prebuilt/afdo-job/llvm
  59. URL_FILE:=$$(AFDO_FILE)
  60. FILE:=$$(URL_FILE)
  61. HASH:=d5730bd681766bcf4fd22c0e560ad500b2d6eb09164a9b80146cc327a156c98c
  62. endef
  63. CLANG_VER:=llvmorg-12-init-3492-ga1caa302-1
  64. CLANG_FILE:=clang-$$(CLANG_VER).tgz
  65. define Download/CLANG
  66. URL:=https://commondatastorage.googleapis.com/chromium-browser-clang/Linux_x64
  67. URL_FILE:=$$(CLANG_FILE)
  68. FILE:=$$(URL_FILE)
  69. HASH:=05df154999115386fb390a5ec7e6ca9e28aeae2ea1cbf76435247c0eee5b9ef3
  70. endef
  71. COLON:= :
  72. GN_VER:=git_revision$$(COLON)e327ffdc503815916db2543ec000226a8df45163
  73. GN_FILE:=gn-$$(GN_VER).zip
  74. define Download/GN_TOOL
  75. URL:=https://chrome-infra-packages.appspot.com/dl/gn/gn/linux-amd64/+
  76. URL_FILE:=$$(GN_VER)
  77. FILE:=$$(GN_FILE)
  78. HASH:=6d141b84a541e31ed7d3cd4d938987fdfa7988d5081d3089bc1509a43d6b742f
  79. endef
  80. define Build/Prepare
  81. $(call Build/Prepare/Default)
  82. ( \
  83. cd $(PKG_BUILD_DIR)/src ; \
  84. bzip2 -cd > "chrome/android/profiles/afdo.prof" < $(DL_DIR)/$(AFDO_FILE) ; \
  85. mkdir -p "third_party/llvm-build/Release+Asserts" ; \
  86. $(TAR) -xzf $(DL_DIR)/$(CLANG_FILE) -C "third_party/llvm-build/Release+Asserts" ; \
  87. mkdir -p "gn/out" ; \
  88. unzip -o $(DL_DIR)/$(GN_FILE) -d "gn/out" ; \
  89. )
  90. endef
  91. define Build/Compile
  92. ( \
  93. cd $(PKG_BUILD_DIR)/src ; \
  94. . ../init_env.sh "$(ARCH)" "$(BOARD)" $(CPU_TYPE) $(CPU_SUBTYPE) "$(TOOLCHAIN_DIR)" ; \
  95. export naive_flags="$$$${naive_flags} $$$${naive_ccache_flags}" ; \
  96. export OP_STAGING_DIR="$(STAGING_DIR)" ; \
  97. mkdir -p out ; \
  98. ./gn/out/gn gen "out/Release" --args="$$$${naive_flags}" --script-executable="$(STAGING_DIR_HOSTPKG)/bin/python3" ; \
  99. $(STAGING_DIR_HOSTPKG)/bin/ninja -C "out/Release" naive ; \
  100. )
  101. endef
  102. define Package/naiveproxy/install
  103. $(INSTALL_DIR) $(1)/usr/bin
  104. $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/out/Release/naive $(1)/usr/bin/naive
  105. endef
  106. $(eval $(call Download,AFDO_PROF))
  107. $(eval $(call Download,CLANG))
  108. $(eval $(call Download,GN_TOOL))
  109. $(eval $(call BuildPackage,naiveproxy))