kenzok8-package/naiveproxy/Makefile
2024-02-15 23:34:51 +08:00

114 lines
3.2 KiB
Makefile

# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=naiveproxy
PKG_VERSION:=121.0.6167.71-1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/klzgrad/naiveproxy/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=8e6d3029a0249140595fab3d668103881689f6c7ef7c65230191f674a370b309
PKG_LICENSE:=BSD 3-Clause
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
PKG_BUILD_DEPENDS:=gn/host
PKG_BUILD_PARALLEL:=1
PKG_BUILD_FLAGS:=no-mips16
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
DEPENDS:=@!(arc||armeb||mips||mips64||powerpc||TARGET_gemini) +libatomic
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
CLANG_VER:=18-init-12938-geb1d5065-1
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)
HASH:=fd1628fdb22157a7328c25802a745f17f92f5210a8b62591202deb92413f52e5
endef
PGO_VER:=6167-1705427108-cb39f8a22759d3159f79efc273ac8b13a0f3882a
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)
HASH:=7632c875db539cb1d4a0df6eb3acc9e155d2d477376dec1f815081bbae7cdd4f
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" ; \
gn gen "out/Release" --args="$$$${naive_flags}" --script-executable="$(PYTHON)" ; \
popd ; \
)
endef
define Build/Compile
+$(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,PGO_PROF))
$(eval $(call BuildPackage,naiveproxy))