mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-04 02:33:56 +08:00
🍉 Sync 2026-06-04 16:44:02
This commit is contained in:
1 parent
c2f5e11633
commit
0bb17b828a
16 files changed
+704
-1127
No files matched your search
@@ -0,0 +1,132 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fusiontunx
|
||||
PKG_VERSION:=1.0.3
|
||||
PKG_RELEASE:=4
|
||||
|
||||
PKG_MAINTAINER:=BobbyUnknown
|
||||
PKG_LICENSE:=MIT
|
||||
|
||||
# Direct download configuration - change GIT_BRANCH to switch branches
|
||||
GIT_BRANCH:=dev
|
||||
|
||||
# Direct download method (no git)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/bobbyunknown/FusionTunX/archive/refs/heads/$(GIT_BRANCH).tar.gz?
|
||||
PKG_HASH:=skip
|
||||
|
||||
PKG_BUILD_DEPENDS:=node/host golang/host
|
||||
|
||||
MIHOMO_VERSION:=v1.19.17
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
|
||||
|
||||
GO_PKG:=github.com/bobbyunknown/FusionTunX
|
||||
|
||||
define Package/fusiontunx
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=FusionTunX Core + Mihomo
|
||||
URL:=https://github.com/bobbyunknown/FusionTunX
|
||||
DEPENDS:=+ca-bundle +ip-full +kmod-tun +kmod-nft-core +kmod-nft-nat +kmod-nft-tproxy +kmod-nft-socket
|
||||
endef
|
||||
|
||||
define Package/fusiontunx/description
|
||||
FusionTunX + Mihomo Core Binary
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
|
||||
$(Build/Patch)
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
@echo "Building Vite dashboard..."
|
||||
cd $(PKG_BUILD_DIR)/src/dash && \
|
||||
npm install && \
|
||||
npm run build
|
||||
|
||||
@echo "Preparing static files..."
|
||||
rm -rf $(PKG_BUILD_DIR)/src/internal/ui/dist
|
||||
cp -r $(PKG_BUILD_DIR)/src/dash/dist $(PKG_BUILD_DIR)/src/internal/ui/dist
|
||||
chmod -R 755 $(PKG_BUILD_DIR)/src/internal/ui/dist
|
||||
|
||||
@echo "Installing dependencies and generating Swagger..."
|
||||
cd $(PKG_BUILD_DIR)/src && \
|
||||
go mod tidy && \
|
||||
go install github.com/swaggo/swag/cmd/swag@latest && \
|
||||
$(HOME)/go/bin/swag init -g cmd/server/main.go -o docs
|
||||
|
||||
@echo "Compiling FusionTunX Go binary..."
|
||||
cd $(PKG_BUILD_DIR)/src && \
|
||||
GOOS=linux GOARCH=$(GO_ARCH) CGO_ENABLED=1 \
|
||||
CC=$(TARGET_CC) CXX=$(TARGET_CXX) \
|
||||
CGO_CFLAGS="$(TARGET_CFLAGS)" \
|
||||
CGO_LDFLAGS="$(TARGET_LDFLAGS)" \
|
||||
go build -v -trimpath -ldflags="-s -w" -o $(PKG_BUILD_DIR)/fusiontunx ./cmd/server
|
||||
|
||||
@echo "Downloading Mihomo $(MIHOMO_VERSION)..."
|
||||
wget -q -O $(PKG_BUILD_DIR)/mihomo.gz "https://github.com/MetaCubeX/mihomo/releases/download/$(MIHOMO_VERSION)/mihomo-linux-$(GO_ARCH)-$(MIHOMO_VERSION).gz"
|
||||
gunzip -f $(PKG_BUILD_DIR)/mihomo.gz
|
||||
chmod +x $(PKG_BUILD_DIR)/mihomo
|
||||
|
||||
@echo "Downloading GeoIP assets..."
|
||||
wget -q -O $(PKG_BUILD_DIR)/country.mmdb https://github.com/rtaserver/meta-rules-dat/releases/latest/download/country.mmdb
|
||||
wget -q -O $(PKG_BUILD_DIR)/geoip.dat https://github.com/rtaserver/meta-rules-dat/releases/latest/download/geoip.dat
|
||||
wget -q -O $(PKG_BUILD_DIR)/geosite.dat https://github.com/rtaserver/meta-rules-dat/releases/latest/download/geosite.dat
|
||||
wget -q -O $(PKG_BUILD_DIR)/geoip.metadb https://github.com/rtaserver/meta-rules-dat/releases/download/latest/geoip.metadb
|
||||
|
||||
@echo "Downloading Zashboard..."
|
||||
curl -sL -o $(PKG_BUILD_DIR)/zashboard.zip "https://github.com/Zephyruso/zashboard/releases/latest/download/dist.zip"
|
||||
mkdir -p $(PKG_BUILD_DIR)/ui/zashboard
|
||||
unzip -q $(PKG_BUILD_DIR)/zashboard.zip -d $(PKG_BUILD_DIR)/temp_zashboard
|
||||
mv $(PKG_BUILD_DIR)/temp_zashboard/dist/* $(PKG_BUILD_DIR)/ui/zashboard/
|
||||
rm -rf $(PKG_BUILD_DIR)/temp_zashboard $(PKG_BUILD_DIR)/zashboard.zip
|
||||
|
||||
@echo "Downloading MetaCubeXD..."
|
||||
curl -sL -o $(PKG_BUILD_DIR)/metacubexd.tgz "https://github.com/MetaCubeX/metacubexd/releases/latest/download/compressed-dist.tgz"
|
||||
mkdir -p $(PKG_BUILD_DIR)/ui/metacubexd
|
||||
tar -xzf $(PKG_BUILD_DIR)/metacubexd.tgz -C $(PKG_BUILD_DIR)/ui/metacubexd
|
||||
rm $(PKG_BUILD_DIR)/metacubexd.tgz
|
||||
|
||||
@echo "Downloading Yacd..."
|
||||
curl -sL -o $(PKG_BUILD_DIR)/yacd.zip "https://github.com/MetaCubeX/Yacd-meta/archive/refs/heads/gh-pages.zip"
|
||||
unzip -q $(PKG_BUILD_DIR)/yacd.zip -d $(PKG_BUILD_DIR)/temp_yacd
|
||||
mv $(PKG_BUILD_DIR)/temp_yacd/Yacd-meta-gh-pages $(PKG_BUILD_DIR)/ui/yacd
|
||||
rm -rf $(PKG_BUILD_DIR)/temp_yacd $(PKG_BUILD_DIR)/yacd.zip
|
||||
endef
|
||||
|
||||
define Package/fusiontunx/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_DIR) $(1)/usr/share/fusiontunx
|
||||
$(INSTALL_DIR) $(1)/etc/fusiontunx/configs
|
||||
$(INSTALL_DIR) $(1)/etc/fusiontunx/proxy_providers
|
||||
$(INSTALL_DIR) $(1)/etc/fusiontunx/rule_providers
|
||||
$(INSTALL_DIR) $(1)/etc/fusiontunx/ui
|
||||
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/fusiontunx $(1)/usr/share/fusiontunx/fusiontunx
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/mihomo $(1)/usr/bin/mihomo
|
||||
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/files/app.yaml $(1)/etc/fusiontunx/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/country.mmdb $(1)/etc/fusiontunx/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/geoip.dat $(1)/etc/fusiontunx/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/geosite.dat $(1)/etc/fusiontunx/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/geoip.metadb $(1)/etc/fusiontunx/
|
||||
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/files/configs/* $(1)/etc/fusiontunx/configs/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/files/proxy_providers/* $(1)/etc/fusiontunx/proxy_providers/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/files/rule_providers/* $(1)/etc/fusiontunx/rule_providers/
|
||||
|
||||
$(CP) -r $(PKG_BUILD_DIR)/ui/* $(1)/etc/fusiontunx/ui/
|
||||
endef
|
||||
|
||||
define Package/fusiontunx/conffiles
|
||||
/etc/fusiontunx/app.yaml
|
||||
/etc/fusiontunx/configs/config.yaml
|
||||
/etc/fusiontunx/proxy_providers/proxy.yaml
|
||||
/etc/fusiontunx/rule_providers/rule.yaml
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,fusiontunx))
|
||||
Reference in new issue
Block a user