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