f2865e7afd1e1a17d2721d6ec4afe35e409306f6
[platform/core/telephony/tel-plugin-database.git] / packaging / tel-plugin-database.spec
1 %define major 0
2 %define minor 1
3 %define patchlevel 19
4
5 Name:           tel-plugin-database
6 Version:        %{major}.%{minor}.%{patchlevel}
7 Release:        1
8 License:        Apache-2.0
9 Summary:        Telephony DataBase storage plugin
10 Group:          System/Libraries
11 Source0:        tel-plugin-database-%{version}.tar.gz
12 BuildRequires:  cmake
13 BuildRequires:  pkgconfig(db-util)
14 BuildRequires:  pkgconfig(glib-2.0)
15 BuildRequires:  pkgconfig(tcore)
16 Requires(post): /sbin/ldconfig
17 Requires(postun): /sbin/ldconfig
18
19 %description
20 Telephony DataBase storage plugin
21
22 %prep
23 %setup -q
24
25 %build
26 versionint=$[%{major} * 1000000 + %{minor} * 1000 + %{patchlevel}]
27 cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
28         -DLIB_INSTALL_DIR=%{_libdir} \
29         -DVERSION=$versionint \
30 %if 0%{?sec_product_feature_telephony_cdma}
31     -DOPERATOR_CDMA=1 \
32 %endif
33
34 make %{?_smp_mflags}
35
36 %post
37 /sbin/ldconfig
38
39 mkdir -p /opt/dbspace
40
41 rm -f /opt/dbspace/.mcc_mnc_oper_list.db
42 sqlite3 /opt/dbspace/.mcc_mnc_oper_list.db < /tmp/mcc_mnc_oper_list.sql
43 rm -f /tmp/mcc_mnc_oper_list.sql
44
45 chmod 600 /opt/dbspace/.mcc_mnc_oper_list.db
46 chown system:system /opt/dbspace/.mcc_mnc_oper_list.db
47 chmod 644 /opt/dbspace/.mcc_mnc_oper_list.db-journal
48 chown system:system /opt/dbspace/.mcc_mnc_oper_list.db-journal
49 chsmack -a 'telephony_framework::db' /opt/dbspace/.mcc_mnc_oper_list.db*
50
51 %if 0%{?sec_product_feature_telephony_cdma}
52         rm -f /opt/dbspace/.mcc_sid_list.db
53         sqlite3 /opt/dbspace/.mcc_sid_list.db < /tmp/mcc_sid_list.sql
54         rm -f /tmp/mcc_sid_list.sql
55         chmod 600 /opt/dbspace/.mcc_sid_list.db
56         chown system:system /opt/dbspace/.mcc_mnc_oper_list.db
57         chmod 644 /opt/dbspace/.mcc_sid_list.db-journal
58         chown system:system /opt/dbspace/.mcc_mnc_oper_list.db-journal
59         chsmack -a 'telephony_framework::db' /opt/dbspace/.mcc_sid_list.db*
60 %endif
61
62 %postun -p /sbin/ldconfig
63
64 %install
65 %make_install
66 mkdir -p %{buildroot}%{_datadir}/license
67
68 %files
69 %defattr(644,system,system,-)
70 /tmp/mcc_mnc_oper_list.sql
71 %if 0%{?sec_product_feature_telephony_cdma}
72         /tmp/mcc_sid_list.sql
73 %endif
74 #%doc COPYING
75 %{_libdir}/telephony/plugins/db-plugin*
76 %{_datadir}/license/tel-plugin-database