-
Notifications
You must be signed in to change notification settings - Fork 10
/
buildqtc.sh
executable file
·610 lines (519 loc) · 18.8 KB
/
buildqtc.sh
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
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
#!/bin/bash
#
# Builds Qt Creator and optionally uploads it to a server
#
# Copyright (C) 2014-2023 Jolla Oy
# All rights reserved.
#
# You may use this file under the terms of BSD license as follows:
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Jolla Ltd nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
. $(dirname $0)/defaults.sh
. $(dirname $0)/utils.sh
OPT_UPLOAD_HOST=$DEF_UPLOAD_HOST
OPT_UPLOAD_USER=$DEF_UPLOAD_USER
OPT_UPLOAD_PATH=$DEF_UPLOAD_PATH
OPT_QTDIR=$DEF_QT_DYN_BUILD_DIR
OPT_LLVM_INSTALL_DIR=$DEF_LLVM_INSTALL_DIR
OPT_QTC_SRC_DIR=$DEF_QTC_SRC_DIR
QTC_BUILD_DIR=$DEF_QTC_BUILD_DIR
QTC_INSTALL_ROOT=$DEF_QTC_INSTALL_ROOT
OPT_ICU_PATH=$DEF_ICU_INSTALL_DIR
OPT_VARIANT=$DEF_VARIANT
OPT_COPY_FROM_VARIANT=$DEF_COPY_FROM_VARIANT
OPT_SFDK_DOCUMENTATION=$([[ $UNAME_SYSTEM == Linux ]] && echo 1)
# TODO Fix gendoc.sh so that it adds the manN subdirectories themsenves
SFDK_DOC_DIR=share/doc/qtcreator/man/man1
SFDK_DOC_NAME=sfdkdocumentation.7z
fail() {
echo "FAIL: $@"
exit 1
}
usage() {
cat <<EOF
Build Qt Creator and optionally upload the result to a server
Usage:
$(basename $0) [OPTION]
Current values are displayed in [ ]s.
Options:
-qtc | --qtc-src <DIR> Qt Creator source directory [$OPT_QTC_SRC_DIR]
-qt | --qt-dir <DIR> Qt (install) directory [$OPT_QTDIR]
-v | --variant <STRING> Use <STRING> as the build variant [$OPT_VARIANT]
-vp | --variant-pretty <STRING> Use <STRING> as the pretty variant (appears in braces
after Qt Creator version in About dialog)
--copy-from-variant <STRING> Copy settings from the older variant <STRING>
if found [$OPT_COPY_FROM_VARIANT]
-r | --revision <STRING> Use <STRING> as the build revision [git sha]
-d | --docs Build Qt Creator documentation
| --sfdk-docs Build sfdk documentation (implied on Linux)
-g | --gdb Build also gdb
-go | --gdb-only Build only gdb
-gd | --gdb-download <URL> Use <URL> to download gdb build deps
-k | --keep-template Keep the Sailfish template code in the package
| --quick Do not run configure or clean build dir
-u | --upload <DIR> upload local build result to [$OPT_UPLOAD_HOST] as user [$OPT_UPLOAD_USER]
the uploaded build will be copied to [$OPT_UPLOAD_PATH/<DIR>]
the upload directory will be created if it is not there
-uh | --uhost <HOST> override default upload host
-up | --upath <PATH> override default upload path
-uu | --uuser <USER> override default upload user
-y | --non-interactive answer yes to all questions presented by the script
-h | --help this help
EOF
# exit if any argument is given
[[ -n "$1" ]] && exit 1
}
# handle commandline options
while [[ ${1:-} ]]; do
case "$1" in
-v | --variant ) shift
OPT_VARIANT=$1; shift
;;
--copy-from-variant ) shift
OPT_COPY_FROM_VARIANT=$1; shift
;;
-r | --revision ) shift
OPT_REVISION=$1; shift
;;
-vp | --variant-pretty ) shift
OPT_VARIANT_PRETTY=$1; shift
;;
-qtc | --qtc-src ) shift
OPT_QTC_SRC_DIR=$1; shift
QTC_BUILD_DIR=$OPT_QTC_SRC_DIR$DEF_QTC_BUILD_SUFFIX
QTC_INSTALL_ROOT=$OPT_QTC_SRC_DIR$DEF_QTC_INSTALL_SUFFIX
;;
-qt | --qt-dir ) shift
OPT_QTDIR=$1; shift
;;
-d | --docs ) shift
OPT_DOCUMENTATION=1
;;
--sfdk-docs ) shift
OPT_SFDK_DOCUMENTATION=1
;;
-g | --gdb ) shift
OPT_GDB=1
;;
-go | --gdb-only ) shift
OPT_GDB=1
OPT_GDB_ONLY=1
;;
-gd | --gdb-download ) shift
OPT_GDB_URL=$1; shift
if [[ -z $OPT_GDB_URL ]]; then
fail "gdb download option requires a URL"
fi
;;
-u | --upload ) shift
OPT_UPLOAD=1
OPT_UL_DIR=$1; shift
if [[ -z $OPT_UL_DIR ]]; then
fail "upload option requires a directory name"
fi
;;
-uh | --uhost ) shift;
OPT_UPLOAD_HOST=$1; shift
;;
-up | --upath ) shift;
OPT_UPLOAD_PATH=$1; shift
;;
-uu | --uuser ) shift;
OPT_UPLOAD_USER=$1; shift
;;
-k | --keep-template ) shift
OPT_KEEP_TEMPLATE=1
;;
-y | --non-interactive ) shift
OPT_YES=1
;;
--quick ) shift
OPT_QUICK=1
;;
-h | --help ) shift
usage quit
;;
* )
usage quit
;;
esac
done
if [[ ! -d $OPT_QTDIR ]]; then
fail "Qt directory [$OPT_QTDIR] not found"
fi
if [[ ! -d $OPT_QTC_SRC_DIR ]]; then
fail "Qt Creator source directory [$OPT_QTC_SRC_DIR] not found"
fi
if [[ ! -d $QTC_INSTALL_ROOT ]]; then
mkdir -p $QTC_INSTALL_ROOT
fi
# the default revision is the git hash of Qt Creator src directory
if [[ -z $OPT_REVISION ]]; then
OPT_REVISION=$(git --git-dir=$OPT_QTC_SRC_DIR/.git rev-parse --short HEAD 2>/dev/null)
fi
if [[ -z $OPT_REVISION ]]; then
OPT_REVISION="unknown"
fi
# summary
echo "Summary of chosen actions:"
cat <<EOF
QT Creator variant [$OPT_VARIANT] revision [$OPT_REVISION]
- Qt Creator source directory [$OPT_QTC_SRC_DIR]
- Qt Creator build directory [$QTC_BUILD_DIR]
- Qt Creator installation directory [$QTC_INSTALL_ROOT]
- Qt directory [$OPT_QTDIR]
EOF
if [[ -n $OPT_COPY_FROM_VARIANT ]]; then
echo " - Copy settings from older variant [$OPT_COPY_FROM_VARIANT]"
fi
if [[ -z $OPT_GDB_ONLY ]]; then
echo " 1) Build Qt Creator"
else
echo " 1) Do NOT build Qt Creator"
fi
if [[ -n $OPT_DOCUMENTATION ]] && [[ -z $OPT_GDB_ONLY ]]; then
echo " 2) Build documentation"
else
echo " 2) Do NOT build documentation"
fi
if [[ -n $OPT_GDB ]]; then
echo " 3) Build GDB"
[[ -n $OPT_GDB_URL ]] && echo " - Download build deps from [$OPT_GDB_URL]"
else
echo " 3) Do NOT build GDB"
fi
if [[ -n $OPT_UPLOAD ]]; then
echo " 4) Upload build result as user [$OPT_UPLOAD_USER] to [$OPT_UPLOAD_HOST:$OPT_UPLOAD_PATH/$OPT_UL_DIR]"
else
echo " 4) Do NOT upload build result anywhere"
fi
# confirm
if [[ -z $OPT_YES ]]; then
while true; do
read -p "Do you want to continue? (y/n) " answer
case $answer in
[Yy]*)
break ;;
[Nn]*)
echo "Ok, exiting"
exit 0
;;
*)
echo "Please answer yes or no."
;;
esac
done
fi
build_arch() {
if [[ $UNAME_SYSTEM == "Linux" ]]; then
if [[ $UNAME_ARCH == "x86_64" ]]; then
echo "linux-64"
else
echo "linux-32"
fi
elif [[ $UNAME_SYSTEM == "Darwin" ]]; then
echo "mac"
else
echo "windows"
fi
}
build_unix_gdb() {
if [[ -n $OPT_GDB ]]; then
rm -f $SAILFISH_GDB_BASENAME*.7z
[[ $OPT_QUICK ]] || rm -rf gdb-build
mkdir -p gdb-build
pushd gdb-build
if [[ $UNAME_SYSTEM == "Linux" ]]; then
GDB_MAKEFILE=Makefile.linux
else
export MACOSX_DEPLOYMENT_TARGET=13.0
GDB_MAKEFILE=Makefile.osx
fi
local downloads
if [[ -n $OPT_GDB_URL ]]; then
downloads="DOWNLOAD_URL=$OPT_GDB_URL"
fi
# Explicitly use bash to prevent built failure e.g. on Ubuntu where /bin/sh defaults to dash
make -f $OPT_QTC_SRC_DIR/dist/gdb/$GDB_MAKEFILE \
SHELL=/bin/bash \
PATCHDIR=$OPT_QTC_SRC_DIR/dist/gdb/patches $downloads
# move the completed package to the parent dir
mv $SAILFISH_GDB_BASENAME*.7z ..
popd
fi
}
setup_unix_qtc_ccache() {
# This only needs to be done on OSX at the moment as OSX QMake
# just plain refuses to obey any command to set the compiler from
# the outside. Not future proof either, as QMake's internal files
# are not guaranteed to be stable.
if [ -f /Users/builder/src/ccache-3.2.2/ccache ]; then
sed -e 's|macosx.QMAKE_CXX =|macosx.QMAKE_CXX = /Users/builder/src/ccache-3.2.2/ccache |' -i '' .qmake.stash
fi
}
build_unix_qtc() {
if [[ -z $OPT_GDB_ONLY ]]; then
export INSTALL_ROOT=$QTC_INSTALL_ROOT
export QTDIR=$OPT_QTDIR/qtbase
export PATH=$QTDIR/bin:$PATH
export INSTALLER_ARCHIVE=$SAILFISH_QTC_BASENAME$(build_arch).7z
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OPT_ICU_PATH/lib
export LLVM_INSTALL_DIR=$OPT_LLVM_INSTALL_DIR
# clear build workspace
[[ $OPT_QUICK ]] || rm -rf $QTC_BUILD_DIR
mkdir -p $QTC_BUILD_DIR
pushd $QTC_BUILD_DIR
if ! [[ $UNAME_SYSTEM == "Darwin" ]]; then
EXTRA_QMAKE_LFLAGS="QMAKE_LFLAGS+=-Wl,--disable-new-dtags"
fi
if ! [[ $OPT_QUICK ]]; then
$QTDIR/bin/qmake $OPT_QTC_SRC_DIR/qtcreator.pro CONFIG+=release -r \
QTC_SHOW_BUILD_DATE=1 \
-after "DEFINES+=IDE_REVISION=$OPT_REVISION" \
${OPT_VARIANT_PRETTY:+"QTCREATOR_DISPLAY_VERSION='$OPT_VARIANT_PRETTY'"} \
${OPT_COPY_FROM_VARIANT:+"DEFINES+=IDE_COPY_SETTINGS_FROM_VARIANT=$OPT_COPY_FROM_VARIANT"} \
"DEFINES+=IDE_SETTINGSVARIANT=$OPT_VARIANT" \
'DEFINES+=QTC_DEFAULT_HELPVIEWER_BACKEND=\\\"litehtml\\\"' \
$EXTRA_QMAKE_LFLAGS \
QTC_PREFIX=
fi
setup_unix_qtc_ccache
make -j$(nproc)
rm -rf $QTC_INSTALL_ROOT/*
if [[ $UNAME_SYSTEM == "Linux" ]]; then
make install
fi
if [[ $UNAME_SYSTEM == "Darwin" ]]; then
echo -e '#!/bin/sh\nexec "$(dirname "$0")/Qt Creator.app/Contents/MacOS/sfdk" "$@"' \
> bin/sfdk
chmod +x bin/sfdk
fi
make deployqt
# Deploy QtWebEngine
if [[ $UNAME_SYSTEM == "Linux" ]]; then
mkdir -p "$QTC_INSTALL_ROOT/lib/Qt/libexec"
cp "$OPT_QTDIR/qtbase/libexec/QtWebEngineProcess" "$QTC_INSTALL_ROOT/lib/Qt/libexec/"
patchelf --remove-rpath "$QTC_INSTALL_ROOT/lib/Qt/libexec/QtWebEngineProcess"
patchelf --set-rpath '$ORIGIN/../lib:$ORIGIN/../../qtcreator' --force-rpath \
"$QTC_INSTALL_ROOT/lib/Qt/libexec/QtWebEngineProcess"
mkdir -p "$QTC_INSTALL_ROOT/lib/Qt/resources"
cp "$OPT_QTDIR/qtbase/resources"/*.pak "$QTC_INSTALL_ROOT/lib/Qt/resources/"
# TODO The docs say this shouldn't be needed when custom ICU is used
cp "$OPT_QTDIR/qtbase/resources"/icudtl.dat "$QTC_INSTALL_ROOT/lib/Qt/resources/"
mkdir -p "$QTC_INSTALL_ROOT/lib/Qt/translations"
cp -r "$OPT_QTDIR/qtbase/translations/qtwebengine_locales" "$QTC_INSTALL_ROOT/lib/Qt/translations/"
fi
if [[ $UNAME_SYSTEM == "Darwin" ]]; then
local dbus_libs=
dbus_libs=$(brew list dbus |grep 'libdbus-1.*\.dylib')
mkdir -p "$QTC_INSTALL_ROOT/bin/Qt Creator.app/Contents/Frameworks/"
cp $dbus_libs "$QTC_INSTALL_ROOT/bin/Qt Creator.app/Contents/Frameworks/"
fi
# Add icu library
if [[ $UNAME_SYSTEM == "Linux" ]]; then
cp $OPT_ICU_PATH/lib/lib*.so* $QTC_INSTALL_ROOT/lib/qtcreator
fi
make bindist_installer
if [[ -z $OPT_KEEP_TEMPLATE ]]; then
# remove the sailfish template project from the
# archive. it will be reinstalled by the installer.
if [[ $UNAME_SYSTEM == "Darwin" ]]; then
7z d $SAILFISH_QTC_BASENAME$(build_arch).7z "bin/Qt Creator.app/Contents/Resources/templates/wizards/sailfishos-qtquick2app"
else
7z d $SAILFISH_QTC_BASENAME$(build_arch).7z share/qtcreator/templates/wizards/sailfishos-qtquick2app
fi
fi
if [[ -n $OPT_DOCUMENTATION ]]; then
make docs
make install_docs
fi
popd
fi
}
build_windows_gdb() {
if [[ -n $OPT_GDB ]]; then
rm -f $SAILFISH_GDB_BASENAME*.7z
[[ $OPT_QUICK ]] || rm -rf gdb-build
mkdir -p gdb-build
pushd gdb-build
GDB_MAKEFILE=Makefile.mingw
local downloads
if [[ -n $OPT_GDB_URL ]]; then
downloads="DOWNLOAD_URL=$OPT_GDB_URL"
fi
# dirty hax to build gdb in another mingw session, which has
# the compiler available
cat <<EOF > build-gdb.bat
@echo off
call C:\msys64\usr\bin\env -u PATH MSYSTEM=UCRT64 C:\msys64\usr\bin\bash.exe --login -c "cd $PWD; make -f $OPT_QTC_SRC_DIR/dist/gdb/Makefile.mingw PATCHDIR=$OPT_QTC_SRC_DIR/dist/gdb/patches $downloads" || exit 1
EOF
cmd //c build-gdb.bat
# move the completed package to the parent dir
mv $SAILFISH_GDB_BASENAME*.7z ..
popd
fi
}
build_windows_qtc() {
if [[ -z $OPT_GDB_ONLY ]]; then
# clear build workspace
[[ $OPT_QUICK ]] || rm -rf $QTC_BUILD_DIR
mkdir -p $QTC_BUILD_DIR
pushd $QTC_BUILD_DIR
# fetch the binary artifacts if they can be found
#
# https://git.gitorious.org/qt-creator/binary-artifacts.git
#
local binary_artifacts="qtc-win32-binary-artifacts.7z"
echo "Downloading binary artifacts ..."
# Allow error code from curl
set +e
curl -s -f -o $binary_artifacts http://$OPT_UPLOAD_HOST/sailfishos/win32-binary-artifacts/$binary_artifacts
[[ $? -ne 0 ]] && echo "NOTE! Downloading binary artifacts failed [ignoring]"
# no more errors allowed
set -e
local opengl32sw_lib="opengl32sw-64-mesa_11_2_2-signed.7z"
curl -s -f -o $opengl32sw_lib http://$OPT_UPLOAD_HOST/sailfishos/win32-binary-artifacts/opengl/$opengl32sw_lib
local pkg_config_libs="pkg-config_0.26-1_win32.zip \
gettext-runtime_0.18.1.1-2_win32.zip \
glib_2.28.8-1_win32.zip"
for lib in $pkg_config_libs; do
curl -s -f -O http://$OPT_UPLOAD_HOST/sailfishos/win32-binary-artifacts/pkg-config/$lib
done
local mingw_dbus="mingw-w64-x86_64-dbus-1.12.20-1-any.pkg.tar"
local mingw_dbus_lib="libdbus-1-3.dll"
curl -s -f -o $mingw_dbus http://$OPT_UPLOAD_HOST/sailfishos/win32-binary-artifacts/dbus/$mingw_dbus
tar -xf $mingw_dbus --strip-components=2 mingw64/bin/$mingw_dbus_lib
# create the build script for windows
cat <<EOF > build-windows.bat
@echo off
if DEFINED ProgramFiles(x86) (
set "_programs=%ProgramFiles(x86)%"
set _systemdir=%windir%\syswow64
)
if Not DEFINED ProgramFiles(x86) (
set _programs=%ProgramFiles%
set _systemdir=%windir%\system32
)
set INSTALL_ROOT=$(win_path $QTC_INSTALL_ROOT)
set QTDIR=$(win_path $OPT_QTDIR)\qtbase
set QMAKESPEC=$DEF_MSVC_SPEC
set PATH=%QTDIR%\bin;$(win_path $DEF_PREFIX)\invariant\bin;$(win_path $OPT_ICU_PATH)\bin64;%PATH%
set LLVM_INSTALL_DIR=$(win_path $OPT_LLVM_INSTALL_DIR)
set INSTALLER_ARCHIVE=$SAILFISH_QTC_BASENAME$(build_arch).7z
call rmdir /s /q $(win_path $QTC_INSTALL_ROOT)
if exist $binary_artifacts (
call 7z x -o$(win_path $QTC_INSTALL_ROOT) $binary_artifacts
)
call "%_programs%\Microsoft Visual Studio\\$DEF_MSVC_VER\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64
call %QTDIR%\bin\qmake $(win_path $OPT_QTC_SRC_DIR)\qtcreator.pro ^
CONFIG+=release CONFIG-=debug_and_release -r ^
QTC_SHOW_BUILD_DATE=1 ^
-after "DEFINES+=IDE_REVISION=$OPT_REVISION" ^
${OPT_COPY_FROM_VARIANT:+"'DEFINES+=IDE_COPY_SETTINGS_FROM_VARIANT=$OPT_COPY_FROM_VARIANT'"} ^
"DEFINES+=IDE_SETTINGSVARIANT=$OPT_VARIANT" ^
"QTCREATOR_DISPLAY_VERSION='$OPT_VARIANT_PRETTY'" ^
QTC_PREFIX= || exit 1
call jom || exit 1
call nmake install || exit 1
call nmake deployqt || exit 1
rem copy all the necessary libraries to the install directory
copy %QTDIR%\bin\libEGL.dll %INSTALL_ROOT%\bin || exit 1
copy %QTDIR%\bin\libGLESv2*.dll %INSTALL_ROOT%\bin || exit 1
call 7z x -o%INSTALL_ROOT%\bin $opengl32sw_lib
for %%i in ($pkg_config_libs) do (
call 7z x -o%INSTALL_ROOT% %%i < NUL || exit 1
)
copy $mingw_dbus_lib %INSTALL_ROOT%\bin || exit 1
copy "%VCToolsInstallDir%\bin\Hostx64\x64\d3dcompiler_*.dll" %INSTALL_ROOT%\bin || exit 1
pushd "%VCToolsRedistDir%\x64\Microsoft.VC*.CRT" ^
&& copy "*.dll" %INSTALL_ROOT%\bin ^
&& popd || exit 1
copy "%_systemdir%\msvc*100.dll" %INSTALL_ROOT%\bin || exit 1
copy $(win_path $OPT_ICU_PATH)\bin64\*.dll %INSTALL_ROOT%\bin || exit 1
# Required by libpython.dll packaged with gdb
copy "%UniversalCRTSdkDir%\Redist\ucrt\DLLs\x64\*.dll" %INSTALL_ROOT%\bin || exit 1
call nmake bindist_installer || exit 1
EOF
# execute the bat
cmd //c build-windows.bat
if [[ -z $OPT_KEEP_TEMPLATE ]]; then
# remove the template project from the archive. it will be
# reinstalled by the installer.
7z d $SAILFISH_QTC_BASENAME$(build_arch).7z share/qtcreator/templates/wizards/sailfishos-qtquick2app
fi
popd
fi
}
# if any step below fails, exit
set -e
# build result files
SAILFISH_QTC_BASENAME="sailfish-qt-creator-"
SAILFISH_GDB_BASENAME="sailfish-gdb-"
# record start time
BUILD_START=$(date +%s)
if [[ $(build_arch) == "windows" ]]; then
build_windows_qtc
build_windows_gdb
else
build_unix_qtc
build_unix_gdb
fi
if [[ $OPT_SFDK_DOCUMENTATION && ! $OPT_GDB_ONLY ]]; then
rm -f $SFDK_DOC_NAME
mkdir -p $QTC_INSTALL_ROOT/$SFDK_DOC_DIR
PATH=$QTC_INSTALL_ROOT/bin:$PATH \
$QTC_INSTALL_ROOT/share/qtcreator/sfdk/gendoc.sh $QTC_INSTALL_ROOT/$SFDK_DOC_DIR
(cd $QTC_INSTALL_ROOT && 7z a $OLDPWD/$SFDK_DOC_NAME $SFDK_DOC_DIR)
fi
# record end time
BUILD_END=$(date +%s)
time=$(( BUILD_END - BUILD_START ))
hour=$(( $time / 3600 ))
mins=$(( $time / 60 - 60*$hour ))
secs=$(( $time - 3600*$hour - 60*$mins ))
echo Time used for QtC build: $(printf "%02d:%02d:%02d" $hour $mins $secs)
if [[ -n "$OPT_UPLOAD" ]]; then
# create upload dir
ssh $OPT_UPLOAD_USER@$OPT_UPLOAD_HOST mkdir -p $OPT_UPLOAD_PATH/$OPT_UL_DIR/$(build_arch)
if [[ -z $OPT_GDB_ONLY ]]; then
echo "Uploading $SAILFISH_QTC_BASENAME$(build_arch).7z ..."
scp $QTC_BUILD_DIR/$SAILFISH_QTC_BASENAME$(build_arch).7z $OPT_UPLOAD_USER@$OPT_UPLOAD_HOST:$OPT_UPLOAD_PATH/$OPT_UL_DIR/$(build_arch)/
if [[ $OPT_SFDK_DOCUMENTATION ]]; then
echo "Uploading $SFDK_DOC_NAME ..."
scp $SFDK_DOC_NAME $OPT_UPLOAD_USER@$OPT_UPLOAD_HOST:$OPT_UPLOAD_PATH/$OPT_UL_DIR/
fi
fi
if [[ -n $OPT_GDB ]]; then
echo "Uploading GDB ..."
scp $SAILFISH_GDB_BASENAME*.7z $OPT_UPLOAD_USER@$OPT_UPLOAD_HOST:$OPT_UPLOAD_PATH/$OPT_UL_DIR/$(build_arch)/
fi
fi
# For Emacs:
# Local Variables:
# indent-tabs-mode:nil
# tab-width:8
# sh-basic-offset:4
# End:
# For VIM:
# vim:set softtabstop=4 shiftwidth=4 tabstop=8 expandtab: