summaryrefslogtreecommitdiff
path: root/net-vpn/frp/frp-0.53.2.ebuild
blob: e391ce1b9d6a176c242f4bc1270e91136531385a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit go-module systemd shell-completion

DESCRIPTION="A reverse proxy that exposes a server behind a NAT or firewall to the internet"
HOMEPAGE="https://github.com/fatedier/frp"
SRC_URI="https://github.com/fatedier/frp/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
	https://dev.gentoo.org/~zmedico/dist/${P}-deps.tar.xz"

LICENSE="Apache-2.0 BSD BSD-2 ISC MIT MPL-2.0"
SLOT="0"
KEYWORDS="~amd64 ~loong ~riscv"
IUSE="+client +server"
REQUIRED_USE="|| ( client server )"

DEPEND="${RDEPEND}"
RDEPEND=""
BDEPEND="dev-lang/go"

src_compile() {
	mkdir -pv completions || die

	if use client; then
		ego build -trimpath -ldflags "-w" -o frpc ./cmd/frpc
		./frpc completion bash > completions/frpc || die
		./frpc completion fish > completions/frpc.fish || die
		./frpc completion zsh > completions/_frpc || die
	fi

	if use server; then
		ego build -trimpath -ldflags "-w" -o frps ./cmd/frps
		./frps completion bash > completions/frps || die
		./frps completion fish > completions/frps.fish || die
		./frps completion zsh > completions/_frps || die
	fi
}

src_install() {
	if use client; then
		dobin frpc
		dobashcomp completions/frpc
		systemd_dounit "${FILESDIR}/frpc.service"
		systemd_newunit "${FILESDIR}/frpc_at_.service" frpc@.service

		for x in conf/frpc*.toml; do mv "${x}"{,.example}; done
	fi

	if use server; then
		dobin frps
		dobashcomp completions/frps
		systemd_dounit "${FILESDIR}/frps.service"
		systemd_newunit "${FILESDIR}/frps_at_.service" frps@.service

		for x in conf/frps*.toml; do mv "${x}"{,.example}; done
	fi

	insinto /etc/frp
	doins conf/*.example

	dofishcomp completions/*.fish
	dozshcomp completions/_*
}