2021-09-05 16:50:22 +08:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#
|
|
|
|
# Copyright (C) 2021 ImmortalWrt.org
|
|
|
|
|
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
|
|
|
|
PKG_NAME:=naiveproxy
|
2021-11-16 12:46:32 +08:00
|
|
|
PKG_VERSION:=96.0.4664.45-1
|
2021-09-05 16:50:22 +08:00
|
|
|
PKG_RELEASE:=$(AUTORELEASE)
|
|
|
|
|
|
|
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
|
|
|
PKG_SOURCE_URL:=https://codeload.github.com/klzgrad/naiveproxy/tar.gz/v$(PKG_VERSION)?
|
2021-09-24 19:49:47 +08:00
|
|
|
PKG_HASH:=skip
|
2021-09-05 16:50:22 +08:00
|
|
|
|
|
|
|
PKG_LICENSE:=BSD 3-Clause
|
|
|
|
PKG_LICENSE_FILES:=LICENSE
|
|
|
|
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
|
|
|
|
|
|
|
|
PKG_BUILD_DEPENDS:=python3/host
|
|
|
|
ifneq ($(wildcard $(TOPDIR)/feeds/packages/devel/ninja/ninja.mk),)
|
|
|
|
PKG_BUILD_DEPENDS+= ninja/host
|
|
|
|
endif
|
|
|
|
PKG_USE_MIPS16:=0
|
|
|
|
PKG_BUILD_PARALLEL:=1
|
|
|
|
|
|
|
|
ifneq ($(CONFIG_CPU_TYPE)," ")
|
|
|
|
CPU_TYPE:=$(word 1, $(subst +," ,$(CONFIG_CPU_TYPE)))
|
|
|
|
CPU_SUBTYPE:=$(word 2, $(subst +, ",$(CONFIG_CPU_TYPE)))
|
|
|
|
ifeq ($(CPU_SUBTYPE),)
|
|
|
|
CPU_SUBTYPE:=""
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
CPU_TYPE:=""
|
|
|
|
CPU_SUBTYPE:=""
|
|
|
|
endif
|
|
|
|
|
|
|
|
include $(INCLUDE_DIR)/package.mk
|
|
|
|
|
|
|
|
define Package/naiveproxy
|
|
|
|
SECTION:=net
|
|
|
|
CATEGORY:=Network
|
|
|
|
SUBMENU:=Web Servers/Proxies
|
|
|
|
URL:=https://github.com/klzgrad/naiveproxy
|
|
|
|
TITLE:=Make a fortune quietly
|
2021-10-25 18:05:09 +08:00
|
|
|
DEPENDS:=@!(arc||(arm&&TARGET_gemini)||armeb||mips||mips64||powerpc) +libatomic
|
2021-09-05 16:50:22 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Package/naiveproxy/description
|
|
|
|
NaïveProxy uses Chrome's network stack to camouflage traffic with strong
|
|
|
|
censorship resistance and low detectability. Reusing Chrome's stack also
|
|
|
|
ensures best practices in performance and security.
|
|
|
|
endef
|
|
|
|
|
|
|
|
ifneq ($(CONFIG_CCACHE),)
|
|
|
|
export CCACHE_SLOPPINESS=time_macros
|
|
|
|
export CCACHE_BASEDIR=$(PKG_BUILD_DIR)/src
|
|
|
|
export CCACHE_CPP2=yes
|
|
|
|
export naive_ccache_flags=cc_wrapper="$(CCACHE)"
|
|
|
|
endif
|
|
|
|
|
2021-11-16 12:46:32 +08:00
|
|
|
CLANG_VER:=14-init-5759-g02895eed-1
|
2021-09-05 16:50:22 +08:00
|
|
|
CLANG_FILE:=clang-llvmorg-$(CLANG_VER).tgz
|
|
|
|
define Download/CLANG
|
2021-11-21 20:29:32 +08:00
|
|
|
URL:=https://commondatastorage.googleapis.com/chromium-browser-clang/Linux_x64 \
|
|
|
|
https://sources.immortalwrt.org \
|
|
|
|
https://sources.cdn.immortalwrt.org
|
2021-09-05 16:50:22 +08:00
|
|
|
URL_FILE:=$(CLANG_FILE)
|
|
|
|
FILE:=$(CLANG_FILE)
|
2021-11-16 12:46:32 +08:00
|
|
|
HASH:=5c2d11236c7254d48b02535ff58897830bc64e7258434d658c7d606e8d01b179
|
2021-09-05 16:50:22 +08:00
|
|
|
endef
|
|
|
|
|
2021-11-16 12:46:32 +08:00
|
|
|
GN_VER:=0153d369bbccc908f4da4993b1ba82728055926a
|
2021-09-05 16:50:22 +08:00
|
|
|
GN_FILE:=gn-git_revision-$(GN_VER).zip
|
|
|
|
define Download/GN_TOOL
|
2021-11-21 20:29:32 +08:00
|
|
|
URL:=https://chrome-infra-packages.appspot.com/dl/gn/gn/linux-amd64/+ \
|
|
|
|
https://sources.immortalwrt.org \
|
|
|
|
https://sources.cdn.immortalwrt.org
|
2021-09-05 16:50:22 +08:00
|
|
|
URL_FILE:=git_revision:$(GN_VER)
|
|
|
|
FILE:=$(GN_FILE)
|
2021-11-16 12:46:32 +08:00
|
|
|
HASH:=8022d1e0d6627a740847806c27a195fa9fc15c4883359a6d162944c3d5e26b44
|
2021-09-05 16:50:22 +08:00
|
|
|
endef
|
|
|
|
|
2021-11-16 12:46:32 +08:00
|
|
|
PGO_VER:=4664-1636557077-6e390f4e505916531ca2ab0c895d5903ab4d88a9
|
2021-09-05 16:50:22 +08:00
|
|
|
PGO_FILE:=chrome-linux-$(PGO_VER).profdata
|
|
|
|
define Download/PGO_PROF
|
|
|
|
URL:=https://storage.googleapis.com.cnpmjs.org/chromium-optimization-profiles/pgo_profiles \
|
2021-11-21 03:37:55 +08:00
|
|
|
https://storage.googleapis.com/chromium-optimization-profiles/pgo_profiles \
|
2021-11-21 20:29:32 +08:00
|
|
|
https://sources.immortalwrt.org \
|
|
|
|
https://sources.cdn.immortalwrt.org
|
2021-09-05 16:50:22 +08:00
|
|
|
URL_FILE:=$(PGO_FILE)
|
|
|
|
FILE:=$(PGO_FILE)
|
2021-11-16 12:46:32 +08:00
|
|
|
HASH:=8dcf5973033d40c9a7b15e571dea3832e7b67976aad9113369e22d43808c603f
|
2021-09-05 16:50:22 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/Prepare
|
|
|
|
$(call Build/Prepare/Default)
|
|
|
|
|
|
|
|
( \
|
|
|
|
cd $(PKG_BUILD_DIR)/src ; \
|
|
|
|
mkdir -p "chrome/build/pgo_profiles" ; \
|
|
|
|
$(CP) "$(DL_DIR)/$(PGO_FILE)" "chrome/build/pgo_profiles" ; \
|
|
|
|
mkdir -p "third_party/llvm-build/Release+Asserts" ; \
|
|
|
|
$(TAR) -xzf "$(DL_DIR)/$(CLANG_FILE)" -C "third_party/llvm-build/Release+Asserts" ; \
|
|
|
|
mkdir -p "gn/out" ; \
|
|
|
|
unzip -o "$(DL_DIR)/$(GN_FILE)" -d "gn/out" ; \
|
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
|
|
|
ifeq ($(NINJA),)
|
|
|
|
NINJA = \
|
|
|
|
MAKEFLAGS="$(MAKE_JOBSERVER)" \
|
|
|
|
$(STAGING_DIR_HOSTPKG)/bin/ninja \
|
|
|
|
$(if $(findstring c,$(OPENWRT_VERBOSE)),-v) \
|
|
|
|
$(if $(MAKE_JOBSERVER),,-j1)
|
|
|
|
endif
|
|
|
|
|
|
|
|
define Build/Compile
|
|
|
|
( \
|
|
|
|
cd "$(PKG_BUILD_DIR)/src" ; \
|
|
|
|
. ../init_env.sh "$(ARCH)" $(CPU_TYPE) $(CPU_SUBTYPE) "$(TOOLCHAIN_DIR)" ; \
|
|
|
|
export naive_flags+=" $$$${naive_ccache_flags}" ; \
|
|
|
|
mkdir -p "out" ; \
|
|
|
|
./gn/out/gn gen "out/Release" --args="$$$${naive_flags}" --script-executable="$(PYTHON)" ; \
|
|
|
|
)
|
|
|
|
+$(NINJA) -C "$(PKG_BUILD_DIR)/src/out/Release" naive
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Package/naiveproxy/install
|
|
|
|
$(INSTALL_DIR) $(1)/usr/bin
|
|
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/out/Release/naive $(1)/usr/bin/naive
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(call Download,CLANG))
|
|
|
|
$(eval $(call Download,GN_TOOL))
|
|
|
|
$(eval $(call Download,PGO_PROF))
|
|
|
|
|
|
|
|
$(eval $(call BuildPackage,naiveproxy))
|