Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions mihomo/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2025 Entware

include $(TOPDIR)/rules.mk

PKG_NAME:=mihomo
PKG_VERSION:=1.19.19
PKG_RELEASE:=1

PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
PKG_SOURCE_URL:=https://github.com/MetaCubeX/mihomo
PKG_MIRROR_HASH:=92614443f400c5cb4e83e0e9cd03c890eb4957f23366a657a8f05f0c0a64d9fc

PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE

PKG_BUILD_PARALLEL:=1

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/golang.mk

define Package/mihomo/Default
SECTION:=net
CATEGORY:=Network
SUBMENU:=Web Servers/Proxies
TITLE:=Mihomo (MetaCubeX) universal proxy
URL:=https://github.com/MetaCubeX/mihomo
MAINTAINER:=Entware team, https://entware.net
DEPENDS:=+ca-certificates
endef

define Package/mihomo
$(call Package/mihomo/Default)
VARIANT:=hf
endef

define Package/mihomo_nohf
$(call Package/mihomo/Default)
VARIANT:=nohf
DEPENDS:=+ca-certificates @arm
endef

define Package/mihomo/description
Mihomo is a rule-based proxy platform written in Go.
endef

Package/mihomo_nohf/description=$(Package/mihomo/description)

define Package/mihomo/conffiles
/opt/etc/mihomo/config.yaml
endef

Package/mihomo_nohf/conffiles=$(Package/mihomo/conffiles)

XIMPORTPATH:=$(call tolower,$(XIMPORTPATH))

GO_LDFLAGS += \
-X '$(XIMPORTPATH)/constant.Version=$(PKG_VERSION)' \
-X '$(XIMPORTPATH)/constant.BuildTime='

GO_TARGET:=./
GO_TAGS:=with_gvisor

define Package/mihomo/install
$(INSTALL_DIR) $(1)/opt/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/mihomo $(1)/opt/sbin/mihomo
$(INSTALL_DIR) $(1)/opt/etc/init.d
$(INSTALL_BIN) ./files/S99mihomo $(1)/opt/etc/init.d
$(INSTALL_DIR) $(1)/opt/etc/mihomo
$(INSTALL_CONF) ./files/config.yaml $(1)/opt/etc/mihomo
endef

Package/mihomo_nohf/install=$(Package/mihomo/install)

$(eval $(call BuildPackage,mihomo))
$(eval $(call BuildPackage,mihomo_nohf))
10 changes: 10 additions & 0 deletions mihomo/files/S99mihomo
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

ENABLED=yes
PROCS=mihomo
ARGS="-d /opt/etc/mihomo"
PREARGS=""
DESC=$PROCS
PATH=/opt/sbin:/opt/bin:/opt/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

. /opt/etc/init.d/rc.func
4 changes: 4 additions & 0 deletions mihomo/files/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tproxy-port: 1181
redir-port: 1182
# Setup documentation:
# https://wiki.metacubex.one/en/config/