forked from liuran001/openwrt-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
135 lines (114 loc) · 3.9 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=naiveproxy
PKG_VERSION:=93.0.4577.63-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:=091fa8129f390cc90530f92b0e9c90f1e7bb131f3f9e5bcda192a782bf7af19e
PKG_LICENSE:=BSD 3-Clause
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Tianling Shen <[email protected]>
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/config
depends on !(arc||armeb||mips||mips64||powerpc)
endef
define Package/naiveproxy
SECTION:=net
CATEGORY:=Network
SUBMENU:=Web Servers/Proxies
URL:=https://github.com/klzgrad/naiveproxy
TITLE:=Make a fortune quietly
DEPENDS:=+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:=13-init-15163-g98033fdc-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:=cf74ea4bdd833b18ef52959f2791b11354fea20425b8dbfa4d017fc46732c665
endef
GN_VER:=24e2f7df92641de0351a96096fb2c490b2436bb8
GN_FILE:=gn-git_revision-$(GN_VER).zip
define Download/GN_TOOL
URL:=https://chrome-infra-packages.appspot.com/dl/gn/gn/linux-amd64/+
URL_FILE:=git_revision:$(GN_VER)
FILE:=$(GN_FILE)
HASH:=b1df7d28776ebf714edc98abaaa09aa8b308212eef5a23fa24de8f4107ae1cd3
endef
PGO_VER:=4577-1629902302-97a75bab19e52f72bda9d9d33032dd998433e8c2
PGO_FILE:=chrome-linux-$(PGO_VER).profdata
define Download/PGO_PROF
URL:=https://storage.googleapis.com.cnpmjs.org/chromium-optimization-profiles/pgo_profiles \
https://storage.googleapis.com/chromium-optimization-profiles/pgo_profiles
URL_FILE:=$(PGO_FILE)
FILE:=$(PGO_FILE)
HASH:=f8874377e631b3bccc6581a79bd9f720b5d0700f7e021930d00b626cf7ab3874
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))