adjust global DB path for owner user
[platform/core/account/account-manager.git] / packaging / account-manager.spec
1 Name:       account-manager
2 Summary:    Account Manager
3 Version:    0.1.10
4 Release:    1
5 Group:      Social & Content/Other
6 License:    Apache-2.0
7 Source0:    account-manager-%{version}.tar.gz
8 Source1:    org.tizen.account.manager.service
9 Source2:    org.tizen.account.manager.conf
10 Source3:    accounts-service.service
11
12 BuildRequires:  cmake
13 BuildRequires:  pkgconfig(dlog)
14 BuildRequires:  pkgconfig(db-util)
15 BuildRequires:  pkgconfig(capi-base-common)
16 BuildRequires:  pkgconfig(pkgmgr-info)
17 BuildRequires:  pkgconfig(glib-2.0) >= 2.26
18 BuildRequires:  pkgconfig(gio-2.0)
19 BuildRequires:  pkgconfig(vconf)
20 BuildRequires:  pkgconfig(cynara-client)
21 BuildRequires:  pkgconfig(cynara-session)
22 BuildRequires:  pkgconfig(cynara-creds-gdbus)
23 BuildRequires:  pkgconfig(account-common)
24 BuildRequires:  pkgconfig(libtzplatform-config)
25
26 %define upgrade_script_path /usr/share/upgrade/scripts
27
28 Requires(post): /sbin/ldconfig
29 Requires(post): /usr/bin/sqlite3
30 Requires(postun): /sbin/ldconfig
31
32 %description
33 Account Daemon: no
34
35 %prep
36 %setup -q
37 cp %{SOURCE1} .
38
39 %build
40 #export   CFLAGS+=" -Wextra -Wcast-align -Wcast-qual -Wshadow -Wwrite-strings -Wswitch-default"
41 #export CXXFLAGS+=" -Wextra -Wcast-align -Wcast-qual -Wshadow -Wwrite-strings -Wswitch-default -Wnon-virtual-dtor -Wno-c++0x-compat"
42 #export   CFLAGS+=" -Wno-unused-parameter -Wno-empty-body"
43 #export CXXFLAGS+=" -Wno-unused-parameter -Wno-empty-body"
44
45 #export   CFLAGS+=" -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-strict-aliasing -fno-unroll-loops -fsigned-char -fstrict-overflow -fno-common"
46 #export CXXFLAGS+=" -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-strict-aliasing -fno-unroll-loops -fsigned-char -fstrict-overflow"
47
48 export CFLAGS="${CFLAGS} -fvisibility=hidden -fPIE"
49 export LDFLAGS="${LDFLAGS} -pie"
50 cmake . -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=%{_libdir}
51
52 make %{?jobs:-j%jobs}
53
54 %install
55 rm -rf %{buildroot}
56 %make_install
57
58 rm -rf %{buildroot}/usr/lib/account-manager
59
60 mkdir -p %{buildroot}/usr/share/dbus-1/system-services
61 install -m 0644 %SOURCE1 %{buildroot}/usr/share/dbus-1/system-services/org.tizen.account.manager.service
62
63 mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d
64 install -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/dbus-1/system.d/
65
66 mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants
67 install -m 644 %SOURCE3 %{buildroot}%{_unitdir}/accounts-service.service
68 %install_service multi-user.target.wants accounts-service.service
69
70 mkdir -p %{buildroot}%{upgrade_script_path}
71 cp -f scripts/%{name}-upgrade.sh %{buildroot}%{upgrade_script_path}
72
73
74 %post
75 /sbin/ldconfig
76 #if [ ! -d /opt/usr/dbspace ]
77 #then
78 #        mkdir -p /opt/usr/dbspace
79 #fi
80 mkdir -p %{TZ_SYS_DB}
81 if [ ! -f %{TZ_SYS_DB}/.account.db ]
82 then
83         sqlite3 %{TZ_SYS_DB}/.account.db 'PRAGMA journal_mode = PERSIST;
84         CREATE TABLE if not exists label (AppId TEXT, Label TEXT, Locale TEXT);
85         CREATE TABLE if not exists account_type (_id INTEGER PRIMARY KEY AUTOINCREMENT, AppId TEXT,
86         ServiceProviderId TEXT, IconPath TEXT, SmallIconPath TEXT, MultipleAccountSupport INT);
87         CREATE TABLE if not exists account_custom (AccountId INTEGER, AppId TEXT, Key TEXT, Value TEXT);
88         CREATE TABLE if not exists account (_id INTEGER PRIMARY KEY AUTOINCREMENT, user_name TEXT, email_address TEXT, display_name TEXT, icon_path TEXT,
89         source TEXT, package_name TEXT, access_token TEXT, domain_name TEXT, auth_type INTEGER, secret INTEGER, sync_support INTEGER,
90         txt_custom0 TEXT, txt_custom1 TEXT, txt_custom2 TEXT, txt_custom3 TEXT, txt_custom4 TEXT,
91         int_custom0 INTEGER, int_custom1 INTEGER, int_custom2 INTEGER, int_custom3 INTEGER, int_custom4 INTEGER);
92         CREATE TABLE if not exists capability (_id INTEGER PRIMARY KEY AUTOINCREMENT, key TEXT, value INTEGER,
93         package_name TEXT, user_name TEXT,  account_id INTEGER, FOREIGN KEY (account_id) REFERENCES account(_id));
94         CREATE TABLE if not exists provider_feature (app_id TEXT, key TEXT);
95 '
96 fi
97
98 chown service_fw:service_fw %{TZ_SYS_DB}/.account.db
99 chown service_fw:service_fw %{TZ_SYS_DB}/.account.db-journal
100
101 chmod 644 %{TZ_SYS_DB}/.account.db
102 chmod 644 %{TZ_SYS_DB}/.account.db-journal
103
104 #smack labeling
105 #chsmack -a 'System::Shared' %{TZ_SYS_DB}/.account.db-journal
106 #chsmack -a 'System::Shared' %{TZ_SYS_DB}/.account.db
107 %postun -p /sbin/ldconfig
108
109
110 %files
111 %manifest account-svcd.manifest
112 #%defattr(-,system,system,-)
113 %config %{_sysconfdir}/dbus-1/system.d/org.tizen.account.manager.conf
114 %{_bindir}/account-svcd
115 %attr(0644,root,root) %{_unitdir}/accounts-service.service
116 %attr(0644,root,root) %{_unitdir}/multi-user.target.wants/accounts-service.service
117 %attr(0644,root,root) /usr/share/dbus-1/system-services/org.tizen.account.manager.service
118 %{upgrade_script_path}/%{name}-upgrade.sh
119