File rocksdb.spec of Package rocksdb

%define realname rocksdb
%define srcext   tar.bz2

%define so_ver   5

# turn off the generation of debuginfo rpm  (RH9) ??
%global debug_package %{nil}

# Common info
Name:          lib%{realname}%{?so_ver}
Version:       0
Release:       wiz%{?extraver:0.}1%{?dist}
License:       GPL-2.0 and BSD-3-Clause and Apache-2.0
Group:         Productivity/Databases/Tools
URL:           http://rocksdb.org/
Summary:       Embeddable, persistent key-value store for fast storage

# Install-time parameters
Provides:      %{realname} = %{version}-%{release}
Provides:      lib%{realname} = %{version}-%{release}

# Build-time parameters
BuildRequires: cmake >= 2.8.12 gcc-c++ pkg-config
BuildRequires: jemalloc-devel
BuildRequires: libsnappy-devel
BuildRequires: zlib-devel
BuildRequires: lz4-devel
%if 0%{?suse_version}
BuildRequires: libbz2-devel
%else
BuildRequires: bzip2-devel
%endif
BuildRoot:     %{_tmppath}/%{name}-root
Source:        %{realname}-%{version}.%{srcext}
Patch:         jemalloc-ldlibs.patch

%description
The RocksDB library provides a persistent key value store. Keys and values are
arbitrary byte arrays. The keys are ordered within the key value store according
to a user-specified comparator function.

The library is maintained by the Facebook Database Engineering Team, and
is based on LevelDB.

%package -n %{realname}-devel
Group:         Development/Languages/C and C++
Summary:       Development files for %{name}
Requires:      %{name} = %{version}-%{release}
Provides:      %{name}-devel = %{version}-%{release}
Provides:      lib%{realname}-devel = %{version}-%{release}

%description -n %{realname}-devel
Development files for %{name}

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver}
%patch -p1

%build
%{__mkdir} build
cd build
cmake .. \
 -DCMAKE_INSTALL_PREFIX=%{_prefix} \
 -DCMAKE_BUILD_TYPE=Release \
 -DCMAKE_CXX_FLAGS_RELEASE="%{optflags}" \
 -DCMAKE_C_FLAGS_RELEASE="%{optflags}" \
 -DCMAKE_EXE_LINKER_FLAGS_RELEASE="-Wl,--as-needed -Wl,--strip-all" \
 -DCMAKE_MODULE_LINKER_FLAGS_RELEASE="-Wl,--as-needed -Wl,--strip-all" \
 -DCMAKE_SHARED_LINKER_FLAGS_RELEASE="-Wl,--as-needed -Wl,--strip-all -shared" \
 -DCMAKE_SKIP_INSTALL_RPATH=YES \
 -DCMAKE_SKIP_RPATH=YES \
 -DCMAKE_VERBOSE_MAKEFILE=YES \
 \
 -DWITH_JEMALLOC=YES \
 -DWITH_SNAPPY=YES \
 -DWITH_ZLIB=YES \
 -DWITH_BZ2=YES \
 -DWITH_LZ4=YES \
 -DPORTABLE=YES \
 -DWITH_TESTS=NO
%{__make} %{?_smp_mflags}

%install
%{__make} -C build install DESTDIR=%{buildroot}

%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%files
%defattr(-,root,root)
%doc AUTHORS CONTRIBUTING.md COPYING LICENSE.Apache LICENSE.leveldb README.md
%doc ROCKSDB_LITE.md USERS.md
%{_libdir}/librocksdb.so.%{?so_ver}*

%files -n %{realname}-devel
%doc AUTHORS CONTRIBUTING.md COPYING DEFAULT_OPTIONS_HISTORY.md DUMP_FORMAT.md
%doc HISTORY.md LANGUAGE-BINDINGS.md LICENSE.Apache LICENSE.leveldb README.md
%doc ROCKSDB_LITE.md USERS.md
%{_includedir}/%{realname}
%{_libdir}/librocksdb.a
%{_libdir}/librocksdb.so
%dir %{_libdir}/cmake/rocksdb
%dir %{_libdir}/cmake
%{_libdir}/cmake/rocksdb/*.cmake

%post   -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%changelog
openSUSE Build Service is sponsored by