halcc: Introduce halcc library
[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(libxml-2.0)
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 Requires(post): /sbin/ldconfig
50 Requires(post): systemd
51 Requires(post): security-config
52 Requires(postun): /sbin/ldconfig
53
54 %description -n %{test_name}
55 Haltests for hal-api-common
56
57 ### build and install #########
58 %prep
59 %setup -q
60
61 %define hal_rpmdb_checker_path /opt/etc/hal
62
63 cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
64         -DCMAKE_LIBDIR_PREFIX=%{_libdir} \
65         -DENABLE_DLOG=1
66
67 %build
68 cp %{SOURCE1} .
69 make %{?jobs:-j%jobs}
70
71 %check
72 (cd tests/unittest && LD_LIBRARY_PATH=../../ ctest -V)
73
74 %install
75 rm -rf %{buildroot}
76 %make_install
77
78 mkdir -p %{buildroot}/hal
79 mkdir -p %{buildroot}%{hal_rpmdb_checker_path}
80 install -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/ld.so.conf.d/libhal-api.conf
81 install -D -m 0755 %{SOURCE3} %{buildroot}%{_systemdgeneratordir}/systemd-hal-firmware-generator
82 install -D -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/rpm/macros.hal-api
83 install -D -m 0644 %{SOURCE5} %{buildroot}%{_unitdir}/haltest.target
84 install -D -m 0755 %{SOURCE6} %{buildroot}%{_bindir}/reboot-haltest
85 install -D -m 0755 %{SOURCE7} %{buildroot}%{_bindir}/reboot-normal
86 install -D -m 0644 %{SOURCE8} %{buildroot}%{_unitdir}/hal-rpmdb-checker.service
87 install -D -m 0755 %{SOURCE9} %{buildroot}%{_bindir}/hal-rpmdb-checker
88
89 %install_service sysinit.target.wants hal-rpmdb-checker.service
90
91 %clean
92 rm -rf %{buildroot}
93
94 %post -n %{test_name}
95 /sbin/ldconfig
96 chsmack -a "System" -t %{hal_rpmdb_checker_path}
97 systemd-tmpfiles /usr/lib/tmpfiles.d/hal-rpmdb-checker.conf --create
98
99 %postun
100 /sbin/ldconfig
101
102 ### contain files to package #########
103 %files  -n %{name}
104 %license LICENSE
105 %manifest %{name}.manifest
106 %defattr(-,root,root,-)
107 %dir /hal
108 %{_libdir}/hal/*.so*
109 %{_bindir}/lshal
110 %{_sysconfdir}/ld.so.conf.d/libhal-api.conf
111 %{_systemdgeneratordir}/systemd-hal-firmware-generator
112
113 %files  -n %{devel_name}
114 %defattr(-,root,root,-)
115 %{_includedir}/hal/*.h
116 %{_includedir}/halcc/*.h
117 %{_libdir}/pkgconfig/*.pc
118 %{_sysconfdir}/rpm/macros.hal-api
119
120 %files -n %{test_name}
121 %dir %{hal_rpmdb_checker_path}
122 %attr(0755,system_fw,system_fw) %{hal_rpmdb_checker_path}
123 %{_unitdir}/haltest.target
124 %{_bindir}/reboot-haltest
125 %{_bindir}/reboot-normal
126 %{_unitdir}/sysinit.target.wants/hal-rpmdb-checker.service
127 %{_unitdir}/hal-rpmdb-checker.service
128 %{_bindir}/hal-rpmdb-checker
129 /usr/lib/tmpfiles.d/hal-rpmdb-checker.conf