Tizen 2.4 SDK Rev6 Release
[apps/widget/data-provider-master.git] / packaging / data-provider-master.spec
1 %bcond_with wayland
2
3 Name: data-provider-master
4 Summary: Master service provider for widgetes
5 Version: 1.2.0
6 Release: 1
7 Group: Applications/Core Applications
8 License: Flora-1.1
9 Source0: %{name}-%{version}.tar.gz
10 Source1001: %{name}.manifest
11 BuildRequires: cmake, gettext-tools, smack, coreutils
12 BuildRequires: pkgconfig(dlog)
13 BuildRequires: pkgconfig(aul)
14 BuildRequires: pkgconfig(vconf)
15 BuildRequires: pkgconfig(sqlite3)
16 BuildRequires: pkgconfig(db-util)
17 BuildRequires: pkgconfig(glib-2.0)
18 BuildRequires: pkgconfig(gio-2.0)
19 BuildRequires: pkgconfig(libsmack)
20 BuildRequires: pkgconfig(bundle)
21 BuildRequires: pkgconfig(capi-appfw-app-manager)
22
23 %if %{with wayland}
24 BuildRequires: pkgconfig(ecore-wayland)
25 %else
26 BuildRequires: pkgconfig(ecore-x)
27 BuildRequires: pkgconfig(x11)
28 BuildRequires: pkgconfig(xfixes)
29 BuildRequires: pkgconfig(xext)
30 BuildRequires: pkgconfig(libdri2)
31 BuildRequires: pkgconfig(xdamage)
32 BuildRequires: pkgconfig(dri2proto)
33 %endif
34
35 BuildRequires: pkgconfig(libtbm)
36 BuildRequires: pkgconfig(ecore)
37 BuildRequires: pkgconfig(eina)
38 BuildRequires: pkgconfig(com-core)
39 BuildRequires: pkgconfig(libxml-2.0)
40 BuildRequires: pkgconfig(pkgmgr)
41 BuildRequires: pkgconfig(pkgmgr-info)
42 BuildRequires: pkgconfig(widget_service)
43 BuildRequires: pkgconfig(notification)
44 BuildRequires: pkgconfig(notification-service)
45 BuildRequires: pkgconfig(badge)
46 BuildRequires: pkgconfig(badge-service)
47 BuildRequires: pkgconfig(shortcut)
48 BuildRequires: pkgconfig(security-server)
49 BuildRequires: pkgconfig(libsystemd-daemon)
50 Requires(post): sys-assert
51 Requires(post): dbus
52
53 %description
54 Manage the 2nd stage widget service provider and communicate with the viewer application.
55 Keep trace on the life-cycle of the widget and status of the service providers, viewer applications.
56
57 %prep
58 %setup -q
59 cp %{SOURCE1001} .
60
61 %build
62 %if 0%{?sec_build_binary_debug_enable}
63 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
64 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
65 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
66 %endif
67
68 export ENGINEER=false
69 %if 0%{?tizen_build_binary_release_type_eng}
70 export CFLAGS="${CFLAGS} -DTIZEN_ENGINEER_MODE"
71 export CXXFLAGS="${CXXFLAGS} -DTIZEN_ENGINEER_MODE"
72 export FFLAGS="${FFLAGS} -DTIZEN_ENGINEER_MODE"
73 export ENGINEER=true
74 %endif
75
76 %if %{with wayland}
77 export WAYLAND_SUPPORT=On
78 export X11_SUPPORT=Off
79 export LIVEBOX_SHM=wayland
80 %else
81 export WAYLAND_SUPPORT=Off
82 export X11_SUPPORT=On
83 export LIVEBOX_SHM=x11
84 %endif
85
86 %if "%{_repository}" == "wearable"
87 export LIVEBOX_SHM="${LIVEBOX_SHM}.wearable"
88 export MOBILE=Off
89 export WEARABLE=On
90 %else
91 export LIVEBOX_SHM="${LIVEBOX_SHM}.mobile"
92 export MOBILE=On
93 export WEARABLE=Off
94 %endif
95
96 export LIVEBOX_SHM="${LIVEBOX_SHM}.480x800"
97 export LIVEBOX=On
98
99 %ifarch %ix86
100 export TARGET=emulator
101 %else
102 export TARGET=device
103 %endif
104
105 %cmake . -DNAME=%{name} -DPRODUCT=${LIVEBOX_SHM} -DENGINEER_BINARY=${ENGINEER} -DWAYLAND_SUPPORT=${WAYLAND_SUPPORT} -DX11_SUPPORT=${X11_SUPPORT} -DMOBILE=${MOBILE} -DWEARABLE=${WEARABLE} -DLIVEBOX=${LIVEBOX} -DTARGET=${TARGET}
106
107 CFLAGS="${CFLAGS} -Wall -Winline -Werror" LDFLAGS="${LDFLAGS}" make %{?jobs:-j%jobs}
108
109 %install
110 rm -rf %{buildroot}
111 %make_install
112 mkdir -p %{buildroot}/%{_datarootdir}/license
113 mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants
114 ln -sf ../%{name}.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/%{name}.service
115 mkdir -p %{buildroot}/opt/usr/share/live_magazine
116 mkdir -p %{buildroot}/opt/usr/share/live_magazine/log
117 mkdir -p %{buildroot}/opt/usr/share/live_magazine/reader
118 mkdir -p %{buildroot}/opt/usr/share/live_magazine/always
119 mkdir -p %{buildroot}/opt/usr/devel/usr/bin
120 mkdir -p %{buildroot}/opt/dbspace
121
122 echo "widget DB file is not exists, initiate it"
123 sqlite3 %{buildroot}/opt/dbspace/.widget.db-new <<EOF
124 CREATE TABLE version ( version INTEGER );
125 CREATE TABLE box_size ( pkgid TEXT NOT NULL, size_type INTEGER, preview TEXT, touch_effect INTEGER, need_frame INTEGER, mouse_event INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
126 CREATE TABLE client (pkgid TEXT PRIMARY KEY NOT NULL, icon TEXT, name TEXT, auto_launch TEXT, gbar_size TEXT, content TEXT, nodisplay INTEGER, setup TEXT, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
127 CREATE TABLE groupinfo ( id INTEGER PRIMARY KEY AUTOINCREMENT, cluster TEXT NOT NULL, category TEXT NOT NULL, pkgid TEXT NOT NULL, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
128 CREATE TABLE groupmap (option_id INTEGER PRIMARY KEY AUTOINCREMENT, id INTEGER, pkgid TEXT NOT NULL, ctx_item TEXT NOT NULL, FOREIGN KEY(id) REFERENCES groupinfo(id), FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
129 CREATE TABLE i18n ( pkgid TEXT NOT NULL, lang TEXT COLLATE NOCASE, name TEXT, icon TEXT, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
130 CREATE TABLE option ( pkgid TEXT NOT NULL, option_id INTEGER, key TEXT NOT NULL, value TEXT NOT NULL, FOREIGN KEY(option_id) REFERENCES groupmap(option_id), FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
131 CREATE TABLE pkgmap ( pkgid TEXT PRIMARY KEY NOT NULL, appid TEXT, uiapp TEXT, prime INTEGER, category TEXT DEFAULT 'http://tizen.org/category/default' );
132 CREATE TABLE provider ( pkgid TEXT PRIMARY KEY NOT NULL, network INTEGER, abi TEXT, secured INTEGER, box_type INTEGER, box_src TEXT, box_group TEXT, gbar_type INTEGER, gbar_src TEXT, gbar_group TEXT, libexec TEXT, timeout INTEGER, period TEXT, script TEXT, pinup INTEGER, count INTEGER, direct_input INTEGER DEFAULT 0, hw_acceleration TEXT DEFAULT '', FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
133 EOF
134
135 %pre
136 # Executing the stop script for stopping the service of installed provider (old version)
137 if [ -x %{_sysconfdir}/rc.d/init.d/%{name} ]; then
138         %{_sysconfdir}/rc.d/init.d/%{name} stop
139 fi
140
141 %post
142 #
143 # NOTE:
144 # This SYSTEM_UID should be updated properly.
145 # In the SPIN, system user id is 1000
146 SYSTEM_UID=1000
147 APP_UID=5000
148 APP_GID=5000
149
150 if [ ! -s /opt/dbspace/.widget.db ]; then
151         echo "DB is not exists"
152         mv /opt/dbspace/.widget.db-new /opt/dbspace/.widget.db
153         mv /opt/dbspace/.widget.db-new-journal /opt/dbspace/.widget.db-journal
154 else
155         VERSION=`sqlite3 /opt/dbspace/.widget.db "SELECT * FROM version"`
156         echo "DB is already exists (Version: $VERSION)"
157         echo "==============================================="
158         sqlite3 /opt/dbspace/.widget.db "SELECT * FROM pkgmap"
159         echo "==============================================="
160         rm -rf /opt/dbspace/.widget.db-new
161         rm -rf /opt/dbspace/.widget.db-new-journal
162 fi
163
164 chown ${APP_UID}:${APP_GID} /opt/usr/share/live_magazine
165 # System tool(widget-mgr) should be able to access this folder.
166 # So give the "rx" permission to the other group. (750 -> 755)
167 chmod 755 /opt/usr/share/live_magazine
168 chown ${APP_UID}:${APP_GID} /opt/usr/share/live_magazine/log
169 chmod 750 /opt/usr/share/live_magazine/log
170 chown ${APP_UID}:${APP_GID} /opt/usr/share/live_magazine/reader
171 chmod 750 /opt/usr/share/live_magazine/reader
172 chown ${APP_UID}:${APP_GID} /opt/usr/share/live_magazine/always
173 chmod 750 /opt/usr/share/live_magazine/always
174 chown ${SYSTEM}:${APP_GID} /opt/dbspace/.widget.db
175 chmod 640 /opt/dbspace/.widget.db
176 chown ${SYSTEM}:${APP_GID} /opt/dbspace/.widget.db-journal
177 chmod 640 /opt/dbspace/.widget.db-journal
178
179 chsmack -a 'data-provider-master::db' /opt/dbspace/.widget.db
180 chsmack -a 'data-provider-master::db' /opt/dbspace/.widget.db-journal
181
182 vconftool set -t bool "memory/%{name}/started" 0 -i -u ${APP_UID} -f -s system::vconf_system
183 vconftool set -t int "memory/private/%{name}/restart_count" 0 -i -u ${APP_UID} -f -s %{name}
184 vconftool set -t string "db/%{name}/serveraddr" "/tmp/.data-provider-master-client.socket" -i -u ${APP_UID} -f -s system::vconf_system
185
186 echo "Successfully installed. Please start a daemon again manually"
187
188 %files -n %{name}
189 %manifest %{name}.manifest
190 %defattr(-,system,system,-)
191 %caps(cap_chown,cap_dac_override,cap_dac_read_search,cap_sys_admin,cap_sys_nice,cap_mac_override+ep) %{_bindir}/%{name}
192 %{_libdir}/systemd/system/multi-user.target.wants/%{name}.service
193 %{_libdir}/systemd/system/%{name}.service
194 %{_libdir}/systemd/system/%{name}.target
195 %{_libdir}/systemd/system/%{name}-client.socket
196 %{_libdir}/systemd/system/%{name}-provider.socket
197 %{_libdir}/systemd/system/%{name}-service.socket
198 %{_libdir}/systemd/system/%{name}-badge.socket
199 %{_libdir}/systemd/system/%{name}-notification.socket
200 %{_libdir}/systemd/system/%{name}-shortcut.socket
201 %{_libdir}/systemd/system/%{name}-utility.socket
202 %{_libdir}/systemd/system/%{name}-fd.socket
203 %{_datarootdir}/license/*
204 %if 0%{?tizen_build_binary_release_type_eng}
205 /opt/usr/devel/usr/bin/*
206 %endif
207 %{_prefix}/etc/package-manager/parserlib/*
208 %{_datarootdir}/%{name}/*
209 /opt/etc/dump.d/module.d/dump_widget.sh
210 /opt/usr/share/live_magazine/*
211 /opt/dbspace/.widget.db*
212 %{_sysconfdir}/smack/accesses.d/%{name}
213
214 # End of a file