Accepting request 899041 from devel:libraries:c_c++

OBS-URL: https://build.opensuse.org/request/show/899041
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/leveldb?expand=0&rev=13
This commit is contained in:
Dominique Leuenberger 2021-06-14 21:10:30 +00:00 committed by Git OBS Bridge
commit ea3cb3a00f
6 changed files with 137 additions and 16 deletions

65
detect-system-gtest.patch Normal file
View File

@ -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)

17
enable-rtti.patch Normal file
View File

@ -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

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:55423cac9e3306f4a9502c738a001e4a339d1a38ffbee7572d4a07d5d63949b2
size 239365

BIN
leveldb-1.23.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,3 +1,34 @@
-------------------------------------------------------------------
Wed Jun 9 12:08:18 UTC 2021 - Ferdinand Thiessen <rpm@fthiessen.de>
- Add enable-rtti.patch, enable rtti support again to fix build
issue of ceph
-------------------------------------------------------------------
Mon May 3 09:46:47 UTC 2021 - Ferdinand Thiessen <rpm@fthiessen.de>
- 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 <ddiss@suse.com>

View File

@ -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,23 @@
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 -- 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
BuildRequires: cmake(GTest)
BuildRequires: cmake(benchmark)
BuildRequires: pkgconfig(sqlite3)
%description
leveldb implements a system for maintaining a persistent key/value store.
@ -65,7 +72,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 +80,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