holgersson-overlay/net-im/dendrite/dendrite-0.12.0.ebuild
Nils Freydank 163ef0a26e
net-im/dendrite: Drop polylith mode including possible breakage
Upstream dropped the polylith mode in 0.12.0 as announced in earlier releases.
This leads to some renaming of files, see e.g. upstream issue 2975[1].

As I've got no OpenRC system or container right now I can't test the modified
OpenRC init scripts. In case you have one feedback either way is appreciated
- confirmations that it's working, bug reports if it failes or even just
suggestions for improvement.

As the ebuild didn't build (failed in the install phase) before this fixup
there is no revbump necessary.

This commit also adds an service file which is based upon upstream's
example for their monolith setup (but with paths in /usr instead of opt)[2].

[1] https://github.com/matrix-org/dendrite/issues/2975
[2] https://github.com/matrix-org/dendrite/blob/main/docs/systemd/monolith-example.service

Signed-off-by: Nils Freydank <nils.freydank@posteo.de>
2023-03-21 22:57:02 +01:00

95 lines
2.1 KiB
Bash

# Copyright 2022-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# TODO:
# 1. fix LICENSE field
# 2. fix init scripts
EAPI="8"
EGO_PN="github.com/matrix-org/dendrite/"
inherit go-module systemd
COMMIT_ID=""
DESCRIPTION="Matrix homeserver written in go"
HOMEPAGE="https://matrix.org https://github.com/matrix-org/dendrite"
if [[ ${PV} == *_p* ]]; then
SRC_URI="https://${EGO_PN}/archive/${COMMIT_ID}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${PN}-${COMMIT_ID}"
else
SRC_URI="https://${EGO_PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
fi
# Add the manually vendored tarball.
# Compress the tarball with: xz -9kT0 --memlimit-decompress=256M
SRC_URI+=" https://files.holgersson.xyz/gentoo/distfiles/${P}-deps.tar.xz"
KEYWORDS="~amd64"
LICENSE="Apache-2.0"
SLOT="0"
IUSE=""
DEPEND=""
RDEPEND="
acct-user/dendrite
acct-group/dendrite
"
BDEPEND=""
src_unpack() {
go-module_src_unpack || die
}
src_compile() {
local mygobuildargs=(
-o bin/
-trimpath
-ldflags="-s -w"
-mod mod
-v -x
-work
)
ego build "${mygobuildargs[@]}" "${S}/cmd/..."
}
src_test() {
ego test -trimpath -v -x -work "${S}/cmd/..."
}
src_install() {
# Install files from bin, prefix with 'dendrite' if necessary.
newbin bin/create-account dendrite-create-account
dobin bin/dendrite-demo-pinecone
dobin bin/dendrite-demo-yggdrasil
dobin bin/dendrite
dobin bin/dendrite-upgrade-tests
# prefix
newbin bin/furl dendrite-furl
newbin bin/generate-config dendrite-generate-config
newbin bin/generate-keys dendrite-generate-keys
newbin bin/resolve-state dendrite-resolve-state
# Provide a sample configuration.
dodir "/etc/dendrite"
insinto /etc/dendrite
doins "${S}/dendrite-sample.yaml"
# Install init scripts for OpenRC
newinitd "${FILESDIR}"/dendrite.initd dendrite
newconfd "${FILESDIR}"/dendrite.confd dendrite
# Install a systemd unit.
systemd_newunit "${FILESDIR}"/dendrite.service dendrite.service
keepdir "/var/log/dendrite"
fowners dendrite:dendrite "/var/log/dendrite"
}
pkg_postinst() {
elog ""
elog "Note that all binaries are prefixed with 'dendrite-'"
elog "- even ones that have no prefix uptream."
}