Remove hardcoded path for multiuser support
[platform/framework/web/wrt.git] / packaging / wrt.spec
1 %bcond_with mesa
2 %bcond_with wayland
3 %bcond_with decrypt
4 %bcond_with multi_user
5
6 Name:       wrt
7 Summary:    web runtime
8 Version:    0.8.288
9 Release:    1
10 Group:      Development/Libraries
11 License:    Apache-2.0
12 URL:        N/A
13 Source0:    %{name}-%{version}.tar.gz
14 ## wrt-launchpad-daemon #######################################################
15 ### systemd service for multi-user mode
16 Source102:  wrt_launchpad_daemon_user.service
17 Source1001:     wrt.manifest
18 ###############################################################################
19
20 BuildRequires:  cmake
21 BuildRequires:  gettext
22 BuildRequires:  edje-tools
23 BuildRequires:  pkgconfig(ail)
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(dpl-efl)
30 BuildRequires:  pkgconfig(libpcrecpp)
31 BuildRequires:  pkgconfig(ecore)
32 BuildRequires:  pkgconfig(eina)
33 BuildRequires:  pkgconfig(ui-gadget-1)
34 BuildRequires:  pkgconfig(utilX)
35 BuildRequires:  pkgconfig(secure-storage)
36 BuildRequires:  pkgconfig(pkgmgr)
37 BuildRequires:  pkgconfig(libiri)
38 BuildRequires:  pkgconfig(appsvc)
39 BuildRequires:  pkgconfig(cert-svc)
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(capi-appfw-application)
48 BuildRequires:  pkgconfig(haptic)
49 BuildRequires:  pkgconfig(capi-web-url-download)
50 BuildRequires:  pkgconfig(wrt-plugin-loading)
51 BuildRequires:  pkgconfig(wrt-plugin-js-overlay)
52 BuildRequires:  pkgconfig(wrt-plugins-ipc-message)
53 BuildRequires:  pkgconfig(wrt-popup-wrt-runner)
54 BuildRequires:  pkgconfig(wrt-popup-ace-runner)
55 BuildRequires:  pkgconfig(sysman)
56 BuildRequires:  pkgconfig(capi-system-system-settings)
57 BuildRequires:  pkgconfig(app2sd)
58 BuildRequires:  pkgconfig(libtzplatform-config)
59 %if %{with mesa}
60 BuildRequires: pkgconfig(gl)
61 BuildRequires: pkgconfig(glesv2)
62 %else
63 BuildRequires: pkgconfig(gles20)
64 %endif
65 Requires(post): /sbin/ldconfig
66 Requires(postun): /sbin/ldconfig
67 BuildRequires:  pkgconfig(libsmack)
68 BuildRequires:  pkgconfig(efl-assist)
69 BuildRequires:  pkgconfig(pkgmgr-info)
70 BuildRequires:  libss-client-devel
71 BuildRequires:  gettext
72 BuildRequires:  edje-tools
73 Requires: libss-client
74 Requires: libtzplatform-config
75
76 ## wrt-launchpad-daemon #######################################################
77 BuildRequires:  pkgconfig(app-checker)
78 BuildRequires:  pkgconfig(bundle)
79 BuildRequires:  pkgconfig(dlog)
80 BuildRequires:  pkgconfig(dbus-glib-1)
81 BuildRequires:  pkgconfig(libsmack)
82 BuildRequires:  pkgconfig(sqlite3)
83 BuildRequires:  pkgconfig(x11)
84 BuildRequires:  pkgconfig(aul)
85 BuildRequires:  pkgconfig(libsystemd-daemon)
86 %{?systemd_requires}
87
88 #Use these macro to avoid hard-coded path
89 #After upgrading systemd to v204 or higher macro can be deleted
90 %define _unitdir /usr/lib/systemd/system
91 ###############################################################################
92
93 %description
94 web runtime
95
96 %package devel
97 Summary:    Wrt header files for external modules
98 Group:      Development/Libraries
99 Requires:   %{name} = %{version}
100
101 %description devel
102 wrt library development headers
103
104 %prep
105 %setup -q
106 cp %{SOURCE1001} .
107
108 %define with_tests 0
109 %if "%{WITH_TESTS}" == "ON" || "%{WITH_TESTS}" == "Y" || "%{WITH_TESTS}" == "YES" || "%{WITH_TESTS}" == "TRUE" || "%{WITH_TESTS}" == "1"
110     %define with_tests 1
111 %endif
112
113 %build
114 %if 0%{?tizen_build_binary_release_type_eng}
115 export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE"
116 export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE"
117 export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE"
118 %endif
119
120 export LDFLAGS+="-Wl,--rpath=%{_libdir}"
121
122 %cmake . -DDPL_LOG="ON"       \
123          -DPROJECT_VERSION=%{version} \
124          -DCMAKE_BUILD_TYPE=%{?build_type:%build_type} \
125 %if %{with mesa}
126         -DUSE_MESA=On \
127 %endif
128 %if %{with wayland}
129          -DX11_SUPPORT=Off \
130 %else
131          -DX11_SUPPORT=On \
132 %endif
133 %if %{with decrypt}
134          -DDECRYPT_SUPPORT=On \
135 %else
136          -DDECRYPT_SUPPORT=Off \
137 %endif
138 %if %{with multi_user}
139          -DMULTI_USER_SUPPORT=On \
140 %else
141          -DMULTI_USER_SUPPORT=Off \
142 %endif
143
144         %{?WITH_TESTS:-DWITH_TESTS=%WITH_TESTS}
145
146 make %{?jobs:-j%jobs}
147
148 %install
149 mkdir -p %{buildroot}/usr/share/license
150 cp LICENSE.APLv2 %{buildroot}/usr/share/license/%{name}
151 cat LICENSE.Flora >> %{buildroot}/usr/share/license/%{name}
152 %make_install
153
154 %if %{with multi_user}
155 mkdir -p %{buildroot}%{_unitdir_user}/tizen-middleware.target.wants/
156 install -m 0644 %SOURCE102 %{buildroot}%{_unitdir_user}/wrt_launchpad_daemon.service
157 ln -s ../wrt_launchpad_daemon.service %{buildroot}%{_unitdir_user}/tizen-middleware.target.wants/wrt_launchpad_daemon.service
158 %else
159 mkdir -p %{buildroot}%{_unitdir}/graphical.target.wants
160 mkdir -p %{buildroot}%{_unitdir}/sockets.target.wants
161 ln -s %{_unitdir}/wrt_launchpad_daemon@.service %{buildroot}%{_unitdir}/graphical.target.wants/wrt_launchpad_daemon@app.service
162 ln -s %{_unitdir}/wrt_launchpad_daemon_1.socket %{buildroot}%{_unitdir}/sockets.target.wants/wrt_launchpad_daemon_1.socket
163 ln -s %{_unitdir}/wrt_launchpad_daemon_2.socket %{buildroot}%{_unitdir}/sockets.target.wants/wrt_launchpad_daemon_2.socket
164 %endif
165
166 %pre
167 if [ $1 -eq 2 ] ; then
168 %if %{with multi_user}
169     systemctl --user stop wrt_launchpad_daemon@app.service wrt_launchpad_daemon_1.socket wrt_launchpad_daemon_2.socket
170 %else
171     systemctl stop wrt_launchpad_daemon@app.service wrt_launchpad_daemon_1.socket wrt_launchpad_daemon_2.socket
172 %endif
173 fi
174
175 %preun
176 if [ $1 -eq 0 ] ; then
177 %if %{with multi_user}
178     systemctl --user stop wrt_launchpad_daemon@app.service wrt_launchpad_daemon_1.socket wrt_launchpad_daemon_2.socket
179 %else
180     systemctl stop wrt_launchpad_daemon@app.service wrt_launchpad_daemon_1.socket wrt_launchpad_daemon_2.socket
181 %endif
182 fi
183
184 %clean
185 rm -rf %{buildroot}
186
187 %post
188 /sbin/ldconfig
189 chmod +s /usr/bin/wrt-launcher
190
191 /sbin/ldconfig
192 systemctl daemon-reload
193 if [ $1 -eq 2 ] ; then
194 %if %{with multi_user}
195     systemctl --user start wrt_launchpad_daemon@app.service
196 %else
197     systemctl start wrt_launchpad_daemon@app.service
198 %endif
199 fi
200
201 %postun -p /sbin/ldconfig
202 systemctl daemon-reload
203
204 %files
205 %manifest %{name}.manifest
206 %{_libdir}/*.so
207 %{_libdir}/*.so.*
208 %attr(755,root,root) %{_bindir}/wrt-client
209 %attr(755,root,root) %{_bindir}/wrt-launcher
210 %attr(755,root,root) %{_bindir}/wrt_reset_all.sh
211 %attr(755,root,root) %{_bindir}/wrt_reset_db.sh
212 %{_datadir}/wrt-engine/*
213 %{_datadir}/license/%{name}
214 %attr(644,root,root) %{_datadir}/edje/wrt/*
215 %attr(644,root,root) %{_datadir}/edje/ace/*
216 %if %{with_tests}
217     %attr(755,root,root) %{_bindir}/wrt-tests-general
218     /opt/share/widget/tests/general/*
219 %endif
220 %attr(755,root,root) %{_sysconfdir}/profile.d/wrt_env.sh
221
222 ## wrt-launchpad-daemon #######################################################
223 %attr(755,root,root) %{_bindir}/wrt_launchpad_daemon
224 /usr/share/aul/preload_list_wrt.txt
225 #systemd
226 %if %{with multi_user}
227 %{_unitdir_user}/tizen-middleware.target.wants/wrt_launchpad_daemon.service
228 %{_unitdir_user}/wrt_launchpad_daemon.service
229 %else
230 %{_unitdir}/graphical.target.wants/wrt_launchpad_daemon@app.service
231 %{_unitdir}/wrt_launchpad_daemon@.service
232 %{_unitdir}/sockets.target.wants/wrt_launchpad_daemon_1.socket
233 %{_unitdir}/wrt_launchpad_daemon_1.socket
234 %{_unitdir}/sockets.target.wants/wrt_launchpad_daemon_2.socket
235 %{_unitdir}/wrt_launchpad_daemon_2.socket
236 %endif
237 ###############################################################################
238
239 %files devel
240 %manifest %{name}.manifest
241 %{_includedir}/*
242 %{_libdir}/pkgconfig/*
243