summaryrefslogtreecommitdiff
path: root/www-servers/static-web-server/static-web-server-2.36.0.ebuild
blob: b1bf34458af1975fcdc3ccfb7a4d14ee88872b2e (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
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

CRATES=" "
inherit cargo systemd shell-completion

DESCRIPTION="A high-performance and asynchronous web server for static files-serving"
HOMEPAGE="https://static-web-server.net/"
SRC_URI="https://github.com/static-web-server/static-web-server/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
SRC_URI+=" https://share.terinstock.com/${P}-vendor.tar.xz"

LICENSE="MIT Apache-2.0"
LICENSE+=" BSD 0BSD ZLIB Unlicense Unicode-3.0 ISC"
SLOT="0"
KEYWORDS="~amd64"

src_unpack() {
	cargo_src_unpack
	mkdir "${S}"/vendor || die
	ln -s "${WORKDIR}/vendor/"* "${S}"/vendor || die
	cp "${FILESDIR}"/"${PN}-vendor-config" "${S}"/.cargo/config.toml || die
}

src_prepare() {
	default
	sed -i 's/strip = true/strip = false/' Cargo.toml || die
}

src_configure() {
	cargo_gen_config
	cargo_src_configure --frozen --no-default-features
}

src_compile() {
	cargo_src_compile

	"$(cargo_target_dir)/${PN}" generate --completions . || die
	"$(cargo_target_dir)/${PN}" generate --man-pages . || die
}

src_install() {
	cargo_src_install

	systemd_dounit systemd/static-web-server.service
	systemd_dounit systemd/static-web-server.socket
	insinto /etc/default
	newins systemd/etc_default_static-web-server static-web-server

	newbashcomp "completions/${PN}.bash" "${PN}"
	newzshcomp "completions/_${PN}" "_${PN}"
	newfishcomp "completions/${PN}.fish" "${PN}"

	doman man/static-web-server.1
	doman man/static-web-server-generate.1
}