Debian Codegraph @

project/bundles/homebrew/makeall.sh

raw
1 #!/bin/bash
2
3 # Script to run all Macports based sub-scripts to build MacOS installer.
4 # Possible option : "-f" to force operations without to ask confirmation to user.
5 #
6 # SPDX-FileCopyrightText: 2013-2026 by Gilles Caulier <caulier dot gilles at gmail dot com>
7 #
8 # SPDX-License-Identifier: BSD-3-Clause
9 #
10
11 ########################################################################
12 # Function to upload host log files
13 HostUploadLogFiles()
14 {
15
16 if [[ $DK_UPLOAD = 1 ]] ; then
17
18 echo -e "---------- Cleanup older host logs from files.kde.org repository \n"
19
20 sftp -q $DK_UPLOADURL:$DK_UPLOADDIR/build.logs/macos-$ARCH_TARGET <<< "rm build-macports.full.log.gz"
21 sftp -q $DK_UPLOADURL:$DK_UPLOADDIR/build.logs/macos-$ARCH_TARGET <<< "rm build-extralibs.full.log.gz"
22
23 echo -e "---------- Compress host log files \n"
24
25 gzip -k $ORIG_WD/logs/build-macports.full.log $ORIG_WD/logs/build-macports.full.log.gz || true
26 gzip -k $ORIG_WD/logs/build-extralibs.full.log $ORIG_WD/logs/build-extralibs.full.log.gz || true
27
28 echo -e "---------- Upload new host logs to files.kde.org repository \n"
29
30 rsync -r -v --progress -e ssh $ORIG_WD/logs/build-macports.full.log.gz $DK_UPLOADURL:$DK_UPLOADDIR/build.logs/macos-$ARCH_TARGET || true
31 rsync -r -v --progress -e ssh $ORIG_WD/logs/build-extralibs.full.log.gz $DK_UPLOADURL:$DK_UPLOADDIR/build.logs/macos-$ARCH_TARGET || true
32
33 echo -e "---------- Cleanup local bundle log file archives \n"
34
35 rm -f $ORIG_WD/logs/build-macports.full.log.gz || true
36 rm -f $ORIG_WD/logs/build-extralibs.full.log.gz || true
37
38 fi
39
40 }
41
42 # Ask to run as root
43 (( EUID != 0 )) && exec sudo -- "$0" "$@"
44
45 # Halt and catch errors
46 set -eE
47 trap 'PREVIOUS_COMMAND=$THIS_COMMAND; THIS_COMMAND=$BASH_COMMAND' DEBUG
48 trap 'echo "FAILED COMMAND: $PREVIOUS_COMMAND"' ERR
49 trap HostUploadLogFiles ERR exit
50
51 #################################################################################################
52 # Pre-processing checks
53
54 ORIG_WD="`pwd`"
55
56 . ./config.sh
57 . ./common.sh
58 StartScript
59 ChecksRunAsRoot
60 ChecksXCodeCLI
61 ChecksCPUCores
62
63 echo "This script will build from scratch the digiKam installer for MacOS using Macports."
64 echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
65
66 if [ -d "$INSTALL_PREFIX" ] ; then
67
68 if [ "$1" != "-f" ] ; then
69
70 read -p "A previous Macports build already exist and it will be removed. Do you want to continue ? [(c)ontinue/(s)top] " answer
71
72 if echo "$answer" | grep -iq "^s" ; then
73
74 echo "---------- Aborting..."
75 exit;
76
77 fi
78
79 fi
80
81 echo "---------- Removing existing Macports build"
82 mv $INSTALL_PREFIX $INSTALL_PREFIX.old && rm -fr $INSTALL_PREFIX.old
83
84 fi
85
86 ./01-build-macports.sh
87 ./02-build-extralibs.sh
88 ./update.sh
89
90 echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
91
92 TerminateScript