Release version 0.1.19
[platform/core/appfw/libeventsystem.git] / packaging / eventsystem.spec
1 Name:       eventsystem
2 Summary:    Event system library
3 Version:    0.1.18
4 Release:    1
5 Group:      Application Framework/Libraries
6 License:    Apache-2.0
7 Source0:    %{name}-%{version}.tar.gz
8 BuildRequires:  cmake
9 BuildRequires:  pkgconfig(ecore)
10 BuildRequires:  pkgconfig(bundle)
11 BuildRequires:  pkgconfig(dlog)
12 BuildRequires:  pkgconfig(gio-2.0)
13 BuildRequires:  pkgconfig(glib-2.0)
14 BuildRequires:  pkgconfig(capi-base-common)
15 BuildRequires:  pkgconfig(gmock)
16
17 %if 0%{?gcov:1}
18 BuildRequires:  lcov
19 BuildRequires:  zip
20 %endif
21
22 Requires(post): /sbin/ldconfig
23 Requires(postun): /sbin/ldconfig
24 Recommends: esd
25
26 %description
27 Event System Library
28
29 %package devel
30 Summary:    Event system library (devel)
31 Group:      Development/Libraries
32 Requires:   %{name} = %{version}-%{release}
33
34 %description devel
35 Event system library (devel)
36
37 #################################################
38 # eventsystem-unittests
39 #################################################
40 %package -n %{name}-unittests
41 Summary:    GTest for EventySystem API
42 Group:      Application Framework/Testing
43 Requires:   %{name}
44
45 %description -n %{name}-unittests
46 GTest for EventSystem API
47
48 #################################################
49 # gcov
50 #################################################
51 %if 0%{?gcov:1}
52 %package gcov
53 Summary:  Event System API(gcov)
54 Group:    Application Framework/Testing
55
56 %description gcov
57 gcov objects of a eventsystem
58 %endif
59
60 %prep
61 %setup -q
62
63 %build
64 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
65 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
66 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
67
68 %if 0%{?gcov:1}
69 export CFLAGS+=" -fprofile-arcs -ftest-coverage"
70 export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
71 export FFLAGS+=" -fprofile-arcs -ftest-coverage"
72 export LDFLAGS+=" -lgcov"
73 %endif
74
75 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
76
77 %cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
78
79 make %{?jobs:-j%jobs}
80
81 %check
82 ctest -V
83 %if 0%{?gcov:1}
84 lcov -c --ignore-errors graph --no-external -q -d . -o ${name}.info
85 genhtml ${name}.info -o out --legend --show-details
86 %endif
87
88 %install
89 rm -rf %{buildroot}
90 %make_install
91
92 %if 0%{?gcov:1}
93 builddir=$(basename $PWD)
94 gcno_obj_dir=%{buildroot}%{_datadir}/gcov/obj/%{name}/"$builddir"
95 mkdir -p "$gcno_obj_dir"
96 find . -name '*.gcno' -exec cp --parents '{}' "$gcno_obj_dir" ';'
97 %endif
98
99 cat << EOF > run-unittest.sh
100 #!/bin/sh
101 setup() {
102     echo "setup start"
103 }
104
105 test_main() {
106     echo "test_main start"
107     /usr/bin/eventsystem-unittests
108 }
109
110 teardown() {
111     echo "teardown start"
112 }
113
114 main() {
115     setup
116     test_main
117     teardown
118 }
119
120 main "\$*"
121 EOF
122
123 mkdir -p %{buildroot}%{_bindir}/tizen-unittests/%{name}
124 install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/%{name}/
125
126
127 %post -p /sbin/ldconfig
128
129 %postun -p /sbin/ldconfig
130
131 %files
132 %manifest eventsystem.manifest
133 %defattr(-,root,root,-)
134 %{_libdir}/libeventsystem.so.*
135 %license LICENSE
136
137 %files devel
138 %defattr(-,root,root,-)
139 %{_includedir}/*.h
140 %{_libdir}/libeventsystem.so
141 %{_libdir}/pkgconfig/eventsystem.pc
142
143 #################################################
144 # eventsystem-unittests
145 #################################################
146 %files -n %{name}-unittests
147 %{_bindir}/%{name}-unittests
148 %{_bindir}/tizen-unittests/%{name}/run-unittest.sh
149
150 #################################################
151 # eventsystem-gcov
152 #################################################
153 %if 0%{?gcov:1}
154 %files gcov
155 %{_datadir}/gcov/obj/*
156 %endif