ad79dc6eebc5796699ca07fc5793c9ea2e67e461
[apps/livebox/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 liveboxes
5 Version: 0.43.2
6 Release: 1
7 Group: HomeTF/Livebox
8 License: Flora
9 Source0: %{name}-%{version}.tar.gz
10 Source1001: %{name}.manifest
11 BuildRequires: cmake, gettext-tools, smack, coreutils
12 BuildRequires: pkgconfig(ail)
13 BuildRequires: pkgconfig(dlog)
14 BuildRequires: pkgconfig(aul)
15 BuildRequires: pkgconfig(vconf)
16 BuildRequires: pkgconfig(sqlite3)
17 BuildRequires: pkgconfig(db-util)
18 BuildRequires: pkgconfig(glib-2.0)
19 BuildRequires: pkgconfig(gio-2.0)
20 BuildRequires: pkgconfig(libsmack)
21 BuildRequires: pkgconfig(bundle)
22
23 %if %{with wayland}
24 BuildRequires: pkgconfig(ecore-wayland)
25 %else
26 BuildRequires: pkgconfig(ecore-x)
27 BuildRequires: pkgconfig(x11)
28 BuildRequires: pkgconfig(libdri2)
29 BuildRequires: pkgconfig(libdrm)
30 BuildRequires: pkgconfig(libtbm)
31 BuildRequires: pkgconfig(xfixes)
32 BuildRequires: pkgconfig(dri2proto)
33 BuildRequires: pkgconfig(xext)
34 BuildRequires: pkgconfig(xdamage)
35 %endif
36
37 BuildRequires: pkgconfig(ecore)
38 BuildRequires: pkgconfig(eina)
39 BuildRequires: pkgconfig(com-core)
40 BuildRequires: pkgconfig(libxml-2.0)
41 BuildRequires: pkgconfig(pkgmgr)
42
43 %if "%{sec_product_feature_livebox}" != "0"
44 BuildRequires: pkgconfig(livebox-service)
45 %endif
46
47 BuildRequires: pkgconfig(notification)
48 BuildRequires: pkgconfig(notification-service)
49 BuildRequires: pkgconfig(badge)
50 BuildRequires: pkgconfig(badge-service)
51 BuildRequires: pkgconfig(shortcut)
52 BuildRequires: pkgconfig(security-server)
53 BuildRequires: pkgconfig(libsystemd-daemon)
54 Requires(post): sys-assert
55 Requires(post): dbus
56
57 %description
58 Manage the 2nd stage livebox service provider and communicate with the viewer application.
59 Keep trace on the life-cycle of the livebox and status of the service providers, viewer applications.
60
61 %prep
62 %setup -q
63 cp %{SOURCE1001} .
64
65 %build
66 %if 0%{?sec_build_binary_debug_enable}
67 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
68 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
69 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
70 %endif
71
72 export ENGINEER=false
73 %if 0%{?tizen_build_binary_release_type_eng}
74 export CFLAGS="${CFLAGS} -DTIZEN_ENGINEER_MODE"
75 export CXXFLAGS="${CXXFLAGS} -DTIZEN_ENGINEER_MODE"
76 export FFLAGS="${FFLAGS} -DTIZEN_ENGINEER_MODE"
77 export ENGINEER=true
78 %endif
79
80 %if %{with wayland}
81 export WAYLAND_SUPPORT=On
82 export X11_SUPPORT=Off
83 export LIVEBOX_SHM=wayland
84 %else
85 export WAYLAND_SUPPORT=Off
86 export X11_SUPPORT=On
87 export LIVEBOX_SHM=x11
88 %endif
89
90 %if "%{_repository}" == "wearable"
91 export LIVEBOX_SHM="${LIVEBOX_SHM}.wearable"
92 export MOBILE=Off
93 export WEARABLE=On
94 %else
95 export LIVEBOX_SHM="${LIVEBOX_SHM}.mobile"
96 export MOBILE=On
97 export WEARABLE=Off
98 %endif
99
100 %if "%{sec_product_feature_livebox}" == "0"
101 export LIVEBOX=Off
102 %else
103 export LIVEBOX=On
104 %endif
105
106 %cmake . -DPRODUCT=${LIVEBOX_SHM} -DENGINEER_BINARY=${ENGINEER} -DWAYLAND_SUPPORT=${WAYLAND_SUPPORT} -DX11_SUPPORT=${X11_SUPPORT} -DMOBILE=${MOBILE} -DWEARABLE=${WEARABLE} -DLIVEBOX=${LIVEBOX}
107
108 CFLAGS="${CFLAGS} -Wall -Winline -Werror" LDFLAGS="${LDFLAGS}" make %{?jobs:-j%jobs}
109
110 %install
111 rm -rf %{buildroot}
112 %make_install
113 mkdir -p %{buildroot}/%{_datarootdir}/license
114 %if "%{_repository}" == "wearable"
115 mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants
116 ln -sf ../data-provider-master.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/data-provider-master.service
117 %else
118 mkdir -p %{buildroot}/%{_libdir}/systemd/user/tizen-middleware.target.wants
119 ln -sf %{_libdir}/systemd/user/data-provider-master.service %{buildroot}/%{_libdir}/systemd/user/tizen-middleware.target.wants/data-provider-master.service
120 %endif
121
122 %if "%{sec_product_feature_livebox}" == "0"
123 # Nothing provides
124 %else
125 mkdir -p %{buildroot}/opt/usr/share/live_magazine
126 mkdir -p %{buildroot}/opt/usr/share/live_magazine/log
127 mkdir -p %{buildroot}/opt/usr/share/live_magazine/reader
128 mkdir -p %{buildroot}/opt/usr/share/live_magazine/always
129 mkdir -p %{buildroot}/opt/usr/devel/usr/bin
130 mkdir -p %{buildroot}/opt/dbspace
131 touch %{buildroot}/opt/dbspace/.livebox.db
132 touch %{buildroot}/opt/dbspace/.livebox.db-journal
133 if [ ! -s %{buildroot}/opt/dbspace/.livebox.db ]; then
134 echo "LiveBox DB file is not exists, initiate it"
135 sqlite3 %{buildroot}/opt/dbspace/.livebox.db <<EOF
136 CREATE TABLE version ( version INTEGER );
137 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);
138 CREATE TABLE client (pkgid TEXT PRIMARY KEY NOT NULL, icon TEXT, name TEXT, auto_launch TEXT, pd_size TEXT, content TEXT, nodisplay INTEGER, setup TEXT, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
139 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);
140 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);
141 CREATE TABLE i18n ( pkgid TEXT NOT NULL, lang TEXT COLLATE NOCASE, name TEXT, icon TEXT, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
142 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);
143 CREATE TABLE pkgmap ( pkgid TEXT PRIMARY KEY NOT NULL, appid TEXT, uiapp TEXT, prime INTEGER, category TEXT DEFAULT 'http://tizen.org/category/default' );
144 CREATE TABLE provider ( pkgid TEXT PRIMARY KEY NOT NULL, network INTEGER, abi TEXT, secured INTEGER, box_type INTEGER, box_src TEXT, box_group TEXT, pd_type INTEGER, pd_src TEXT, pd_group TEXT, libexec TEXT, timeout INTEGER, period TEXT, script TEXT, pinup INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
145 EOF
146 fi
147 %endif
148
149 %pre
150 # Executing the stop script for stopping the service of installed provider (old version)
151 if [ -x %{_sysconfdir}/rc.d/init.d/data-provider-master ]; then
152         %{_sysconfdir}/rc.d/init.d/data-provider-master stop
153 fi
154
155 %post
156 %if "%{sec_product_feature_livebox}" == "0"
157 #Nothing provides
158 %else
159 chown 5000:5000 /opt/usr/share/live_magazine
160 chmod 750 /opt/usr/share/live_magazine
161 chown 5000:5000 /opt/usr/share/live_magazine/log
162 chmod 750 /opt/usr/share/live_magazine/log
163 chown 5000:5000 /opt/usr/share/live_magazine/reader
164 chmod 750 /opt/usr/share/live_magazine/reader
165 chown 5000:5000 /opt/usr/share/live_magazine/always
166 chmod 750 /opt/usr/share/live_magazine/always
167 chown 0:5000 /opt/dbspace/.livebox.db
168 chmod 640 /opt/dbspace/.livebox.db
169 chown 0:5000 /opt/dbspace/.livebox.db-journal
170 chmod 640 /opt/dbspace/.livebox.db-journal
171 %endif
172 vconftool set -t bool "memory/data-provider-master/started" 0 -i -u 5000 -f -s system::vconf_system
173 vconftool set -t int "memory/private/data-provider-master/restart_count" 0 -i -u 5000 -f -s data-provider-master
174 vconftool set -t string "db/data-provider-master/serveraddr" "/opt/usr/share/live_magazine/.client.socket" -i -u 5000 -f -s system::vconf_system
175 echo "Successfully installed. Please start a daemon again manually"
176 echo "%{_sysconfdir}/init.d/data-provider-master start"
177
178 %files -n data-provider-master
179 %manifest %{name}.manifest
180 %defattr(-,root,root,-)
181 %{_bindir}/data-provider-master
182 %if "%{_repository}" == "wearable"
183 %{_libdir}/systemd/system/multi-user.target.wants/data-provider-master.service
184 %{_libdir}/systemd/system/data-provider-master.service
185 /opt/etc/dump.d/module.d/dump_livebox.sh
186 %else
187 %{_libdir}/systemd/user/data-provider-master.service
188 %{_libdir}/systemd/user/tizen-middleware.target.wants/data-provider-master.service
189 /opt/etc/smack/accesses.d
190 %endif
191 %{_datarootdir}/license/*
192 %if "%{sec_product_feature_livebox}" == "0"
193 # Nothing provides
194 %else
195 %if 0%{?tizen_build_binary_release_type_eng}
196 /opt/usr/devel/usr/bin/*
197 %endif
198 %{_prefix}/etc/package-manager/parserlib/*
199 %{_datarootdir}/data-provider-master/*
200 /opt/usr/share/live_magazine/*
201 /opt/dbspace/.livebox.db
202 /opt/dbspace/.livebox.db-journal
203 %endif
204
205 # End of a file