Summary: Couchbase Client & Protocol Library
Name: libcouchbase
Version: @VERSION@
Release: @RELEASE@%{?dist}
Vendor: Couchbase, Inc.
Packager: Couchbase SDK Team <support@couchbase.com>
License: Apache-2
Group: System Environment/Libraries
%if %{?fedora}0 >= 180 || %{?rhel}0 >= 60
BuildRequires: cmake >= 2.8.9
%else
BuildRequires: cmake28
%endif
BuildRequires: libevent-devel >= 1.4, libev-devel >= 3, openssl-devel
URL: https://github.com/couchbase/libcouchbase
Source: @TARREDAS@.tar.gz
BuildRoot: %{_topdir}/build/@TARREDAS@

%description
This is the client and protocol library for Couchbase project.

%package -n %{name}2-libevent
Group: System Environment/Libraries
Summary: Couchbase Client & Protocol Library (libevent backend)
Requires: %{name}2-core = %{version}-%{release}, libevent >= 1.4
%description -n %{name}2-libevent
This package provides libevent backend for libcouchbase

%package -n %{name}2-libev
Group: System Environment/Libraries
Summary: Couchbase Client & Protocol Library (libev backend)
Requires: %{name}2-core = %{version}-%{release}, libev >= 3
%description -n %{name}2-libev
This package provides libev backend for libcouchbase

%package -n %{name}2-core
Group: System Environment/Libraries
Summary: Couchbase Client & Protocol Library (core)
Provides: %{name}2
%description -n %{name}2-core
This package provides the core for libcouchbase. It contains an IO
implementation based on select(2). If preferred, you can install one
of the available backends (libcouchbase2-libevent or
libcouchbase2-libev).  libcouchbase will automatically use the
installed backend. It is also possible to integrate another IO backend
or write your own.

%package -n %{name}2-bin
Group: Development/Tools
Summary: Couchbase Client Tools
Requires: %{name}2-core = %{version}-%{release}
%description -n %{name}2-bin
This is the CLI tools Couchbase project.

%package devel
Group: Development/Libraries
Summary: Couchbase Client & Protocol Library - Header files
Requires: %{name}2-core = %{version}-%{release}
%description devel
Development files for the Couchbase Client & Protocol Library

%prep
%if 0%{?rhel} > 5 || 0%{?fedora} > 7
%define __lcb_cmake %cmake
%else
%define __lcb_cmake %cmake28
%endif

%setup -q -n @TARREDAS@
%{__lcb_cmake} -DLCB_NO_TESTS=1 -DLCB_BUILD_LIBUV=OFF

%build
%{__make} %{_smp_mflags}

%install
%{__make} install DESTDIR="%{buildroot}" AM_INSTALL_PROGRAM_FLAGS=""

%clean
%{__rm} -rf %{buildroot}

%post -n %{name}2-core -p /sbin/ldconfig

%postun -n %{name}2-core -p /sbin/ldconfig

%files -n %{name}2-core
%defattr(-, root, root)
%{_libdir}/libcouchbase.so.*
%doc README.markdown LICENSE RELEASE_NOTES.markdown

%files -n %{name}2-libevent
%defattr(-, root, root)
%{_libdir}/libcouchbase_libevent.so

%files -n %{name}2-libev
%defattr(-, root, root)
%{_libdir}/libcouchbase_libev.so

%files -n %{name}2-bin
%defattr(-, root, root)
%{_bindir}/cbc*
%{_mandir}/man1/cbc*.1*
%{_mandir}/man4/cbcrc*.4*

%files devel
%defattr(-, root, root)
%{_includedir}/libcouchbase
%{_libdir}/libcouchbase.so
%{_libdir}/pkgconfig/libcouchbase.pc
