dev-libs/raft: new package

It's from Gentoo commit 91137d52c4f6307b512c6f447236bc75e8f8b3ec.

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
This commit is contained in:
Mathieu Tortuyaux 2025-05-14 17:20:24 +02:00
parent 047c57cb23
commit 56eda53b35
No known key found for this signature in database
GPG Key ID: AC5CCFB52545D9B8
4 changed files with 107 additions and 0 deletions

View File

@ -0,0 +1 @@
DIST raft-0.22.1.tar.gz 362393 BLAKE2B b6fc8f8e9dc6801ac8ad1b9d94f984b249b83def00a08776292500b079bb777330e8a83cf40153bfb1baae921105788d758c9f61a021d5519d5c27048b6be8b9 SHA512 fb4ea98321336daaa605e1c3cd55f672860fc8894d479fdff4e1862a4eb5622dbaf7a943e030dd2bcdaa14cc639e7e11ac43d71f00bdbd27f12c6b67653b70e4

View File

@ -0,0 +1,21 @@
diff -Naur a/configure.ac b/configure.ac
--- a/configure.ac 2021-03-16 14:45:58.000000000 +0200
+++ b/configure.ac 2021-03-23 07:45:06.875557286 +0200
@@ -47,13 +47,10 @@
# Checks for header files.
AC_CHECK_HEADERS([stdlib.h string.h stdio.h assert.h unistd.h linux/io_uring.h linux/aio_abi.h])
-# Check if zfs >= 0.8.0 is available (for direct I/O support).
-AC_CHECK_PROG(have_zfs, zfs, yes)
-AS_IF([test x"$have_zfs" = x"yes"],
- [AX_COMPARE_VERSION($(cat /sys/module/zfs/version | cut -f 1 -d -), [ge], [0.8.0],
- [AC_DEFINE(RAFT_HAVE_ZFS_WITH_DIRECT_IO)], [])
- ],
- [])
+# zfs support. We have 0.8.6 as stable in Gentoo, which is plenty above the required minimum.
+AC_ARG_WITH([zfs], AS_HELP_STRING([--with-zfs], [Build with zfs support (default: disabled)]))
+AS_IF([test "x$with_zfs" = "xyes"],
+ [AC_DEFINE(RAFT_HAVE_ZFS_WITH_DIRECT_IO)], [])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>juippis@gentoo.org</email>
<name>Joonas Niilola</name>
</maintainer>
<maintainer type="project">
<email>virtualization@gentoo.org</email>
<name>Gentoo Virtualization Project</name>
</maintainer>
<use>
<flag name="zfs">ZFS support</flag>
</use>
<longdescription>
The library has modular design: its core part implements only the core
Raft algorithm logic, in a fully platform independent way. On top of that,
a pluggable interface defines the I/O implementation for networking
(send/receive RPC messages) and disk persistence (store log entries and
snapshots).
</longdescription>
<upstream>
<remote-id type="github">cowsql/raft</remote-id>
</upstream>
</pkgmetadata>

View File

@ -0,0 +1,60 @@
# Copyright 2020-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit autotools
DESCRIPTION="C implementation of the Raft consensus protocol"
HOMEPAGE="https://github.com/cowsql/raft"
SRC_URI="https://github.com/cowsql/raft/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="LGPL-3-with-linking-exception"
# Upstream change from canonical to cowsql resetted SONAME, 3 -> 0. bgo#915960
SLOT="0/0"
KEYWORDS="amd64 ~arm64 ~x86"
IUSE="lz4 test zfs"
RESTRICT="!test? ( test )"
DEPEND="dev-libs/libuv:=
lz4? ( app-arch/lz4:= )"
RDEPEND="${DEPEND}"
BDEPEND="virtual/pkgconfig"
PATCHES=(
"${FILESDIR}"/raft-0.10.0-toggle-zfs.patch
)
src_prepare() {
default
eautoreconf
}
src_configure() {
# --disable-hardening: most of these are covered on non-hardened Gentoo already.
local myeconfargs=(
--enable-uv
--enable-v0
--disable-backtrace
--disable-benchmark
--disable-debug
--disable-example
--disable-hardening
--disable-sanitize
--disable-static
$(use_enable test fixture)
$(use_with lz4)
$(use_with zfs)
)
econf "${myeconfargs[@]}"
}
src_install() {
default
find "${ED}" -name '*.la' -delete || die
}