Name: rpc-port
Summary: RPC Port library
-Version: 1.0.0
+Version: 1.3.28
Release: 0
Group: Application Framework/Libraries
License: Apache-2.0
BuildRequires: pkgconfig(aul)
BuildRequires: pkgconfig(pkgmgr)
BuildRequires: pkgconfig(pkgmgr-info)
-BuildRequires: pkgconfig(openssl)
+BuildRequires: pkgconfig(gmock)
+BuildRequires: pkgconfig(cynara-client)
+BuildRequires: pkgconfig(cynara-creds-gdbus)
+BuildRequires: pkgconfig(uuid)
+
+%if 0%{?gcov:1}
+BuildRequires: lcov
+BuildRequires: zip
+%endif
Requires(post): /sbin/ldconfig
Requires(post): coreutils
Requires(postun): /sbin/ldconfig
-Provides: capi-rpc-port
-Provides: libcapi-rpc-port.so.1
+Recommends: amd-mod-rpc-port
%description
RPC Port library package.
%description devel
RPC Port library (Development) package.
+#################################################
+# rpc-port-unittests
+#################################################
+%package -n rpc-port-unittests
+Summary: GTest for rpc-port
+Group: Development/Libraries
+Requires: %{name}
+
+%description -n rpc-port-unittests
+GTest for rpc-port
+
+#################################################
+# rpc-port-gcov
+#################################################
+%if 0%{?gcov:1}
+%package gcov
+Summary: RPC Port(gcov)
+Group: Application Framework/Testing
+
+%description gcov
+RPC Port gcov objects
+%endif
+
%prep
%setup -q
cp %{SOURCE1001} .
%build
+%if 0%{?gcov:1}
+export CFLAGS+=" -fprofile-arcs -ftest-coverage"
+export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
+export FFLAGS+=" -fprofile-arcs -ftest-coverage"
+export LDFLAGS+=" -lgcov"
+%endif
+
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
# Call make instruction with smp support
%__make %{?jobs:-j%jobs}
+%if 0%{?gcov:1}
+mkdir -p gcov-obj
+find . -name '*.gcno' -exec cp '{}' gcov-obj ';'
+%endif
+
+%check
+ctest --output-on-failure %{?_smp_mflags}
+%if 0%{?gcov:1}
+lcov -c --ignore-errors graph --no-external -q -d . -o rpc-port.info
+genhtml rpc-port.info -o rpc-port.out
+zip -r rpc-port.zip rpc-port.out rpc-port.info
+install -m 0644 rpc-port.zip %{buildroot}%{_datadir}/gcov/
+%endif
+
%install
rm -rf %{buildroot}
%make_install
+%if 0%{?gcov:1}
+mkdir -p %{buildroot}%{_datadir}/gcov/obj
+install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
+%endif
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
+%post -n rpc-port-unittests
+%if 0%{?gcov:1}
+%{_bindir}/rpc-port_unittests
+%endif
+
%files
%manifest %{name}.manifest
%attr(0644,root,root) %{_libdir}/lib%{name}.so.*
-%attr(0644,root,root) %{_libdir}/libcapi-rpc-port.so.*
%license LICENSE.APLv2
%files devel
%{_includedir}/rpc-port/*.h
%{_libdir}/pkgconfig/*.pc
%{_libdir}/lib%{name}.so
+
+#################################################
+# rpc-port-unittests
+#################################################
+%files -n rpc-port-unittests
+%{_bindir}/rpc-port_unittests
+
+#################################################
+# rpc-port-gcov
+#################################################
+%if 0%{?gcov:1}
+%files gcov
+%{_datadir}/gcov/*
+%endif