From 79d4c07431e6e4463ac279a8cf81a07492650a24 Mon Sep 17 00:00:00 2001 From: Nils Freydank Date: Sun, 29 Jan 2023 21:10:34 +0100 Subject: [PATCH] net-im/dendrite: Add new package net-im/dendrite, version 0.11.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This package was copied and adopted from “antons-matrix-overlay”: - upstream's repo: https://gitlab.com/anton.molyboha.group/gentoo/overlays/matrix - github.com mirror: https://github.com/gentoo-mirror/antons-matrix-overlay (It's in net-matrix category over there while put into net-im/matrix here.) Signed-off-by: Nils Freydank --- net-im/dendrite/Manifest | 2 + net-im/dendrite/dendrite-0.11.0.ebuild | 84 ++++++++++++++++++++++++++ net-im/dendrite/files/dendrite.confd | 27 +++++++++ net-im/dendrite/files/dendrite.initd | 64 ++++++++++++++++++++ net-im/dendrite/metadata.xml | 11 ++++ 5 files changed, 188 insertions(+) create mode 100644 net-im/dendrite/Manifest create mode 100644 net-im/dendrite/dendrite-0.11.0.ebuild create mode 100644 net-im/dendrite/files/dendrite.confd create mode 100644 net-im/dendrite/files/dendrite.initd create mode 100644 net-im/dendrite/metadata.xml diff --git a/net-im/dendrite/Manifest b/net-im/dendrite/Manifest new file mode 100644 index 0000000..6a44345 --- /dev/null +++ b/net-im/dendrite/Manifest @@ -0,0 +1,2 @@ +DIST dendrite-0.11.0-deps.tar.xz 517650728 BLAKE2B a2f21b87c8f07aa5e181b2403d1aa851c76cd40691438fd4004e6a2e9f2c9049d45f3419f9f3a7f20aca3064c490a611d5d04839e2645054abdcf5fd29f8a169 SHA512 9fcaf0d584f590929c9b20e62f6552e68f6d88d95271d52bcad5d75220193319cc28c4533020c97940ce089381dcb581c71d0ea327430a80b8897a9a43d092a0 +DIST dendrite-0.11.0.tar.gz 1052719 BLAKE2B d770a0dd9046e1b5716e870f929ef14cb491641988378f7b48a7d3222eaed3ac4edde3206c6247a97ba6c792fb8ab3c2d294165bcd7c23c39bac7fb90159718f SHA512 3dbb9ec780f08657129376dcb126891c5154efc5a592e1fe1e87637b2e0d84a9038f1119086e4b99c3e22264ae0f6fe436776e8f9989607c16c8a37392aed541 diff --git a/net-im/dendrite/dendrite-0.11.0.ebuild b/net-im/dendrite/dendrite-0.11.0.ebuild new file mode 100644 index 0000000..88ab0b9 --- /dev/null +++ b/net-im/dendrite/dendrite-0.11.0.ebuild @@ -0,0 +1,84 @@ +# Copyright 2022-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="8" +EGO_PN="github.com/matrix-org/dendrite/" +inherit go-module +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" +# FIXME +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 the binaries from bin and prefix everything with "dendrite". + newbin bin/create-account dendrite-create-account + dobin bin/dendrite-demo-pinecone + dobin bin/dendrite-demo-yggdrasil + dobin bin/dendrite-monolith-server + dobin bin/dendrite-polylith-multi + dobin bin/dendrite-upgrade-tests + 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 + + dodir "/etc/dendrite" + insinto /etc/dendrite + doins "${S}/dendrite-sample.monolith.yaml" + doins "${S}/dendrite-sample.polylith.yaml" + newinitd "${FILESDIR}"/dendrite.initd dendrite + newconfd "${FILESDIR}"/dendrite.confd dendrite + + 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." +} diff --git a/net-im/dendrite/files/dendrite.confd b/net-im/dendrite/files/dendrite.confd new file mode 100644 index 0000000..7a2f10f --- /dev/null +++ b/net-im/dendrite/files/dendrite.confd @@ -0,0 +1,27 @@ +# Increase the maximum number of open file descriptors. Set to a higher +# value for larger servers or if joining larger rooms. +rc_ulimit="-n 4096" + +# Specify the network service that corresponds to the "bind" setting +# in your configuration file. For example, if you bind to 127.0.0.1, +# this should be set to "loopback" which provides the loopback interface. +rc_need="loopback" + +# Dendrite mode. Either "monolith" or "polylith". +DENDRITE_MODE="monolith" + +# If your configuration of dendrite uses locally running PostgreSQL +# you may want to uncomment the next line +# rc_need="${rc_need} postgresql" + +# If your configuration of dendrite uses locally running kafka +# you may want to uncomment the next line +# rc_need="${rc_need} kafka" + +# If you use nginx as a reverse proxy for your dendrite +# you may want to uncomment the next line +# rc_need="${rc_need} nginx" + +# Additional command-line options. These can be used to set the bind address and port of the monolith server, +# among other things. See `dendrite-monolith-server -help` or `dendrite-polylith-multi -help` for a full list. +# DENDRITE_OPTS="-http-bind-address localhost:8008" diff --git a/net-im/dendrite/files/dendrite.initd b/net-im/dendrite/files/dendrite.initd new file mode 100644 index 0000000..5ddc76c --- /dev/null +++ b/net-im/dendrite/files/dendrite.initd @@ -0,0 +1,64 @@ +#!/sbin/openrc-run + +DENDRITE=${SVCNAME#*.} +: ${DENDRITE_CONFDIR:=${RC_PREFIX%/}/etc/dendrite} + +if [ -n "${DENDRITE}" ] && [ ${SVCNAME} != "dendrite" ]; then +: ${DENDRITE_CONFIG:=${DENDRITE_CONFDIR}/${DENDRITE}.yaml} +: ${DENDRITE_PIDFILE:=${RC_PREFIX%/}/run/dendrite.${DENDRITE}.pid} +: ${DENDRITE_RC_CONFIG:=${RC_PREFIX%/}/etc/conf.d/dendrite.${DENDRITE}} +else +: ${DENDRITE_CONFIG:=${DENDRITE_CONFDIR}/dendrite.yaml} +: ${DENDRITE_PIDFILE:=${RC_PREFIX%/}/run/${SVCNAME}.pid} +: ${DENDRITE_RC_CONFIG:=${RC_PREFIX%/}/etc/conf.d/dendrite} +fi + +if [ -n "${DENDRITE_BINARY}" ] ; then + : # Do nothing, DENDRITE_BINARY is set externally. +elif [ -z "${DENDRITE_MODE}" -o "${DENDRITE_MODE}" == "monolith" ] ; then + DENDRITE_BINARY=${RC_PREFIX%/}/usr/bin/dendrite-monolith-server +elif [ "${DENDRITE_MODE}" == "polylith" ] ; then + DENDRITE_BINARY:=${RC_PREFIX%/}/usr/bin/dendrite-polylith-multi +else + echo "Unknown dendrite mode: \"${DENDRITE_MODE}\"." >&2 + echo "Check the DENDRITE_MODE variable in ${DENDRITE_RC_CONFIG}" >&2 + exit 1 +fi + +command="${DENDRITE_BINARY}" +pidfile="${DENDRITE_PIDFILE}" +command_background=true +command_user="dendrite:dendrite" +directory="/var/lib/dendrite" +command_args="${DENDRITE_OPTS} -config ${DENDRITE_CONFIG}" + +checkconfig() { + test -f "${DENDRITE_CONFIG}" || { + echo "\"${DENDRITE_CONFIG}\" does not exist or is not a regular file." >&2 + echo "Please, look at https://github.com/matrix-org/dendrite for instructions" >&2 + echo "on how to configure your dendrite instance, and use" >&2 + echo "\"${DENDRITE_CONFIDR}/dendrite-config-example.yaml\" as an example." >&2 + return 1 + } +} + +start_pre() { + # If this isn't a restart, make sure that the user's config isn't + # busted before we try to start the daemon (this will produce + # better error messages than if we just try to start it blindly). + # + # If, on the other hand, this *is* a restart, then the stop_pre + # action will have ensured that the config is usable and we don't + # need to do that again. + if [ "${RC_CMD}" != "restart" ] ; then + checkconfig || return $? + fi +} + +stop_pre() { + # If this is a restart, check to make sure the user's config + # isn't busted before we stop the running daemon. + if [ "${RC_CMD}" = "restart" ] ; then + checkconfig || return $? + fi +} diff --git a/net-im/dendrite/metadata.xml b/net-im/dendrite/metadata.xml new file mode 100644 index 0000000..8b2f15b --- /dev/null +++ b/net-im/dendrite/metadata.xml @@ -0,0 +1,11 @@ + + + + + Nils Freydank + holgersson@posteo.de + + + matrix-org/dendrite + +