net-misc/hoppscotch-bin: bump version to 24.11.0.0
[gentoo-zh.git] / net-proxy / mihomo / mihomo-1.18.10-r2.ebuild
blob9fff3d1d0c1e1eb1d236c2a0b9e073b28f1d4fd9
1 # Copyright 2023-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
5 inherit go-module systemd fcaps
7 DESCRIPTION="Another Clash Kernel, formerly Clash.Meta"
8 HOMEPAGE="
9         https://wiki.metacubex.one/
10         https://github.com/MetaCubeX/mihomo/
12 SRC_URI="
13         https://github.com/MetaCubeX/mihomo/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
15 SRC_URI+="
16         https://github.com/peeweep/gentoo-go-deps/releases/download/${P}/${P}-vendor.tar.xz
19 DEPEND="
20         acct-group/mihomo
21         acct-user/mihomo
23 RDEPEND="
24         ${DEPEND}
25         systemd? (
26                 sys-apps/systemd
27         )
28         !systemd? (
29                 tun? (
30                         sys-apps/openrc[caps(+)]
31                 )
32                 !tun? (
33                         sys-apps/openrc
34                 )
35         )
37 BDEPEND=">=dev-lang/go-1.20.4"
39 LICENSE="GPL-3"
40 SLOT="0"
41 KEYWORDS="~amd64 ~arm64 ~loong"
42 IUSE="+gvisor systemd +tun"
44 FILECAPS=(
45         cap_net_admin,cap_net_bind_service=+ep /usr/bin/mihomo
48 src_compile() {
49         local BUILDTIME=$(LC_ALL=C date -u || die)
50         local MY_TAGS
51         if use gvisor; then
52                 MY_TAGS="with_gvisor"
53         fi
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}\" \
58                 -w -s -buildid=" \
59                 -o bin/mihomo
62 src_install() {
63         dobin bin/mihomo
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