From 22cc9a1d988b35808404aaf26032d7e329fc9279 Mon Sep 17 00:00:00 2001 From: Michel Alexandre Salim Date: Wed, 22 Dec 2021 14:29:33 -0800 Subject: submitting cachelib for review Signed-off-by: Michel Alexandre Salim --- meta/cachelib.spec | 100 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 77 insertions(+), 23 deletions(-) diff --git a/meta/cachelib.spec b/meta/cachelib.spec index ab0e82a..b08710e 100644 --- a/meta/cachelib.spec +++ b/meta/cachelib.spec @@ -1,67 +1,121 @@ -# CacheLib doesn't reliably build with gcc at the moment -%global toolchain clang - -# Likely incompatible with gtest 1.11 +# Tests currently fail with +# /builddir/build/BUILD/CacheLib-e3703aade03d359d290936b334ab81ca4a856b41/cachelib/compact_cache/tests/CCacheTests.cpp:159:1: required from here +# /builddir/build/BUILD/CacheLib-e3703aade03d359d290936b334ab81ca4a856b41/cachelib/../cachelib/compact_cache/CCacheFixedLruBucket.h:277:11: internal compiler error: Floating point exception +# 277 | memcpy(destPtr, srcPtr, sizeof(T)); +# | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ %bcond_with tests %global forgeurl https://github.com/facebook/CacheLib -%global commit c9edf4fae2d10b274e082557c4e70523b42be567 -%global date 20211216 +%global commit e3703aade03d359d290936b334ab81ca4a856b41 +%global date 20211129 %forgemeta +# see cachelib/allocator/CacheVersion.h's kCachelibVersion +%global major_ver 16 + + Name: cachelib -Version: 0.1 +Version: %{major_ver} Release: %autorelease Summary: Pluggable caching engine for scale high performance cache services License: ASL 2.0 URL: %forgeurl Source0: %forgesource -# require atomic when building against clang -# will upstream -Patch0: %{name}-req_atomic_for_clang.patch +# move TestUtils from cachelib_common to common_test_support to avoid ld issues +Patch0: %{name}-ld_gtest.patch +# need to install cachelib_cachebench when building shared libs +Patch1: %{name}-install_cachebench_so.patch +# and version them +Patch2: %{name}-versioned_so.patch + +# Folly is known not to work on big-endian CPUs +# https://bugzilla.redhat.com/show_bug.cgi?id=1892151 +ExcludeArch: s390x -BuildRequires: clang BuildRequires: cmake +BuildRequires: gcc-c++ BuildRequires: fbthrift-devel -BuildRequires: wangle-devel -BuildRequires: folly-devel BuildRequires: fizz-devel +BuildRequires: folly-devel +%if %{with tests} +BuildRequires: gmock-devel +%endif +# this is actually needed, because of +# cachelib/navy/admission_policy/DynamicRandomAP.h +BuildRequires: gtest-devel BuildRequires: libdwarf-devel BuildRequires: libzstd-devel +BuildRequires: wangle-devel BuildRequires: zlib-devel BuildRequires: tsl-sparse-map-devel -BuildRequires: libatomic +# BuildRequires: libatomic + -%description +%global _description %{expand: CacheLib is a C++ library providing in-process high performance caching mechanism. CacheLib provides a thread safe API to build high throughput, low overhead caching services, with built-in ability to leverage DRAM and SSD -caching transparently. +caching transparently.} + +%description %{_description} + +%package devel +Summary: %{summary} +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: cmake + +%description devel %{_description} + +The %{name}-devel package contains libraries and header files for developing +applications that use %{name}. + %prep %forgeautosetup -p1 + %build -pushd cachelib +pushd %{name} +%cmake \ %if %{with tests} -%cmake + -DBUILD_TESTS:BOOL=ON \ %else -%cmake -DBUILD_TESTS:BOOL=OFF + -DBUILD_TESTS:BOOL=OFF \ %endif + -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=FALSE \ + -DCMAKE_INSTALL_DIR:PATH=%{_libdir}/cmake/%{name} \ + -DCONFIGS_INSTALL_DIR:STRING=%{_datadir}/%{name}/test_configs \ + -DINCLUDE_INSTALL_DIR:PATH=%{_includedir}/%{name} \ + -DCACHELIB_MAJOR_VERSION:STRING=%{major_ver} \ + -DPACKAGE_VERSION:STRING=%{major_ver}.%{date} %cmake_build -%check -pushd cachelib -%ctest %install -pushd cachelib +pushd %{name} %cmake_install + +%if %{with tests} +%check +pushd %{name} +%ctest +%endif + + %files %license LICENSE %doc BENCHMARKS.md CHANGELOG.md README.md examples +%{_bindir}/cachebench +%{_datadir}/%{name} +%{_libdir}/*.so.* + +%files devel +%{_includedir}/%{name} +%{_libdir}/*.so +%{_libdir}/cmake/%{name} + %changelog %autochangelog -- cgit