File _service:set_version:mongo-cxx-driver.spec of Package mongo-cxx-driver

# norootforbuild
#
# spec file for package mongo-cxx-driver
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

%define sover 3_6-1
%define libname libmongocxx-1.0
%define mongoc_version 1.17.0

Name:           mongo-cxx-driver
Version:        3.6.1git~20201026T111023~5b4628114
Release:        0
Summary:        MongoDB C++ Driver
Group:          System Environment/Libraries/C and C++
License:        Apache-2.0
URL:            https://github.com/mongodb/mongo-cxx-driver
Source0:        %{name}-%{version}.tar.xz
Source100:      %{name}-rpmlintrc
BuildRequires:  cmake >= 3.2
BuildRequires:  gcc-c++ >= 7.0
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(libmongoc-1.0) >= %{mongoc_version}
BuildRequires:  pkgconfig(libbson-1.0)
BuildRequires:  pkgconfig(openssl)
BuildRequires:  pkgconfig(libsasl2)
BuildRequires:  cmake(Snappy)
Requires:       libmongocxx-%{sover} = %{version}-%{release}

%description
mongo-cxx-driver is a library for building high-performance
C++ applications that communicate with the MongoDB NoSQL
database.
This package contains the new and rewritten driver.

%package -n libmongocxx-%{sover}
Summary:        A library for parsing and generating BSON documents
Group:          Development/Languages/C and C++
Requires:       libmongoc-1.0 = %{mongoc_version}
Requires:       libbsoncxx-%{sover} = %{version}-%{release}
Provides:       %{libname}

%description -n libmongocxx-%{sover}
libbsoncxx is a library providing useful C++ routines related to 
building, parsing, and iterating BSON documents.

%package -n libmongocxx-devel
Summary:        Development files for mongo-cxx-driver
Group:          Development/Libraries/C and C++
Requires:       %{libname}-%{sover} = %{version}-%{release}
Requires:       libbsoncxx-devel = %{version}-%{release}
Conflicts:      %{name}-devel < 3.0

%description -n libmongocxx-devel
This package contains libraries and header files for developing
C++ applications with mongodb access.

%package -n libmongocxx-static-devel
Summary:        Development files for libmongocxx
Group:          Development/Libraries/C and C++
BuildRequires:  pkgconfig(libmongoc-static-1.0) >= %{mongoc_version}
Requires:       libmongocxx-devel = %{version}-%{release}
Requires:       libbsoncxx-static-devel = %{version}-%{release}

%description -n libmongocxx-static-devel
This package contains the static libmongo library.

%package -n libbsoncxx-%{sover}
Summary:        A library for parsing and generating BSON documents
Group:          Development/Languages/C and C++
Provides:       libbsoncxx-1.0

%description -n libbsoncxx-%{sover}
libbsoncxx is a library providing useful C++ routines related to 
building, parsing, and iterating BSON documents.


%package -n libbsoncxx-devel
Summary:        Development files for libbsoncxx
Group:          Development/Libraries/C and C++
Requires:       libbsoncxx-%{sover} = %{version}-%{release}

%description -n libbsoncxx-devel
This package contains libraries and header files for
developing applications that use libbson.

%package -n libbsoncxx-static-devel
Summary:        Development files for libbsoncxx
Group:          Development/Libraries/C and C++
BuildRequires:  pkgconfig(libbson-static-1.0) >= %{mongoc_version}
Requires:       libbsoncxx-devel = %{version}-%{release}

%description -n libbsoncxx-static-devel
This package contains the static libbson library.

%prep
%setup -q

# CRLF -> LF
sed -i 's/\r//' README.md

sed -i 's/PACKAGE_LIBRARY_INSTALL_DIRS lib/PACKAGE_LIBRARY_INSTALL_DIRS %{_lib}/' src/mongocxx/CMakeLists.txt
sed -i 's/PACKAGE_LIBRARY_INSTALL_DIRS lib/PACKAGE_LIBRARY_INSTALL_DIRS %{_lib}/' src/bsoncxx/CMakeLists.txt
sed -i 's/DESTINATION lib/DESTINATION %{_lib}/g' src/mongocxx/CMakeLists.txt
sed -i 's/DESTINATION lib/DESTINATION %{_lib}/g' src/bsoncxx/CMakeLists.txt
sed -i 's/DESTINATION lib/DESTINATION %{_lib}/g' src/mongocxx/config/CMakeLists.txt
sed -i 's/DESTINATION lib/DESTINATION %{_lib}/g' src/bsoncxx/config/CMakeLists.txt

%define ver %(echo %{version} | cut -d g -f1)
%define major %(echo %{ver} | cut -d . -f1)
%define minor %(echo %{ver} | cut -d . -f2)
%define micro %(echo %{ver} | cut -d . -f3)

%build
%cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
       -DCMAKE_CXX_STANDARD=17 \
       -DBUILD_SHARED_AND_STATIC_LIBS=ON \
       -DBUILD_VERSION=%{ver}

%install
%cmake_install

sed -i 's/\/lib/\/%{_lib}/' %{buildroot}/%{_libdir}/pkgconfig/libbsoncxx.pc
sed -i 's/\/lib/\/%{_lib}/' %{buildroot}/%{_libdir}/pkgconfig/libmongocxx.pc

#rm %{buildroot}/%{_libdir}/*._noabi ||:
rm %{buildroot}/%{_datadir}/mongo-cxx-driver/LICENSE ||:
rm %{buildroot}/%{_datadir}/mongo-cxx-driver/README.md ||:
rm %{buildroot}/%{_datadir}/mongo-cxx-driver/THIRD-PARTY-NOTICES ||:
rm %{buildroot}/%{_datadir}/mongo-cxx-driver/uninstall.sh ||:

%post -n libmongocxx-%{sover} -p /sbin/ldconfig

%postun -n libmongocxx-%{sover} -p /sbin/ldconfig

%post -n libbsoncxx-%{sover} -p /sbin/ldconfig

%postun -n libbsoncxx-%{sover} -p /sbin/ldconfig

%files
%doc README.md LICENSE 

%files -n libmongocxx-%{sover}
%{_libdir}/libmongocxx.so.*

%files -n libmongocxx-devel
%{_includedir}/mongocxx*
%{_libdir}/libmongocxx.so
%{_libdir}/cmake/mongocxx-%{ver}
%{_libdir}/cmake/libmongocxx-%{ver}
%{_libdir}/pkgconfig/libmongocxx.pc

%files -n libmongocxx-static-devel
%{_libdir}/libmongocxx-static.a
%{_libdir}/pkgconfig/libmongocxx-static.pc
%{_libdir}/cmake/libmongocxx-static-%{ver}

%files -n libbsoncxx-%{sover}
%{_libdir}/libbsoncxx.so.*

%files -n libbsoncxx-devel
%{_includedir}/bsoncxx*
%{_libdir}/libbsoncxx.so
%{_libdir}/cmake/bsoncxx-%{ver}
%{_libdir}/cmake/libbsoncxx-%{ver}
%{_libdir}/pkgconfig/libbsoncxx.pc

%files -n libbsoncxx-static-devel
%{_libdir}/libbsoncxx-static.a
%{_libdir}/pkgconfig/libbsoncxx-static.pc
%{_libdir}/cmake/libbsoncxx-static-%{ver}

%changelog
openSUSE Build Service is sponsored by