*/*: add clash-meta
[gentoo-zh.git] / net-proxy / clash-meta / clash-meta-1.16.0.ebuild
bloba2ee34383f83c51da7bb6b17a570b96e194b5f4f
1 # Copyright 1999-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."
8 HOMEPAGE="https://github.com/MetaCubeX/Clash.Meta"
10 SRC_URI="
11 https://github.com/MetaCubeX/Clash.Meta/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
12 https://github.com/st0nie/gentoo-go-deps/releases/download/${P}/${P}-deps.tar.xz
15 RESTRICT="mirror"
16 DEPEND="
17 acct-user/clash-meta
18 acct-group/clash-meta
19 >=dev-lang/go-1.20.4
21 RDEPEND="${DEPEND}"
22 LICENSE="GPL-3"
23 SLOT="0"
24 KEYWORDS="~amd64"
25 S="${WORKDIR}/Clash.Meta-${PV}"
26 IUSE="+gvisor lwip"
28 src_compile() {
29 local BUILDTIME=$(LC_ALL=C date -u || die)
30 local MY_TAGS
31 if use gvisor; then
32 MY_TAGS="with_gvisor"
34 if use lwip; then
35 MY_TAGS+=" with_lwip"
37 ego build \
38 -ldflags "-linkmode external -extldflags \"${LDFLAGS}\" \
39 -X \"github.com/Dreamacro/clash/constant.Version=${PV}\" \
40 -X \"github.com/Dreamacro/clash/constant.BuildTime=${BUILDTIME}\" \
41 " \
42 -tags "$MY_TAGS" -o "${P}"
45 src_install() {
46 newbin "${P}" "${PN}"
47 systemd_dounit "${FILESDIR}/Clash-Meta.service"
48 newinitd "${FILESDIR}"/clash-meta.initd clash-meta