Files
guru/net-im/tuwunel/tuwunel-1.8.0.ebuild
Niklaus 'vimja' Hofer 94248d1105 net-im/tuwunel: add 1.8.0, drop 1.7.0
Signed-off-by: Niklaus 'vimja' Hofer <gentoo-bugzilla@vimja.email>
2026-06-28 15:10:43 +02:00

232 lines
8.5 KiB
Bash

# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# Autogenerated by pycargoebuild 0.15.1
EAPI=8
CRATES="
"
declare -A GIT_CRATES=(
[async-channel]='https://github.com/matrix-construct/async-channel;debb93f14a20fa7c1989042c2f07f53654d75908;async-channel-%commit%'
[axum-server-dual-protocol]='https://github.com/matrix-construct/axum-server-dual-protocol;76c782fa6f129f83ffdca59e903093e798d4a82f;axum-server-dual-protocol-%commit%'
[core_affinity]='https://github.com/matrix-construct/core_affinity_rs;ff148c2985cbaff3e6e953d45cda4d7696f38d75;core_affinity_rs-%commit%'
[event-listener]='https://github.com/matrix-construct/event-listener;18af85c4df39a11b44b39629783ed3ddec6a8853;event-listener-%commit%'
[hyper-util]='https://github.com/matrix-construct/hyper-util;0510e3a3cba7aedd504b4ee0d69fbf41e76a524f;hyper-util-%commit%'
[jevmalloc-sys]='https://github.com/matrix-construct/jevmalloc;93795449913f65ab533b7fa482333eef63fc3ae0;jevmalloc-%commit%/jevmalloc-sys'
[jevmalloc]='https://github.com/matrix-construct/jevmalloc;93795449913f65ab533b7fa482333eef63fc3ae0;jevmalloc-%commit%/jevmalloc'
[lber]='https://github.com/matrix-construct/ldap3;fdfbba2bf916b53e5f73cdb1a495ebb649978079;ldap3-%commit%/lber'
[ldap3]='https://github.com/matrix-construct/ldap3;fdfbba2bf916b53e5f73cdb1a495ebb649978079;ldap3-%commit%'
[resolv-conf]='https://github.com/matrix-construct/resolv-conf;ab5c3e44016bc76b8798ec837a5a9cf9d88bf233;resolv-conf-%commit%'
[ruma-appservice-api]='https://github.com/matrix-construct/ruma;55d532152ec3b6ebab8ac141cc4bcc78452aa049;ruma-%commit%/crates/ruma-appservice-api'
[ruma-client-api]='https://github.com/matrix-construct/ruma;55d532152ec3b6ebab8ac141cc4bcc78452aa049;ruma-%commit%/crates/ruma-client-api'
[ruma-common]='https://github.com/matrix-construct/ruma;55d532152ec3b6ebab8ac141cc4bcc78452aa049;ruma-%commit%/crates/ruma-common'
[ruma-events]='https://github.com/matrix-construct/ruma;55d532152ec3b6ebab8ac141cc4bcc78452aa049;ruma-%commit%/crates/ruma-events'
[ruma-federation-api]='https://github.com/matrix-construct/ruma;55d532152ec3b6ebab8ac141cc4bcc78452aa049;ruma-%commit%/crates/ruma-federation-api'
[ruma-identifiers-validation]='https://github.com/matrix-construct/ruma;55d532152ec3b6ebab8ac141cc4bcc78452aa049;ruma-%commit%/crates/ruma-identifiers-validation'
[ruma-identity-service-api]='https://github.com/matrix-construct/ruma;55d532152ec3b6ebab8ac141cc4bcc78452aa049;ruma-%commit%/crates/ruma-identity-service-api'
[ruma-macros]='https://github.com/matrix-construct/ruma;55d532152ec3b6ebab8ac141cc4bcc78452aa049;ruma-%commit%/crates/ruma-macros'
[ruma-push-gateway-api]='https://github.com/matrix-construct/ruma;55d532152ec3b6ebab8ac141cc4bcc78452aa049;ruma-%commit%/crates/ruma-push-gateway-api'
[ruma-signatures]='https://github.com/matrix-construct/ruma;55d532152ec3b6ebab8ac141cc4bcc78452aa049;ruma-%commit%/crates/ruma-signatures'
[ruma]='https://github.com/matrix-construct/ruma;55d532152ec3b6ebab8ac141cc4bcc78452aa049;ruma-%commit%/crates/ruma'
[rust-librocksdb-sys]='https://github.com/matrix-construct/rust-rocksdb;8d92399498d85b486707c6febb278ad902d3aba3;rust-rocksdb-%commit%/librocksdb-sys'
[rust-rocksdb]='https://github.com/matrix-construct/rust-rocksdb;8d92399498d85b486707c6febb278ad902d3aba3;rust-rocksdb-%commit%'
[rustyline-async]='https://github.com/matrix-construct/rustyline-async;879968ba99c2558ae234fd67a057b7ea6f761fd3;rustyline-async-%commit%'
[synapse-admin-api]='https://github.com/matrix-construct/synapse-admin-api;010b9a1e1cb8937669af7503de0dbccb125051f1;synapse-admin-api-%commit%'
)
LLVM_COMPAT=( 21 )
RUST_MIN_VER="1.94.0"
inherit cargo llvm-r2 linux-info
DESCRIPTION="High Performance Matrix Homeserver in Rust!"
HOMEPAGE="
https://tuwunel.chat
https://github.com/matrix-construct/tuwunel
"
# Copy this from the GIT_CRATES[rust-rocksdb] entry.
RUST_ROCKSB_GIT_COMMIT=8d92399498d85b486707c6febb278ad902d3aba3
# cat flake.lock | jq '.nodes.rocksdb.locked.rev'
ROCKSDB_GIT_COMMIT=0bd7e6d6438d318d66e8374ec1fe24126204f3b3
SRC_URI="
${CARGO_CRATE_URIS}
https://github.com/matrix-construct/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
https://github.com/gentoo-crate-dist/${PN}/releases/download/v${PV}/${P}-crates.tar.xz
https://github.com/matrix-construct/rocksdb/archive/${ROCKSDB_GIT_COMMIT}.tar.gz
-> rocksdb-${ROCKSDB_GIT_COMMIT}.tar.gz
"
# The repository's root directory is a "workspace root".
# It's easier and less error prone to work in src/main.
S="${WORKDIR}/${P}/src/main"
LICENSE="Apache-2.0"
# Dependent crate licenses
LICENSE+="
Apache-2.0 BSD-2 BSD BlueOak-1.0.0 CDLA-Permissive-2.0 ISC MIT
MPL-2.0 Unicode-3.0 Unlicense ZLIB
"
SLOT="0"
KEYWORDS="~amd64 ~arm64"
IUSE="jemalloc gzip zstd lz4 bzip2 systemd brotli ldap io-uring"
# bzip2 looks difficult to un-bundle:
# https://wiki.gentoo.org/wiki/Project:Rust/sys_crates#bzip2-sys
# lz4 cannot be un-bundled:
# https://wiki.gentoo.org/wiki/Writing_Rust_ebuilds#Unbundling_C_libraries
COMMON_DEPEND="
jemalloc? ( dev-libs/jemalloc:= )
app-arch/snappy:=
zstd? (
app-arch/zstd:=
)
"
RDEPEND="
${COMMON_DEPEND}
acct-user/tuwunel
app-misc/ca-certificates
"
# clang needed for bindgen
DEPEND="
${COMMON_DEPEND}
$(llvm_gen_dep '
llvm-core/clang:${LLVM_SLOT}
llvm-core/llvm:${LLVM_SLOT}
')
"
# Required for pkg-config crate:
# https://wiki.gentoo.org/wiki/Writing_Rust_ebuilds#pkg-config_crate
BDEPEND="virtual/pkgconfig"
# rust does not use *FLAGS from make.conf, silence portage warning
# update with proper path to binaries this crate installs, omit leading /
QA_FLAGS_IGNORED="usr/bin/${PN}"
DOCS=( ../../{README,RELEASE,CONTRIBUTING,CODE_OF_CONDUCT}.md )
pkg_setup() {
CONFIG_CHECK=""
# IO-Uring requires kernel support.
if use io-uring; then
CONFIG_CHECK+=" ~IO_URING"
ERROR_IO_URING="${P} requires io-uring in-kernel support."
fi
if [[ -n ${CONFIG_CHECK} ]]; then
linux-info_pkg_setup
fi
llvm-r2_pkg_setup
rust_pkg_setup
}
src_prepare() {
# grep '\[patch\.' ../../Cargo.toml
local patched_crates=(
async-channel
core_affinity
event-listener
hyper-util
resolv-conf
rustyline-async
)
for patched_crate in ${patched_crates[@]}; do
local commit_hash=$(
echo ${GIT_CRATES[${patched_crate}]} \
| cut --delimiter=';' --fields=2
)
local directory_prefix=$(
echo ${GIT_CRATES[${patched_crate}]} \
| cut --delimiter=';' --fields=3 \
| cut --delimiter='%' --fields=1
)
echo "" >> "${ECARGO_HOME}/config.toml" || die
echo "[patch.crates-io.${patched_crate}]" >> "${ECARGO_HOME}/config.toml" || die
echo "path = \"${WORKDIR}/${directory_prefix}${commit_hash}\"" >> "${ECARGO_HOME}/config.toml" || die
done
local rocksdb_path="${WORKDIR}"/rust-rocksdb-${RUST_ROCKSB_GIT_COMMIT}/librocksdb-sys/rocksdb
rmdir "${rocksdb_path}" || die
mv "${WORKDIR}"/rocksdb-${ROCKSDB_GIT_COMMIT} "${rocksdb_path}" || die
eapply_user
}
src_configure() {
# Required for pkg-config crate:
# https://wiki.gentoo.org/wiki/Writing_Rust_ebuilds#pkg-config_crate
export PKG_CONFIG_ALLOW_CROSS=1
# Required to un-bundle jemalloc:
# https://wiki.gentoo.org/wiki/Writing_Rust_ebuilds#Common_-sys_crates
export JEMALLOC_OVERRIDE="${ESYSROOT}/usr/$(get_libdir)/libjemalloc.so"
if use zstd; then
# Required to un-bundle zstd:
# https://wiki.gentoo.org/wiki/Project:Rust/sys_crates#zstd-sys
export ZSTD_SYS_USE_PKG_CONFIG=1
fi
# The project maintains their own fork of rocksdb. Because of that,
# unbundling it is not an option at this point.
local myfeatures=(
element_hacks
media_thumbnail
release_max_log_level
url_preview
$(usev io-uring io_uring)
$(usev systemd)
$(usev jemalloc)
$(usev ldap)
$(usev jemalloc jemalloc_conf)
$(usev zstd zstd_compression)
$(usev lz4 lz4_compression)
$(usev gzip gzip_compression)
$(usev bzip2 bzip2_compression)
$(usev brotli brotli_compression)
)
rust_pkg_setup
cargo_src_configure --no-default-features --offline
}
src_install() {
cargo_src_install
keepdir /var/lib/tuwunel
fowners tuwunel:tuwunel /var/lib/tuwunel
fperms 750 /var/lib/tuwunel
keepdir /var/log/tuwunel
fowners tuwunel:tuwunel /var/log/tuwunel
fperms 750 /var/log/tuwunel
insinto /etc/tuwunel
newins "${WORKDIR}"/"${P}"/tuwunel-example.toml tuwunel.toml
insinto /etc/logrotate.d
newins "${FILESDIR}"/tuwunel.logrotate-r1 tuwunel
newinitd "${FILESDIR}"/tuwunel.init-r1 tuwunel
newconfd "${FILESDIR}"/tuwunel.conf-r1 tuwunel
# TODO: Add systemd service.
}
src_test() {
mkdir -p "${T}/var/lib/tuwunel" || die
TUWUNEL_DATABASE_PATH="${T}/var/lib/tuwunel" cargo_src_test
}