snappy: upgrade to v1.1.9

gtest: fix spec
google-benchmark: new addition

Change-Id: I331a5d6152e1610c68e21ea480d2b7ef6fa88286
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/17382
Tested-by: gerrit-photon <photon-checkins@vmware.com>
This commit is contained in:
Shreenidhi Shedi 2022-08-17 23:53:12 -07:00
parent ca22b6f347
commit f3af8c60af
5 changed files with 256 additions and 60 deletions

View File

@ -0,0 +1,77 @@
%global srcname benchmark
Name: google-benchmark
Version: 1.7.1
Release: 1%{?dist}
License: Apache-2.0
Summary: A microbenchmark support library
URL: https://github.com/google/%{srcname}
Group: Applications/System
Vendor: VMware, Inc.
Distribution: Photon
Source0: https://github.com/google/benchmark/archive/refs/tags/%{name}-%{version}.tar.gz
%define sha512 %{name}=396af1c1d3eaa2b78c6d23b1472f6088db85a294056ae1c2366dc5c0becdc8f141ba8fc3a235033324ab0a41c2298f5d242ef09b9b6f69d9877de6bcb2062efd
BuildRequires: gtest-devel
BuildRequires: gmock-devel
BuildRequires: ninja-build
BuildRequires: build-essential
BuildRequires: cmake
%description
A library to support the benchmarking of functions, similar to unit-tests.
%package devel
Summary: Development files for %{name}
Requires: %{name} = %{version}-%{release}
%description devel
%{summary}.
%prep
%autosetup -p1 -n %{srcname}-%{version}
sed -e '/get_git_version/d' -e '/-Werror/d' -i CMakeLists.txt
%build
%{cmake} -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DGIT_VERSION=%{version} \
-DBENCHMARK_ENABLE_DOXYGEN:BOOL=OFF \
-DBENCHMARK_ENABLE_TESTING:BOOL=ON \
-DBENCHMARK_USE_BUNDLED_GTEST:BOOL=OFF \
-DBENCHMARK_ENABLE_GTEST_TESTS:BOOL=ON \
-DBENCHMARK_ENABLE_INSTALL:BOOL=ON \
-DBENCHMARK_INSTALL_DOCS:BOOL=OFF \
-DCMAKE_INSTALL_LIBDIR=%{_libdir}
%{cmake_build}
%install
%{cmake_install}
%if 0%{?with_check}
%check
%{ctest}
%endif
%clean
rm -rf %{buildroot}
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(-,root,root)
%{_libdir}/libbenchmark*.so.*
%files devel
%defattr(-,root,root)
%{_libdir}/libbenchmark*.so
%{_includedir}/%{srcname}
%{_libdir}/cmake/%{srcname}
%{_libdir}/pkgconfig/%{srcname}.pc
%changelog
* Thu Jan 12 2023 Shreenidhi Shedi <sshedi@vmware.com> 1.7.1-1
- Intial version. Needed by snappy.

View File

@ -1,21 +1,18 @@
Summary: Google's C++ gtest framework
Name: gtest
Version: 1.12.1
Release: 1%{?dist}
Release: 2%{?dist}
License: ASL 2.0
URL: https://github.com/google/googletest
Group: Development/Tools
Vendor: VMware, Inc.
Distribution: Photon
Source0: https://github.com/google/googletest/archive/googletest-%{version}.tar.gz
%define sha512 googletest=a9104dc6c53747e36e7dd7bb93dfce51a558bd31b487a9ef08def095518e1296da140e0db263e0644d9055dbd903c0cb69380cb2322941dbfb04780ef247df9c
Source0: https://github.com/google/googletest/archive/googletest-%{version}.tar.gz
%define sha512 googletest=a9104dc6c53747e36e7dd7bb93dfce51a558bd31b487a9ef08def095518e1296da140e0db263e0644d9055dbd903c0cb69380cb2322941dbfb04780ef247df9c
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: build-essential
BuildRequires: cmake
BuildRequires: make
BuildRequires: gcc
%description
Google's C++ test framework that combines the GoogleTest and GoogleMock projects.
@ -24,20 +21,15 @@ This package provides gtest shared libraries.
%package devel
Summary: libgtest headers
Group: Development/Tools
Requires: %{name} = %{version}-%{release}
%description devel
This contains libgtest header files.
%package static
Summary: libgtest static lib
Group: Development/Tools
%description static
This contains libgtest static library.
%package -n gmock
Summary: Google's C++ gmock framework
Group: Development/Tools
Requires: %{name} = %{version}-%{release}
%description -n gmock
Google's C++ test framework that combines the GoogleTest and GoogleMock projects.
@ -46,29 +38,29 @@ This package provides gmock shared libraries.
%package -n gmock-devel
Summary: libgmock headers
Group: Development/Tools
Requires: gmock = %{version}-%{release}
%description -n gmock-devel
This contains libgmock header files.
%package -n gmock-static
Summary: libgtest static lib
Group: Development/Tools
%description -n gmock-static
This contains libgmock static library.
%prep
%autosetup -p1 -n googletest-release-%{version}
%build
%cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_LIBDIR=%{_libdir}
%cmake_build
%{cmake} \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_INSTALL_LIBDIR=%{_libdir}
%cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_LIBDIR=%{_libdir}
%cmake_build
%{cmake_build}
%{cmake} \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_INSTALL_LIBDIR=%{_libdir}
%{cmake_build}
%install
%cmake_install
%{cmake_install}
mv %{__cmake_builddir}/lib/*.a %{buildroot}%{_libdir}
chmod 644 %{buildroot}%{_libdir}/*.a
@ -77,16 +69,25 @@ install -vdm 755 %{buildroot}%{_usrsrc}/gtest/src/
install -vdm 755 %{buildroot}%{_usrsrc}/gmock/src/
cp googletest/src/* %{buildroot}%{_usrsrc}/gtest/src/
cp googlemock/src/* %{buildroot}%{_usrsrc}/gmock/src/
find %{buildroot} -name '*.la' -delete
%clean
rm -rf %{buildroot}/*
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%post -n gmock -p /sbin/ldconfig
%postun -n gmock -p /sbin/ldconfig
%files
%defattr(-,root,root)
%{_libdir}/libgtest.so
%{_libdir}/libgtest_main.so
%{_libdir}/libgtest.so.*
%{_libdir}/libgtest_main.so.*
%files -n gmock
%{_libdir}/libgmock.so
%{_libdir}/libgmock_main.so
%defattr(-,root,root)
%{_libdir}/libgmock.so.*
%{_libdir}/libgmock_main.so.*
%files devel
%defattr(-,root,root)
@ -94,26 +95,23 @@ find %{buildroot} -name '*.la' -delete
%{_usrsrc}/gtest/
%{_libdir}/cmake/GTest/*.cmake
%{_libdir}/pkgconfig/*.pc
%{_libdir}/libgmock.so.*
%{_libdir}/libgmock_main.so.*
%{_libdir}/libgtest.so.*
%{_libdir}/libgtest_main.so.*
%files -n gmock-devel
%{_includedir}/gmock/*
%{_usrsrc}/gmock/
%files -n gmock-static
%defattr(-,root,root)
%{_libdir}/libgmock.a
%{_libdir}/libgmock_main.a
%files static
%defattr(-,root,root)
%{_libdir}/libgtest.so
%{_libdir}/libgtest_main.so
%{_libdir}/libgtest.a
%{_libdir}/libgtest_main.a
%files -n gmock-devel
%defattr(-,root,root)
%{_includedir}/gmock/*
%{_libdir}/libgmock.so
%{_libdir}/libgmock_main.so
%{_usrsrc}/gmock/
%{_libdir}/libgmock.a
%{_libdir}/libgmock_main.a
%changelog
* Thu Jan 12 2023 Shreenidhi Shedi <sshedi@vmware.com> 1.12.1-2
- Fix requires in all packages
* Mon Jul 11 2022 Gerrit Photon <photon-checkins@vmware.com> 1.12.1-1
- Automatic Version Bump
* Mon Jun 20 2022 Shreenidhi Shedi <sshedi@vmware.com> 1.11.0-2

View File

@ -0,0 +1,71 @@
From 4728803cc8687431449c8c9fbfabb1da04943400 Mon Sep 17 00:00:00 2001
From: "Georgi D. Sotirov" <gdsotirov@gmail.com>
Date: Wed, 5 May 2021 14:16:46 +0300
Subject: [PATCH] Add inline with SNAPPY_ATTRIBUTE_ALWAYS_INLINE
Add inline with SNAPPY_ATTRIBUTE_ALWAYS_INLINE on AdvanceToNextTag to
fix the following compilation errors and a warning with GCC:
[ 2%] Building CXX object CMakeFiles/snappy.dir/snappy.cc.o
/usr/bin/c++ -DHAVE_CONFIG_H -Dsnappy_EXPORTS
-I/tmp/snappy-1.1.9/build -I/tmp/snappy-1.1.9 -O3
-march=i586 -mtune=i686 -Wall -Wextra -fno-exceptions -fno-rtti -O3
-DNDEBUG -fPIC -std=c++11 -o CMakeFiles/snappy.dir/snappy.cc.o -c
/tmp/snappy-1.1.9/snappy.cc
/tmp/snappy-1.1.9/snappy.cc:1017:8: warning: always_inline
function might not be inlinable [-Wattributes]
size_t AdvanceToNextTag(const uint8_t** ip_p, size_t* tag) {
^
/tmp/snappy-1.1.9/snappy.cc: In function 'std::pair<const
unsigned char*, int> snappy::DecompressBranchless(const uint8_t*, const
uint8_t*, ptrdiff_t, T, ptrdiff_t) [with T = char*; uint8_t = unsigned
char; ptrdiff_t = int]':
/tmp/snappy-1.1.9/snappy.cc:1017:8: error: inlining failed in
call to always_inline 'size_t snappy::AdvanceToNextTag(const uint8_t**,
size_t*)': function body can be overwritten at link time
/tmp/snappy-1.1.9/snappy.cc:1097:53: error: called from here
size_t tag_type = AdvanceToNextTag(&ip, &tag);
^
/tmp/snappy-1.1.9/snappy.cc:1017:8: error: inlining failed in
call to always_inline 'size_t snappy::AdvanceToNextTag(const uint8_t**,
size_t*)': function body can be overwritten at link time
size_t AdvanceToNextTag(const uint8_t** ip_p, size_t* tag) {
^
/tmp/snappy-1.1.9/snappy.cc:1097:53: error: called from here
size_t tag_type = AdvanceToNextTag(&ip, &tag);
^
/tmp/snappy-1.1.9/snappy.cc:1017:8: error: inlining failed in
call to always_inline 'size_t snappy::AdvanceToNextTag(const uint8_t**,
size_t*)': function body can be overwritten at link time
size_t AdvanceToNextTag(const uint8_t** ip_p, size_t* tag) {
^
/tmp/snappy-1.1.9/snappy.cc:1097:53: error: called from here
size_t tag_type = AdvanceToNextTag(&ip, &tag);
^
CMakeFiles/snappy.dir/build.make:137: recipe for target
'CMakeFiles/snappy.dir/snappy.cc.o' failed
Just like with other functions using SNAPPY_ATTRIBUTE_ALWAYS_INLINE
macro (i.e. __attribute__((always_inline)) ) it is necessary to use C++
inline specifier.
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Upstream-Status: Submitted [https://github.com/google/snappy/pull/128]
---
snappy.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/snappy.cc b/snappy.cc
index 79dc0e8..51157be 100644
--- a/snappy.cc
+++ b/snappy.cc
@@ -1014,7 +1014,7 @@ void MemMove(ptrdiff_t dst, const void* src, size_t size) {
}
SNAPPY_ATTRIBUTE_ALWAYS_INLINE
-size_t AdvanceToNextTag(const uint8_t** ip_p, size_t* tag) {
+inline size_t AdvanceToNextTag(const uint8_t** ip_p, size_t* tag) {
const uint8_t*& ip = *ip_p;
// This section is crucial for the throughput of the decompression loop.
// The latency of an iteration is fundamentally constrained by the

View File

@ -0,0 +1,48 @@
diff -r efdeda5cdfa2 CMakeLists.txt
--- a/CMakeLists.txt Sat May 15 14:50:17 2021 +0200
+++ b/CMakeLists.txt Sat May 15 14:54:41 2021 +0200
@@ -284,29 +284,12 @@
if(SNAPPY_BUILD_TESTS)
enable_testing()
- # Prevent overriding the parent project's compiler/linker settings on Windows.
- set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
- set(install_gtest OFF)
- set(install_gmock OFF)
- set(build_gmock ON)
-
- # This project is tested using GoogleTest.
- add_subdirectory("third_party/googletest")
-
- # GoogleTest triggers a missing field initializers warning.
- if(SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS)
- set_property(TARGET gtest
- APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
- set_property(TARGET gmock
- APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
- endif(SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS)
-
add_executable(snappy_unittest "")
target_sources(snappy_unittest
PRIVATE
"snappy_unittest.cc"
)
- target_link_libraries(snappy_unittest snappy_test_support gmock_main gtest)
+ target_link_libraries(snappy_unittest snappy_test_support gtest_main gtest)
add_test(
NAME snappy_unittest
@@ -327,12 +310,11 @@
PRIVATE
"snappy_benchmark.cc"
)
- target_link_libraries(snappy_benchmark snappy_test_support benchmark_main)
+ target_link_libraries(snappy_benchmark snappy_test_support benchmark_main benchmark)
# This project uses Google benchmark for benchmarking.
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
set(BENCHMARK_ENABLE_EXCEPTIONS OFF CACHE BOOL "" FORCE)
- add_subdirectory("third_party/benchmark")
endif(SNAPPY_BUILD_BENCHMARKS)
if(SNAPPY_FUZZING_BUILD)

View File

@ -1,6 +1,6 @@
Summary: Fast compression and decompression library
Name: snappy
Version: 1.1.8
Version: 1.1.9
Release: 1%{?dist}
License: BSD and LGPLv2 and Sleepycat
URL: http://code.google.com/p/snappy
@ -8,10 +8,15 @@ Group: System/Libraries
Vendor: VMware, Inc.
Distribution: Photon
Source0: https://github.com/google/%{name}/archive/%{name}-%{version}.tar.gz
%define sha512 %{name}=efe18ff1b3edda1b4b6cefcbc6da8119c05d63afdbf7a784f3490353c74dced76baed7b5f1aa34b99899729192b9d657c33c76de4b507a51553fa8001ae75c1c
Source0: https://github.com/google/%{name}/archive/%{name}-%{version}.tar.gz
%define sha512 %{name}=f1f8a90f5f7f23310423574b1d8c9acb84c66ea620f3999d1060395205e5760883476837aba02f0aa913af60819e34c625d8308c18a5d7a9c4e190f35968b024
BuildRequires: cmake
Patch0: snappy-inline.patch
Patch1: snappy-thirdparty.patch
BuildRequires: cmake
BuildRequires: gtest-devel
BuildRequires: google-benchmark-devel
%description
Snappy is a compression/decompression library. It does not aim for maximum
@ -31,25 +36,22 @@ It contains the libraries and header files to create applications
%autosetup -p1
%build
%cmake \
%{cmake} \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_LIBDIR=%{_libdir}
%cmake_build
%{cmake_build}
%install
%cmake_install
rm -rf %{buildroot}%{_docdir}/%{name}
find %{buildroot} -name '*.la' -delete
%{cmake_install}
%clean
rm -rf %{buildroot}
%if 0%{?with_check}
%check
cd %{__cmake_builddir}
make test %{?_smp_mflags}
%{ctest}
%endif
%post -p /sbin/ldconfig
@ -57,17 +59,17 @@ make test %{?_smp_mflags}
%files
%defattr(-,root,root)
%doc AUTHORS
%{_libdir}/*.so.*
%exclude %{_libdir}/cmake
%files devel
%defattr(-,root,root)
%doc format_description.txt framing_format.txt
%{_includedir}/*
%{_libdir}/libsnappy.so
%changelog
* Thu Jan 12 2023 Shreenidhi Shedi <sshedi@vmware.com> 1.1.9-1
- Upgrade to v1.1.9
* Tue Jun 30 2020 Gerrit Photon <photon-checkins@vmware.com> 1.1.8-1
- Automatic Version Bump
* Wed Jan 09 2019 Michelle Wang <michellew@vmware.com> 1.1.7-2