Release version 1.13.12
[platform/core/appfw/rpc-port.git] / packaging / rpc-port.spec
1 Name:       rpc-port
2 Summary:    RPC Port library
3 Version:        1.13.12
4 Release:    0
5 Group:          Application Framework/Libraries
6 License:    Apache-2.0
7 Source0:    %{name}-%{version}.tar.gz
8 Source1001:     %{name}.manifest
9 BuildRequires:  cmake
10 BuildRequires:  pkgconfig(aul)
11 BuildRequires:  pkgconfig(bundle)
12 BuildRequires:  pkgconfig(cynara-client)
13 BuildRequires:  pkgconfig(cynara-creds-socket)
14 BuildRequires:  pkgconfig(dlog)
15 BuildRequires:  pkgconfig(glib-2.0)
16 BuildRequires:  pkgconfig(gmock)
17 BuildRequires:  pkgconfig(libtzplatform-config)
18 BuildRequires:  pkgconfig(parcel)
19 BuildRequires:  pkgconfig(pkgmgr)
20 BuildRequires:  pkgconfig(pkgmgr-info)
21 BuildRequires:  pkgconfig(tizen-shared-queue)
22 BuildRequires:  pkgconfig(uuid)
23
24 %if 0%{?gcov:1}
25 BuildRequires:  lcov
26 BuildRequires:  zip
27 %endif
28
29 Requires(post): /sbin/ldconfig
30 Requires(post): coreutils
31 Requires(postun): /sbin/ldconfig
32
33 Recommends: amd-mod-rpc-port
34
35 %description
36 RPC Port library package.
37
38 %package devel
39 Summary:  RPC Port library (Development)
40 Group:    Application Framework/Development
41 Requires: %{name} = %{version}-%{release}
42
43 %description devel
44 RPC Port library (Development) package.
45
46 #################################################
47 # rpc-port-unittests
48 #################################################
49 %package unittests
50 Summary:    GTest for rpc-port
51 Group:      Development/Libraries
52 Requires:   %{name}
53
54 %description unittests
55 GTest for rpc-port
56
57 #################################################
58 # rpc-port-gcov
59 #################################################
60 %if 0%{?gcov:1}
61 %package gcov
62 Summary:    RPC Port(gcov)
63 Group:      Application Framework/Testing
64
65 %description gcov
66 RPC Port gcov objects
67 %endif
68
69 %prep
70 %setup -q
71 cp %{SOURCE1001} .
72
73 %build
74 %if 0%{?gcov:1}
75 export CFLAGS+=" -fprofile-arcs -ftest-coverage"
76 export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
77 export FFLAGS+=" -fprofile-arcs -ftest-coverage"
78 export LDFLAGS+=" -lgcov"
79 %endif
80
81 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
82 %cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
83 # Call make instruction with smp support
84 %__make %{?jobs:-j%jobs}
85
86 %check
87 export LD_LIBRARY_PATH="../../src"
88 ctest -V %{?_smp_mflags}
89
90 %if 0%{?gcov:1}
91 lcov -c --ignore-errors graph --no-external -b . -d . -o %{name}.info
92 genhtml %{name}.info -o out --legend --show-details
93 %endif
94
95 %install
96 rm -rf %{buildroot}
97
98 %make_install
99
100 %if 0%{?gcov:1}
101 builddir=$(basename $PWD)
102 gcno_obj_dir=%{buildroot}%{_datadir}/gcov/obj/%{name}/"$builddir"
103 mkdir -p "$gcno_obj_dir"
104 find . -name '*.gcno' -exec cp --parents '{}' "$gcno_obj_dir" ';'
105 %endif
106
107 cat << EOF > run-unittest.sh
108 #!/bin/sh
109 GCOV_PATH="/tmp/home/abuild/rpmbuild/BUILD"
110 PAKCAGE="%{name}-%{version}"
111
112 set_perm() {
113     ## Sets the permission for applications
114     /usr/bin/find /tmp/home/ -print | /usr/bin/xargs -n1 /usr/bin/chsmack -a "System::Run" &> /dev/null
115     /usr/bin/find /tmp/home/ -print | /usr/bin/xargs -n1 /usr/bin/chsmack -a "System::Run" -t &> /dev/null
116     /usr/bin/chmod -R 777 /tmp/home/
117 }
118
119 setup() {
120     echo "setup start"
121     /usr/bin/mkdir -p "${GCOV_PATH}/${PACKAGE}"
122     set_perm
123 }
124
125 test_main() {
126     echo "test_main start"
127     export "GCOV_PREFIX=/tmp"
128     /usr/bin/rpc-port_unittests
129 }
130
131 teardown() {
132     echo "teardown start"
133     set_perm
134 }
135
136 main() {
137     setup
138     test_main
139     teardown
140 }
141
142 main "\$*"
143 EOF
144
145 mkdir -p %{buildroot}%{_bindir}/tizen-unittests/%{name}
146 install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/%{name}/
147
148 %post -p /sbin/ldconfig
149
150 %postun -p /sbin/ldconfig
151
152 %files
153 %manifest %{name}.manifest
154 %attr(0644,root,root) %{_libdir}/lib%{name}.so.*
155 %license LICENSE.APLv2
156 %{_bindir}/rpc-port-util
157 %{_bindir}/rpc-port-benchmark-server
158 %{_bindir}/rpc-port-benchmark-tool
159 %config %{_sysconfdir}/dbus-1/system.d/rpc-port.conf
160
161 %files devel
162 %{_includedir}/rpc-port/*.h
163 %{_libdir}/pkgconfig/*.pc
164 %{_libdir}/lib%{name}.so
165
166 #################################################
167 # rpc-port-unittests
168 #################################################
169 %files unittests
170 %{_bindir}/rpc-port_unittests
171 %{_bindir}/tizen-unittests/%{name}/run-unittest.sh
172
173 #################################################
174 # rpc-port-gcov
175 #################################################
176 %if 0%{?gcov:1}
177 %files gcov
178 %{_datadir}/gcov/*
179 %endif