2c79eafe3bfdf9cea53a8a9f017310f1cad342e8
[platform/core/appfw/rpc-port.git] / packaging / rpc-port.spec
1 Name:       rpc-port
2 Summary:    RPC Port library
3 Version:        1.14.17
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-util -n test_port &
129     /usr/bin/rpc-port_unittests
130 }
131
132 teardown() {
133     echo "teardown start"
134     set_perm
135     killall rpc-port-util
136 }
137
138 main() {
139     setup
140     test_main
141     teardown
142 }
143
144 main "\$*"
145 EOF
146
147 mkdir -p %{buildroot}%{_bindir}/tizen-unittests/%{name}
148 install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/%{name}/
149
150 %post -p /sbin/ldconfig
151
152 %postun -p /sbin/ldconfig
153
154 %files
155 %manifest %{name}.manifest
156 %attr(0644,root,root) %{_libdir}/lib%{name}.so.*
157 %license LICENSE.APLv2
158 %{_bindir}/rpc-port-util
159 %{_bindir}/rpc-port-benchmark-server
160 %{_bindir}/rpc-port-benchmark-tool
161 %config %{_sysconfdir}/dbus-1/system.d/rpc-port.conf
162
163 %files devel
164 %{_includedir}/rpc-port/*.h
165 %{_libdir}/pkgconfig/*.pc
166 %{_libdir}/lib%{name}.so
167
168 #################################################
169 # rpc-port-unittests
170 #################################################
171 %files unittests
172 %{_bindir}/rpc-port_unittests
173 %{_bindir}/tizen-unittests/%{name}/run-unittest.sh
174
175 #################################################
176 # rpc-port-gcov
177 #################################################
178 %if 0%{?gcov:1}
179 %files gcov
180 %{_datadir}/gcov/*
181 %endif