-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure
executable file
·433 lines (394 loc) · 16.3 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
#!/bin/bash
#
# Copyright © 2016 Wind River Systems, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
SUPPOTED_TARGETDEVICES=( x11 minnowmax mrb)
SUPPOTED_HMIPROFILES=( cockpit )
WRSCOMPOSITOR_PRO=compositor/compositor.pro
show_help() {
echo "Usage: configure [options]"
echo "Options: [defaults in brackets after descriptions]"
echo
echo "Standard options:"
echo " --help print this message"
echo " --prefix=DIR prefix dir for installation"
echo " --with-digitalcluster build with digital cluster feature (on 2nd display)"
echo " --with-reardisplay build with rear display feature (on 3rd display)"
echo " --without-maindisplay build without main display"
echo " --enable-webengine Use WebEngine instead of WebKit for WebRuntime"
echo " --enable-vthandler Use VT Handler to switch Virtual Terminal"
echo " --target-device=NAME Set JS configuration for specific target device"
echo " --hmi-profile=NAME Set HMI Profile"
echo " --overwrite overwrite existing config.js by new target/hmi config"
echo " --without-qmake don't execute qmake in configure"
echo " --with-qmake=path set qmake path (e.g - /usr/bin/qmake)"
echo ""
echo "Supported target devices:"
for name in "${SUPPOTED_TARGETDEVICES[@]}"
do
if [ "$name" = "x11" ]; then
echo " $name (default for PC dev environment)"
else
echo " $name"
fi
done
echo ""
echo "Supported HMI profile:"
for name in "${SUPPOTED_HMIPROFILES[@]}"
do
if [ "$name" = "cockpit" ]; then
echo " $name (default for demo)"
else
echo " $name"
fi
done
echo ""
}
if [ "$1" = -h -o "$1" = -help -o "$1" = --help ]
then
show_help
exit
fi
SUPPORT_MAINDISPLAY=1
SUPPORT_DCLUSTER=0
SUPPORT_REARDISPLAY=0
SUPPORT_WLCOMPOSITOR=1
SUPPORT_WEBENGINE=0
SUPPORT_VTHANDLER=0
SUPPORT_DBUS=1
MANUAL_QMAKE=0
TARGET_DEVICE=x11
HMI_PROFILE=cockpit
OVERWRITE=0
QMAKEPATH=
OPTARGS=""
PREFIX=/usr
for opt do
optval="${opt#*=}"
case "$opt" in
--without-maindisplay)
SUPPORT_MAINDISPLAY=0
;;
--enable-webengine)
SUPPORT_WEBENGINE=1
;;
--enable-vthandler)
SUPPORT_VTHANDLER=1
;;
--with-digitalcluster)
SUPPORT_DCLUSTER=1
;;
--with-reardisplay)
SUPPORT_REARDISPLAY=1
;;
--without-qmake)
MANUAL_QMAKE=1
;;
--with-qmake=*)
if [ ! -f "$optval" ]; then
echo "Error, Could not found $optval"
exit 1
fi
QMAKEPATH=$optval
;;
--prefix=*)
PREFIX=$optval
;;
--target-device=*)
for name in "${SUPPOTED_TARGETDEVICES[@]}"
do
if [ $name = $optval ]; then
TARGET_DEVICE=$optval
break
fi
done
if [ $optval != $TARGET_DEVICE ]; then
show_help
echo
echo "\"$optval\" is not supported target device"
exit
fi
;;
--hmi-profile=*)
for name in "${SUPPOTED_HMIPROFILES[@]}"
do
if [ $name = $optval ]; then
HMI_PROFILE=$optval
break
fi
done
if [ $optval != $HMI_PROFILE ]; then
show_help
echo
echo "\"$optval\" is not supported HMI Profile"
exit
fi
;;
--overwrite)
OVERWRITE=1
;;
--help)
show_help
exit
;;
*)
OPTARGS="$opt $OPTARGS"
;;
esac
done
if [ "$QMAKEPATH" = "" ]; then
QMAKEPATH_IN_LINUXDISTROS=( /usr/bin /usr/bin/qt5)
FOUND=0
for bindir in "${QMAKEPATH_IN_LINUXDISTROS[@]}"
do
if [ -f $bindir/qmake ]; then
QMAKEPATH=$bindir/qmake
break
elif [ -f $bindir/qmake-qt5 ]; then
QMAKEPATH=$bindir/qmake-qt5
break
fi
done
fi
if [ "$QMAKEPATH" = "" ]; then
echo "Error, Could not found qmake, please set with --with-qmake"
exit 1
fi
export PATH=`dirname $QMAKEPATH`:$PATH
echo "Build configuration"
echo " SUPPORT_MAINDISPLAY=$SUPPORT_MAINDISPLAY"
echo " SUPPORT_DIGITALCLUSTER=$SUPPORT_DCLUSTER"
echo " SUPPORT_REARDISPLAY=$SUPPORT_REARDISPLAY"
echo " SUPPORT_WLCOMPOSITOR=$SUPPORT_WLCOMPOSITOR"
echo " SUPPORT_WEBENGINE=$SUPPORT_WEBENGINE"
echo " SUPPORT_VTHANDLER=$SUPPORT_VTHANDLER"
echo " SUPPORT_DBUS=$SUPPORT_DBUS"
echo " TARGET_DEVICE=$TARGET_DEVICE"
echo " HMI_PROFILE=$HMI_PROFILE"
echo " OPTARGS: $OPTARGS"
echo " PREFIX: $PREFIX"
echo
echo "Qt information"
echo " Qt Version=`$QMAKEPATH -query QT_VERSION`"
echo " QMake Path=$QMAKEPATH"
echo " QMake Version=`$QMAKEPATH -query QMAKE_VERSION`"
echo
#printf "Checking pam devel ..."
#if [ ! -f /usr/include/security/pam_appl.h ]; then
#echo $'\r'"Checking pam devel ........................................ Failure"
#echo "Error, Please install wayland development package(s)"
#echo " ubuntu: libpam0g-dev"
#echo " fedora: pam-devel"
#exit 1
#else
#echo $'\r'"Checking pam devel ........................................... Done"
#fi
printf "Checking pkg-config wayland-server ..."
if ! pkg-config --exists wayland-server ; then
echo $'\r'"Checking pkg-config wayland-server ........................ Failure"
echo "Error, Please install wayland development package(s)"
echo " ubuntu: libwayland-dev"
echo " fedora: wayland-devel, libwayland-server-devel"
echo " libwayland-client-devel, libwayland-cursor-devel"
exit 1
else
echo $'\r'"Checking pkg-config wayland-server ........................... Done"
fi
printf "Checking pkg-config gbm ..."
if ! pkg-config --exists gbm ; then
echo $'\r'"Checking pkg-config gbm ................................... Failure"
echo "Error, Please install gbm development package(s)"
echo " ubuntu: libgbm-dev"
echo " fedora: mesa-libgbm-devel"
exit 1
else
echo $'\r'"Checking pkg-config gbm ...................................... Done"
fi
#printf "Checking pkg-config libsystemd-login ..."
#if ! pkg-config --exists libsystemd-login ; then
#echo $'\r'"Checking pkg-config libsystemd-login ...................... Failure"
#echo "Error, Please install libsystemd-login-dev package"
#echo "Error, Please install systemd development package(s)"
#echo " ubuntu: libsystemd-login-dev"
#echo " fedora: systemd-devel"
#exit 1
#else
#echo $'\r'"Checking pkg-config libsystemd-login ......................... Done"
#fi
printf "Generating compositor.pro ..."
echo "QT += quick qml network gui-private" > $WRSCOMPOSITOR_PRO
if [ "$SUPPORT_WEBENGINE" = "1" ]; then
echo "QT += webengine" >> $WRSCOMPOSITOR_PRO
else
echo "QT += webkitwidgets" >> $WRSCOMPOSITOR_PRO
fi
if [ "$SUPPORT_WLCOMPOSITOR" = "1" ]; then
echo "DEFINES += QT_COMPOSITOR_QUICK" >> $WRSCOMPOSITOR_PRO
echo "QT += compositor" >> $WRSCOMPOSITOR_PRO
echo "QT += compositor-private" >> $WRSCOMPOSITOR_PRO
echo "CONFIG +=wayland-scanner" >> $WRSCOMPOSITOR_PRO
echo "WAYLANDSERVERSOURCES += protocols/ivi-controller.xml" >> $WRSCOMPOSITOR_PRO
echo "WAYLANDSERVERSOURCES += protocols/ivi-application.xml" >> $WRSCOMPOSITOR_PRO
echo "CONFIG += link_pkgconfig" >> $WRSCOMPOSITOR_PRO
echo "PKGCONFIG += wayland-server gbm" >> $WRSCOMPOSITOR_PRO
echo "HEADERS += wrsivimodel.h wrsivisurface.h wrsivicontroller.h wrsiviapplication.h" >> $WRSCOMPOSITOR_PRO
echo "SOURCES += wrsivimodel.cpp wrsivisurface.cpp wrsivicontroller.cpp wrsiviapplication.cpp" >> $WRSCOMPOSITOR_PRO
fi
if [ "$SUPPORT_DCLUSTER" = "1" ]; then
echo "HEADERS += digitalcluster.h" >> $WRSCOMPOSITOR_PRO
echo "SOURCES += digitalcluster.cpp" >> $WRSCOMPOSITOR_PRO
fi
if [ "$SUPPORT_REARDISPLAY" = "1" ]; then
echo "HEADERS += reardisplay.h" >> $WRSCOMPOSITOR_PRO
echo "SOURCES += reardisplay.cpp" >> $WRSCOMPOSITOR_PRO
echo "OTHER_FILES += rearmain.qml" >> $WRSCOMPOSITOR_PRO
fi
if [ "$SUPPORT_DBUS" = "1" ]; then
echo "QT += dbus" >> $WRSCOMPOSITOR_PRO
fi
echo "QT += multimedia" >> $WRSCOMPOSITOR_PRO
echo "PREFIX=$PREFIX" >> $WRSCOMPOSITOR_PRO
cat $WRSCOMPOSITOR_PRO.in >> $WRSCOMPOSITOR_PRO
echo $'\r'"Generating compositor.pro .................................... Done"
printf "Generating config.h for wrscompositor ..."
cat compositor/config.h.in | sed \
-e "s/WRSCOMPOSITOR_MAINDISPLAY 0/WRSCOMPOSITOR_MAINDISPLAY $SUPPORT_MAINDISPLAY/" \
-e "s/WRSCOMPOSITOR_DIGITALCLUSTER 0/WRSCOMPOSITOR_DIGITALCLUSTER $SUPPORT_DCLUSTER/" \
-e "s/WRSCOMPOSITOR_REARDISPLAY 0/WRSCOMPOSITOR_REARDISPLAY $SUPPORT_REARDISPLAY/" \
-e "s/WRSCOMPOSITOR_WAYLAND_COMPOSITOR 0/WRSCOMPOSITOR_WAYLAND_COMPOSITOR $SUPPORT_WLCOMPOSITOR/" \
-e "s/WRSCOMPOSITOR_WEBENGINE 0/WRSCOMPOSITOR_WEBENGINE $SUPPORT_WEBENGINE/" \
-e "s/WRSCOMPOSITOR_VTHANDLER 0/WRSCOMPOSITOR_VTHANDLER $SUPPORT_VTHANDLER/" \
-e "s/WRSCOMPOSITOR_DBUS 0/WRSCOMPOSITOR_DBUS $SUPPORT_DBUS/" \
-e "s/DEFAULT_TARGET_DEVICE/$TARGET_DEVICE/" \
-e "s/DEFAULT_HMI_PROFILE/$HMI_PROFILE/" \
> compositor/config.h
echo $'\r'"Generating config.h for wrscompositor .................................. Done"
printf "Generating config.js for hmi profile ..."
TARGETDIR="compositor/targets/$TARGET_DEVICE"
CONFIGJS=compositor/hmi/$HMI_PROFILE/config.js
if [ -d "$TARGETDIR" ]; then
OVERWRITTEN=0
if [ -f $CONFIGJS ]; then
echo $'\r'"Generating config.js for hmi profile ............... Already Exists"
if [ "$OVERWRITE" = "0" ]; then
echo "Error, Could not write $CONFIGJS, It's alreay exists"
echo "Use --overwrite or remove it first before do configure"
exit 1
fi
OVERWRITTEN=1
fi
cp -f compositor/config-default.js $CONFIGJS
if [ -f "$TARGETDIR/config-opt.js" ]; then
cat $TARGETDIR/config-opt.js >> $CONFIGJS
fi
if [ "$SUPPORT_WEBENGINE" = "1" ]; then
echo "useWebEngine = $SUPPORT_WEBENGINE;" >> $CONFIGJS
fi
if [ "$OVERWRITTEN" = "1" ]; then
echo $'\r'" overwritten at $CONFIGJS"
else
echo $'\r'"Generating config.js for hmi profile ......................... Done"
fi
else
echo $'\r'"Generating config.js for hmi profile ...................... Failure"
echo "Error, not supported target device: $TARGET_DEVICE"
exit
fi
echo
if [ "$TARGET_DEVICE" = "x11" ]; then
mkdir -p /usr/share/wrscompositor
cp clients/mediaplayer/video/*.ogv /usr/share/wrscompositor
cp compositor/hmi/$HMI_PROFILE/config.json /usr/share/wrscompositor
cp compositor/tools/update-qt-eglfs-kms-conf /usr/share/wrscompositor
cp compositor/targets/common/etc/dbus-1/system.d/wrscompositor.conf /etc/dbus-1/system.d/
fi
printf "Generating hmi-xxx.qrc ..."
HMI_RC="hmi-$HMI_PROFILE.qrc"
RCPATH="../../$HMI_RC"
cd compositor/hmi/$HMI_PROFILE
echo "<RCC>" > $RCPATH
echo " <qresource prefix=\"/\">" >> $RCPATH
echo " <file>wrscompositor.js</file>" >> $RCPATH
echo " <file>hmi-interface.js</file>" >> $RCPATH
echo " <file>wrscompositor.qml</file>" >> $RCPATH
echo " <file>wrslauncher.qml</file>" >> $RCPATH
echo " <file>WindowFrame.qml</file>" >> $RCPATH
for name in `find . -name '*.qml' -o -name '*.js' -o -name '*.jpg' -o -name '*.png' -o -name '*.svg' -o -name '*.otf' | sed -e "s/.\///"`
do
echo " <file alias=\"$name\">hmi/$HMI_PROFILE/$name</file>" >> $RCPATH
done
echo " </qresource>" >> $RCPATH
echo "</RCC>" >> $RCPATH
cd ../../..
echo "RESOURCES += $HMI_RC" >> $WRSCOMPOSITOR_PRO
echo $'\r'"Generating hmi-xxx.qrc ....................................... Done"
printf "Generating vt-handler.pro ..."
echo "PREFIX=$PREFIX" > vt-handler/vt-handler.pro
cat vt-handler/vt-handler.pro.in >> vt-handler/vt-handler.pro
echo $'\r'"Generating vt-handler.pro .................................... Done"
printf "Generating mediaplayer.pro ..."
echo "PREFIX=$PREFIX" > clients/mediaplayer/mediaplayer.pro
echo "QT += gui_private waylandclient-private" >> clients/mediaplayer/mediaplayer.pro
echo "INCLUDEPATH += ../libs/qtwayland" >> clients/mediaplayer/mediaplayer.pro
echo "LIBS += -L../libs/qtwayland -lWrsQtWayland -lwayland-client -lwayland-cursor" >> clients/mediaplayer/mediaplayer.pro
cat clients/mediaplayer/mediaplayer.pro.in >> clients/mediaplayer/mediaplayer.pro
echo $'\r'"Generating mediaplayer.pro .................................... Done"
printf "Generating skobblernavi.pro ..."
echo "PREFIX=$PREFIX" > clients/skobblernavi/skobblernavi.pro
echo "QT += gui_private waylandclient-private" >> clients/skobblernavi/skobblernavi.pro
echo "INCLUDEPATH += ../libs/qtwayland" >> clients/skobblernavi/skobblernavi.pro
echo "LIBS += -L../libs/qtwayland -lWrsQtWayland -lwayland-client -lwayland-cursor" >> clients/skobblernavi/skobblernavi.pro
cat clients/skobblernavi/skobblernavi.pro.in >> clients/skobblernavi/skobblernavi.pro
echo $'\r'"Generating skobblernavi.pro .................................... Done"
printf "Generating phone.pro ..."
echo "PREFIX=$PREFIX" > clients/phone/phone.pro
echo "QT += gui_private waylandclient-private" >> clients/phone/phone.pro
echo "INCLUDEPATH += ../libs/qtwayland" >> clients/phone/phone.pro
echo "LIBS += -L../libs/qtwayland -lWrsQtWayland -lwayland-client -lwayland-cursor" >> clients/phone/phone.pro
cat clients/phone/phone.pro.in >> clients/phone/phone.pro
echo $'\r'"Generating phone.pro .................................... Done"
printf "Generating camera.pro ..."
echo "PREFIX=$PREFIX" > clients/camera/camera.pro
echo "QT += gui_private waylandclient-private" >> clients/camera/camera.pro
echo "INCLUDEPATH += ../libs/qtwayland" >> clients/camera/camera.pro
echo "LIBS += -L../libs/qtwayland -lWrsQtWayland -lwayland-client -lwayland-cursor" >> clients/camera/camera.pro
cat clients/camera/camera.pro.in >> clients/camera/camera.pro
echo $'\r'"Generating camera.pro .................................... Done"
printf "Generating keyboard.pro ..."
echo "PREFIX=$PREFIX" > clients/keyboard/keyboard.pro
echo "QT += gui_private waylandclient-private" >> clients/keyboard/keyboard.pro
echo "INCLUDEPATH += ../libs/qtwayland" >> clients/keyboard/keyboard.pro
echo "LIBS += -L../libs/qtwayland -lWrsQtWayland -lwayland-client -lwayland-cursor" >> clients/keyboard/keyboard.pro
cat clients/keyboard/keyboard.pro.in >> clients/keyboard/keyboard.pro
echo $'\r'"Generating keyboard.pro .................................... Done"
printf "Generating textinput.pro ..."
echo "PREFIX=$PREFIX" > clients/textinput/textinput.pro
echo "QT += gui_private waylandclient-private" >> clients/textinput/textinput.pro
echo "INCLUDEPATH += ../libs/qtwayland" >> clients/textinput/textinput.pro
echo "LIBS += -L../libs/qtwayland -lWrsQtWayland -lwayland-client -lwayland-cursor" >> clients/textinput/textinput.pro
cat clients/textinput/textinput.pro.in >> clients/textinput/textinput.pro
echo $'\r'"Generating textinput.pro .................................... Done"
if [ "$MANUAL_QMAKE" = "0" ]; then
$QMAKEPATH $OPTARGS && echo "Makefile generated"
else
echo "Please execute qmake to create a Makefile"
fi
echo "Configuration Completed"
echo $0 $@ > config.log