app-editors/zed: add 0.144.3, drop 0.143.7
[gentoo-zh.git] / net-proxy / mihomo / mihomo-1.18.6-r1.ebuild
blob79d46dd14513abed7343236afcd849b78b9daa66
1 # Copyright 2023 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
5 inherit go-module systemd
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}-deps.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                 caps? (
30                         sys-apps/openrc[caps(+)]
31                 )
32                 !caps? (
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"
42 IUSE="+gvisor systemd caps"
44 src_compile() {
45         local BUILDTIME=$(LC_ALL=C date -u || die)
46         local MY_TAGS
47         if use gvisor; then
48                 MY_TAGS="with_gvisor"
49         fi
50         ego build -tags "${MY_TAGS}" -trimpath -ldflags "
51                 -linkmode external -extldflags \"${LDFLAGS}\" \
52                 -X \"github.com/metacubex/mihomo/constant.Version=${PV}\" \
53                 -X \"github.com/metacubex/mihomo/constant.BuildTime=${BUILDTIME}\" \
54                 -w -s -buildid=" \
55                 -o bin/mihomo
58 src_install() {
59         dobin bin/mihomo
60         dosym -r "/usr/bin/mihomo" "/usr/bin/clash-meta"
61         systemd_dounit "${FILESDIR}/mihomo.service"
62         newinitd "${FILESDIR}"/mihomo.initd mihomo