Skip to content

Commit

Permalink
remove pack phase from macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
alemuntoni committed Nov 30, 2022
1 parent 07d6760 commit a272715
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/BuildMeshLab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions scripts/Linux/2_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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=*)
Expand All @@ -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 ======="

Expand Down
36 changes: 12 additions & 24 deletions scripts/macOS/2_deploy.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
Expand All @@ -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
;;
*)
Expand All @@ -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
echo "======= DMG Created ======="
39 changes: 39 additions & 0 deletions scripts/macOS/internal/2a_appbundle.sh
Original file line number Diff line number Diff line change
@@ -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
52 changes: 52 additions & 0 deletions scripts/macOS/internal/2b_dmg.sh
Original file line number Diff line number Diff line change
@@ -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
19 changes: 1 addition & 18 deletions scripts/macOS/make_it.sh
Original file line number Diff line number Diff line change
@@ -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/../..
Expand Down Expand Up @@ -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

0 comments on commit a272715

Please sign in to comment.