Release version 1.12.11
[platform/core/appfw/tpk-manifest-handlers.git] / packaging / tpk-manifest-handlers.spec
1 Name:           tpk-manifest-handlers
2 Summary:        tpk-manifest-handlers
3 Version:        1.12.11
4 Release:        1
5 Group:          Application Framework/Package Management
6 License:        Apache-2.0
7 Source0:        %{name}-%{version}.tar.gz
8 Source100:      %{name}.manifest
9
10 BuildRequires:  boost-devel
11 BuildRequires:  cmake
12 BuildRequires:  pkgconfig(manifest-parser)
13 BuildRequires:  pkgconfig(gmock)
14
15 %if 0%{?gcov:1}
16 BuildRequires: lcov
17 BuildRequires: zip
18 %endif
19
20 %description
21 Installs tpk parser and handlers based on manifest-parser
22
23 %package devel
24 Summary:    Manifest parser development files
25 Group:      Application Framework/Package Management
26 Requires:   %{name} = %{version}
27 Requires:   boost-devel
28
29 %description devel
30 This package contains necessaary files for manifest-parser development
31
32 %package unittests
33 Summary:    %{name} unittests binary
34
35 %description unittests
36 unittest binary
37
38 %prep
39 %setup -q
40 cp %{SOURCE100} .
41
42 %build
43 export CFLAGS="$(echo $CFLAGS | sed 's/-Wl,--as-needed//g')"
44 export CXXFLAGS="$(echo $CXXFLAGS | sed 's/-Wl,--as-needed//g')"
45 export FFLAGS="$(echo $FFLAGS | sed 's/-Wl,--as-needed//g')"
46
47 %if 0%{?gcov:1}
48 export CFLAGS+=" -fprofile-arcs -ftest-coverage"
49 export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
50 export FFLAGS=" -fprofile-arcs -ftest-coverage"
51 export LDFLAGS+=" -lgcov"
52 %endif
53
54 # BUILD_PARSER macro is defined so we can build two separate projects
55 # with cmake, which are on one repository. Later this macro
56 # is used in CMakeLists.txt files to distinguish, which project
57 # is currently being build.
58 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
59 %cmake . -DCMAKE_BUILD_TYPE=%{?build_type:%build_type} \
60          -DTIZEN_VERSION=%{tizen_version} \
61          -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
62
63 make %{?_smp_mflags}
64
65 %check
66 export LD_LIBRARY_PATH=../../src/tpk_manifest_handlers
67 ctest -V
68 %if 0%{?gcov:1}
69 lcov -c --ignore-errors graph --no-external -b . -d . -o %{name}.info
70 genhtml %{name}.info -o out --legend --show-details
71 %endif
72
73 %install
74 %make_install
75
76 %if 0%{?gcov:1}
77 builddir=$(basename $PWD)
78 gcno_obj_dir=%{buildroot}%{_datadir}/gcov/obj/%{name}/"$builddir"
79 mkdir -p "$gcno_obj_dir"
80 find . -name '*.gcno' -exec cp --parents '{}' "$gcno_obj_dir" ';'
81 %endif
82
83 cat << EOF > run-unittest.sh
84 #!/bin/sh
85
86 setup() {
87     echo "setup start"
88 }
89
90 test_main() {
91     echo "test_main start"
92     CUR_DIR=$(pwd)
93     cd /usr/bin
94     /usr/bin/tpk-manifest-handlers-unit-test
95     cd $CUR_DIR
96 }
97
98 teardown() {
99     echo "teardown start"
100 }
101
102 main() {
103     setup
104     test_main
105     teardown
106 }
107
108 main "\$*"
109 EOF
110
111 mkdir -p %{buildroot}%{_bindir}/tizen-unittests/%{name}
112 install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/%{name}/
113
114 %post -p /sbin/ldconfig
115
116 %postun -p /sbin/ldconfig
117
118 %files
119 %manifest %{name}.manifest
120 %defattr(-,root,root)
121 %{_libdir}/libtpk-manifest-handlers.so.*
122 %license LICENSE
123
124 %files devel
125 %manifest %{name}.manifest
126 %{_libdir}/pkgconfig/*.pc
127 %{_libdir}/libtpk-manifest-handlers.so
128 %{_includedir}/tpk_manifest_handlers/*.h
129
130 #################################################
131 # tpk-manifest-handlers-gcov
132 #################################################
133 %if 0%{?gcov:1}
134 %package gcov
135 Summary:    Simple string key-val dictionary ADT (gcov)
136 Group:      Application Framework/Testing
137
138 %description gcov
139 Simple string key-val dictionary ADT gcov objects
140 %endif
141
142 %if 0%{?gcov:1}
143 %files gcov
144 %defattr(-,root,root,-)
145 %{_datadir}/gcov/obj/*
146 %endif
147
148 %files unittests
149 %{_bindir}/tpk-manifest-handlers-unit-test
150 %{_bindir}/test_samples
151 %{_bindir}/tizen-unittests/%{name}/run-unittest.sh