浏览代码

naiveproxy: sync with upstream source

Signed-off-by: Tianling Shen <[email protected]>
Tianling Shen 4 年之前
父节点
当前提交
9534d2889b
共有 3 个文件被更改,包括 57 次插入43 次删除
  1. 22 22
      naiveproxy/Makefile
  2. 1 1
      naiveproxy/patches/001-Remove-concurrency-limit.patch
  3. 34 20
      naiveproxy/src/init_env.sh

+ 22 - 22
naiveproxy/Makefile

@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=naiveproxy
 PKG_VERSION:=91.0.4472.77-1
-PKG_RELEASE:=1
+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)?
@@ -16,19 +16,19 @@ PKG_LICENSE:=BSD 3-Clause
 PKG_LICENSE_FILES:=LICENSE
 PKG_MAINTAINER:=Tianling Shen <[email protected]>
 
-PKG_BUILD_DEPENDS:=ninja/host python3/host
+PKG_BUILD_DEPENDS:=python3/host
 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
+  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:=""
+  CPU_TYPE:=""
+  CPU_SUBTYPE:=""
 endif
 
 include $(INCLUDE_DIR)/package.mk
@@ -53,10 +53,10 @@ define Package/naiveproxy/description
 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)"
+  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:=llvmorg-13-init-6429-g0e92cbd6-2
@@ -102,14 +102,14 @@ define Build/Prepare
 endef
 
 define Build/Compile
-( \
-	cd "$(PKG_BUILD_DIR)/src" ; \
-	. ../init_env.sh "$(ARCH)" "$(BOARD)" $(CPU_TYPE) $(CPU_SUBTYPE) "$(TOOLCHAIN_DIR)" ; \
-	export naive_flags="$$$${naive_flags} $$$${naive_ccache_flags}" ; \
-	mkdir -p "out" ; \
-	./gn/out/gn gen "out/Release" --args="$$$${naive_flags}" --script-executable="$(STAGING_DIR_HOSTPKG)/bin/python3" ; \
-	$(STAGING_DIR_HOSTPKG)/bin/ninja -C "out/Release" naive ; \
-)
+	( \
+		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
@@ -121,4 +121,4 @@ $(eval $(call Download,CLANG))
 $(eval $(call Download,GN_TOOL))
 $(eval $(call Download,PGO_PROF))
 
-$(eval $(call BuildPackage,naiveproxy))
+$(eval $(call BuildPackage,naiveproxy))

+ 1 - 1
naiveproxy/patches/001-Remove-concurrency-limit.patch

@@ -29,7 +29,7 @@ Subject: [PATCH] Remove concurrency limit
        net_log_(
 --- a/src/net/tools/naive/naive_proxy_bin.cc
 +++ b/src/net/tools/naive/naive_proxy_bin.cc
-@@ -299,7 +299,7 @@ bool ParseCommandLine(const CommandLine&
+@@ -296,7 +296,7 @@ bool ParseCommandLine(const CommandLine&
  
    if (!cmdline.concurrency.empty()) {
      if (!base::StringToInt(cmdline.concurrency, &params->concurrency) ||

+ 34 - 20
naiveproxy/src/init_env.sh

@@ -7,17 +7,25 @@
 
 # Read args from shell
 target_arch="$1"
-target_board="$2"
-cpu_type="$3"
-cpu_subtype="$4"
-toolchain_dir="$5"
+cpu_type="$2"
+cpu_subtype="$3"
+toolchain_dir="$4"
 
 # Set arch info
-naive_arch="${target_arch}"
-[ "${target_arch}" == "i386" ] && naive_arch="x86"
-[ "${target_arch}" == "x86_64" ] && naive_arch="x64"
-[ "${target_arch}" == "aarch64" ] && naive_arch="arm64"
-# ldso_path="/lib/$(find "${toolchain_dir}/" | grep -Eo "ld-musl-[a-z0-9_-]+\\.so\\.1")"
+case "${target_arch}" in
+"aarch64")
+	naive_arch="arm64"
+	;;
+"i386")
+	naive_arch="x86"
+	;;
+"x86_64")
+	naive_arch="x64"
+	;;
+*)
+	naive_arch="${target_arch}"
+	;;
+esac
 
 # OS detection
 [ "$(uname)" != "Linux" -o "$(uname -m)" != "x86_64" ] && { echo -e "Support Linux AMD64 only."; exit 1; }
@@ -62,17 +70,23 @@ include_transport_security_state_preload_list=false
 target_os=\"openwrt\"
 target_cpu=\"${naive_arch}\"
 target_sysroot=\"${toolchain_dir}\""
-# ldso_path=\"${ldso_path}\""
-[ "${target_arch}" == "arm" ] && {
-	naive_flags="${naive_flags} arm_version=0 arm_cpu=\"${cpu_type}\""
+
+case "${target_arch}" in
+"arm")
+	naive_flags+=" arm_version=0 arm_cpu=\"${cpu_type}\""
 	if [ -n "${cpu_subtype}" ]; then
-		echo "${cpu_subtype}" | grep -q "neon" && neon_flag="arm_use_neon=true" || neon_flag="arm_use_neon=false"
-		naive_flags="${naive_flags} arm_fpu=\"${cpu_subtype}\" arm_float_abi=\"hard\" ${neon_flag}"
+		if grep -q "neon" <<< "${cpu_subtype}"; then
+			neon_flag="arm_use_neon=true"
+		else
+			neon_flag="arm_use_neon=false"
+		fi
+		naive_flags+=" arm_fpu=\"${cpu_subtype}\" arm_float_abi=\"hard\" ${neon_flag}"
 	else
-		naive_flags="${naive_flags} arm_float_abi=\"soft\" arm_use_neon=false"
+		naive_flags+=" arm_float_abi=\"soft\" arm_use_neon=false"
 	fi
-}
-[[ "mips mips64 mipsel mips64el" =~ (^|[[:space:]])"${target_arch}"($|[[:space:]]) ]] && {
-	naive_flags="${naive_flags} use_gold=false is_cfi=false use_cfi_icall=false use_thin_lto=false mips_arch_variant=\"r2\""
-	[[ "${target_arch}" =~ ^"mips"$|^"mipsel"$ ]] && naive_flags="${naive_flags} mips_float_abi=\"soft\" mips_tune=\"${cpu_type}\""
-}
+	;;
+"mips"|"mips64"|"mipsel"|"mips64el")
+	naive_flags+=" use_gold=false is_cfi=false use_cfi_icall=false use_thin_lto=false mips_arch_variant=\"r2\""
+	[[ "${target_arch}" =~ "mips"|"mipsel" ]] && naive_flags+=" mips_float_abi=\"soft\" mips_tune=\"${cpu_type}\""
+	;;
+esac