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
This commit is contained in:
Dirk Mueller 2021-05-22 11:01:27 +00:00 committed by Git OBS Bridge
parent 721891c198
commit e5a050e75d
5 changed files with 112 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)

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,28 @@
-------------------------------------------------------------------
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> Wed Apr 29 12:33:36 UTC 2020 - David Disseldorp <ddiss@suse.com>

View File

@ -1,7 +1,7 @@
# #
# spec file for package leveldb # 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 # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -17,16 +17,21 @@
Name: leveldb Name: leveldb
Version: 1.22 Version: 1.23
Release: 0 Release: 0
Summary: A key/value-store Summary: A key/value-store
License: BSD-3-Clause License: BSD-3-Clause
Group: Development/Libraries/C and C++ Group: Development/Libraries/C and C++
URL: https://github.com/google/leveldb 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: cmake
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: snappy-devel BuildRequires: snappy-devel
BuildRequires: cmake(GTest)
BuildRequires: cmake(benchmark)
BuildRequires: pkgconfig(sqlite3)
%description %description
leveldb implements a system for maintaining a persistent key/value store. 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. This package holds the development files for statically linking leveldb.
%prep %prep
%setup -q %autosetup -p1
%build %build
# unfortunately a two-pass build is needed for shared and static libs # 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 -DBUILD_SHARED_LIBS=ON
%cmake_build %cmake_build
cd .. cd ..
%define __builddir build_static
%cmake -DBUILD_SHARED_LIBS=OFF %cmake -DBUILD_SHARED_LIBS=OFF
%cmake_build %cmake_build
%install %install
# Install shared libraries
%define __builddir build
%cmake_install %cmake_install
# collect shared libs built in the first pass # collect static libs built in the second pass
cp -a build/libleveldb.so* %{buildroot}%{_libdir} cp -a build_static/libleveldb.a %{buildroot}%{_libdir}
# cmake_install omits db_bench # cmake_install omits db_bench
install -d -m 0755 %{buildroot}%{_bindir} install -d -m 0755 %{buildroot}%{_bindir}
cp -a build/db_bench %{buildroot}%{_bindir} cp -a build_static/db_bench %{buildroot}%{_bindir}
%check %check
%define __builddir build_static
%ctest %ctest
%post -n %{lib_name} -p /sbin/ldconfig %post -n %{lib_name} -p /sbin/ldconfig
%postun -n %{lib_name} -p /sbin/ldconfig %postun -n %{lib_name} -p /sbin/ldconfig
%files %files
%defattr(-,root,root,-)
%{_bindir}/db_bench %{_bindir}/db_bench
%files -n %{lib_name} %files -n %{lib_name}
%defattr(-,root,root,-) %license LICENSE
%{_libdir}/libleveldb.so.* %{_libdir}/libleveldb.so.*
%files devel %files devel
%defattr(-,root,root,-) %doc AUTHORS NEWS README.md TODO doc/*
%doc AUTHORS LICENSE NEWS README.md TODO doc/*
%{_includedir}/leveldb/ %{_includedir}/leveldb/
%{_libdir}/libleveldb.so %{_libdir}/libleveldb.so
%{_libdir}/cmake/leveldb
%files devel-static %files devel-static
%defattr(-,root,root,-)
%{_libdir}/libleveldb.a %{_libdir}/libleveldb.a
%{_libdir}/cmake/
%changelog %changelog