86fc372
%bcond_with toolchain_clang
9562c88
9562c88
%if %{with toolchain_clang}
9562c88
%global toolchain clang
86fc372
%endif
67882a9
%ifarch x86_64 aarch64
4221a62
# tests can be compiled, keep it that way
95331a3
# on aarch64 ctest doesn't seem to find tests yet
9562c88
%bcond_without check
9562c88
%else
67882a9
# tests don't compile cleanly on ppc64le yet
9562c88
%bcond_with check
4221a62
%endif
9562c88
95331a3
# use this to re-test running all tests
95331a3
%bcond_with all_tests
95331a3
5c246e6
%ifarch aarch64
5c246e6
# In file included from /builddir/build/BUILD/folly-2023.04.24.00/folly/detail/SplitStringSimd.cpp:18:
5c246e6
# /builddir/build/BUILD/folly-2023.04.24.00/folly/detail/SplitStringSimdImpl.h: In static member function 'static uint64_t folly::detail::StringSplitAarch64Platform::equal(reg_t, char)':
5c246e6
# /builddir/build/BUILD/folly-2023.04.24.00/folly/detail/SplitStringSimdImpl.h:129:25: note: use '-flax-vector-conversions' to permit conversions between vectors with differing element types or numbers of subparts
5c246e6
#   129 |     return vget_lane_u64(vmovn_u16(u16s), 0);
5c246e6
#       |            ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
5c246e6
# /builddir/build/BUILD/folly-2023.04.24.00/folly/detail/SplitStringSimdImpl.h:129:35: error: cannot convert 'uint8x8_t' to 'uint64x1_t'
5c246e6
#   129 |     return vget_lane_u64(vmovn_u16(u16s), 0);
5c246e6
#       |                          ~~~~~~~~~^~~~~~
5c246e6
#       |                                   |
5c246e6
#       |                                   uint8x8_t
5c246e6
# In file included from /builddir/build/BUILD/folly-2023.04.24.00/folly/detail/SplitStringSimdImpl.h:29:
5c246e6
# /usr/lib/gcc/aarch64-redhat-linux/13/include/arm_neon.h:2725:27: note:   initializing argument 1 of 'uint64_t vget_lane_u64(uint64x1_t, int)'
5c246e6
#  2725 | vget_lane_u64 (uint64x1_t __a, const int __b)
5c246e6
#       |                ~~~~~~~~~~~^~~
5c246e6
%global optflags %optflags -flax-vector-conversions
5c246e6
%endif
5c246e6
9bdc291
%if 0%{?el9}
8184525
# pandoc is not in CS9
8184525
# https://bugzilla.redhat.com/show_bug.cgi?id=2035151
8184525
%bcond_with docs
9bdc291
%else
8184525
%bcond_without docs
9bdc291
%endif
9bdc291
5c246e6
# Python bindings not buildable with CMake
5c246e6
# folly/iobuf.cpp:20:10: fatal error: folly/python/iobuf_api.h: No such file or directory   
5c246e6
%bcond_with python
5c246e6
5c246e6
%global liburing_min_version 2.1
5c246e6
%if 0%{?fedora} || 0%{?rhel} >= 10
5c246e6
%bcond_without uring
5c246e6
%else
5c246e6
# liburing too old: IORING_CQE_F_MORE added in
5c246e6
# 674d092f634e61ab1ec72c190a29bc9bde0f5076 included in 2.1+
5c246e6
%bcond_with uring
5c246e6
%endif
8184525
ab7c586
Name:           folly
b423e7a
Version:        2024.02.19.00
3b3b659
Release:        %{autorelease}
ab7c586
Summary:        An open-source C++ library developed and used at Facebook
ab7c586
f2ecf11
License:        Apache-2.0
ab7c586
URL:            https://github.com/facebook/folly
f620f9f
Source:         %{url}/archive/v%{version}/folly-%{version}.tar.gz
67882a9
JasenChao 440f075
ExclusiveArch:  x86_64 aarch64 ppc64le riscv64
ab7c586
ab7c586
BuildRequires:  cmake
9562c88
%if %{with toolchain_clang}
9562c88
BuildRequires:  clang
9562c88
BuildRequires:  libatomic
9562c88
%else
ab7c586
BuildRequires:  gcc-c++
9562c88
%endif
ab7c586
# Docs dependencies
8184525
%if %{with docs}
ab7c586
BuildRequires:  pandoc
8184525
%endif
ab7c586
# Library dependencies
ab7c586
# for libiberty
ab7c586
BuildRequires:  binutils-devel
ab7c586
BuildRequires:  boost-devel
ab7c586
BuildRequires:  bzip2-devel
ab7c586
BuildRequires:  double-conversion-devel
ab7c586
BuildRequires:  fmt-devel
ab7c586
BuildRequires:  gflags-devel
ab7c586
BuildRequires:  glog-devel
f620f9f
%if %{with check}
ab7c586
BuildRequires:  gmock-devel
e32871d
BuildRequires:  gtest-devel
ab7c586
%endif
ab7c586
BuildRequires:  libaio-devel
ab7c586
BuildRequires:  libdwarf-devel
ab7c586
BuildRequires:  libevent-devel
ab7c586
BuildRequires:  libsodium-devel
ab7c586
BuildRequires:  libunwind-devel
5c246e6
%if %{with uring}
ab7c586
# 0.7-3 fixes build on armv7hl
5c246e6
BuildRequires:  liburing-devel >= %{liburing_min_version}
5c246e6
%endif
ab7c586
BuildRequires:  libzstd-devel
ab7c586
BuildRequires:  lz4-devel
09e5004
BuildRequires:  openssl-devel
ab7c586
BuildRequires:  snappy-devel
ab7c586
BuildRequires:  xz-devel
ab7c586
BuildRequires:  zlib-devel
ab7c586
8184525
%global _description %{expand:
ab7c586
Folly (acronymed loosely after Facebook Open Source Library) is a library of
ab7c586
C++14 components designed with practicality and efficiency in mind. Folly
ab7c586
contains a variety of core library components used extensively at Facebook. In
ab7c586
particular, it's often a dependency of Facebook's other open source C++ efforts
ab7c586
and place where those projects can share code.
ab7c586
ab7c586
It complements (as opposed to competing against) offerings such as Boost and of
ab7c586
course std. In fact, we embark on defining our own component only when something
ab7c586
we need is either not available, or does not meet the needed performance
ab7c586
profile. We endeavor to remove things from folly if or when std or Boost
ab7c586
obsoletes them.
ab7c586
ab7c586
Performance concerns permeate much of Folly, sometimes leading to designs that
ab7c586
are more idiosyncratic than they would otherwise be (see e.g. PackedSyncPtr.h,
ab7c586
SmallLocks.h). Good performance at large scale is a unifying theme in all of
8184525
Folly.}
8184525
8184525
%description %{_description}
ab7c586
ab7c586
ab7c586
%package        devel
ab7c586
Summary:        Development files for %{name}
ab7c586
Requires:       %{name}%{?_isa} = %{version}-%{release}
ab7c586
Requires:       binutils-devel%{?_isa}
ab7c586
Requires:       boost-devel%{?_isa}
ab7c586
Requires:       bzip2-devel%{?_isa}
ab7c586
Requires:       cmake-filesystem
ab7c586
Requires:       double-conversion-devel%{?_isa}
ab7c586
Requires:       fmt-devel%{?_isa}
ab7c586
Requires:       glog-devel%{?_isa}
ab7c586
Requires:       libaio-devel%{?_isa}
ab7c586
Requires:       libdwarf-devel%{?_isa}
ab7c586
Requires:       libevent-devel%{?_isa}
ab7c586
Requires:       libsodium-devel%{?_isa}
ab7c586
Requires:       libunwind-devel%{?_isa}
5c246e6
%if %{with uring}
5c246e6
Requires:       liburing-devel%{?_isa} >= %{liburing_min_version}
5c246e6
%endif
ab7c586
Requires:       libzstd-devel%{?_isa}
ab7c586
Requires:       lz4-devel%{?_isa}
09e5004
Requires:       openssl-devel%{?_isa}
ab7c586
Requires:       snappy-devel%{?_isa}
ab7c586
Requires:       xz-devel%{?_isa}
ab7c586
Requires:       zlib-devel%{?_isa}
5c246e6
%if %{without python}
f0ec5d9
Obsoletes:      python3-%{name} < 2023.04.24.00-1
5c246e6
%endif
f620f9f
Obsoletes:      %{name}-static < 2022.02.28.00-1
ab7c586
8184525
%description    devel %{_description}
8184525
ab7c586
The %{name}-devel package contains libraries and header files for
ab7c586
developing applications that use %{name}.
ab7c586
ab7c586
8184525
%if %{with docs}
ab7c586
%package        docs
ab7c586
Summary:        Documentation for %{name}
ab7c586
BuildArch:      noarch
ab7c586
Requires:       %{name} = %{version}-%{release}
ab7c586
8184525
%description    docs %{_description}
8184525
ab7c586
The %{name}-docs package contains documentation for %{name}.
8184525
%endif
ab7c586
ab7c586
45b7601
%if %{with python}
45b7601
%package -n python3-%{name}
45b7601
Summary:        Python bindings for %{name}
8184525
BuildRequires:  make
d0bd912
BuildRequires:  python3-devel
962b12d
BuildRequires:  python3dist(setuptools)
d0bd912
BuildRequires:  python3dist(cython)
d0bd912
BuildRequires:  python3dist(wheel)
45b7601
Requires:       %{name}%{?_isa} = %{version}-%{release}
45b7601
8184525
%description -n python3-%{name} %{_description}
8184525
45b7601
The python3-%{name} package contains Python bindings for %{name}.
d0bd912
d0bd912
d0bd912
%package -n python3-%{name}-devel
d0bd912
Summary:        Development files for python3-%{name}
d0bd912
Requires:       %{name}-devel%{?_isa} = %{version}-%{release}
d0bd912
Requires:       python3-%{name}%{?_isa} = %{version}-%{release}
d0bd912
8184525
%description -n python3-%{name}-devel %{_description}
8184525
d0bd912
The python3-%{name}-devel package contains libraries and header files for
d0bd912
developing applications that use python3-%{name}.
45b7601
%endif
45b7601
45b7601
ab7c586
%prep
67882a9
%autosetup -p1
ebfc301
45b7601
%if %{with python}
45b7601
# this file gets cached starting in 841d5087eda926eac1cb17c4683fd48b247afe50
45b7601
# but it depends on executor_api.h which is generated alongside executor.cpp
45b7601
# delete this file so we regenerate both and allow the Python extension to be built
45b7601
rm folly/python/executor.cpp
45b7601
%endif
ab7c586
86fc372
%if %{with toolchain_clang}
86fc372
%ifarch ppc64le
86fc372
# folly/logging/example/logging_example: link failure wrt fmt
86fc372
sed -i folly/CMakeLists.txt -e '\@logging/example@s|add_subdirectory|#add_subdirectory|'
86fc372
%endif
86fc372
%endif
ab7c586
ab7c586
%build
464499c
%cmake \
464499c
  -DBUILD_SHARED_LIBS=ON \
464499c
%if %{with python}
464499c
  -DPYTHON_EXTENSIONS=ON \
464499c
%endif
f620f9f
%if %{with check}
f620f9f
  -DBUILD_TESTS=ON \
f620f9f
%endif
464499c
  -DCMAKE_INSTALL_DIR=%{_libdir}/cmake/%{name} \
d17cfdf
%if 0%{?fedora} >= 36 || 0%{?rhel} >= 9
09e5004
  -DLIBDWARF_INCLUDE_DIR=%{_includedir}/libdwarf-0 \
9bdc291
%endif
JasenChao 440f075
%ifarch riscv64
JasenChao 440f075
  -DFOLLY_HAVE_INT128_T=1 \
JasenChao 440f075
%endif
464499c
  -DPACKAGE_VERSION=%{version}
464499c
%cmake_build
464499c
8184525
%if %{with docs}
ab7c586
# Build documentation
ab7c586
make -C folly/docs
8184525
%endif
ab7c586
ab7c586
ab7c586
%install
ab7c586
%cmake_install
ab7c586
ab7c586
f620f9f
%if %{with check}
ab7c586
%check
95331a3
%if %{with all_tests}
95331a3
%ctest
95331a3
%else
4221a62
# x86_64: disable flaky tests
4221a62
# ix86: some tests are still failing
95331a3
cd "%{__cmake_builddir}"
95331a3
4bd0fba
# flaky tests
8a8f0db
EXCLUDED_TESTS='-E DISABLED'
8a8f0db
EXCLUDED_TESTS+='|glog_test\.LogEveryMs\.basic'
50e06aa
EXCLUDED_TESTS+='|fbstring_test\.FBString\.testAllClauses'
a244914
EXCLUDED_TESTS+='|AsyncUDPSocketTest\.AsyncSocketIntegrationTest\.PingPongNotifyMmsg'
a244914
EXCLUDED_TESTS+='|HHWheelTimerTest\.HHWheelTimerTest\.CancelTimeout'
f2ecf11
EXCLUDED_TESTS+='|HHWheelTimerTest\.HHWheelTimerTest\.ReschedTest'
8a8f0db
EXCLUDED_TESTS+='|fbvector_test\.'
4bd0fba
95331a3
%ifarch aarch64
d904ada
EXCLUDED_TESTS+='|cache_locality_test\.Getcpu\.VdsoGetcpu'
67882a9
EXCLUDED_TESTS+='|HHWheelTimerTest\.HHWheelTimerTest\.FireOnce'
67882a9
EXCLUDED_TESTS+='|HHWheelTimerTest\.HHWheelTimerTest\.DestroyTimeoutSet'
67882a9
EXCLUDED_TESTS+='|HHWheelTimerTest\.HHWheelTimerTest\.SlowFast'
67882a9
EXCLUDED_TESTS+='|HHWheelTimerTest\.HHWheelTimerTest\.DefaultTimeout'
67882a9
EXCLUDED_TESTS+='|HHWheelTimerTest\.HHWheelTimerTest\.IntrusivePtr'
67882a9
EXCLUDED_TESTS+='|HHWheelTimerTest\.HHWheelTimerTest\.GetTimeRemaining'
67882a9
EXCLUDED_TESTS+='|HHWheelTimerTest\.HHWheelTimerTest\.Level1'
86fc372
EXCLUDED_TESTS+='|timeseries_histogram_test\.TimeseriesHistogram\.Percentile'
67882a9
EXCLUDED_TESTS+='|memcpy_test\.folly_memcpy\.overlap'
67882a9
EXCLUDED_TESTS+='|HHWheelTimerTest\.HHWheelTimerTest\.DeleteWheelInTimeout'
67882a9
EXCLUDED_TESTS+='|HHWheelTimerTest\.HHWheelTimerTest\.NegativeTimeout'
67882a9
EXCLUDED_TESTS+='|cache_locality_test\.CacheLocality\.LinuxActual'
67882a9
EXCLUDED_TESTS+='|small_locks_test\.SmallLocks\.SpinLockCorrectness'
67882a9
EXCLUDED_TESTS+='|locks_test\.SpinLock\.Correctness'
4bd0fba
EXCLUDED_TESTS+='|fbstring_test\.FBString\.testAllClauses'
ab7c586
%endif
ab7c586
95331a3
%{__ctest} --output-on-failure --force-new-ctest-process %{?_smp_mflags} \
67882a9
  ${EXCLUDED_TESTS}
95331a3
4221a62
cd -
4221a62
%endif
95331a3
%endif
95331a3
ab7c586
ab7c586
%files
ab7c586
%license LICENSE
f620f9f
%{_libdir}/*.so.%{version}
ab7c586
ab7c586
%files devel
ab7c586
%doc CODE_OF_CONDUCT.md CONTRIBUTING.md README.md
ab7c586
%{_includedir}/*
ab7c586
%{_libdir}/*.so
ab7c586
%{_libdir}/cmake/%{name}
ab7c586
%{_libdir}/pkgconfig/lib%{name}.pc
d0bd912
%exclude %{_includedir}/folly/python
ab7c586
8184525
%if %{with docs}
ab7c586
%files docs
ab7c586
%doc folly/docs/*.html
8184525
%endif
ab7c586
45b7601
%if %{with python}
45b7601
%files -n python3-%{name}
45b7601
%{python3_sitearch}/%{name}
45b7601
%{python3_sitearch}/%{name}-0.0.1-py%{python3_version}.egg-info
d0bd912
%exclude %{python3_sitearch}/%{name}/*.h
d0bd912
%exclude %{python3_sitearch}/%{name}/*.pxd
d0bd912
d0bd912
%files -n python3-%{name}-devel
d0bd912
%{_includedir}/folly/python
d0bd912
%{python3_sitearch}/%{name}/*.h
d0bd912
%{python3_sitearch}/%{name}/*.pxd
45b7601
%endif
45b7601
ab7c586
ab7c586
%changelog
3b3b659
%autochangelog