blob: 03d641880383a24d1c3676ad663830f2aa4a63fd (
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit fcaps go-module systemd shell-completion
DESCRIPTION="Fast and lightweight DNS proxy as ad-blocker with many features written in Go"
HOMEPAGE="https://github.com/0xERR0R/blocky/"
if [[ ${PV} == 9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/0xERR0R/blocky.git"
else
SRC_URI="
https://github.com/0xERR0R/blocky/archive/v${PV}.tar.gz -> ${P}.tar.gz
https://github.com/gentoo-golang-dist/blocky/releases/download/v${PV}/${P}-vendor.tar.xz -> ${P}-deps.tar.xz
"
KEYWORDS="~amd64 ~arm64"
fi
# main
LICENSE="Apache-2.0"
# deps
LICENSE+=" AGPL-3 BSD-2 BSD ISC MIT MPL-2.0"
SLOT="0"
RESTRICT="test"
RDEPEND="
acct-user/blocky
acct-group/blocky
"
BDEPEND=">=dev-lang/go-1.26.2"
# PATCHES=(
# "${FILESDIR}"/disable-failed-tests-0.22.patch
# )
FILECAPS=(
-m 755 'cap_net_bind_service=+ep' usr/bin/"${PN}"
)
QA_PRESTRIPPED="usr/bin/${PN}"
src_unpack() {
if [[ ${PV} == 9999* ]]; then
git-r3_src_unpack
go-module_live_vendor
else
go-module_src_unpack
fi
}
src_compile() {
[[ ${PV} != 9999* ]] && { export VERSION="${PV}" || die ; }
# mimicking project's Dockerfile
emake GO_SKIP_GENERATE=1 GO_BUILD_FLAGS="-tags static -v " build
local shell
for shell in bash fish zsh; do
bin/"${PN}" completion "${shell}" > "${PN}"."${shell}" || die
done
}
src_test() {
# mimcking make test
ego run github.com/onsi/ginkgo/v2/ginkgo --label-filter="!e2e" --coverprofile=coverage.txt --covermode=atomic \
--cover -r -p
ego tool cover -html coverage.txt -o coverage.html
}
src_install() {
# primary program
dobin bin/"${PN}"
# secondary supplements
insinto /etc/"${PN}"
newins docs/config.yml config.yml.sample
newbashcomp "${PN}".bash "${PN}"
dofishcomp "${PN}".fish
newzshcomp "${PN}".zsh _"${PN}"
# TODO openrc services
systemd_newunit "${FILESDIR}"/blocky-0.22.service "${PN}".service
# docs
einstalldocs
}
|