From a2727154c3863435e86963b3a7c79048141deabb Mon Sep 17 00:00:00 2001 From: alemuntoni Date: Wed, 30 Nov 2022 16:31:34 +0100 Subject: [PATCH] remove pack phase from macOS --- .github/workflows/BuildMeshLab.yml | 2 +- scripts/Linux/2_deploy.sh | 6 +-- scripts/macOS/2_deploy.sh | 36 ++++++------------ scripts/macOS/internal/2a_appbundle.sh | 39 +++++++++++++++++++ scripts/macOS/internal/2b_dmg.sh | 52 ++++++++++++++++++++++++++ scripts/macOS/make_it.sh | 19 +--------- 6 files changed, 108 insertions(+), 46 deletions(-) create mode 100644 scripts/macOS/internal/2a_appbundle.sh create mode 100644 scripts/macOS/internal/2b_dmg.sh diff --git a/.github/workflows/BuildMeshLab.yml b/.github/workflows/BuildMeshLab.yml index c6addc564..f2030ffca 100644 --- a/.github/workflows/BuildMeshLab.yml +++ b/.github/workflows/BuildMeshLab.yml @@ -68,7 +68,7 @@ jobs: run: | bash scripts/${{ runner.os }}/2_deploy.sh - name: Packaging - if: runner.os != 'Linux' + if: runner.os == 'Windows' shell: bash run: | bash scripts/${{ runner.os }}/3_pack.sh diff --git a/scripts/Linux/2_deploy.sh b/scripts/Linux/2_deploy.sh index 06702dacd..8c79a5261 100644 --- a/scripts/Linux/2_deploy.sh +++ b/scripts/Linux/2_deploy.sh @@ -2,7 +2,7 @@ SCRIPTS_PATH="$(dirname "$(realpath "$0")")" INSTALL_PATH=$SCRIPTS_PATH/../../install -QT_DIR="" +QT_DIR_OPTION="" PACKAGES_PATH=$SCRIPTS_PATH/../../packages #checking for parameters @@ -14,7 +14,7 @@ case $i in shift # past argument=value ;; -qt=*|--qt_dir=*) - QT_DIR=${i#*=} + QT_DIR_OPTION=-qt=${i#*=} shift # past argument=value ;; -p=*|--packages_path=*) @@ -35,7 +35,7 @@ bash $SCRIPTS_PATH/internal/2b_deb.sh -i=$INSTALL_PATH -p=$PACKAGES_PATH echo "======= Deb Created =======" -bash $SCRIPTS_PATH/internal/2c_portable.sh -i=$INSTALL_PATH -qt=$QT_DIR +bash $SCRIPTS_PATH/internal/2c_portable.sh -i=$INSTALL_PATH $QT_DIR_OPTION echo "======= Portable Version Created =======" diff --git a/scripts/macOS/2_deploy.sh b/scripts/macOS/2_deploy.sh index b60576b32..25d0f4a8d 100755 --- a/scripts/macOS/2_deploy.sh +++ b/scripts/macOS/2_deploy.sh @@ -1,20 +1,10 @@ #!/bin/bash -# this is a script shell for deploying a meshlab-portable app. -# Requires a properly built meshlab. -# -# Without given arguments, the folder that will be deployed is meshlab/install. -# -# You can give as argument the INSTALL_PATH in the following way: -# bash 2_deploy.sh --install_path=/path/to/install -# -i argument is also supported. -# -# After running this script, $INSTALL_PATH/meshlab.app will be a portable meshlab application. -SCRIPTS_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +SCRIPTS_PATH="$(dirname "$(realpath "$0")")" INSTALL_PATH=$SCRIPTS_PATH/../../install -QT_DIR="" -APPNAME="meshlab.app" +QT_DIR_OPTION="" +PACKAGES_PATH=$SCRIPTS_PATH/../../packages #checking for parameters for i in "$@" @@ -25,7 +15,11 @@ case $i in shift # past argument=value ;; -qt=*|--qt_dir=*) - QT_DIR=${i#*=}/bin/ + QT_DIR_OPTION=-qt=${i#*=} + shift # past argument=value + ;; + -p=*|--packages_path=*) + PACKAGES_PATH="${i#*=}" shift # past argument=value ;; *) @@ -34,16 +28,10 @@ case $i in esac done -ARGUMENTS="" +bash $SCRIPTS_PATH/internal/2a_appbundle.sh -i=$INSTALL_PATH $QT_DIR_OPTION -for plugin in $INSTALL_PATH/$APPNAME/Contents/PlugIns/*.so -do - ARGUMENTS="${ARGUMENTS} -executable=${plugin}" -done +echo "======= AppBundle Created =======" -${QT_DIR}macdeployqt $INSTALL_PATH/$APPNAME \ - $ARGUMENTS +bash $SCRIPTS_PATH/internal/2b_dmg.sh -i=$INSTALL_PATH -p=$PACKAGES_PATH -# remove everything from install path, except the appbundle -cd $INSTALL_PATH -ls | grep -xv "${APPNAME}" | xargs rm \ No newline at end of file +echo "======= DMG Created =======" \ No newline at end of file diff --git a/scripts/macOS/internal/2a_appbundle.sh b/scripts/macOS/internal/2a_appbundle.sh new file mode 100644 index 000000000..fb3dfb4c7 --- /dev/null +++ b/scripts/macOS/internal/2a_appbundle.sh @@ -0,0 +1,39 @@ +#!/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#*=}/bin/ + 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_DIR}macdeployqt $INSTALL_PATH/$APPNAME \ + $ARGUMENTS + +# remove everything from install path, except the appbundle +cd $INSTALL_PATH +ls | grep -xv "${APPNAME}" | xargs rm \ No newline at end of file diff --git a/scripts/macOS/internal/2b_dmg.sh b/scripts/macOS/internal/2b_dmg.sh new file mode 100644 index 000000000..7a5495d15 --- /dev/null +++ b/scripts/macOS/internal/2b_dmg.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +SCRIPTS_PATH="$(dirname "$(realpath "$0")")"/.. +RESOURCES_PATH=$SCRIPTS_PATH/../../resources +INSTALL_PATH=$SCRIPTS_PATH/../../install +PACKAGES_PATH=$SCRIPTS_PATH/../../packages + +#checking for parameters +for i in "$@" +do +case $i in + -i=*|--install_path=*) + INSTALL_PATH="${i#*=}" + shift # past argument=value + ;; + -p=*|--packages_path=*) + PACKAGES_PATH="${i#*=}" + shift # past argument=value + ;; + *) + # unknown option + ;; +esac +done + +if ! [ -e $INSTALL_PATH/meshlab.app -a -d $INSTALL_PATH/meshlab.app ] +then + echo "Started in the wrong dir: I have not found the meshlab.app" + exit -1 +fi + +#get version +IFS=' ' #space delimiter +STR_VERSION=$($INSTALL_PATH/meshlab.app/Contents/MacOS/meshlab --version) +read -a strarr <<< "$STR_VERSION" +ML_VERSION=${strarr[1]} #get the meshlab version from the string + +# final step create the dmg using appdmg +# appdmg is installed with 'npm install -g appdmg'", +sed "s%DISTRIB_PATH%$INSTALL_PATH%g" $RESOURCES_PATH/macos/meshlab_dmg_latest.json > $RESOURCES_PATH/macos/meshlab_dmg_final.json +sed -i '' "s%ML_VERSION%$ML_VERSION%g" $RESOURCES_PATH/macos/meshlab_dmg_final.json +sed -i '' "s%RESOURCES_PATH%$RESOURCES_PATH%g" $RESOURCES_PATH/macos/meshlab_dmg_final.json + +rm -f $INSTALL_PATH/*.dmg + +mv $INSTALL_PATH/meshlab.app $INSTALL_PATH/MeshLab$ML_VERSION.app + +mkdir $PACKAGES_PATH + +appdmg $RESOURCES_PATH/macos/meshlab_dmg_final.json $PACKAGES_PATH/MeshLab$ML_VERSION-macos.dmg + +rm $RESOURCES_PATH/macos/meshlab_dmg_final.json \ No newline at end of file diff --git a/scripts/macOS/make_it.sh b/scripts/macOS/make_it.sh index c485c68a6..a28a311ff 100644 --- a/scripts/macOS/make_it.sh +++ b/scripts/macOS/make_it.sh @@ -1,20 +1,4 @@ #!/bin/bash -# This is a script shell for compiling and deploying MeshLab in a MacOS environment. -# -# Requires a Qt environment which is set-up properly, and an accessible -# cmake binary. -# -# Without given arguments, MeshLab will be built in the meshlab/build, -# the folder meshlab/install will contain meshlab.app and -# the DMG will be placed in the meshlab directory. -# -# You can give as argument the build path, the install path (that will contain -# the portable version of MeshLab), and the number of cores to use to build MeshLab -# (default: 4). -# The DMG will be placed in the parent directory of the install path. -# -# Example of call: -# bash make_it.sh --build_path=path/to/build --install_path=path/to/install -j8 SCRIPTS_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) SOURCE_PATH=$SCRIPTS_PATH/../.. @@ -66,6 +50,5 @@ esac done bash $SCRIPTS_PATH/1_build.sh -b=$BUILD_PATH -i=$INSTALL_PATH $NIGHTLY_OPTION $DOUBLE_PRECISION_OPTION $QT_DIR_OPTION $CCACHE_OPTION -bash $SCRIPTS_PATH/2_deploy.sh -i=$INSTALL_PATH $QT_DIR_OPTION -bash $SCRIPTS_PATH/3_pack.sh -i=$INSTALL_PATH -p=$PACKAGES_PATH +bash $SCRIPTS_PATH/2_deploy.sh -i=$INSTALL_PATH -p=$PACKAGES_PATH $QT_DIR_OPTION