You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
156 lines
4.7 KiB
156 lines
4.7 KiB
3 years ago
|
#!/bin/bash
|
||
13 years ago
|
# --------------------------------------------------------------------
|
||
|
# This program is free software: you can redistribute it and/or modify
|
||
|
# it under the terms of the GNU General Public License as published by
|
||
|
# the Free Software Foundation, either version 3 of the License, or
|
||
|
# (at your option) any later version.
|
||
|
#
|
||
|
# This program is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU General Public License for more details.
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
# ---------------------------------------------------------------------
|
||
|
|
||
9 years ago
|
SCRIPT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||
9 years ago
|
PROJECT_ROOT="$SCRIPT_PATH/../.."
|
||
|
|
||
13 years ago
|
|
||
12 years ago
|
APPLICATION_NAME="OpenBoard"
|
||
3 years ago
|
BASE_QT_DIR=~/Qt/5.15.2/clang_64
|
||
14 years ago
|
# Executables
|
||
9 years ago
|
QMAKE=$BASE_QT_DIR/bin/qmake
|
||
|
MACDEPLOYQT=$BASE_QT_DIR/bin/macdeployqt
|
||
5 years ago
|
DMGUTIL="$PROJECT_ROOT/release_scripts/osx/refnum/dmgutil/dmgutil.pl"
|
||
14 years ago
|
DSYMUTIL=/usr/bin/dsymutil
|
||
|
STRIP=/usr/bin/strip
|
||
|
PLISTBUDDY=/usr/libexec/PlistBuddy
|
||
13 years ago
|
ICEBERG=/usr/local/bin/freeze
|
||
9 years ago
|
LRELEASE=$BASE_QT_DIR/bin/lrelease
|
||
14 years ago
|
|
||
|
# Directories
|
||
9 years ago
|
BUILD_DIR="$PROJECT_ROOT/build/macx/release"
|
||
14 years ago
|
PRODUCT_DIR="$BUILD_DIR/product"
|
||
9 years ago
|
BASE_QT_TRANSLATIONS_DIRECTORY=$BASE_QT_DIR/translations
|
||
14 years ago
|
|
||
3 years ago
|
|
||
14 years ago
|
function notify {
|
||
|
GROWLNOTIFY=`which growlnotify`
|
||
|
if [ -x "$GROWLNOTIFY" ]; then
|
||
12 years ago
|
$GROWLNOTIFY --name OpenBoard-build --iconpath /Developer/Applications/Xcode.app --message "$1" "OpenBoard"
|
||
14 years ago
|
fi
|
||
3 years ago
|
printf "\033[48;5;120m--->\033[0m $1\n"
|
||
14 years ago
|
}
|
||
|
|
||
|
function warn {
|
||
3 years ago
|
printf "\033[48;5;178m--->\033[0m $1\n"
|
||
14 years ago
|
}
|
||
|
|
||
3 years ago
|
function error
|
||
|
{
|
||
|
printf "\033[48;5;160;38;5;15m--->\033[0m $1\n"
|
||
14 years ago
|
}
|
||
|
|
||
3 years ago
|
function abort {
|
||
|
error "$1"
|
||
|
exit 1
|
||
13 years ago
|
}
|
||
|
|
||
3 years ago
|
function checkExecutable {
|
||
|
if [ ! -x "$1" ]; then
|
||
|
abort "$1 not found"
|
||
12 years ago
|
fi
|
||
|
}
|
||
|
|
||
12 years ago
|
trap "defaults write org.oe-f.OpenBoard.release Running -bool NO" EXIT
|
||
14 years ago
|
|
||
12 years ago
|
notify "Running OpenBoard release script (`date`)"
|
||
14 years ago
|
|
||
9 years ago
|
cd $PROJECT_ROOT
|
||
|
|
||
12 years ago
|
script_is_running=`defaults read org.oe-f.OpenBoard.release Running 2>/dev/null`
|
||
14 years ago
|
if [[ $? -eq 0 ]] && [[ "$script_is_running" = "1" ]]; then
|
||
|
trap EXIT
|
||
|
abort "another release script already running"
|
||
|
fi
|
||
12 years ago
|
defaults write org.oe-f.OpenBoard.release Running -bool YES
|
||
14 years ago
|
|
||
|
# Check for executables
|
||
|
checkExecutable "$QMAKE"
|
||
|
checkExecutable "$MACDEPLOYQT"
|
||
|
checkExecutable "$DMGUTIL"
|
||
|
checkExecutable "$DSYMUTIL"
|
||
|
checkExecutable "$STRIP"
|
||
|
checkExecutable "$PLISTBUDDY"
|
||
13 years ago
|
checkExecutable "$ICEBERG"
|
||
13 years ago
|
checkExecutable "$LRELEASE"
|
||
14 years ago
|
|
||
12 years ago
|
DMG="$APPLICATION_NAME.dmg"
|
||
10 years ago
|
|
||
12 years ago
|
VOLUME="/Volumes/$APPLICATION_NAME"
|
||
|
APP="$PRODUCT_DIR/$APPLICATION_NAME.app"
|
||
|
DSYM_NAME="$APPLICATION_NAME (r$SVN_REVISION).dSYM"
|
||
14 years ago
|
DSYM="$PRODUCT_DIR/$DSYM_NAME"
|
||
12 years ago
|
GSYM_i386="$PRODUCT_DIR/$APPLICATION_NAME i386.sym"
|
||
14 years ago
|
INFO_PLIST="$APP/Contents/Info.plist"
|
||
|
|
||
13 years ago
|
if [ "$1" == "pkg" ]; then
|
||
9 years ago
|
BASE_ICEBERG_CONFIG_FILE="$SCRIPT_PATH/$APPLICATION_NAME.packproj"
|
||
13 years ago
|
#copy the standard file for working with
|
||
12 years ago
|
ICEBERG_CONFIG_FILE="$APPLICATION_NAME-working.packproj"
|
||
13 years ago
|
cp -r $BASE_ICEBERG_CONFIG_FILE $ICEBERG_CONFIG_FILE
|
||
13 years ago
|
# set version information
|
||
|
$PLISTBUDDY -c "Set :Hierarchy:Attributes:Settings:Description:International:IFPkgDescriptionVersion $VERSION" "$ICEBERG_CONFIG_FILE"
|
||
|
$PLISTBUDDY -c "Set :Hierarchy:Attributes:Settings:Display\ Information:CFBundleShortVersionString $VERSION" "$ICEBERG_CONFIG_FILE"
|
||
|
$PLISTBUDDY -c "Set :Hierarchy:Attributes:Settings:Version:IFMajorVersion `echo $VERSION | awk 'BEGIN { FS = "." }; { print $1 }'`" "$ICEBERG_CONFIG_FILE"
|
||
|
$PLISTBUDDY -c "Set :Hierarchy:Attributes:Settings:Version:IFMinorVersion `echo $VERSION | awk 'BEGIN { FS = "." }; { print $2 }'`" "$ICEBERG_CONFIG_FILE"
|
||
|
|
||
|
|
||
|
PRODUCT_DIR="install/mac/"
|
||
|
|
||
|
if [ ! -d "${PRODUCT_DIR}" ]; then
|
||
|
mkdir -p "${PRODUCT_DIR}"
|
||
|
fi
|
||
|
$ICEBERG $ICEBERG_CONFIG_FILE
|
||
13 years ago
|
|
||
|
#clean up mess
|
||
|
rm -rf $ICEBERG_CONFIG_FILE
|
||
|
|
||
13 years ago
|
exit 0
|
||
|
fi
|
||
|
|
||
14 years ago
|
notify "Creating dmg ..."
|
||
|
umount "$VOLUME" 2> /dev/null
|
||
12 years ago
|
$DMGUTIL --open --volume="$APPLICATION_NAME" "$DMG"
|
||
14 years ago
|
|
||
11 years ago
|
#cp *.pdf "$VOLUME"
|
||
14 years ago
|
cp -R "$APP" "$VOLUME"
|
||
|
ln -s /Applications "$VOLUME"
|
||
|
|
||
12 years ago
|
$DMGUTIL --set --iconsize=96 --toolbar=false --icon=resources/macx/OpenBoard.icns "$VOLUME"
|
||
13 years ago
|
$DMGUTIL --set --x=20 --y=60 --width=580 --height=440 "$VOLUME"
|
||
|
$DMGUTIL --set --x=180 --y=120 "$VOLUME/`basename \"$APP\"`"
|
||
|
$DMGUTIL --set --x=400 --y=120 "$VOLUME/Applications"
|
||
14 years ago
|
|
||
12 years ago
|
$DMGUTIL --close --volume="$APPLICATION_NAME" "$DMG"
|
||
14 years ago
|
|
||
|
PRODUCT_DIR="install/mac/"
|
||
|
|
||
|
if [ ! -d "${PRODUCT_DIR}" ]; then
|
||
|
mkdir -p "${PRODUCT_DIR}"
|
||
|
fi
|
||
|
|
||
10 years ago
|
|
||
|
if [ "$1" == "1010" ]; then
|
||
|
mv "$DMG" "${PRODUCT_DIR}/OpenBoard_for_1010.dmg"
|
||
|
else
|
||
|
mv "$DMG" "${PRODUCT_DIR}"
|
||
|
fi
|
||
|
|
||
3 years ago
|
notify "$APPLICATION_NAME is now packaged. You can submit this dmg file to notarization using notarize.sh"
|
||
14 years ago
|
|
||
|
exit 0
|
||
|
|