Notification time stamped 2021-07-31 22:40:14 UTC
From e135cfc06a35570b5c61b741ecee9c44b520e8f0 Mon Sep 17 00:00:00 2001
From: Filipe Brandenburger <filbranden(a)gmail.com>
Date: Jul 30 2021 23:03:28 +0000
Subject: Enable support for C++ coroutines through -fcoroutines
Do so instead of bumping up the C++ standard to C++20, which is not
yet officially supported in Folly.
Signed-off-by: Filipe Brandenburger <filbranden(a)gmail.com>
---
diff --git a/folly-gcc-enable-coroutines.patch b/folly-gcc-enable-coroutines.patch
new file mode 100644
index 0000000..c210813
--- /dev/null
+++ b/folly-gcc-enable-coroutines.patch
@@ -0,0 +1,27 @@
+diff -Naur folly-2021.07.22.00.orig/CMakeLists.txt folly-2021.07.22.00/CMakeLists.txt
+--- folly-2021.07.22.00.orig/CMakeLists.txt 2021-07-21 17:15:26.000000000 -0700
++++ folly-2021.07.22.00/CMakeLists.txt 2021-07-30 16:03:14.912611147 -0700
+@@ -234,6 +234,23 @@
+ )
+ endif()
+
++if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
++ check_cxx_compiler_flag(-fcoroutines COMPILER_HAS_F_COROUTINES)
++ if (COMPILER_HAS_F_COROUTINES)
++ message(
++ STATUS
++ "GCC has support for C++ coroutines, setting flag for Folly build."
++ )
++ add_compile_options(-fcoroutines)
++ else()
++ message(
++ WARNING
++ "GCC does not have support for C++ coroutines, "
++ "disabling Folly coroutine support."
++ )
++ endif()
++endif()
++
+ if (${LIBSODIUM_FOUND})
+ string(FIND "${CMAKE_LIBRARY_ARCHITECTURE}" "x86_64" IS_X86_64_ARCH)
+ if (${IS_X86_64_ARCH} STREQUAL "-1")
diff --git a/folly.spec b/folly.spec
index 4f6ae8e..7afde8e 100644
--- a/folly.spec
+++ b/folly.spec
@@ -5,12 +5,9 @@
%global _static_builddir static_build
-# Use C++20 standard, required for folly coroutines.
-%global build_cxxflags -std=c++20 %{optflags}
-
Name: folly
Version: 2021.07.22.00
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: An open-source C++ library developed and used at Facebook
License: ASL 2.0
@@ -19,6 +16,7 @@ Source0: %{url}/archive/v%{version}/folly-%{version}.tar.gz
# getStackTraceInPlace uses setjmp on ppc64le and can't be inlined
Patch0: %{name}-fix_ppc64le_inlining.patch
Patch1: %{name}-drop-immintrin.patch
+Patch2: %{name}-gcc-enable-coroutines.patch
# Folly is known not to work on big-endian CPUs
# https://bugzilla.redhat.com/show_bug.cgi?id=1892151
@@ -240,6 +238,9 @@ popd
%changelog
+* Fri Jul 30 2021 Filipe Brandenburger <filbranden(a)gmail.com> - 2021.07.22.00-3
+- Enable coroutines through -fcoroutines instead of -std=c++20.
+
* Thu Jul 29 2021 Filipe Brandenburger <filbranden(a)gmail.com> - 2021.07.22.00-2
- Use C++20 standard, in order to enable C++ coroutines.
https://src.fedoraproject.org/rpms/folly/c/e135cfc06a35570b5c61b741ecee9c44…