meshlab/scripts/macOS/internal/2a_appbundle.sh
2024-02-02 09:42:04 +01:00

55 lines
1.1 KiB
Bash

#!/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 qt5)
shift # past argument=value
;;
*)
# unknown option
;;
esac
done
ARGUMENTS=""
for plugin in $INSTALL_PATH/$APPNAME/Contents/PlugIns/*.so
do
ARGUMENTS="${ARGUMENTS} -executable=${plugin}"
done
# save in message the output of macdeployqt
message=$(${QT_DIR}/bin/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"