summaryrefslogtreecommitdiff
blob: 75c89bd5df5131d607f01bce7992c32f1056563b (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# Autogenerated by pycargoebuild 0.13.2

EAPI=8

inherit cargo systemd

DESCRIPTION="A Matrix homeserver written in Rust"
HOMEPAGE="https://conduit.rs"

if [[ ${PV} = 9999 ]]; then
	EGIT_REPO_URI="https://gitlab.com/famedly/${PN}.git"
	inherit git-r3
else
	SRC_URI="
		https://gitlab.com/famedly/${PN}/-/archive/v${PV}/${PN}-v${PV}.tar.bz2
		${CARGO_CRATE_URIS}
	"
	KEYWORDS="~amd64 ~arm64"
	S="${WORKDIR}/${PN}-v${PV}"
fi

LICENSE="Apache-2.0"
# Manually inspected crate licenses
LICENSE+="
	ISC openssl MIT
"
# Dependent crate licenses
LICENSE+=" Apache-2.0 BSD-2 BSD ISC MIT MPL-2.0 Unicode-DFS-2016 ZLIB"
SLOT="0"

IUSE="+rocksdb"

BDEPEND="
	virtual/rust
	rocksdb? (
		virtual/pkgconfig
		sys-devel/clang
	)
"
DEPEND="
	rocksdb? ( dev-libs/rocksdb )
"
RDEPEND="${DEPEND}"

QA_FLAGS_IGNORED="/usr/bin/conduit"

src_unpack() {
	if [[ ${PV} = 9999 ]]; then
		git-r3_src_unpack
		cargo_live_src_unpack
	else
		cargo_src_unpack
	fi
}

src_configure() {
	# See https://wiki.gentoo.org/wiki/Writing_Rust_ebuilds#Unbundling_C_libraries
	local ld="${ESYSROOT}/usr/$(get_libdir)"
	export PKG_CONFIG_ALLOW_CROSS=1

	# This mess seems to be required based on librocksdb-sys' build.rs.
	export ROCKSDB_LIB_DIR="${ld}"
	export SNAPPY_LIB_DIR="${ld}"
	export LZ4_LIB_DIR="${ld}"
	export Z_LIB_DIR="${ld}"
	export BZ2_LIB_DIR="${ld}"
	export ZSTD_LIB_DIR="${ld}"
	export ZSTD_SYS_USE_PKG_CONFIG=1

	local myfeatures=(
		backend_sqlite
		systemd
		conduit_bin
		persy
		$(usev rocksdb backend_rocksdb)
	)
	cargo_src_configure --no-default-features
}

src_install() {
	local target_dir="$(usex debug debug release)"
	dobin target/"${target_dir}"/conduit

	systemd_dounit "${FILESDIR}"/matrix-conduit.service
	dodoc README.md LICENSE conduit-example.toml
}