halapi: Delete unused code to make directory
[platform/hal/api/common.git] / packaging / hal-api-common.spec
1 %define name            hal-api-common
2 %define devel_name      hal-api-common-devel
3 %define test_name       hal-api-common-haltests
4
5 ### main package #########
6 Name:       %{name}
7 Summary:    %{name} interface
8 Version:    0.0.1
9 Release:    1
10 Group:      Development/Libraries
11 License:    Apache-2.0
12 Source0:    %{name}-%{version}.tar.gz
13 Source1:    %{name}.manifest
14 Source2:    libhal-api.conf
15 Source3:    systemd-hal-firmware-generator
16 Source4:    macros.hal-api
17 Source5:    haltest.target
18 Source6:    reboot-haltest
19 Source7:    reboot-normal
20 Source8:    hal-rpmdb-checker.service
21 Source9:    hal-rpmdb-checker
22
23 Requires(post): /sbin/ldconfig
24 Requires(postun): /sbin/ldconfig
25 BuildRequires: cmake
26 BuildRequires: pkgconfig(dlog)
27 BuildRequires: pkgconfig(gio-2.0)
28 BuildRequires: pkgconfig(glib-2.0)
29 BuildRequires: pkgconfig(json-c)
30 BuildRequires: pkgconfig(gmock)
31 BuildRequires: pkgconfig(systemd)
32
33 %description
34 %{name} interface
35
36 ### devel package #########
37 %package -n     %{devel_name}
38 Summary:        %{name} interface
39 Group:          Development/Libraries
40 Requires:       %{name} = %{version}-%{release}
41
42 %description -n %{devel_name}
43 %{name} Interface for product vendor developer
44
45 ### test package #########
46 %package -n %{test_name}
47 Summary: tests for hal-api-common
48 Requires: hal-api-common = %{version}
49
50 %description -n %{test_name}
51 Haltests for hal-api-common
52
53 ### build and install #########
54 %prep
55 %setup -q
56
57 %define hal_rpmdb_checker_path /opt/etc/hal
58
59 cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_LIBDIR_PREFIX=%{_libdir}
60
61 %build
62 cp %{SOURCE1} .
63 make %{?jobs:-j%jobs}
64
65 %check
66 (cd tests/unittest && LD_LIBRARY_PATH=../../ ctest -V)
67
68 %install
69 rm -rf %{buildroot}
70 %make_install
71
72 mkdir -p %{buildroot}/hal
73 mkdir -p %{buildroot}%{hal_rpmdb_checker_path}
74 install -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/ld.so.conf.d/libhal-api.conf
75 install -D -m 0755 %{SOURCE3} %{buildroot}%{_systemdgeneratordir}/systemd-hal-firmware-generator
76 install -D -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/rpm/macros.hal-api
77 install -D -m 0644 %{SOURCE5} %{buildroot}%{_unitdir}/haltest.target
78 install -D -m 0755 %{SOURCE6} %{buildroot}%{_bindir}/reboot-haltest
79 install -D -m 0755 %{SOURCE7} %{buildroot}%{_bindir}/reboot-normal
80 install -D -m 0644 %{SOURCE8} %{buildroot}%{_unitdir}/hal-rpmdb-checker.service
81 install -D -m 0755 %{SOURCE9} %{buildroot}%{_bindir}/hal-rpmdb-checker
82
83 %install_service sysinit.target.wants hal-rpmdb-checker.service
84
85 %clean
86 rm -rf %{buildroot}
87
88 %post
89 /sbin/ldconfig
90 chsmack -a "System" -t %{hal_rpmdb_checker_path}
91
92 %postun
93 /sbin/ldconfig
94
95 ### contain files to package #########
96 %files  -n %{name}
97 %license LICENSE
98 %manifest %{name}.manifest
99 %defattr(-,root,root,-)
100 %dir /hal
101 %{_libdir}/hal/*.so*
102 %{_sysconfdir}/ld.so.conf.d/libhal-api.conf
103 %{_systemdgeneratordir}/systemd-hal-firmware-generator
104
105 %files  -n %{devel_name}
106 %defattr(-,root,root,-)
107 %{_includedir}/hal/*.h
108 %{_libdir}/pkgconfig/*.pc
109 %{_sysconfdir}/rpm/macros.hal-api
110
111 %files -n %{test_name}
112 %dir %{hal_rpmdb_checker_path}
113 %attr(0755,system_fw,system_fw) %{hal_rpmdb_checker_path}
114 %{_bindir}/hal/common-haltests
115 %{_unitdir}/haltest.target
116 %{_bindir}/reboot-haltest
117 %{_bindir}/reboot-normal
118 %{_unitdir}/sysinit.target.wants/hal-rpmdb-checker.service
119 %{_unitdir}/hal-rpmdb-checker.service
120 %{_bindir}/hal-rpmdb-checker