diff options
Diffstat (limited to 'www-servers')
-rw-r--r-- | www-servers/caddy/Manifest | 1 | ||||
-rw-r--r-- | www-servers/caddy/caddy-2.7.6-r1.ebuild | 129 | ||||
-rw-r--r-- | www-servers/caddy/caddy-9999.ebuild | 49 | ||||
-rw-r--r-- | www-servers/caddy/metadata.xml | 7 |
4 files changed, 179 insertions, 7 deletions
diff --git a/www-servers/caddy/Manifest b/www-servers/caddy/Manifest index 73698a62c2e7..da79d9aa35ce 100644 --- a/www-servers/caddy/Manifest +++ b/www-servers/caddy/Manifest @@ -6,4 +6,5 @@ DIST caddy-2.7.5-docs.tar.gz 24578 BLAKE2B e08bfa37b157d8d4300198384bfc4c19cb0f5 DIST caddy-2.7.5.tar.gz 611282 BLAKE2B 86c28922f80f931452e81b0c3fa52ed0b86b2325eb2a1adf1de830a7a339772063955fd3cb5ee888cbf8c1c905b98bb6a292b592a2983012ad4fefe33c361e82 SHA512 45f6790b7c3683a8001445e932d5678fd27d204500f7301d92c4d8421f24574e113bf7c335bd277b16abe07eb3d24258358f87c68cee38905fa6d0e6bcc1c24c DIST caddy-2.7.6-deps.tar.xz 128958740 BLAKE2B ffbe682df64a88dac9f50e9712f1d6697e58f2d9854c270321f7a0325f0b5ead7f93316756136a4435b70c5e08742c7130ce507ee4aa4696f4fb906f4eba8754 SHA512 f467144e235e09a7718cffe5ed3c40ec2d63038a6a948fe4f85d34717877af8a9959ef7e2c3ac32fd0cce522d693ccac883877f061f5cefc9512f7eed556b336 DIST caddy-2.7.6-docs.tar.gz 24583 BLAKE2B d3dbbb701d86cbfaf538f10911fdd3613b8c3c0f49ef9e229487d2a4fcef9eff79b56e9852d5c1ccd5a8d1d1898861fc8183c343c129901562b03a9092af9e61 SHA512 62e534d41e714b47265fd8089ad9e03a1a89903460976d8af27fa5f71173e076bab8574282213595e495be701b769e1a70ff9e7ec9576fbf8e821e672207faa5 +DIST caddy-2.7.6-r1-deps.tar.xz 129331604 BLAKE2B 50b83c012c70637936c83ec765758cdcd80014ca224d76a746de8640a6b36ae15ce11ec57d9fdb20a5f7b3add946209c6dde7bb4e4bd4a47ffe3ffc8971725db SHA512 a4bc56de4f7ec8e9967dde3d7ca4cbb74cba9ce0b8906ffe16f8dae3f52fff1164827942df8154eadbae80cce3ee603535b9135cf8a5126d84a9017e8aece078 DIST caddy-2.7.6.tar.gz 606077 BLAKE2B 1237edc164ec6095c9dff27c332925c4ce9d91a60e629770463bbffb1503b8b11e36033e852df3eb5bb69ffa448833b6ee2891dc0ba6dc9b43b6cce27d492179 SHA512 ef0cb6fd7f6f2a296290b4bb520300e043ad31cc612e734632ffa25cdaa23fd7d601ac4ceaa1c76285d54a07ee773360f795103ef3c2ec79516a4f18a5e844b5 diff --git a/www-servers/caddy/caddy-2.7.6-r1.ebuild b/www-servers/caddy/caddy-2.7.6-r1.ebuild new file mode 100644 index 000000000000..c9b5a47b3c6f --- /dev/null +++ b/www-servers/caddy/caddy-2.7.6-r1.ebuild @@ -0,0 +1,129 @@ +# Copyright 1999-2024 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 extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS" +HOMEPAGE="https://caddyserver.com" + +if [[ "${PV}" == 9999* ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/caddyserver/caddy.git" +else + SRC_URI=" + https://github.com/caddyserver/caddy/archive/v${PV}.tar.gz -> ${P}.tar.gz + https://github.com/rahilarious/gentoo-distfiles/releases/download/${PF}/deps.tar.xz -> ${PF}-deps.tar.xz + https://github.com/caddyserver/dist/archive/refs/tags/v${PV}.tar.gz -> ${P}-docs.tar.gz +" + KEYWORDS="~amd64 ~arm64 ~loong ~riscv" +fi + +# MAIN +LICENSE="Apache-2.0" +# deps +LICENSE+=" BSD ECL-2.0 MIT CC0-1.0" +SLOT="0" + +IUSE='events-handlers-exec' +RESTRICT="test" + +RDEPEND=" + acct-user/http + acct-group/http" +DEPEND="${RDEPEND}" + +FILECAPS=( + -m 755 'cap_net_bind_service=+ep' usr/bin/"${PN}" +) + +PATCHES=( + "${FILESDIR}"/remove-binary-altering-commands-2.7.5.patch +) + +# takes a module as an only arg +add_custom_module() { + local LINE_NO=$(grep -n 'plug in Caddy modules here' cmd/caddy/main.go | awk -F: '{print $1;}') + sed -i -e "${LINE_NO:?}a \ _ \"$1\"" cmd/caddy/main.go || die +} + +src_unpack() { + if [[ "${PV}" == 9999* ]]; then + # clone main git repo + git-r3_src_unpack + + # get extra modules + if use events-handlers-exec; then + pushd "${P}" + add_custom_module 'github.com/mholt/caddy-events-exec' || die + ego get github.com/mholt/caddy-events-exec + popd + fi + + # clone dist repo (docs and misc) + EGIT_REPO_URI="https://github.com/caddyserver/dist.git" + EGIT_CHECKOUT_DIR="${WORKDIR}/dist-${PV}" + git-r3_src_unpack + + go-module_live_vendor + else + go-module_src_unpack + fi +} + +src_prepare() { + default + sed -i -e "s|User=caddy|User=http|g;s|Group=caddy|Group=http|g;" ../dist-"${PV}"/init/*service || die + + if use events-handlers-exec && [[ "${PV}" != 9999* ]]; then + add_custom_module 'github.com/mholt/caddy-events-exec' || die + cat <<-EOF >> go.sum || die + github.com/mholt/caddy-events-exec v0.0.0-20231121214933-055bfd2e8b82 h1:uRsPaFNQJRDrYcSsgnH0hFhCWFXfgB8QVH8yjX+u154= + github.com/mholt/caddy-events-exec v0.0.0-20231121214933-055bfd2e8b82/go.mod h1:Y9JjT8YLxpmk7PeUkvsWAhzzRdC6rXP7QjAHiwmvjD0= + EOF + + cat <<-EOF >> go.mod || die + require ( + github.com/mholt/caddy-events-exec v0.0.0-20231121214933-055bfd2e8b82 // indirect + ) + EOF + fi +} + +src_compile() { + # https://github.com/caddyserver/caddy/blob/master/caddy.go#L843 + if [[ ${PV} == 9999* ]]; then + local CUSTOM_VER="git-$(git rev-parse --short HEAD)" + else + local CUSTOM_VER="${PV}" + fi + + ego build -ldflags "-X github.com/caddyserver/caddy/v2.CustomVersion=${CUSTOM_VER}" ./cmd/caddy + local sh + for sh in bash fish zsh; do + ./caddy completion "${sh}" > completion."${sh}" || die + done + ./caddy manpage -o manpages || die +} + +src_install() { + default + + dobin "${PN}" + insinto /etc/"${PN}" + doins ../dist-"${PV}"/config/Caddyfile + systemd_dounit ../dist-"${PV}"/init/*.service + newinitd "${FILESDIR}"/initd-2.7.5 "${PN}" + newconfd "${FILESDIR}"/confd-2.7.5 "${PN}" + insinto /etc/logrotate.d + newins "${FILESDIR}/logrotated" "${PN}" + insinto /usr/share/"${PN}" + doins ../dist-"${PV}"/welcome/index.html + + newbashcomp completion.bash "${PN}" + newfishcomp completion.fish "${PN}".fish + newzshcomp completion.zsh _"${PN}" + newdoc ../dist-"${PV}"/init/README.md systemd-services-README.md + doman manpages/* +} diff --git a/www-servers/caddy/caddy-9999.ebuild b/www-servers/caddy/caddy-9999.ebuild index 5657c0607730..daa4e4571bd8 100644 --- a/www-servers/caddy/caddy-9999.ebuild +++ b/www-servers/caddy/caddy-9999.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2023 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -12,16 +12,23 @@ if [[ "${PV}" == 9999* ]]; then inherit git-r3 EGIT_REPO_URI="https://github.com/caddyserver/caddy.git" else - SRC_URI="https://github.com/caddyserver/caddy/archive/v${PV}.tar.gz -> ${P}.tar.gz" - SRC_URI+=" https://github.com/rahilarious/gentoo-distfiles/releases/download/${P}/deps.tar.xz -> ${P}-deps.tar.xz" - SRC_URI+=" https://github.com/caddyserver/dist/archive/refs/tags/v${PV}.tar.gz -> ${P}-docs.tar.gz" + SRC_URI=" + https://github.com/caddyserver/caddy/archive/v${PV}.tar.gz -> ${P}.tar.gz + https://github.com/rahilarious/gentoo-distfiles/releases/download/${P}/deps.tar.xz -> ${P}-deps.tar.xz + https://github.com/caddyserver/dist/archive/refs/tags/v${PV}.tar.gz -> ${P}-docs.tar.gz +" KEYWORDS="~amd64 ~arm64 ~loong ~riscv" fi +# MAIN LICENSE="Apache-2.0" +# deps LICENSE+=" BSD ECL-2.0 MIT CC0-1.0" SLOT="0" + +IUSE='events-handlers-exec' RESTRICT="test" + RDEPEND=" acct-user/http acct-group/http" @@ -35,12 +42,26 @@ PATCHES=( "${FILESDIR}"/remove-binary-altering-commands-2.7.5.patch ) +# takes a module as an only arg +add_custom_module() { + local LINE_NO=$(grep -n 'plug in Caddy modules here' cmd/caddy/main.go | awk -F: '{print $1;}') + sed -i -e "${LINE_NO:?}a \ _ \"$1\"" cmd/caddy/main.go || die +} + src_unpack() { if [[ "${PV}" == 9999* ]]; then - # unpack code + # clone main git repo git-r3_src_unpack - # unpack docs and misc + # get extra modules + if use events-handlers-exec; then + pushd "${P}" + add_custom_module 'github.com/mholt/caddy-events-exec' || die + ego get github.com/mholt/caddy-events-exec + popd + fi + + # clone dist repo (docs and misc) EGIT_REPO_URI="https://github.com/caddyserver/dist.git" EGIT_CHECKOUT_DIR="${WORKDIR}/dist-${PV}" git-r3_src_unpack @@ -51,9 +72,23 @@ src_unpack() { fi } -src_prepare(){ +src_prepare() { default sed -i -e "s|User=caddy|User=http|g;s|Group=caddy|Group=http|g;" ../dist-"${PV}"/init/*service || die + + if use events-handlers-exec && [[ "${PV}" != 9999* ]]; then + add_custom_module 'github.com/mholt/caddy-events-exec' || die + cat <<-EOF >> go.sum || die + github.com/mholt/caddy-events-exec v0.0.0-20231121214933-055bfd2e8b82 h1:uRsPaFNQJRDrYcSsgnH0hFhCWFXfgB8QVH8yjX+u154= + github.com/mholt/caddy-events-exec v0.0.0-20231121214933-055bfd2e8b82/go.mod h1:Y9JjT8YLxpmk7PeUkvsWAhzzRdC6rXP7QjAHiwmvjD0= + EOF + + cat <<-EOF >> go.mod || die + require ( + github.com/mholt/caddy-events-exec v0.0.0-20231121214933-055bfd2e8b82 // indirect + ) + EOF + fi } src_compile() { diff --git a/www-servers/caddy/metadata.xml b/www-servers/caddy/metadata.xml index 94c564bbfc25..ede41c6d550d 100644 --- a/www-servers/caddy/metadata.xml +++ b/www-servers/caddy/metadata.xml @@ -13,6 +13,13 @@ <email>proxy-maint@gentoo.org</email> <name>Proxy Maintainers</name> </maintainer> + <use> + <flag name="events-handlers-exec"> + Builds a module which lets user exec command on Caddy events + https://caddyserver.com/docs/modules/events.handlers.exec + https://caddyserver.com/docs/caddyfile/options#event-options + </flag> + </use> <upstream> <remote-id type="github">caddyserver/caddy</remote-id> <bugs-to>https://github.com/caddyserver/caddy/issues</bugs-to> |