File indexing completed on 2024-06-16 04:06:50

0001 #!/bin/bash
0002 
0003 # Script to run all VCPKG based sub-scripts to build Windows installer.
0004 # Possible option : "-f" to force operations without to ask confirmation to user.
0005 #
0006 # SPDX-FileCopyrightText: 2013-2024 by Gilles Caulier  <caulier dot gilles at gmail dot com>
0007 #
0008 # SPDX-License-Identifier: BSD-3-Clause
0009 #
0010 
0011 ########################################################################
0012 # Function to upload host log files
0013 HostUploadLogFiles()
0014 {
0015 
0016 if [[ $DK_UPLOAD = 1 ]] ; then
0017 
0018     echo -e "---------- Cleanup older host logs from files.kde.org repository \n"
0019 
0020     sftp -q $DK_UPLOADURL:$DK_UPLOADDIR/build.logs/win64 <<< "rm build-vcpkg.full.log.gz"
0021     sftp -q $DK_UPLOADURL:$DK_UPLOADDIR/build.logs/win64 <<< "rm build-extralibs.full.log.gz"
0022 
0023     echo -e "---------- Compress host log files \n"
0024 
0025     gzip -k $ORIG_WD/logs/build-mxe.full.log $ORIG_WD/logs/build-vcpkg.full.log.gz           || true
0026     gzip -k $ORIG_WD/logs/build-extralibs.full.log $ORIG_WD/logs/build-extralibs.full.log.gz || true
0027 
0028     echo -e "---------- Upload new host logs to files.kde.org repository \n"
0029 
0030     UploadWithRetry $ORIG_WD/logs/build-vcpkg.full.log.gz     $DK_UPLOADURL $DK_UPLOADDIR/build.logs/win64 10
0031     UploadWithRetry $ORIG_WD/logs/build-extralibs.full.log.gz $DK_UPLOADURL $DK_UPLOADDIR/build.logs/win64 10
0032 
0033     echo -e "---------- Cleanup local bundle log file archives \n"
0034 
0035     rm -f $ORIG_WD/logs/build-vcpkg.full.log.gz     || true
0036     rm -f $ORIG_WD/logs/build-extralibs.full.log.gz || true
0037 
0038 fi
0039 
0040 }
0041 
0042 # Halt and catch errors
0043 set -eE
0044 trap 'PREVIOUS_COMMAND=$THIS_COMMAND; THIS_COMMAND=$BASH_COMMAND' DEBUG
0045 trap 'echo "FAILED COMMAND: $PREVIOUS_COMMAND"' ERR
0046 trap HostUploadLogFiles ERR exit
0047 
0048 ORIG_WD="`pwd`"
0049 
0050 . ./config.sh
0051 . ./common.sh
0052 StartScript
0053 
0054 echo "This script will build from scratch the digiKam installer for Windows using VCPKG."
0055 echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
0056 
0057 if [ -d "$VCPKG_DIR" ] ; then
0058 
0059     if [ "$1" != "-f" ] ; then
0060 
0061         read -p "$VCPKG_DIR already exist. Do you want to remove it or to continue an aborted previous installation ? [(r)emove/(c)ontinue/(s)top] " answer
0062 
0063         if echo "$answer" | grep -iq "^r" ;then
0064 
0065             echo "---------- Removing existing $VCPKG_BUILDROOT"
0066             rm -rf "$VCPKG_DIR"
0067 
0068         elif echo "$answer" | grep -iq "^c" ;then
0069 
0070             echo "---------- Continue aborted previous installation in $VCPKG_DIR"
0071             CONTINUE_INSTALL=1
0072 
0073         else
0074 
0075             echo "---------- Aborting..."
0076             exit;
0077         fi
0078 
0079     fi
0080 
0081 fi
0082 
0083 echo "++++++++++++++++   Build 64 bits Installer   ++++++++++++++++++++++++++++++++++"
0084 echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
0085 
0086 ./01-build-vcpkg.sh
0087 ./02-build-extralibs.sh
0088 ./update.sh
0089 
0090 echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
0091 
0092 TerminateScript