File: 2a_appbundle.sh

package info (click to toggle)
meshlab 2025.07~dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,136 kB
  • sloc: cpp: 224,482; ansic: 20,973; sh: 1,001; makefile: 31
file content (62 lines) | stat: -rw-r--r-- 1,322 bytes parent folder | download
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
#!/bin/bash

SCRIPTS_PATH="$(dirname "$(realpath "$0")")"/..

INSTALL_PATH=$SCRIPTS_PATH/../../install
QT_DIR=""
APPNAME="meshlab.app"

#checking for parameters
for i in "$@"
do
case $i in
    -i=*|--install_path=*)
        INSTALL_PATH="${i#*=}"
        shift # past argument=value
        ;;
    -qt=*|--qt_dir=*)
        QT_DIR=${i#*=}
        shift # past argument=value
        ;;
    --use_brew_qt)
        QT_DIR=$(brew --prefix qt@5)
        shift # past argument=value
        ;;
    *)
        # unknown option
        ;;
esac
done

ARGUMENTS=""

for plugin in $INSTALL_PATH/$APPNAME/Contents/PlugIns/*.so
do
    ARGUMENTS="${ARGUMENTS} -executable=${plugin}"
done

QT_BASE_DIR=""

# if QT_DIR is not empty
if [ -n "$QT_DIR" ]; then
    # set QT_BASE_DIR to the path of QT_DIR/bin
    QT_BASE_DIR="${QT_DIR}/bin/"
fi

# save in message the output of macdeployqt
message=$(${QT_BASE_DIR}macdeployqt $INSTALL_PATH/$APPNAME \
    $ARGUMENTS 2>&1)

# if message contains "ERROR" then macdeployqt failed
if [[ $message == *"ERROR"* ]]; then
    echo "macdeployqt failed."
    echo "macdeployqt output:"
    echo $message
    exit 1
fi

# remove everything from install path, except the appbundle
cd $INSTALL_PATH
ls | grep -xv "${APPNAME}" | xargs rm

echo "$INSTALL_PATH is now a self contained meshlab application"