commit:     2503b56f8a968294d095ecdcb95ad504a6280c85
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 21 21:40:39 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jan 21 21:57:35 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2503b56f

dev-cpp/folly: add 2023.01.16.00

Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-cpp/folly/Manifest                             |   1 +
 .../folly/files/folly-2023.01.16.00-gcc13.patch    |  23 +++++
 .../folly/files/folly-2023.01.16.00-liburing.patch |  54 +++++++++++
 dev-cpp/folly/folly-2023.01.16.00.ebuild           | 104 +++++++++++++++++++++
 4 files changed, 182 insertions(+)

diff --git a/dev-cpp/folly/Manifest b/dev-cpp/folly/Manifest
index 93cd328824c3..a3a4c71865cd 100644
--- a/dev-cpp/folly/Manifest
+++ b/dev-cpp/folly/Manifest
@@ -1,2 +1,3 @@
 DIST folly-v2022.08.29.00.tar.gz 3696645 BLAKE2B 
c1ff618be8b6a73bf0a1249212cf904ac472711086e54da73dd631ecf002761e30496e8631d6591f51e279b736ae9b3fe50959de6b1f86f01f9d6bc08fe675fc
 SHA512 
1437a1314e26624715a0bb781049e19300eb3a67648287b319c55ce0dfbc867a09bd9d2f0cece6fc75fc62b21899aa94b464ae49c12687be7c94fdf0c7b95790
 DIST folly-v2022.09.12.00.tar.gz 3710760 BLAKE2B 
af59580ebee3229a6564c4b29e1d24bc405f4ae3b79751af315245c87472293f97c2d78348c92620d3196d1d41a7b55af9627cd42d23f74cbf6f00d129b3b77c
 SHA512 
f9d0ca44f6f0c343d16e8ee5408808830b30155d42a257c48e627f9a82bb4a57568a7feeba01cf73704db68af1eee7424971540635d5dfe1728fc2ae73953940
+DIST folly-v2023.01.16.00.tar.gz 3774935 BLAKE2B 
e6c5925de0e571d83ac6db363a92f3d8c2fa7e911efc3db8f41b702dacd64aed5247313102ca12ca36a27a6fd8d8d5168ca8e98835f4000b425c10560a39e392
 SHA512 
941e09c90fab9e668d5f6b77f22caeff1da4347324c017ad64359748e18fc7c713d13f839d90a116164005041824c8a8d2039cfcc7687e23d9be8fa5acbd61ec

diff --git a/dev-cpp/folly/files/folly-2023.01.16.00-gcc13.patch 
b/dev-cpp/folly/files/folly-2023.01.16.00-gcc13.patch
new file mode 100644
index 000000000000..0fed0efeb505
--- /dev/null
+++ b/dev-cpp/folly/files/folly-2023.01.16.00-gcc13.patch
@@ -0,0 +1,23 @@
+--- a/folly/system/AtFork.cpp
++++ b/folly/system/AtFork.cpp
+@@ -14,6 +14,8 @@
+  * limitations under the License.
+  */
+ 
++#include <stdexcept>
++
+ #include <folly/system/AtFork.h>
+ 
+ #include <folly/ScopeGuard.h>
+diff --git a/folly/system/AtFork.cpp b/folly/system/AtFork.cpp
+index be613c7..a557033 100644
+--- a/folly/system/AtFork.cpp
++++ b/folly/system/AtFork.cpp
+@@ -15,6 +15,7 @@
+  */
+ 
+ #include <stdexcept>
++#include <system_error>
+ 
+ #include <folly/system/AtFork.h>
+ 

diff --git a/dev-cpp/folly/files/folly-2023.01.16.00-liburing.patch 
b/dev-cpp/folly/files/folly-2023.01.16.00-liburing.patch
new file mode 100644
index 000000000000..e2a692cea50c
--- /dev/null
+++ b/dev-cpp/folly/files/folly-2023.01.16.00-liburing.patch
@@ -0,0 +1,54 @@
+https://bugs.gentoo.org/891633
+https://github.com/facebook/folly/issues/1908
+https://github.com/facebook/folly/commit/259c9d6a4f0eb6d80e0263c2fe5d1af5bff116dc
+
+From 259c9d6a4f0eb6d80e0263c2fe5d1af5bff116dc Mon Sep 17 00:00:00 2001
+From: Dylan Yudaken <[email protected]>
+Date: Mon, 16 Jan 2023 01:20:04 -0800
+Subject: [PATCH] io_uring: implement io_uring_enable_rings locally (#1915)
+
+Summary:
+Pull Request resolved: https://github.com/facebook/folly/pull/1915
+
+io_uring_enable_rings was missing from liburing upstream (see 
https://github.com/axboe/liburing/issues/773) which is breaking the open source 
build. See https://github.com/facebook/folly/issues/1908
+
+Instead just implement it locally, as it's trivial
+
+Reviewed By: dmm-fb
+
+Differential Revision: D42497664
+
+fbshipit-source-id: 7241785a36046e867f907bfe74623aaeb38c4b70
+--- a/folly/experimental/io/IoUringBackend.cpp
++++ b/folly/experimental/io/IoUringBackend.cpp
+@@ -56,6 +56,20 @@ namespace folly {
+ 
+ namespace {
+ 
++#if FOLLY_IO_URING_UP_TO_DATE
++int ioUringEnableRings(FOLLY_MAYBE_UNUSED struct io_uring* ring) {
++  // Ideally this would call ::io_uring_enable_rings directly which just runs
++  // the below however this was missing from a stable version of liburing, 
which
++  // means that some distributions were not able to compile it. see
++  // https://github.com/axboe/liburing/issues/773
++
++  // since it is so simple, just implement it here until the fix rolls out to 
an
++  // acceptable number of OSS distributions.
++  return ::io_uring_register(
++      ring->ring_fd, IORING_REGISTER_ENABLE_RINGS, nullptr, 0);
++}
++#endif
++
+ struct SignalRegistry {
+   struct SigInfo {
+     struct sigaction sa_ {};
+@@ -1360,7 +1374,7 @@ void IoUringBackend::delayedInit() {
+   if (usingDeferTaskrun_) {
+     // usingDeferTaskrun_ is guarded already on having an up to date liburing
+ #if FOLLY_IO_URING_UP_TO_DATE
+-    int ret = ::io_uring_enable_rings(&ioRing_);
++    int ret = ioUringEnableRings(&ioRing_);
+     if (ret) {
+       LOG(ERROR) << "io_uring_enable_rings gave " << folly::errnoStr(-ret);
+     }
+

diff --git a/dev-cpp/folly/folly-2023.01.16.00.ebuild 
b/dev-cpp/folly/folly-2023.01.16.00.ebuild
new file mode 100644
index 000000000000..c8873dfdd4ee
--- /dev/null
+++ b/dev-cpp/folly/folly-2023.01.16.00.ebuild
@@ -0,0 +1,104 @@
+# Copyright 1999-2023 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/folly
+# dev-util/watchman
+
+inherit 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";
+S="${WORKDIR}"
+
+LICENSE="Apache-2.0"
+SLOT="0/${PV}"
+KEYWORDS="~amd64"
+IUSE="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/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/liburing-2.2:=
+       sys-libs/zlib
+       llvm-libunwind? ( sys-libs/llvm-libunwind:= )
+       !llvm-libunwind? ( sys-libs/libunwind:= )"
+# libiberty is linked statically
+DEPEND="${RDEPEND}
+       sys-libs/binutils-libs
+       test? ( dev-cpp/gtest )"
+BDEPEND="test? ( sys-devel/clang )"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-2022.07.04.00-musl-fix.patch
+       "${FILESDIR}"/${PN}-2023.01.16.00-gcc13.patch
+       "${FILESDIR}"/${P}-liburing.patch
+)
+
+pkg_setup() {
+       [[ ${BUILD_TYPE} == binary ]] && return
+
+       if use test && ! tc-is-clang ; then
+               # Always build w/ Clang for now to avoid gcc ICE
+               # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106230
+               #if [[ $(gcc-major-version) -eq 12 ]] ; then
+               #       return
+               #fi
+
+               ## Only older GCC 11 is broken
+               #if [[ $(gcc-major-version) -eq 11 && $(gcc-minor-version) -ge 
3 && $(gcc-micro-version) -ge 1 ]] ; then
+               #       return
+               #fi
+
+               ewarn "Forcing build with Clang due to GCC bug (because tests 
are enabled)"
+               #ewarn "(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104008)"
+
+               export CC=${CHOST}-clang
+               export CXX=${CHOST}-clang++
+       fi
+}
+
+src_configure() {
+       # Fragile when changing compilers
+       export CCACHE_DISABLE=1
+
+       # TODO: liburing could in theory be optional but fails to link
+       local mycmakeargs=(
+               -DLIB_INSTALL_DIR="$(get_libdir)"
+
+               -DBUILD_TESTS=$(usex test)
+       )
+
+       cmake_src_configure
+}
+
+src_test() {
+       local myctestargs=(
+               # - 
timeseries_histogram_test.TimeseriesHistogram.Percentile|HHWheelTimerTest
+               # Long-standing known test failure
+               # TODO: report upstream
+               # - HHWheelTimerTest.HHWheelTimerTest.CancelTimeout
+               # Timeouts are fragile
+               # - concurrent_hash_map_test.*
+               # TODO: All SIGSEGV, report upstream!
+               -E 
"(timeseries_histogram_test.TimeseriesHistogram.Percentile|HHWheelTimerTest.HHWheelTimerTest.CancelTimeout|concurrent_hash_map_test.*)"
+       )
+
+       cmake_src_test
+}

Reply via email to