summaryrefslogtreecommitdiff
blob: a40cf866054851b3f32f14d4ed42eb369c9e9099 (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
# Copyright 2021-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7
inherit fcaps go-module systemd

DESCRIPTION="Fast, cross-platform HTTP/2 web server with automatic HTTPS"
HOMEPAGE="https://caddyserver.com"
SRC_URI="https://github.com/caddyserver/caddy/archive/v${PV}.tar.gz -> ${P}.tar.gz
	https://dev.gentoo.org/~zmedico/dist/${P}-deps.tar.xz"

LICENSE="Apache-2.0 BSD ECL-2.0 MIT"
SLOT="0"
KEYWORDS="amd64"
RDEPEND="
	acct-user/http
	acct-group/http"
DEPEND="${RDEPEND}"
BDEPEND="<dev-lang/go-1.18"

RESTRICT+=" test"

FILECAPS=(
	-m 755 'cap_net_bind_service=+ep' usr/bin/${PN}
)

src_compile() {
	go build ./cmd/caddy || die
}

src_install() {
	dobin caddy
	dodoc README.md
	keepdir /etc/caddy
	insinto /etc/caddy
	newins "${FILESDIR}"/caddy_config.json caddy_config.json.example
	systemd_dounit "${FILESDIR}/${PN}.service"
	newinitd "${FILESDIR}/initd" "${PN}"
	newconfd "${FILESDIR}/confd" "${PN}"
	insinto /etc/logrotate.d
	newins "${FILESDIR}/logrotated" "${PN}"
}

pkg_postinst() {
	fcaps_pkg_postinst
}