summaryrefslogtreecommitdiff
path: root/packaging/capi-system-info.spec
blob: 18f85bb302a806086ecae953d67e896e38702e20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
Name:           capi-system-info
Version:        0.5.2
Release:        1
License:        Apache-2.0
Summary:        A System Information library in Core API
Group:          System/API
Source0:        %{name}-%{version}.tar.gz
Source1001:     %{name}.manifest
BuildRequires:  cmake
BuildRequires:  pkgconfig(capi-base-common)
BuildRequires:  pkgconfig(dlog)
BuildRequires:  pkgconfig(iniparser)
BuildRequires:  pkgconfig(libxml-2.0)
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(libtzplatform-config)
BuildRequires:  pkgconfig(uuid)
BuildRequires:  pkgconfig(libsyscommon)
BuildRequires:  glibc-devel-static
Requires: security-config

%description

%package devel
Summary:  A System Information library in Core API (Development)
Group:    Development/System
Requires: %{name} = %{version}-%{release}

%description devel

%package test
Summary:  System-info test package
Group:    Development/System
Requires: %{name}

%description test
A System Information test tool

%package tool
Summary:  System-info command line tool package
Group:    Development/System
Requires: %{name}

%description tool
A System Information command line tool

%if 0%{?gcov:1}
%package -n system-info-gcov
Summary:  A System Information gcov test file
%description -n system-info-gcov
gcno files for System-info line coverage test
%endif


%prep
%setup -q
cp %{SOURCE1001} .

%define info_file_path /etc/info.ini
%define sysinfo_shared_path %{TZ_SYS_ETC}/sysinfo
%define tizen_id_path %{sysinfo_shared_path}/tizenid

%define model_config_ro_path %{_sysconfdir}/config/model-config.xml
%define db_ro_path %{TZ_SYS_RO_ETC}/system_info_db
%define hal_db_ro_path %{_hal_prefix}/etc/system_info_db
%define model_config_rw_dir /opt/system/model-config
%define db_rw_path %{model_config_rw_dir}/system_info_db

%define plugin_dir %{_libdir}

%build
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`

%cmake . -DMODEL_CONFIG_RO_PATH=%{model_config_ro_path} \
         -DINFO_FILE_PATH=%{info_file_path} \
	     -DMAJORVER=${MAJORVER} \
	     -DFULLVER=%{version} \
	     -DTIZEN_ID_PATH=%{tizen_id_path} \
	     -DDB_RO_PATH=%{db_ro_path} \
	     -DDB_RW_PATH=%{db_rw_path}	\
	     -DHAL_DB_RO_PATH=%{hal_db_ro_path} \
	     -DPLUGIN_DIR=%{plugin_dir} \
	     -DGCOV=%{?gcov:1}%{!?gcov:0}

%__make %{?_smp_mflags}

%if 0%{?gcov:1}
mkdir -p gcov-obj
find . -name '*.gcno' -exec cp '{}' gcov-obj ';'
%endif


%install
%make_install
mkdir -p %{buildroot}/etc
cp -f script/make_info_file.sh %{buildroot}/etc/make_info_file.sh

%install_service sysinit.target.wants tizenid.service

mkdir -p %{buildroot}/%{sysinfo_shared_path}
mkdir -p %{buildroot}/%{model_config_rw_dir}

%if 0%{?gcov:1}
mkdir -p %{buildroot}%{_datadir}/gcov/obj
install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
%endif


%posttrans
/usr/bin/chsmack -a "System::Shared" -t %{sysinfo_shared_path}
/usr/bin/chsmack -a "System::Shared" -t %{model_config_rw_dir}
/usr/bin/system_info_init_db
/sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%manifest %{name}.manifest
%license LICENSE
%{_libdir}/libcapi-system-info.so.*
%attr(0744,root,-) /etc/make_info_file.sh
%{_bindir}/system_info_init_db

%attr(0775,root,system_share) %dir %{model_config_rw_dir}
#tizenid
%attr(0775,root,system_share) %dir %{sysinfo_shared_path}
%{_bindir}/tizen_id

%{_unitdir}/tizenid.service
%{_unitdir}/sysinit.target.wants/tizenid.service

%files devel
%manifest %{name}.manifest
%{_includedir}/system/system_info.h
%{_includedir}/system/system_info_type.h
%{_includedir}/plugin/system_info_intf.h
%{_libdir}/pkgconfig/*.pc
%{_libdir}/libcapi-system-info.so

%files test
# Init DB test
%{_bindir}/system_info_init_db_test
# Plugin test
%attr(0755,root,-) %{_bindir}/system_info_external_plugin_test.sh
%{_libdir}/libsystem_info_plugins/libsystem_info_test_plugin.so
%{_libdir}/libsystem_info_plugins/libsystem_info_test_plugin2.so

%if 0%{?gcov:1}
%files -n system-info-gcov
%{_datadir}/gcov/obj/*
%endif

%files tool
%{_bindir}/system-info-tool