Support wayland build
[platform/framework/web/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.40.1
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(com-core)
39 BuildRequires: pkgconfig(libxml-2.0)
40 BuildRequires: pkgconfig(pkgmgr)
41 BuildRequires: pkgconfig(livebox-service)
42 BuildRequires: pkgconfig(notification)
43 BuildRequires: pkgconfig(notification-service)
44 BuildRequires: pkgconfig(badge)
45 BuildRequires: pkgconfig(badge-service)
46 BuildRequires: pkgconfig(shortcut)
47 BuildRequires: pkgconfig(security-server)
48 Requires(post): sys-assert
49 Requires(post): dbus
50
51 %description
52 Manage the 2nd stage livebox service provider and communicate with the viewer application.
53 Keep trace on the life-cycle of the livebox and status of the service providers, viewer applications.
54
55 %prep
56 %setup -q
57 cp %{SOURCE1001} .
58
59 %build
60 %if 0%{?sec_build_binary_debug_enable}
61 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
62 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
63 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
64 %endif
65
66 export ENGINEER=false
67 %if 0%{?tizen_build_binary_release_type_eng}
68 export CFLAGS="${CFLAGS} -DTIZEN_ENGINEER_MODE"
69 export CXXFLAGS="${CXXFLAGS} -DTIZEN_ENGINEER_MODE"
70 export FFLAGS="${FFLAGS} -DTIZEN_ENGINEER_MODE"
71 export ENGINEER=true
72 %endif
73
74 %if 0%{?sec_product_feature_livebox_shm}
75 export LIVEBOX_SHM=baltic
76 %else
77 export LIVEBOX_SHM=private
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 %endif
88
89 %cmake . -DPRODUCT=${LIVEBOX_SHM} -DENGINEER_BINARY=${ENGINEER} -DWAYLAND_SUPPORT=${WAYLAND_SUPPORT} -DX11_SUPPORT=${X11_SUPPORT}
90
91 CFLAGS="${CFLAGS} -Wall -Winline -Werror" LDFLAGS="${LDFLAGS}" make %{?jobs:-j%jobs}
92
93 %install
94 rm -rf %{buildroot}
95 %make_install
96 mkdir -p %{buildroot}/%{_datarootdir}/license
97 mkdir -p %{buildroot}/opt/usr/share/live_magazine
98 mkdir -p %{buildroot}/opt/usr/share/live_magazine/log
99 mkdir -p %{buildroot}/opt/usr/share/live_magazine/reader
100 mkdir -p %{buildroot}/opt/usr/share/live_magazine/always
101 mkdir -p %{buildroot}/opt/usr/devel/usr/bin
102 mkdir -p %{buildroot}/opt/dbspace
103 #mkdir -p %{buildroot}/%{_sysconfdir}/rc.d/rc3.d
104 mkdir -p %{buildroot}%{_unitdir_user}/tizen-middleware.target.wants
105 mkdir -p %{buildroot}%{_unitdir_user}/sockets.target.wants
106 touch %{buildroot}/opt/dbspace/.livebox.db
107 touch %{buildroot}/opt/dbspace/.livebox.db-journal
108 #ln -sf %{_sysconfdir}/rc.d/init.d/data-provider-master %{buildroot}/%{_sysconfdir}/rc.d/rc3.d/S99data-provider-master
109 ln -sf %{_unitdir_user}/data-provider-master.service %{buildroot}%{_unitdir_user}/tizen-middleware.target.wants/data-provider-master.service
110 ln -sf %{_unitdir_user}/data-provider-master.socket %{buildroot}%{_unitdir_user}/sockets.target.wants/data-provider-master.socket
111 if [ ! -s %{buildroot}/opt/dbspace/.livebox.db ]; then
112 echo "LiveBox DB file is not exists, initiate it"
113 sqlite3 %{buildroot}/opt/dbspace/.livebox.db <<EOF
114 CREATE TABLE version ( version INTEGER );
115 CREATE TABLE box_size ( pkgid TEXT NOT NULL, size_type INTEGER, preview TEXT, touch_effect INTEGER, need_frame INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
116 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, mouse_event INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
117 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);
118 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);
119 CREATE TABLE i18n ( pkgid TEXT NOT NULL, lang TEXT COLLATE NOCASE, name TEXT, icon TEXT, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE);
120 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);
121 CREATE TABLE pkgmap ( pkgid TEXT PRIMARY KEY NOT NULL, appid TEXT, uiapp TEXT, prime INTEGER, category TEXT DEFAULT 'http://tizen.org/category/default' );
122 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);
123 EOF
124 fi
125
126 %pre
127 # Executing the stop script for stopping the service of installed provider (old version)
128 if [ -x %{_sysconfdir}/rc.d/init.d/data-provider-master ]; then
129         %{_sysconfdir}/rc.d/init.d/data-provider-master stop
130 fi
131
132 %post
133 chown 5000:5000 /opt/usr/share/live_magazine
134 chmod 750 /opt/usr/share/live_magazine
135 chown 5000:5000 /opt/usr/share/live_magazine/log
136 chmod 750 /opt/usr/share/live_magazine/log
137 chown 5000:5000 /opt/usr/share/live_magazine/reader
138 chmod 750 /opt/usr/share/live_magazine/reader
139 chown 5000:5000 /opt/usr/share/live_magazine/always
140 chmod 750 /opt/usr/share/live_magazine/always
141 chown 0:5000 /opt/dbspace/.livebox.db
142 chmod 640 /opt/dbspace/.livebox.db
143 chown 0:5000 /opt/dbspace/.livebox.db-journal
144 chmod 640 /opt/dbspace/.livebox.db-journal
145 vconftool set -t bool "memory/data-provider-master/started" 0 -i -u 5000 -f -s system::vconf_system
146 vconftool set -t int "memory/private/data-provider-master/restart_count" 0 -i -u 5000 -f -s data-provider-master
147 vconftool set -t string "db/data-provider-master/serveraddr" "/opt/usr/share/live_magazine/.client.socket" -i -u 5000 -f -s system::vconf_system
148 echo "Successfully installed. Please start a daemon again manually"
149 echo "%{_sysconfdir}/init.d/data-provider-master start"
150
151 %files -n data-provider-master
152 %manifest %{name}.manifest
153 %defattr(-,root,root,-)
154 %{_sysconfdir}/rc.d/init.d/data-provider-master
155 #%{_sysconfdir}/rc.d/rc3.d/S99data-provider-master
156 %{_bindir}/data-provider-master
157 %{_prefix}/etc/package-manager/parserlib/*
158 %{_datarootdir}/data-provider-master/*
159 %{_unitdir_user}/data-provider-master.service
160 %{_unitdir_user}/data-provider-master.socket
161 %{_unitdir_user}/tizen-middleware.target.wants/data-provider-master.service
162 %{_unitdir_user}/sockets.target.wants/data-provider-master.socket
163
164 %{_datarootdir}/license/*
165 /opt/usr/share/live_magazine/*
166 /opt/etc/dump.d/module.d/dump_livebox.sh
167 %if 0%{?tizen_build_binary_release_type_eng}
168 /opt/usr/devel/usr/bin/*
169 %endif
170 /opt/dbspace/.livebox.db
171 /opt/dbspace/.livebox.db-journal
172 /opt/etc/smack/accesses.d/*
173
174 # End of a file