-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
54 lines (41 loc) · 1.72 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
include $(TOPDIR)/rules.mk
PKG_NAME:=ua4f
PKG_VERSION:=0.1.1
PKG_MAINTAINER := James Clef <[email protected]>
PKG_LICENSE:=AGPL-3.0-or-later
PKG_LICENSE_FILES:=LICENSE.md
HOST_BUILD_DEPENDS:=rust/host
include $(INCLUDE_DIR)/package.mk
include ./rustc_targets.mk
define Package/ua4f
SECTION:=net
CATEGORY:=Network
TITLE:=UA4F
endef
define Package/ua4f/description
Another User Agent faker, allowing users to bypass multi device detection for Campus Network via socks5 proxy.
endef
define Build/Prepare
$(call Build/Prepare/Default)
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./* $(PKG_BUILD_DIR)/
sed -i 's/0.1.0/$(PKG_VERSION)/g' $(PKG_BUILD_DIR)/Cargo.toml
sed -i 's/0.1.0/$(PKG_VERSION)/g' $(PKG_BUILD_DIR)/openwrt/usr/lib/lua/luci/controller/ua4f.lua
endef
define Build/Compile
cd $(PKG_BUILD_DIR) && cargo rustc --target=$(RUSTC_TARGET_ARCH) --release $(NEED_BUILD_STD) -- -C linker=$(TARGET_CC_NOCACHE) -C ar=$(TARGET_AR)
stat $(PKG_BUILD_DIR)/target/$(RUSTC_TARGET_ARCH)/release/ua4f
endef
define Package/ua4f/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/target/$(RUSTC_TARGET_ARCH)/release/ua4f $(1)/usr/bin/ua4f
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_BIN) $(PKG_BUILD_DIR)/openwrt/etc/config/ua4f $(1)/etc/config/ua4f
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/openwrt/etc/init.d/ua4f $(1)/etc/init.d/ua4f
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/openwrt/usr/lib/lua/luci/controller/ua4f.lua $(1)/usr/lib/lua/luci/controller/ua4f.lua
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/openwrt/usr/lib/lua/luci/model/cbi/ua4f.lua $(1)/usr/lib/lua/luci/model/cbi/ua4f.lua
endef
$(eval $(call BuildPackage,ua4f))