[cleanup]revise file location, name and so on
[platform/core/appfw/libslp-db-util.git] / packaging / libslp-db-util.spec
index ae1a9dd..27d34ca 100644 (file)
-Name:       libslp-db-util
-Summary:    DB Utility
-Version:    0.1.1
-Release:    4
-Group:      System/Libraries
-License:    Apache License, Version 2.0
-Source0:    %{name}-%{version}.tar.gz
-Requires(post): /sbin/ldconfig
-Requires(postun): /sbin/ldconfig
+Name:           libslp-db-util
+Version:        0.1.1
+Release:        6
+License:        Apache-2.0
+Summary:        DB Utility
+Group:          Application Framework/Database
+Source0:        %{name}-%{version}.tar.gz
+Source1001:    %{name}.manifest
 BuildRequires:  cmake
-BuildRequires:  pkgconfig(sqlite3)
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(icu-i18n)
+BuildRequires:  pkgconfig(sqlite3)
+BuildRequires:  pkgconfig(vconf)
+
+%if 0%{?gcov:1}
+BuildRequires:  gtest-devel
+BuildRequires:  lcov
+%endif
 
 %description
+DB Utility.
 
 %package devel
-Summary:    Devel package for libslp-db-util (devel)
-Group:      Development/Libraries
-Requires:   %{name} = %{version}-%{release}
-
+Summary:        Devel package for libslp-db-util (devel)
+Requires:       %{name} = %{version}
 %description devel
+Devel package for libslp-db-util (devel)
+
+%if 0%{?gcov:1}
+%package gcov
+Summary:  DB Utility(gcov)
+Group:    Application Framework/Database
+%description gcov
+libslp-db-util gcov objects
+%endif
 
 %prep
-%setup -q -n %{name}-%{version}
+%setup -q
+cp %{SOURCE1001} ./%{name}.manifest
 
 %build
-cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
 
-make %{?jobs:-j%jobs}
+%ifarch aarch64 x86_64
+export CFLAGS+=" $CFLAGS -DDB_UTIL_ARCH_64 "
+export CXXFLAGS+=" $CXXFLAGS -DDB_UTIL_ARCH_64 "
+export FFLAGS+=" $FFLAGS -DDB_UTIL_ARCH_64 "
+%endif
+
+%if 0%{?gcov:1}
+export CFLAGS+=" -O0 -fprofile-arcs -ftest-coverage"
+export CXXFLAGS+=" -O0 -fprofile-arcs -ftest-coverage"
+%define CMAKE_GCOV -DGCOV=1
+%else
+%define CMAKE_GCOV %{nil}
+%endif
+
+%cmake . %{CMAKE_GCOV}
+make %{?_smp_mflags}
+
+%if 0%{?gcov:1}
+mkdir -p gcov-obj
+find . -name '*.gcno' -exec cp '{}' gcov-obj ';'
+%endif
 
 %install
-rm -rf %{buildroot}
 %make_install
-mkdir -p %{buildroot}/usr/share/license
-install LICENSE %{buildroot}/usr/share/license/%{name}
-
-%post
-/sbin/ldconfig
-if [ ! -d /opt/dbspace ]
-then
-        mkdir -p /opt/dbspace
-fi
-if [ ! -d /opt/usr/dbspace ]
-then
-        mkdir -p /opt/usr/dbspace
-fi
-chown :5000 /opt/dbspace
-chmod 775 /opt/dbspace
-chown :5000 /opt/usr/dbspace
-chmod 775 /opt/usr/dbspace
+
+%if 0%{?gcov:1}
+mkdir -p %{buildroot}%{_datadir}/gcov/obj
+install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
+%endif
+
+%check
+%if 0%{?gcov:1}
+pushd tests
+./run_coverage.sh
+popd
+%endif
+
+%post -p /sbin/ldconfig
 
 %postun -p /sbin/ldconfig
 
 %files
-%manifest libSLP-db-util.manifest
+%manifest %{name}.manifest
+%license LICENSE.APLv2
 %defattr(-,root,root,-)
-%{_libdir}/libSLP-db-util.so
 %{_libdir}/libSLP-db-util.so.0
 %{_libdir}/libSLP-db-util.so.0.1.0
-/usr/share/license/%{name}
 
 %files devel
 %defattr(-,root,root,-)
+%dir %{_includedir}/db-util
 %{_includedir}/db-util/*.h
 %{_libdir}/pkgconfig/db-util.pc
+%{_libdir}/libSLP-db-util.so
+
 
+%if 0%{?gcov:1}
+%files gcov
+%defattr(-,root,root,-)
+%{_datadir}/gcov/obj/*
+%endif