File indexing completed on 2024-06-16 04:06:49
0001 #!/bin/bash 0002 0003 # Script to run all Macports based sub-scripts to build MacOS 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/macos <<< "rm build-macports.full.log.gz" 0021 sftp -q $DK_UPLOADURL:$DK_UPLOADDIR/build.logs/macos <<< "rm build-extralibs.full.log.gz" 0022 0023 echo -e "---------- Compress host log files \n" 0024 0025 gzip -k $ORIG_WD/logs/build-macports.full.log $ORIG_WD/logs/build-macports.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-macports.full.log.gz $DK_UPLOADURL:$DK_UPLOADDIR/build.logs/macos || true 0031 rsync -r -v --progress -e ssh $ORIG_WD/logs/build-extralibs.full.log.gz $DK_UPLOADURL:$DK_UPLOADDIR/build.logs/macos || true 0032 0033 echo -e "---------- Cleanup local bundle log file archives \n" 0034 0035 rm -f $ORIG_WD/logs/build-macports.full.log.gz || true 0036 rm -f $ORIG_WD/logs/build-extralibs.full.log.gz || true 0037 0038 fi 0039 0040 } 0041 0042 # Ask to run as root 0043 (( EUID != 0 )) && exec sudo -- "$0" "$@" 0044 0045 # Halt and catch errors 0046 set -eE 0047 trap 'PREVIOUS_COMMAND=$THIS_COMMAND; THIS_COMMAND=$BASH_COMMAND' DEBUG 0048 trap 'echo "FAILED COMMAND: $PREVIOUS_COMMAND"' ERR 0049 trap HostUploadLogFiles ERR exit 0050 0051 ################################################################################################# 0052 # Pre-processing checks 0053 0054 ORIG_WD="`pwd`" 0055 0056 . ./config.sh 0057 . ./common.sh 0058 StartScript 0059 ChecksRunAsRoot 0060 ChecksXCodeCLI 0061 ChecksCPUCores 0062 0063 echo "This script will build from scratch the digiKam installer for MacOS using Macports." 0064 echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 0065 0066 if [ -d "$INSTALL_PREFIX" ] ; then 0067 0068 if [ "$1" != "-f" ] ; then 0069 0070 read -p "A previous Macports build already exist and it will be removed. Do you want to continue ? [(c)ontinue/(s)top] " answer 0071 0072 if echo "$answer" | grep -iq "^s" ; then 0073 0074 echo "---------- Aborting..." 0075 exit; 0076 0077 fi 0078 0079 fi 0080 0081 echo "---------- Removing existing Macports build" 0082 mv $INSTALL_PREFIX $INSTALL_PREFIX.old && rm -fr $INSTALL_PREFIX.old 0083 0084 fi 0085 0086 ./01-build-macports.sh 0087 ./02-build-extralibs.sh 0088 ./update.sh 0089 0090 echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 0091 0092 TerminateScript