1 # Copyright 2023-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
5 inherit go-module systemd fcaps
7 DESCRIPTION="Another Clash Kernel, formerly Clash.Meta"
9 https://wiki.metacubex.one/
10 https://github.com/MetaCubeX/mihomo/
13 https://github.com/MetaCubeX/mihomo/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
16 https://github.com/peeweep/gentoo-go-deps/releases/download/${P}/${P}-vendor.tar.xz
30 sys-apps/openrc[caps(+)]
37 BDEPEND=">=dev-lang/go-1.20.4"
41 KEYWORDS="~amd64 ~arm64 ~loong"
42 IUSE="+gvisor systemd +tun"
45 cap_net_admin,cap_net_bind_service=+ep /usr/bin/mihomo
49 local BUILDTIME=$(LC_ALL=C date -u || die)
54 ego build -tags "${MY_TAGS}" -trimpath -ldflags "
55 -linkmode external -extldflags \"${LDFLAGS}\" \
56 -X \"github.com/metacubex/mihomo/constant.Version=${PV}\" \
57 -X \"github.com/metacubex/mihomo/constant.BuildTime=${BUILDTIME}\" \
64 dosym -r "/usr/bin/mihomo" "/usr/bin/clash-meta"
65 systemd_dounit "${FILESDIR}/mihomo.service"
66 systemd_newunit "${FILESDIR}/mihomo_at.service" mihomo@.service
67 newinitd "${FILESDIR}"/mihomo.initd mihomo