aboutsummaryrefslogtreecommitdiff
blob: 43a517238148a72d8f91fe497a16e3203178d656 (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
# Copyright 2023-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit go-module systemd

MY_P="${PN}-v${PV}"
JOB_ID="749935"
DESCRIPTION="Pluggable Transport using WebRTC, inspired by Flashproxy"
HOMEPAGE="
	https://snowflake.torproject.org/
	https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake
"
SRC_URI="https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/${PN}/-/jobs/${JOB_ID}/artifacts/raw/${MY_P}.tar.gz"
S="${WORKDIR}/${MY_P}"

LICENSE="Apache-2.0 BSD BSD-2 CC0-1.0 MIT"
SLOT="0"
KEYWORDS="~amd64"
IUSE="test"
RESTRICT="!test? ( test )"

BDEPEND=">=dev-lang/go-1.21"

src_configure() {
	COMPONENTS=(
		broker
		client
		probetest
		proxy
		server
	)
}

src_compile() {
	for component in "${COMPONENTS[@]}"; do
		pushd ${component} || die
		einfo "Building ${component}"
		nonfatal ego build || die "${component}: build failed"
		popd || die
	done
}

src_test() {
	ego test ./...
}

src_install() {
	local component
	for component in "${COMPONENTS[@]}"; do
		newbin ${component}/${component} snowflake-${component}
		newdoc ${component}/README.md README_${component}.md
	done

	systemd_dounit "${FILESDIR}"/snowflake-proxy.service
	newinitd "${FILESDIR}"/snowflake-proxy.initd snowflake-proxy

	einstalldocs
	dodoc doc/*.txt doc/*.md
	doman doc/*.1
}