2018-08-11 21:52:44 +00:00
|
|
|
# This script requires create-dmg to be installed from https://github.com/sindresorhus/create-dmg
|
2018-07-29 10:38:59 +00:00
|
|
|
BUILD_CONFIG=$1
|
|
|
|
|
|
|
|
fail()
|
|
|
|
{
|
|
|
|
echo "$1" 1>&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ "$BUILD_CONFIG" != "Debug" ] && [ "$BUILD_CONFIG" != "Release" ]; then
|
|
|
|
fail "Invalid build configuration"
|
|
|
|
fi
|
|
|
|
|
2019-01-06 01:25:40 +00:00
|
|
|
[ "$SIGNING_KEY" == "" ] || git diff-index --quiet HEAD -- || fail "Signed release builds must not have unstaged changes!"
|
|
|
|
|
2018-07-29 10:38:59 +00:00
|
|
|
BUILD_ROOT=$PWD/build
|
|
|
|
SOURCE_ROOT=$PWD
|
|
|
|
BUILD_FOLDER=$BUILD_ROOT/build-$BUILD_CONFIG
|
|
|
|
INSTALLER_FOLDER=$BUILD_ROOT/installer-$BUILD_CONFIG
|
2019-01-06 03:06:00 +00:00
|
|
|
VERSION=`cat $SOURCE_ROOT/app/version.txt`
|
2018-07-29 10:38:59 +00:00
|
|
|
|
|
|
|
echo Cleaning output directories
|
|
|
|
rm -rf $BUILD_FOLDER
|
|
|
|
rm -rf $INSTALLER_FOLDER
|
|
|
|
mkdir $BUILD_ROOT
|
|
|
|
mkdir $BUILD_FOLDER
|
|
|
|
mkdir $INSTALLER_FOLDER
|
|
|
|
|
|
|
|
echo Configuring the project
|
|
|
|
pushd $BUILD_FOLDER
|
|
|
|
qmake $SOURCE_ROOT/moonlight-qt.pro || fail "Qmake failed!"
|
|
|
|
popd
|
|
|
|
|
|
|
|
echo Compiling Moonlight in $BUILD_CONFIG configuration
|
|
|
|
pushd $BUILD_FOLDER
|
|
|
|
make $(echo "$BUILD_CONFIG" | tr '[:upper:]' '[:lower:]') || fail "Make failed!"
|
|
|
|
popd
|
|
|
|
|
2018-09-04 09:20:00 +00:00
|
|
|
echo Saving dSYM file
|
|
|
|
pushd $BUILD_FOLDER
|
2019-01-06 03:06:00 +00:00
|
|
|
dsymutil app/Moonlight.app/Contents/MacOS/Moonlight -o Moonlight-$VERSION.dsym || fail "dSYM creation failed!"
|
|
|
|
cp -R Moonlight-$VERSION.dsym $INSTALLER_FOLDER || fail "dSYM copy failed!"
|
2018-09-04 09:20:00 +00:00
|
|
|
popd
|
|
|
|
|
2018-07-29 10:38:59 +00:00
|
|
|
echo Copying dylib dependencies
|
|
|
|
mkdir $BUILD_FOLDER/app/Moonlight.app/Contents/lib
|
2018-07-29 22:35:51 +00:00
|
|
|
cp $SOURCE_ROOT/libs/mac/lib/*.dylib $BUILD_FOLDER/app/Moonlight.app/Contents/lib/ || fail "Dylib copy failed!"
|
2018-07-29 10:38:59 +00:00
|
|
|
|
2018-08-11 21:52:44 +00:00
|
|
|
echo Creating app bundle
|
2018-07-29 10:38:59 +00:00
|
|
|
EXTRA_ARGS=
|
2018-07-29 22:35:51 +00:00
|
|
|
if [ "$BUILD_CONFIG" == "Debug" ]; then EXTRA_ARGS="$EXTRA_ARGS -use-debug-libs"; fi
|
|
|
|
if [ "$SIGNING_KEY" != "" ]; then EXTRA_ARGS="$EXTRA_ARGS -codesign=$SIGNING_KEY"; fi
|
|
|
|
echo Extra deployment arguments: $EXTRA_ARGS
|
2018-08-11 21:52:44 +00:00
|
|
|
macdeployqt $BUILD_FOLDER/app/Moonlight.app $EXTRA_ARGS -qmldir=$SOURCE_ROOT/app/gui -appstore-compliant || fail "macdeployqt failed!"
|
2018-07-29 22:35:51 +00:00
|
|
|
|
2018-08-11 21:52:44 +00:00
|
|
|
echo Creating DMG
|
|
|
|
create-dmg $BUILD_FOLDER/app/Moonlight.app $INSTALLER_FOLDER || fail "create-dmg failed!"
|
2019-01-06 03:06:00 +00:00
|
|
|
mv $INSTALLER_FOLDER/Moonlight\ $VERSION.dmg $INSTALLER_FOLDER/Moonlight-$VERSION.dmg
|