From e5a050e75d93ca241ef5bf2eb61e1485b88a364dd7fd45d9fd0c2fe3cfb195a7 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Sat, 22 May 2021 11:01:27 +0000 Subject: [PATCH 1/2] Accepting request 890031 from home:susnux:branches:devel:libraries:c_c++ Update to version 1.23 Install cmake files for shared library OBS-URL: https://build.opensuse.org/request/show/890031 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/leveldb?expand=0&rev=28 --- detect-system-gtest.patch | 65 +++++++++++++++++++++++++++++++++++++++ leveldb-1.22.tar.gz | 3 -- leveldb-1.23.tar.gz | 3 ++ leveldb.changes | 25 +++++++++++++++ leveldb.spec | 32 +++++++++++-------- 5 files changed, 112 insertions(+), 16 deletions(-) create mode 100644 detect-system-gtest.patch delete mode 100644 leveldb-1.22.tar.gz create mode 100644 leveldb-1.23.tar.gz diff --git a/detect-system-gtest.patch b/detect-system-gtest.patch new file mode 100644 index 0000000..1cf0895 --- /dev/null +++ b/detect-system-gtest.patch @@ -0,0 +1,65 @@ +diff -Nur leveldb-1.23/CMakeLists.txt new/CMakeLists.txt +--- leveldb-1.23/CMakeLists.txt 2021-02-23 21:54:37.000000000 +0100 ++++ new/CMakeLists.txt 2021-05-03 12:17:15.280336224 +0200 +@@ -289,27 +289,25 @@ + if(LEVELDB_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") +- +- # 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") +- +- # GoogleTest triggers a missing field initializers warning. +- if(LEVELDB_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(LEVELDB_HAVE_NO_MISSING_FIELD_INITIALIZERS) ++ find_package(GTest) ++ if(NOT GTest_FOUND) ++ # 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(LEVELDB_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(LEVELDB_HAVE_NO_MISSING_FIELD_INITIALIZERS) ++ endif() + + function(leveldb_test test_file) + get_filename_component(test_target_name "${test_file}" NAME_WE) +@@ -386,6 +384,14 @@ + endif(LEVELDB_BUILD_TESTS) + + if(LEVELDB_BUILD_BENCHMARKS) ++ find_package(benchmark) ++ if (NOT benchmark_FOUND) ++ # 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() ++ + function(leveldb_benchmark bench_file) + get_filename_component(bench_target_name "${bench_file}" NAME_WE) + diff --git a/leveldb-1.22.tar.gz b/leveldb-1.22.tar.gz deleted file mode 100644 index 8936732..0000000 --- a/leveldb-1.22.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:55423cac9e3306f4a9502c738a001e4a339d1a38ffbee7572d4a07d5d63949b2 -size 239365 diff --git a/leveldb-1.23.tar.gz b/leveldb-1.23.tar.gz new file mode 100644 index 0000000..c371c3d --- /dev/null +++ b/leveldb-1.23.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a37f8a6174f09bd622bc723b55881dc541cd50747cbd08831c2a82d620f6d76 +size 242925 diff --git a/leveldb.changes b/leveldb.changes index 2b703a0..f052012 100644 --- a/leveldb.changes +++ b/leveldb.changes @@ -1,3 +1,28 @@ +------------------------------------------------------------------- +Mon May 3 09:46:47 UTC 2021 - Ferdinand Thiessen + +- Update to version 1.23: + * Switch from C headers to C++ headers. + * Remove leveldb::port::kLittleEndian. + * Add Env::Remove{File,Dir} which obsolete Env::Delete{File,Dir}. + * Sync MANIFEST before closing in db_impl when creating a new DB. + * Optimize leveldb block seeks to utilize the current iterator + location. + * broken db: fix assertion in leveldb::InternalKey::Encode, + mark base as corrupt + * fix bug(uninitialized options pointer in State) + * Fix accidental double std:: qualifiers. + * Fix tsan problem in env_test. + * Don't check current key in DBIter::Next() + * block_builder header file dependency fixed + * Add O_CLOEXEC to open calls. + * Memory optimization + * Documentation improvements +- Add detect-system-gtest.patch to use googletest and benchmark + from system, add those libraries as dependencies +- Build in second build directory to prevent cmake files generated + for the static library (prefer shared one) + ------------------------------------------------------------------- Wed Apr 29 12:33:36 UTC 2020 - David Disseldorp diff --git a/leveldb.spec b/leveldb.spec index 8e18ce7..36369db 100644 --- a/leveldb.spec +++ b/leveldb.spec @@ -1,7 +1,7 @@ # # spec file for package leveldb # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,16 +17,21 @@ Name: leveldb -Version: 1.22 +Version: 1.23 Release: 0 Summary: A key/value-store License: BSD-3-Clause Group: Development/Libraries/C and C++ URL: https://github.com/google/leveldb -Source0: https://github.com/google/leveldb/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz +Source0: %{URL}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz +# PATCH-FEATURE-OPENSUSE detect-system-gtest.patch -- Use googletest from system if provided +Patch0: detect-system-gtest.patch BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: snappy-devel +BuildRequires: cmake(GTest) +BuildRequires: cmake(benchmark) +BuildRequires: pkgconfig(sqlite3) %description leveldb implements a system for maintaining a persistent key/value store. @@ -65,7 +70,7 @@ leveldb implements a system for maintaining a persistent key/value store. This package holds the development files for statically linking leveldb. %prep -%setup -q +%autosetup -p1 %build # unfortunately a two-pass build is needed for shared and static libs @@ -73,40 +78,41 @@ This package holds the development files for statically linking leveldb. %cmake -DBUILD_SHARED_LIBS=ON %cmake_build cd .. +%define __builddir build_static %cmake -DBUILD_SHARED_LIBS=OFF %cmake_build %install +# Install shared libraries +%define __builddir build %cmake_install -# collect shared libs built in the first pass -cp -a build/libleveldb.so* %{buildroot}%{_libdir} +# collect static libs built in the second pass +cp -a build_static/libleveldb.a %{buildroot}%{_libdir} # cmake_install omits db_bench install -d -m 0755 %{buildroot}%{_bindir} -cp -a build/db_bench %{buildroot}%{_bindir} +cp -a build_static/db_bench %{buildroot}%{_bindir} %check +%define __builddir build_static %ctest %post -n %{lib_name} -p /sbin/ldconfig %postun -n %{lib_name} -p /sbin/ldconfig %files -%defattr(-,root,root,-) %{_bindir}/db_bench %files -n %{lib_name} -%defattr(-,root,root,-) +%license LICENSE %{_libdir}/libleveldb.so.* %files devel -%defattr(-,root,root,-) -%doc AUTHORS LICENSE NEWS README.md TODO doc/* +%doc AUTHORS NEWS README.md TODO doc/* %{_includedir}/leveldb/ %{_libdir}/libleveldb.so +%{_libdir}/cmake/leveldb %files devel-static -%defattr(-,root,root,-) %{_libdir}/libleveldb.a -%{_libdir}/cmake/ %changelog From 31f53c2f54f75f3958adf27b32a328e51de96c6a7da1bdc5c8257783ba19f4e5 Mon Sep 17 00:00:00 2001 From: David Disseldorp Date: Thu, 10 Jun 2021 12:33:25 +0000 Subject: [PATCH 2/2] Accepting request 898809 from home:susnux:branches:devel:libraries:c_c++ - Add enable-rtti.patch, enable rtti support again to fix build issue of ceph OBS-URL: https://build.opensuse.org/request/show/898809 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/leveldb?expand=0&rev=29 --- enable-rtti.patch | 17 +++++++++++++++++ leveldb.changes | 6 ++++++ leveldb.spec | 6 ++++-- 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 enable-rtti.patch diff --git a/enable-rtti.patch b/enable-rtti.patch new file mode 100644 index 0000000..3b88627 --- /dev/null +++ b/enable-rtti.patch @@ -0,0 +1,17 @@ +diff -Nur leveldb-1.23/CMakeLists.txt new/CMakeLists.txt +--- leveldb-1.23/CMakeLists.txt 2021-02-23 21:54:37.000000000 +0100 ++++ new/CMakeLists.txt 2021-06-09 14:06:15.129760255 +0200 +@@ -71,9 +71,10 @@ + string(REGEX REPLACE "-fexceptions" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") + ++ ++ # We need RTTI support if code that uses leveldb uses typeid (e.g. ceph). +- # Disable RTTI. +- string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") ++ # string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") ++ # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") + endif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + + # Test whether -Wthread-safety is available. See diff --git a/leveldb.changes b/leveldb.changes index f052012..9df01c1 100644 --- a/leveldb.changes +++ b/leveldb.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Jun 9 12:08:18 UTC 2021 - Ferdinand Thiessen + +- Add enable-rtti.patch, enable rtti support again to fix build + issue of ceph + ------------------------------------------------------------------- Mon May 3 09:46:47 UTC 2021 - Ferdinand Thiessen diff --git a/leveldb.spec b/leveldb.spec index 36369db..a5d26d2 100644 --- a/leveldb.spec +++ b/leveldb.spec @@ -23,9 +23,11 @@ Summary: A key/value-store License: BSD-3-Clause Group: Development/Libraries/C and C++ URL: https://github.com/google/leveldb -Source0: %{URL}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz -# PATCH-FEATURE-OPENSUSE detect-system-gtest.patch -- Use googletest from system if provided +Source0: %{url}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz +# PATCH-FEATURE-OPENSUSE detect-system-gtest.patch -- https://github.com/google/leveldb/pull/912 Patch0: detect-system-gtest.patch +# PATCH-FIX-OPENSUSE enable-rtti.patch -- Enable rtti support again, needed for ceph +Patch1: enable-rtti.patch BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: snappy-devel