File indexing completed on 2025-01-05 04:00:17

0001 #!/bin/bash
0002 
0003 # Script to run all MXE 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-mxe.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-mxe.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     rsync -r -v --progress -e ssh $ORIG_WD/logs/build-mxe.full.log.gz $DK_UPLOADURL:$DK_UPLOADDIR/build.logs/win64       || true
0031     rsync -r -v --progress -e ssh $ORIG_WD/logs/build-extralibs.full.log.gz $DK_UPLOADURL:$DK_UPLOADDIR/build.logs/win64 || true
0032 
0033     echo -e "---------- Cleanup local bundle log file archives \n"
0034 
0035     rm -f $ORIG_WD/logs/build-mxe.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 MXE."
0055 echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
0056 
0057 if [[ -d "`pwd`/build.win64" ]] ; then
0058 
0059     if [ "$1" != "-f" ] ; then
0060 
0061         read -p "Previous MXE build already exist and it will be removed. Do you want to continue ? [(c)ontinue/(s)top] " answer
0062 
0063         if echo "$answer" | grep -iq "^s" ; then
0064 
0065             echo "---------- Aborting..."
0066             exit;
0067 
0068         fi
0069 
0070     fi
0071 
0072     echo "---------- Removing existing MXE build"
0073     rm -fr `pwd`/build.win64
0074 
0075 fi
0076 
0077 echo "++++++++++++++++   Build 64 bits Installer   ++++++++++++++++++++++++++++++++++"
0078 echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
0079 
0080 ./01-build-mxe.sh
0081 ./02-build-extralibs.sh
0082 ./update.sh
0083 
0084 echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
0085 
0086 TerminateScript