This commit is contained in:
kenzok8 2023-08-29 11:08:45 +00:00
parent 04c44abf87
commit a539afcec6
4 changed files with 72 additions and 14 deletions

View File

@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=naiveproxy
PKG_VERSION:=113.0.5672.62-1
PKG_VERSION:=116.0.5845.92-2
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:=f8e86f5e9fc8985042d4fa8e0122b513f187cc878bfbabf133e520fa8d5f3410
PKG_HASH:=1e027730e9abdb9cf02eb4e0b831072f437c66647a9df4389dbecd7364614592
PKG_LICENSE:=BSD 3-Clause
PKG_LICENSE_FILES:=LICENSE
@ -18,7 +18,7 @@ PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
PKG_BUILD_DEPENDS:=gn/host
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
PKG_BUILD_FLAGS:=no-mips16
ifneq ($(CONFIG_CPU_TYPE)," ")
CPU_TYPE:=$(word 1, $(subst +," ,$(CONFIG_CPU_TYPE)))
@ -39,7 +39,7 @@ define Package/naiveproxy
SUBMENU:=Web Servers/Proxies
TITLE:=Make a fortune quietly
URL:=https://github.com/klzgrad/naiveproxy
DEPENDS:=@!(arc||armeb||mips||mips64||powerpc||TARGET_gemini) +libatomic
DEPENDS:=@!(arc||mips||mips64||powerpc||TARGET_gemini) +libatomic
endef
define Package/naiveproxy/description
@ -55,22 +55,22 @@ ifneq ($(CONFIG_CCACHE),)
export naive_ccache_flags=cc_wrapper="$(CCACHE)"
endif
CLANG_VER:=17-init-4759-g547e3456-1
CLANG_VER:=17-init-12166-g7586aeab-3
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:=1949427e0030523dc86bdf4b63dac88228cfe05c57318be2d0b0b290297925f6
HASH:=a3c744bef3e76c985b51f55f2c864f9bd10ac777b88a65a31d6cd85b6dda816b
endef
PGO_VER:=5672-1682419203-4df9c2f8b97b0e23303fa2b15279906232abc306
PGO_VER:=5845-1691722785-bee99d0dc25d78f4193491ad30759d668e3c9311
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:=5fae812f617d882222cd5aa5620fb355583391127f608759b030c231b71d4c90
HASH:=e6693bb2d9257a1c0d56c8bbd7713387a47e8d0bea44a5946699ffb393911cb4
endef
define Build/Prepare
@ -102,13 +102,19 @@ define Build/Compile
+$(NINJA) -C "$(PKG_BUILD_DIR)/src/out/Release" naive
endef
define Package/naiveproxy/conffiles
/etc/config/naiveproxy
endef
define Package/naiveproxy/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/out/Release/naive $(1)/usr/bin/naive
$(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
endef
$(eval $(call Download,CLANG))
$(eval $(call Download,PGO_PROF))
$(eval $(call BuildPackage,naiveproxy))

View File

@ -0,0 +1,6 @@
config naiveproxy 'config'
option enable '0'
option listen_addr ''
option server_addr ''
option extra_argument ''

View File

@ -0,0 +1,47 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2021 ImmortalWrt
. /lib/functions.sh
. /lib/functions/procd.sh
USE_PROCD=1
START=99
STOP=10
init_conf() {
config_load "naiveproxy"
config_get "enable" "config" "enable" "0"
config_get "listen_addr" "config" "listen_addr"
config_get "server_addr" "config" "server_addr"
config_get "extra_argument" "config" "extra_argument"
}
start_service() {
init_conf
[ "${enable}" == "1" ] || return 0
procd_open_instance naiveproxy
procd_set_param command naive
procd_append_param command --listen="${listen_addr}"
procd_append_param command --proxy="${server_addr}"
[ -n "${extra_argument}" ] && procd_append_param command "${extra_argument}"
procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
procd_set_param limits core="unlimited"
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}
reload_service()
{
stop
start
}
service_triggers() {
procd_add_reload_trigger "naiveproxy"
}

View File

@ -71,6 +71,7 @@ target_sysroot=\"${toolchain_dir}\""
case "${target_arch}" in
"arm")
naive_flags+=" arm_version=0 arm_cpu=\"${cpu_type}\""
case "${cpu_type}" in "arm1176jzf-s"|"arm926ej-s"|"mpcore"|"xscale") naive_flags+=" arm_use_thumb=false" ;; esac
if [ -n "${cpu_subtype}" ]; then
if grep -q "neon" <<< "${cpu_subtype}"; then
neon_flag="arm_use_neon=true"
@ -81,11 +82,9 @@ case "${target_arch}" in
else
naive_flags+=" arm_float_abi=\"soft\" arm_use_neon=false"
fi
case "${cpu_type}" in
"arm1176jzf-s"|"arm926ej-s"|"mpcore"|"xscale")
naive_flags+=" arm_use_thumb=false"
;;
esac
;;
"arm64")
[ -n "${cpu_type}" ] && naive_flags+=" arm_cpu=\"${cpu_type}\""
;;
"mipsel"|"mips64el")
naive_flags+=" use_thin_lto=false chrome_pgo_phase=0 mips_arch_variant=\"r2\""