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.
206 lines
6.2 KiB
206 lines
6.2 KiB
3 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/>.
|
||
|
# ---------------------------------------------------------------------
|
||
|
|
||
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
|
|
||
|
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
|
}
|
||
|
|
||
3 years ago
|
function warn {
|
||
|
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"
|
||
|
}
|
||
|
|
||
|
function abort {
|
||
|
error "$1"
|
||
|
exit 1
|
||
14 years ago
|
}
|
||
|
|
||
|
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*
|
||
12 years ago
|
rm -rf release
|
||
|
rm -rf debug
|
||
3 years ago
|
$QMAKE ${importerName}.pro -spec macx-clang
|
||
12 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
|
|
||
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
|
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
|
||
3 years ago
|
QMAKE_CMD="$QMAKE \"DEFINES+=OS_NEWER_THAN_OR_EQUAL_TO_1010\" $APPLICATION_NAME.pro -spec macx-clang"
|
||
10 years ago
|
else
|
||
3 years ago
|
QMAKE_CMD="$QMAKE $APPLICATION_NAME.pro -spec macx-clang"
|
||
10 years ago
|
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
|
||
14 years ago
|
fi
|
||
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"
|
||
3 years ago
|
$PLISTBUDDY -c "Set :CFBundleGetInfoString $VERSION" "$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
|
|
||
3 years ago
|
notify "$APPLICATION_NAME is now built. You can now sign the application using the script 'codesign.sh'."
|
||
|
notify "Usage : sudo ./codesign.sh \"Developer ID Application: ...\""
|
||
|
notify "You can also ignore signing step if you don't intend to distribute this version"
|
||
|
notify "If so, you can directly package OpenBoard using the script 'package.sh'"
|
||
|
notify "Usage : sudo ./package.sh"
|
||
14 years ago
|
|
||
|
exit 0
|
||
|
|