Add build Option for multi-user support
[platform/framework/web/wrt.git] / packaging / wrt.spec
1 %bcond_with wayland
2 %bcond_with decrypt
3 %bcond_with multi_user
4
5 Name:       wrt
6 Summary:    Web runtime
7 Version:    0.8.198.3
8 Release:    1
9 Group:      Development/Libraries
10 License:    Apache-2.0
11 URL:        N/A
12 Source0:    %{name}-%{version}.tar.gz
13 ## wrt-launchpad-daemon #######################################################
14 ### systemd service for mono-user mode
15 Source101:  wrt_launchpad_daemon@.service
16 ### systemd service for multi-user mode
17 Source102:  wrt_launchpad_daemon_user.service
18 Source1001:     wrt.manifest
19 ###############################################################################
20
21 BuildRequires:  cmake
22 BuildRequires:  gettext
23 BuildRequires:  edje-tools
24 BuildRequires:  pkgconfig(aul)
25 BuildRequires:  pkgconfig(glib-2.0)
26 BuildRequires:  pkgconfig(ewebkit2)
27 BuildRequires:  pkgconfig(appcore-efl)
28 BuildRequires:  pkgconfig(openssl)
29 BuildRequires:  pkgconfig(cert-svc)
30 BuildRequires:  pkgconfig(dpl-efl)
31 BuildRequires:  pkgconfig(libpcrecpp)
32 BuildRequires:  pkgconfig(ecore)
33 BuildRequires:  pkgconfig(eina)
34 BuildRequires:  pkgconfig(ui-gadget-1)
35 BuildRequires:  pkgconfig(utilX)
36 BuildRequires:  pkgconfig(secure-storage)
37 BuildRequires:  pkgconfig(pkgmgr)
38 BuildRequires:  pkgconfig(libiri)
39 BuildRequires:  pkgconfig(appsvc)
40 BuildRequires:  pkgconfig(cert-svc-vcore)
41 BuildRequires:  pkgconfig(libsoup-2.4)
42 BuildRequires:  pkgconfig(security-core)
43 BuildRequires:  pkgconfig(security-client)
44 BuildRequires:  pkgconfig(notification)
45 BuildRequires:  pkgconfig(libprivilege-control)
46 BuildRequires:  pkgconfig(capi-appfw-app-manager)
47 BuildRequires:  pkgconfig(haptic)
48 BuildRequires:  pkgconfig(capi-web-url-download)
49 BuildRequires:  pkgconfig(wrt-plugin-loading)
50 BuildRequires:  pkgconfig(wrt-plugin-js-overlay)
51 BuildRequires:  pkgconfig(dpl-encryption)
52 BuildRequires:  pkgconfig(wrt-popup-wrt-runner)
53 BuildRequires:  pkgconfig(wrt-popup-ace-runner)
54 BuildRequires:  pkgconfig(sysman)
55 BuildRequires:  pkgconfig(app2sd)
56 BuildRequires:  pkgconfig(capi-system-system-settings)
57 %if %{with decrypt}
58 BuildRequires:  pkgconfig(osp-appfw)
59 BuildRequires:  osp-appfw-internal-devel
60 Requires: osp-appfw
61 %endif
62 Requires(post): /sbin/ldconfig
63 Requires(postun): /sbin/ldconfig
64
65 ## wrt-launchpad-daemon #######################################################
66 BuildRequires:  pkgconfig(app-checker)
67 BuildRequires:  pkgconfig(bundle)
68 BuildRequires:  pkgconfig(dlog)
69 BuildRequires:  pkgconfig(dbus-glib-1)
70 BuildRequires:  pkgconfig(libsmack)
71 BuildRequires:  pkgconfig(sqlite3)
72 BuildRequires:  pkgconfig(x11)
73 BuildRequires:  pkgconfig(aul)
74 ###############################################################################
75
76 %description
77 web runtime
78
79 %package devel
80 Summary:    Wrt header files for external modules
81 Group:      Development/Libraries
82 Requires:   %{name} = %{version}
83
84 %description devel
85 wrt library development headers
86
87 %prep
88 %setup -q
89 cp %{SOURCE1001} .
90
91 %define with_tests 0
92 %if "%{WITH_TESTS}" == "ON" || "%{WITH_TESTS}" == "Y" || "%{WITH_TESTS}" == "YES" || "%{WITH_TESTS}" == "TRUE" || "%{WITH_TESTS}" == "1"
93     %define with_tests 1
94 %endif
95
96 %build
97 export LDFLAGS+="-Wl,--rpath=%{_libdir}"
98
99 %cmake . -DDPL_LOG="ON"       \
100          -DPROJECT_VERSION=%{version} \
101          -DCMAKE_BUILD_TYPE=%{?build_type:%build_type} \
102 %if %{with wayland}
103          -DX11_SUPPORT=Off \
104 %else
105          -DX11_SUPPORT=On \
106 %endif
107 %if %{with decrypt}
108          -DDECRYPT_SUPPORT=On \
109 %else
110          -DDECRYPT_SUPPORT=Off \
111 %endif
112 %if %{with multi_user}
113          -DMULTI_USER_SUPPORT=On \
114 %else
115          -DMULTI_USER_SUPPORT=Off \
116 %endif
117
118         %{?WITH_TESTS:-DWITH_TESTS=%WITH_TESTS}
119
120 make %{?jobs:-j%jobs}
121
122 %install
123 mkdir -p %{buildroot}/usr/share/license
124 cp LICENSE %{buildroot}/usr/share/license/%{name}
125 %make_install
126
127 ## wrt-launchpad-daemon #######################################################
128 mkdir -p %{buildroot}/etc/init.d
129 install -m 755 src/wrt-launchpad-daemon/wrt_launchpad_run.sh %{buildroot}/%{_sysconfdir}/init.d
130
131 mkdir -p %{buildroot}/etc/rc.d/rc3.d
132 mkdir -p %{buildroot}/etc/rc.d/rc4.d
133 ln -sf ../../init.d/wrt_launchpad_run.sh %{buildroot}/%{_sysconfdir}/rc.d/rc3.d/S15wrt_launchpad_run
134 ln -sf ../../init.d/wrt_launchpad_run.sh %{buildroot}/%{_sysconfdir}/rc.d/rc4.d/S80wrt_launchpad_run
135
136 #systemd
137
138 %if %{with multi_user}
139 mkdir -p %{buildroot}%{_unitdir_user}/tizen-middleware.target.wants/
140 install -m 0644 %SOURCE102 %{buildroot}%{_unitdir_user}/wrt_launchpad_daemon.service
141 ln -s ../wrt_launchpad_daemon.service %{buildroot}%{_unitdir_user}/tizen-middleware.target.wants/wrt_launchpad_daemon.service
142 %else
143 mkdir -p %{buildroot}%{_unitdir}/graphical.target.wants
144 install -m 0644 %SOURCE101 %{buildroot}%{_unitdir}/wrt_launchpad_daemon@.service
145 ln -s ../wrt_launchpad_daemon@.service %{buildroot}%{_unitdir}/graphical.target.wants/wrt_launchpad_daemon@app.service
146 %endif
147
148 %preun
149 if [ $1 == 0 ]; then
150 %if %{with multi_user}
151         systemctl --user stop wrt_launchpad_daemon.service
152 %else
153         systemctl stop wrt_launchpad_daemon@app.service
154 %endif
155
156 fi
157
158
159
160
161 ###############################################################################
162
163
164
165
166 %clean
167 rm -rf %{buildroot}
168
169 %post
170 /sbin/ldconfig
171 chmod +s /usr/bin/wrt-launcher
172
173 ## wrt-launchpad-daemon #######################################################
174 #systemd
175 /sbin/ldconfig
176 systemctl daemon-reload
177 if [ $1 == 1 ]; then
178 %if %{with multi_user}
179     systemctl --user restart wrt_launchpad_daemon.service
180 %else
181     systemctl restart wrt_launchpad_daemon@app.service
182 %endif
183
184
185 fi
186 ###############################################################################
187
188 echo "[WRT] wrt postinst done ..."
189
190 ## wrt-launchpad-daemon #######################################################
191 #systemd
192 %postun -p /sbin/ldconfig
193 systemctl daemon-reload
194 ###############################################################################
195
196 %files
197 %manifest %{name}.manifest
198 %{_libdir}/*.so
199 %{_libdir}/*.so.*
200 %attr(755,root,root) %{_bindir}/wrt-client
201 %attr(755,root,root) %{_bindir}/wrt-launcher
202 %attr(755,root,root) %{_bindir}/wrt_reset_all.sh
203 %attr(755,root,root) %{_bindir}/wrt_reset_db.sh
204 %{_datadir}/locale/*
205 %{_datadir}/wrt-engine/*
206 %{_datadir}/license/%{name}
207 %attr(644,root,root) %{_datadir}/edje/wrt/*
208 %attr(644,root,root) %{_datadir}/edje/ace/*
209 %attr(644,root,root) /usr/etc/wrt/*
210 %if %{with_tests}
211     %attr(755,root,root) %{_bindir}/wrt-tests-general
212     /opt/share/widget/tests/general/*
213 %endif
214 %attr(755,root,root) %{_sysconfdir}/profile.d/wrt_env.sh
215
216 ## wrt-launchpad-daemon #######################################################
217 %attr(755,root,root) %{_bindir}/wrt_launchpad_daemon
218 /usr/share/aul/preload_list_wrt.txt
219 %{_sysconfdir}/init.d/wrt_launchpad_run.sh
220 %attr(0755,root,root) %{_sysconfdir}/rc.d/rc3.d/S15wrt_launchpad_run
221 %attr(0755,root,root) %{_sysconfdir}/rc.d/rc4.d/S80wrt_launchpad_run
222 /etc/smack/accesses2.d/wrt_launchpad_daemon.rule
223 /opt/etc/smack/accesses.d/wrt_launchpad_daemon.rule
224 #systemd
225 %if %{with multi_user}
226 %{_unitdir_user}/tizen-middleware.target.wants/wrt_launchpad_daemon.service
227 %{_unitdir_user}/wrt_launchpad_daemon.service
228 %else
229 %{_unitdir}/graphical.target.wants/wrt_launchpad_daemon@app.service
230 %{_unitdir}/wrt_launchpad_daemon@.service
231 %endif
232
233 ###############################################################################
234
235 %files devel
236 %manifest %{name}.manifest
237 %{_includedir}/*
238 %{_libdir}/pkgconfig/*
239