Files
gentoo/dev-cpp/folly/folly-2025.04.14.00-r1.ebuild
T
sin-ack 8ac2ad8883 dev-cpp/folly: add IUSE io-uring
There are three different problems being addressed here:

1. Recent Folly versions depend on liburing features that have not yet
   been released.
2. Folly has no build system configuration option to disable io_uring
   support.
3. Folly's CMake build system will unconditionally add liburing as a
   library to link against, which downstream Facebook libraries rely on.

The third one creates an implicit dependency between Folly and liburing
which means if liburing gets depcleaned or otherwise unmerged, other
Facebook packages will fail to build.

We solve this by conditionally patching out io_uring support based on
USE=io-uring and having a (currently technically invalid) dependency
on the yet-unreleased liburing-2.10, which will make it automagically
start working once we do have that release in ::gentoo.

Ref: https://github.com/facebook/folly/issues/2420
Bug: https://bugs.gentoo.org/954335
Signed-off-by: sin-ack <sin-ack@protonmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/41734
Signed-off-by: Sam James <sam@gentoo.org>
2025-04-25 00:31:44 +01:00

123 lines
2.8 KiB
Bash

# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
# These must be bumped together:
# dev-cpp/edencommon
# dev-cpp/fb303
# dev-cpp/fbthrift
# dev-cpp/fizz
# dev-cpp/folly
# dev-cpp/mvfst
# dev-cpp/wangle
# dev-util/watchman
inherit flag-o-matic cmake toolchain-funcs
DESCRIPTION="An open-source C++ library developed and used at Facebook"
HOMEPAGE="https://github.com/facebook/folly"
SRC_URI="https://github.com/facebook/folly/releases/download/v${PV}/${PN}-v${PV}.tar.gz"
LICENSE="Apache-2.0"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~arm64 ~ppc64"
IUSE="io-uring llvm-libunwind test"
RESTRICT="!test? ( test )"
RDEPEND="
app-arch/bzip2
app-arch/lz4:=
app-arch/snappy:=
app-arch/xz-utils
app-arch/zstd:=
dev-cpp/fast_float:=
dev-cpp/gflags:=
dev-cpp/glog:=[gflags]
dev-libs/boost:=[context]
dev-libs/double-conversion:=
dev-libs/libaio
dev-libs/libevent:=
dev-libs/libfmt:=
dev-libs/libsodium:=
dev-libs/openssl:=
sys-libs/zlib
llvm-libunwind? ( llvm-runtimes/libunwind:= )
!llvm-libunwind? ( sys-libs/libunwind:= )
io-uring? ( >=sys-libs/liburing-2.10:= )
"
DEPEND="
${RDEPEND}
sys-libs/binutils-libs
test? ( dev-cpp/gtest )
"
PATCHES=(
"${FILESDIR}"/${PN}-2024.11.04.00-musl-fix.patch
)
src_unpack() {
# Workaround for bug #889420
mkdir -p "${S}" || die
cd "${S}" || die
default
}
src_prepare() {
# Folly has no configuration option for disabling io_uring support
# so we need to patch it out.
if use !io-uring; then
eapply "${FILESDIR}"/${PN}-2025.04.14.00-force-liburing-off.patch
eapply "${FILESDIR}"/${PN}-2025.04.14.00-CMake-Avoid-finding-liburing.patch
fi
cmake_src_prepare
}
src_configure() {
local mycmakeargs=(
-DCMAKE_INSTALL_DIR="$(get_libdir)/cmake/${PN}"
-DLIB_INSTALL_DIR="$(get_libdir)"
-DBUILD_TESTS=$(usex test)
# https://github.com/gentoo/gentoo/pull/29393
-DCMAKE_LIBRARY_ARCHITECTURE=$(usex amd64 x86_64 ${ARCH})
)
# https://github.com/facebook/folly/issues/1984
use arm64 && append-cxxflags "-flax-vector-conversions"
cmake_src_configure
}
src_test() {
CMAKE_SKIP_TESTS=(
# Mysterious "invalid json" failure
io_async_ssl_session_test.SSLSessionTest
singleton_thread_local_test.SingletonThreadLocalDeathTest
# TODO: All SIGSEGV, report upstream!
'concurrency_concurrent_hash_map_test.*'
)
if use arm64; then
CMAKE_SKIP_TESTS+=(
# Tests are flaky/timing dependent on both QEMU chroot and real hardware
io_async_hh_wheel_timer_test.HHWheelTimerTest
# Times out on real hardware
concurrent_skip_list_test.ConcurrentSkipList
futures_retrying_test.RetryingTest.largeRetries
)
fi
if [[ $(tc-get-cxx-stdlib) == libc++ ]]; then
CMAKE_SKIP_TESTS+=(
# Aborts with libc++.
# https://github.com/facebook/folly/issues/2345
buffered_atomic_test.BufferedAtomic.singleThreadUnguardedAccess
)
fi
cmake_src_test
}