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.
260 lines
7.8 KiB
260 lines
7.8 KiB
13 years ago
|
#!/bin/bash
|
||
14 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/>.
|
||
|
# ---------------------------------------------------------------------
|
||
|
|
||
13 years ago
|
|
||
12 years ago
|
APPLICATION_NAME="OpenBoard"
|
||
9 years ago
|
BASE_QT_DIR=~/Qt/5.5/clang_64
|
||
14 years ago
|
# Executables
|
||
9 years ago
|
QMAKE=$BASE_QT_DIR/bin/qmake
|
||
|
MACDEPLOYQT=$BASE_QT_DIR/bin/macdeployqt
|
||
|
DMGUTIL="`pwd`/../OpenBoard-ThirdParty/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
|
||
|
BUILD_DIR="build/macx/release"
|
||
|
PRODUCT_DIR="$BUILD_DIR/product"
|
||
9 years ago
|
BASE_QT_TRANSLATIONS_DIRECTORY=$BASE_QT_DIR/translations
|
||
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
|
||
|
printf "\033[32m--->\033[0m $1\n"
|
||
|
}
|
||
|
|
||
|
function abort {
|
||
|
printf "\033[31merror:\033[0m $1\n"
|
||
|
exit 1
|
||
|
}
|
||
|
|
||
|
function warn {
|
||
|
abort "$1"
|
||
|
}
|
||
|
|
||
|
function checkExecutable {
|
||
|
if [ ! -x "$1" ]; then
|
||
|
abort "$1 not found"
|
||
|
fi
|
||
|
}
|
||
|
|
||
13 years ago
|
function addQtTranslations {
|
||
|
for eachTranslation in `ls $BASE_QT_TRANSLATIONS_DIRECTORY/qt_??.qm`
|
||
|
do
|
||
|
# looking fo the language code for each qt translation file
|
||
|
languageCode=`echo $eachTranslation | sed 's/.*qt_\(.*\).qm/\1/'`
|
||
12 years ago
|
basicDir=$PRODUCT_DIR/$APPLICATION_NAME.app/Contents/Resources/
|
||
13 years ago
|
for eachDirectory in `ls $basicDir`
|
||
|
do
|
||
12 years ago
|
# looping through the OpenBoard availables languages
|
||
13 years ago
|
directoryLanguageCode=`echo $eachDirectory | sed 's/\(.*\)\.lproj/\1/'`
|
||
|
if [ ! -z $directoryLanguageCode ]; then
|
||
|
if [[ $eachDirectory == *".lproj"* && $eachDirectory != "empty.lproj" && $directoryLanguageCode == *$languageCode* ]]; then
|
||
12 years ago
|
# OpenBoard translation found for qt translation file
|
||
13 years ago
|
cp $eachTranslation $basicDir/$eachDirectory
|
||
|
if [ $directoryLanguageCode != $languageCode ]; then
|
||
|
# handling fr and fr_CH code.
|
||
|
mv $basicDir/$eachDirectory/qt_$languageCode.qm $basicDir/$eachDirectory/qt_$directoryLanguageCode.qm
|
||
|
fi
|
||
|
fi
|
||
|
fi
|
||
|
done
|
||
|
done
|
||
|
|
||
|
}
|
||
|
|
||
12 years ago
|
|
||
|
function addImporter {
|
||
10 years ago
|
importerDir="`pwd`/../OpenBoard-Importer"
|
||
12 years ago
|
importerName="OpenBoardImporter"
|
||
|
|
||
|
if [ ! -e ${importerDir} ]; then
|
||
|
abort "${importerDir} not found"
|
||
|
fi
|
||
|
|
||
|
cd ${importerDir}
|
||
9 years ago
|
# git reset --hard
|
||
|
# git pull
|
||
12 years ago
|
rm -rf ${importerName}.app
|
||
|
rm MakeFile*
|
||
11 years ago
|
rm -rf release
|
||
|
rm -rf debug
|
||
12 years ago
|
$QMAKE ${importerName}.pro
|
||
11 years ago
|
make -j4 release
|
||
12 years ago
|
$MACDEPLOYQT ${importerName}.app
|
||
|
cd -
|
||
|
}
|
||
|
|
||
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
|
|
||
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
|
addImporter
|
||
|
|
||
14 years ago
|
# delete the build directory
|
||
|
notify "Cleaning ..."
|
||
|
rm -rf "$BUILD_DIR"
|
||
|
|
||
13 years ago
|
# application translations
|
||
|
notify "Generating applications translatons"
|
||
12 years ago
|
$LRELEASE "$APPLICATION_NAME.pro"
|
||
13 years ago
|
|
||
14 years ago
|
# generate Makefiles
|
||
|
notify "Generating Makefile ..."
|
||
|
|
||
|
|
||
10 years ago
|
if [ "$1" == "1010" ]; then
|
||
|
QMAKE_CMD="$QMAKE \"DEFINES+=OS_NEWER_THAN_OR_EQUAL_TO_1010\" $APPLICATION_NAME.pro -spec macx-g++"
|
||
|
else
|
||
|
QMAKE_CMD="$QMAKE $APPLICATION_NAME.pro -spec macx-g++"
|
||
|
fi
|
||
14 years ago
|
$QMAKE_CMD
|
||
|
|
||
14 years ago
|
# build
|
||
|
notify "Compiling ..."
|
||
|
make -j4 release
|
||
|
|
||
13 years ago
|
notify "Qt Translations ..."
|
||
9 years ago
|
#$LRELEASE $BASE_QT_TRANSLATIONS_DIRECTORY/translations.pro
|
||
13 years ago
|
addQtTranslations
|
||
|
|
||
12 years ago
|
cp -R resources/customizations $PRODUCT_DIR/$APPLICATION_NAME.app/Contents/Resources
|
||
12 years ago
|
cp -R $importerDir/$importerName.app $PRODUCT_DIR/$APPLICATION_NAME.app/Contents/Resources
|
||
13 years ago
|
|
||
14 years ago
|
VERSION=`cat "$BUILD_DIR/version"`
|
||
14 years ago
|
if [ ! -f "$BUILD_DIR/version" ]; then
|
||
14 years ago
|
echo "version not found"
|
||
|
exit 1
|
||
9 years ago
|
#else
|
||
|
# notify "Tagging ..."
|
||
|
# LAST_COMMITED_VERSION="`git describe $(git rev-list --tags --max-count=1)`"
|
||
|
# if [ "v$VERSION" != "$LAST_COMMITED_VERSION" ]; then
|
||
|
# echo creating a tag with the version $VERSION
|
||
12 years ago
|
# git tag -a "v$VERSION" -m "Generated setup for v$VERSION"
|
||
|
# git push origin --tags
|
||
9 years ago
|
# fi
|
||
14 years ago
|
fi
|
||
14 years ago
|
|
||
9 years ago
|
#if [ $? != 0 ]; then
|
||
|
# abort "compilation failed"
|
||
|
#fi
|
||
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"
|
||
|
|
||
|
rm -f "$APP/Contents/Resources/empty.lproj"
|
||
|
|
||
|
# set various version infomration in Info.plist
|
||
13 years ago
|
$PLISTBUDDY -c "Set :CFBundleVersion $VERSION" "$INFO_PLIST"
|
||
14 years ago
|
$PLISTBUDDY -c "Set :CFBundleShortVersionString $VERSION" "$INFO_PLIST"
|
||
12 years ago
|
$PLISTBUDDY -c "Set :CFBundleGetInfoString $APPLICATION_NAME" "$INFO_PLIST"
|
||
14 years ago
|
|
||
|
# bundle Qt Frameworks into the app bundle
|
||
|
notify "Bulding frameworks ..."
|
||
13 years ago
|
cd "`pwd`/build/macx/release/product/"
|
||
12 years ago
|
$MACDEPLOYQT "`pwd`/$APPLICATION_NAME.app"
|
||
13 years ago
|
cd -
|
||
14 years ago
|
|
||
|
notify "Extracting debug information ..."
|
||
12 years ago
|
$DSYMUTIL "$APP/Contents/MacOS/$APPLICATION_NAME" -o "$DSYM"
|
||
|
$STRIP -S "$APP/Contents/MacOS/$APPLICATION_NAME"
|
||
14 years ago
|
|
||
13 years ago
|
if [ "$1" == "pkg" ]; then
|
||
12 years ago
|
BASE_ICEBERG_CONFIG_FILE="$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
|
|
||
12 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
|
|
||
12 years ago
|
notify "$APPLICATION_NAME is built"
|
||
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
|
||
|
|
||
14 years ago
|
|
||
|
exit 0
|
||
|
|