1 |
|
# Copyright 2021-2023 Gentoo Authors
|
|
1 |
# Copyright 1999-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
4 |
EAPI=8
|
5 |
|
inherit fcaps go-module systemd
|
6 |
5 |
|
7 |
|
DESCRIPTION="Fast, cross-platform HTTP/2 web server with automatic HTTPS"
|
|
6 |
inherit fcaps go-module systemd shell-completion
|
|
7 |
|
|
8 |
DESCRIPTION="Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS"
|
8 |
9 |
HOMEPAGE="https://caddyserver.com"
|
9 |
|
SRC_URI="https://github.com/caddyserver/caddy/archive/v${PV}.tar.gz -> ${P}.tar.gz"
|
10 |
|
SRC_URI+=" https://dev.gentoo.org/~williamh/dist/${P}-deps.tar.xz"
|
11 |
10 |
|
12 |
|
LICENSE="Apache-2.0 BSD ECL-2.0 MIT"
|
|
11 |
if [[ "${PV}" == *9999* ]]; then
|
|
12 |
inherit git-r3
|
|
13 |
EGIT_REPO_URI="https://github.com/caddyserver/caddy.git"
|
|
14 |
else
|
|
15 |
SRC_URI="https://github.com/caddyserver/caddy/archive/v${PV}.tar.gz -> ${P}.tar.gz"
|
|
16 |
SRC_URI+=" https://dev.gentoo.org/~williamh/dist/${P}-deps.tar.xz"
|
|
17 |
SRC_URI+=" https://github.com/caddyserver/dist/archive/refs/tags/v${PV}.tar.gz -> ${P}-docs.tar.gz"
|
|
18 |
KEYWORDS="~amd64 ~arm64 ~loong ~riscv"
|
|
19 |
fi
|
|
20 |
|
|
21 |
LICENSE="Apache-2.0 BSD ECL-2.0 MIT CC0-1.0"
|
13 |
22 |
SLOT="0"
|
14 |
|
KEYWORDS="amd64 ~arm64 ~riscv"
|
|
23 |
RESTRICT="test"
|
15 |
24 |
RDEPEND="
|
16 |
25 |
acct-user/http
|
17 |
26 |
acct-group/http"
|
18 |
27 |
DEPEND="${RDEPEND}"
|
19 |
28 |
|
20 |
|
RESTRICT="test"
|
21 |
|
|
22 |
29 |
FILECAPS=(
|
23 |
|
-m 755 'cap_net_bind_service=+ep' usr/bin/${PN}
|
|
30 |
-m 755 'cap_net_bind_service=+ep' usr/bin/"${PN}"
|
24 |
31 |
)
|
25 |
32 |
|
|
33 |
src_unpack() {
|
|
34 |
if [[ "${PV}" == *9999* ]]; then
|
|
35 |
# unpack code
|
|
36 |
git-r3_src_unpack
|
|
37 |
|
|
38 |
# unpack docs and misc
|
|
39 |
EGIT_REPO_URI="https://github.com/caddyserver/dist.git"
|
|
40 |
EGIT_CHECKOUT_DIR="${WORKDIR}/dist-${PV}"
|
|
41 |
git-r3_src_unpack
|
|
42 |
|
|
43 |
go-module_live_vendor
|
|
44 |
else
|
|
45 |
go-module_src_unpack
|
|
46 |
fi
|
|
47 |
}
|
|
48 |
|
|
49 |
src_prepare(){
|
|
50 |
default
|
|
51 |
sed -i -e "s|User=caddy|User=http|g;" ../dist-"${PV}"/init/*service || die
|
|
52 |
sed -i -e "s|Group=caddy|Group=http|g;" ../dist-"${PV}"/init/*service || die
|
|
53 |
}
|
|
54 |
|
26 |
55 |
src_compile() {
|
27 |
56 |
ego build ./cmd/caddy
|
|
57 |
for sh in bash fish zsh; do
|
|
58 |
./caddy completion "${sh}" > completion."${sh}" || die
|
|
59 |
done
|
|
60 |
./caddy manpage -o manpages || die
|
28 |
61 |
}
|
29 |
62 |
|
30 |
63 |
src_install() {
|
31 |
|
dobin caddy
|
32 |
|
dodoc README.md
|
33 |
|
keepdir /etc/caddy
|
34 |
|
insinto /etc/caddy
|
35 |
|
newins "${FILESDIR}"/caddy_config.json caddy_config.json.example
|
36 |
|
systemd_dounit "${FILESDIR}/${PN}.service"
|
|
64 |
default
|
|
65 |
|
|
66 |
dobin "${PN}"
|
|
67 |
insinto /etc/"${PN}"
|
|
68 |
newins ../dist-"${PV}"/config/Caddyfile Caddyfile.example
|
|
69 |
systemd_dounit ../dist-"${PV}"/init/*.service
|
37 |
70 |
newinitd "${FILESDIR}/initd" "${PN}"
|
38 |
71 |
newconfd "${FILESDIR}/confd" "${PN}"
|
39 |
72 |
insinto /etc/logrotate.d
|
40 |
73 |
newins "${FILESDIR}/logrotated" "${PN}"
|
|
74 |
insinto /usr/share/"${PN}"
|
|
75 |
doins ../dist-"${PV}"/welcome/index.html
|
|
76 |
|
|
77 |
newbashcomp completion.bash "${PN}"
|
|
78 |
newfishcomp completion.fish "${PN}".fish
|
|
79 |
newzshcomp completion.zsh _"${PN}"
|
|
80 |
newdoc ../dist-"${PV}"/init/README.md systemd-services-README.md
|
|
81 |
doman manpages/*
|
41 |
82 |
}
|
42 |
83 |
|
43 |
84 |
pkg_postinst() {
|