2023-02-06 13:54:53 +08:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#
|
|
|
|
# Copyright (C) 2021 ImmortalWrt.org
|
|
|
|
|
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
|
|
|
|
PKG_NAME:=naiveproxy
|
2023-12-15 23:35:48 +08:00
|
|
|
PKG_VERSION:=120.0.6099.43-1
|
2023-03-19 10:37:36 +08:00
|
|
|
PKG_RELEASE:=1
|
2023-02-06 13:54:53 +08:00
|
|
|
|
|
|
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
|
|
|
PKG_SOURCE_URL:=https://codeload.github.com/klzgrad/naiveproxy/tar.gz/v$(PKG_VERSION)?
|
2023-12-15 23:35:48 +08:00
|
|
|
PKG_HASH:=b5344626f88b8b728116851d5a6f372e75557cbff878f9eda2f2fa7c2ae2e59f
|
2023-02-06 13:54:53 +08:00
|
|
|
|
|
|
|
PKG_LICENSE:=BSD 3-Clause
|
|
|
|
PKG_LICENSE_FILES:=LICENSE
|
|
|
|
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
|
|
|
|
|
2023-03-19 10:37:36 +08:00
|
|
|
PKG_BUILD_DEPENDS:=gn/host
|
2023-02-06 13:54:53 +08:00
|
|
|
PKG_BUILD_PARALLEL:=1
|
2023-09-17 04:18:18 +08:00
|
|
|
PKG_BUILD_FLAGS:=no-mips16
|
2023-02-06 13:54:53 +08:00
|
|
|
|
|
|
|
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
|
|
|
|
TITLE:=Make a fortune quietly
|
|
|
|
URL:=https://github.com/klzgrad/naiveproxy
|
2023-11-09 23:36:12 +08:00
|
|
|
DEPENDS:=@!(arc||armeb||mips||mips64||powerpc||TARGET_gemini) +libatomic
|
2023-02-06 13:54:53 +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
|
|
|
|
|
2023-12-15 23:35:48 +08:00
|
|
|
CLANG_VER:=18-init-9505-g10664813-1
|
2023-02-06 13:54:53 +08:00
|
|
|
CLANG_FILE:=clang-llvmorg-$(CLANG_VER).tgz
|
|
|
|
define Download/CLANG
|
|
|
|
URL:=https://commondatastorage.googleapis.com/chromium-browser-clang/Linux_x64
|
|
|
|
URL_FILE:=$(CLANG_FILE)
|
|
|
|
FILE:=$(CLANG_FILE)
|
2023-12-15 23:35:48 +08:00
|
|
|
HASH:=4385259d1f5a1c932a252cee70b5a9244f7a6de3f13aed4197056ef9151ad50c
|
2023-02-06 13:54:53 +08:00
|
|
|
endef
|
|
|
|
|
2023-12-15 23:35:48 +08:00
|
|
|
PGO_VER:=6099-1701163313-b23d7b20bc0e6506140a32e766fa675f7dc261e2
|
2023-02-06 13:54:53 +08:00
|
|
|
PGO_FILE:=chrome-linux-$(PGO_VER).profdata
|
|
|
|
define Download/PGO_PROF
|
|
|
|
URL:=https://storage.googleapis.com/chromium-optimization-profiles/pgo_profiles
|
|
|
|
URL_FILE:=$(PGO_FILE)
|
|
|
|
FILE:=$(PGO_FILE)
|
2023-12-15 23:35:48 +08:00
|
|
|
HASH:=0f6a5220f4022429e41cce213c7895e0adf838e5e491fad088e7cd295d37810a
|
2023-02-06 13:54:53 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/Prepare
|
|
|
|
$(call Build/Prepare/Default)
|
|
|
|
|
|
|
|
( \
|
|
|
|
pushd $(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" ; \
|
|
|
|
echo -e "llvmorg-$(CLANG_VER)" > "third_party/llvm-build/Release+Asserts/cr_build_revision" ; \
|
|
|
|
popd ; \
|
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/Configure
|
|
|
|
( \
|
|
|
|
pushd "$(PKG_BUILD_DIR)/src" ; \
|
|
|
|
. ../init_env.sh "$(ARCH)" $(CPU_TYPE) $(CPU_SUBTYPE) "$(TOOLCHAIN_DIR)" ; \
|
|
|
|
export naive_flags+=" $$$${naive_ccache_flags}" ; \
|
|
|
|
mkdir -p "out" ; \
|
2023-03-19 10:37:36 +08:00
|
|
|
gn gen "out/Release" --args="$$$${naive_flags}" --script-executable="$(PYTHON)" ; \
|
2023-02-06 13:54:53 +08:00
|
|
|
popd ; \
|
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/Compile
|
2023-04-09 01:18:55 +08:00
|
|
|
+$(NINJA) -C "$(PKG_BUILD_DIR)/src/out/Release" naive
|
2023-02-06 13:54:53 +08:00
|
|
|
endef
|
|
|
|
|
2023-08-29 19:14:08 +08:00
|
|
|
define Package/naiveproxy/conffiles
|
|
|
|
/etc/config/naiveproxy
|
|
|
|
endef
|
|
|
|
|
2023-02-06 13:54:53 +08:00
|
|
|
define Package/naiveproxy/install
|
|
|
|
$(INSTALL_DIR) $(1)/usr/bin
|
|
|
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/out/Release/naive $(1)/usr/bin/naive
|
2023-08-29 19:14:08 +08:00
|
|
|
$(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d
|
|
|
|
$(INSTALL_CONF) $(CURDIR)/files/naiveproxy.config $(1)/etc/config/naiveproxy
|
|
|
|
$(INSTALL_BIN) $(CURDIR)/files/naiveproxy.init $(1)/etc/init.d/naiveproxy
|
2023-02-06 13:54:53 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(call Download,CLANG))
|
|
|
|
$(eval $(call Download,PGO_PROF))
|
|
|
|
|
|
|
|
$(eval $(call BuildPackage,naiveproxy))
|