# 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 }