cad65cd0b2fb7d2917ec0fb8e03ae830b31b0d40
[framework/pim/libaccounts-svc.git] / packaging / libaccounts-svc.spec
1
2 Name:       libaccounts-svc
3 Summary:    Account DB library
4 Version:    0.2.41
5 Release:    1
6 Group:      TO_BE/FILLED_IN
7 License:    Apache-2.0
8 Source0:    libaccounts-svc-%{version}.tar.gz
9
10 BuildRequires:  cmake
11 BuildRequires:  pkgconfig(glib-2.0)
12 BuildRequires:  pkgconfig(dlog)
13 BuildRequires:  pkgconfig(db-util)
14 BuildRequires:  pkgconfig(capi-base-common)
15 BuildRequires:  pkgconfig(vconf)
16 BuildRequires:  pkgconfig(capi-appfw-application)
17 BuildRequires:  pkgconfig(libxml-2.0)
18 BuildRequires:  pkgconfig(pkgmgr-info)
19 BuildRequires:  pkgconfig(aul)
20 Requires(post): /sbin/ldconfig
21 Requires(post): /usr/bin/sqlite3
22 Requires(postun): /sbin/ldconfig
23
24 %description
25 Account DB libraryXB-Public-Package: no
26
27 %package devel
28 Summary:    Development files for %{name}
29 Group:      Development/Libraries
30 Requires:   %{name} = %{version}-%{release}
31 %description devel
32 Development files for %{name}
33
34 %prep
35 %setup -q
36
37 %build
38 export CFLAGS="${CFLAGS} -fPIC -fvisibility=hidden"
39 cmake . -DCMAKE_INSTALL_PREFIX=/usr
40
41 make %{?jobs:-j%jobs}
42
43 %install
44 rm -rf %{buildroot}
45 %make_install
46
47 rm -rf %{buildroot}/usr/lib/accounts-svc
48
49 %post
50 /sbin/ldconfig
51 if [ ! -d /opt/dbspace ]
52 then
53         mkdir -p /opt/dbspace
54 fi
55 if [ ! -f /opt/dbspace/.account.db ]
56 rm -rf /opt/dbspace/.account.db*
57 then
58         sqlite3 /opt/dbspace/.account.db 'PRAGMA journal_mode = PERSIST;
59         CREATE TABLE if not exists label (AppId TEXT, Label TEXT, Locale TEXT);
60         CREATE TABLE if not exists account_type (_id INTEGER PRIMARY KEY AUTOINCREMENT, AppId TEXT,
61         ServiceProviderId TEXT, IconPath TEXT, SmallIconPath TEXT, MultipleAccountSupport INT);
62         CREATE TABLE if not exists account_custom (AccountId INTEGER, AppId TEXT, Key TEXT, Value TEXT);
63         CREATE TABLE if not exists account (_id INTEGER PRIMARY KEY AUTOINCREMENT, user_name TEXT, email_address TEXT, display_name TEXT, icon_path TEXT,
64         source TEXT, package_name TEXT, access_token TEXT, domain_name TEXT, auth_type INTEGER, secret INTEGER, sync_support INTEGER,
65         txt_custom0 TEXT, txt_custom1 TEXT, txt_custom2 TEXT, txt_custom3 TEXT, txt_custom4 TEXT,
66         int_custom0 INTEGER, int_custom1 INTEGER, int_custom2 INTEGER, int_custom3 INTEGER, int_custom4 INTEGER);
67         CREATE TABLE if not exists capability (_id INTEGER PRIMARY KEY AUTOINCREMENT, key TEXT, value INTEGER,
68         package_name TEXT, user_name TEXT,  account_id INTEGER, FOREIGN KEY (account_id) REFERENCES account(_id));
69         CREATE TABLE if not exists provider_feature (app_id TEXT, key TEXT);'
70 fi
71
72 mkdir -p /opt/usr/share/account
73 chown 5000:5000 /opt/dbspace/.account.db
74 chown 5000:5000 /opt/dbspace/.account.db-journal
75 chown 5000:5000 /opt/usr/share/account
76
77 chmod 660 /opt/dbspace/.account.db
78 chmod 660 /opt/dbspace/.account.db-journal
79 chmod 755 /opt/usr/share/account
80
81 #set message key value to NULL
82 vconftool set -t string db/account/msg '' -g 6514
83
84 #smack labeling
85 if [ -f /usr/lib/rpm-plugins/msm.so ]
86 then
87         chsmack -a 'libaccounts-svc::db' /opt/dbspace/.account.db-journal
88         chsmack -a 'libaccounts-svc::db' /opt/dbspace/.account.db
89 fi
90
91 %postun -p /sbin/ldconfig
92
93 %files
94 %manifest libaccounts-svc.manifest
95 %defattr(-,root,root,-)
96 %{_libdir}/*.so.*
97 %{_bindir}/account-xml-verify
98
99 %files devel
100 %defattr(-,root,root,-)
101 %{_libdir}/*.so
102 %{_libdir}/pkgconfig/accounts-svc.pc
103 %{_includedir}/*.h
104 %{_bindir}/account-xml-verify