2014-07-23 11:15:34 +00:00
|
|
|
|
#!/bin/sh
|
2019-08-30 14:09:08 +02:00
|
|
|
|
# Copyright 2019 The QElectroTech Team
|
2014-07-23 11:15:34 +00:00
|
|
|
|
# This file is part of QElectroTech.
|
|
|
|
|
|
|
|
|
|
# QElectroTech 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 2 of the License, or
|
|
|
|
|
# (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
# QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
2016-10-14 14:59:18 +00:00
|
|
|
|
# Need homebrew and coreutils installed see <http://brew.sh>.
|
2014-07-23 11:15:34 +00:00
|
|
|
|
|
|
|
|
|
# configuration
|
|
|
|
|
APPNAME='qelectrotech'
|
|
|
|
|
BUNDLE=$APPNAME.app
|
|
|
|
|
APPBIN="$BUNDLE/Contents/MacOS/$APPNAME"
|
|
|
|
|
|
|
|
|
|
# Emplacement du script
|
|
|
|
|
current_dir=$(dirname "$0")
|
|
|
|
|
|
|
|
|
|
# On se remet au depart
|
2014-11-14 20:44:17 +00:00
|
|
|
|
cd "${current_dir}/../"
|
2014-07-23 11:15:34 +00:00
|
|
|
|
|
|
|
|
|
# Emplacement courant
|
|
|
|
|
current_dir=$(PWD)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### get system configuration ########################################
|
|
|
|
|
|
|
|
|
|
echo
|
|
|
|
|
echo "______________________________________________________________"
|
|
|
|
|
echo "This script prepares a Qt application bundle for deployment."
|
|
|
|
|
echo "Please see the \"Deploying an Application on Qt/Mac\""
|
|
|
|
|
echo "page in the Qt documentation for more information."
|
|
|
|
|
echo
|
|
|
|
|
echo "This script :"
|
|
|
|
|
echo "\t - up date the svn depot"
|
|
|
|
|
echo "\t - built the application bundle,"
|
|
|
|
|
echo "\t - copy over required Qt frameworks,"
|
2022-12-04 16:54:51 -05:00
|
|
|
|
echo "\t - copy additional files: translations, titleblocks and elements,"
|
2014-07-23 11:15:34 +00:00
|
|
|
|
echo "\t - create image disk."
|
|
|
|
|
echo
|
|
|
|
|
echo "Enjoy ;-)"
|
|
|
|
|
echo
|
|
|
|
|
|
|
|
|
|
# as long as we can find qmake, we don't need QTDIR
|
|
|
|
|
FWPATH=`qmake -query QT_INSTALL_LIBS`
|
|
|
|
|
if [ ! -d $FWPATH/QtGui.framework ] ; then
|
|
|
|
|
echo "ERROR: cannot find the Qt frameworks. Make sure Qt is installed"
|
|
|
|
|
echo "and qmake is in your environment path."
|
|
|
|
|
exit
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
2019-08-30 14:09:08 +02:00
|
|
|
|
### GIT ####################################################
|
2014-07-23 11:15:34 +00:00
|
|
|
|
|
|
|
|
|
echo
|
|
|
|
|
echo "______________________________________________________________"
|
2019-08-30 14:09:08 +02:00
|
|
|
|
echo "Run GIT:"
|
2014-07-23 11:15:34 +00:00
|
|
|
|
|
|
|
|
|
# recupere le numero de la dernière revision
|
|
|
|
|
# Si il y a ':' garde la 2e partie
|
|
|
|
|
# Remplace les lettres par 'rien'
|
2019-08-30 14:09:08 +02:00
|
|
|
|
#revAv=$(svnversion | cut -d : -f 2 | tr -d '[:alpha:]')
|
2014-07-23 11:15:34 +00:00
|
|
|
|
|
|
|
|
|
# Fait une mise à jour
|
2019-08-30 14:09:08 +02:00
|
|
|
|
git pull
|
|
|
|
|
#git checkout foliolist_position
|
2014-07-23 11:15:34 +00:00
|
|
|
|
|
|
|
|
|
# recupere le numero de la nouvelle revision
|
2019-08-30 14:09:08 +02:00
|
|
|
|
|
|
|
|
|
GITCOMMIT=$(git rev-parse --short HEAD)
|
|
|
|
|
A=$(git rev-list HEAD --count)
|
|
|
|
|
HEAD=$(($A+473))
|
|
|
|
|
|
2023-01-25 12:27:25 +01:00
|
|
|
|
|
|
|
|
|
VERSION=$(cat sources/qetversion.cpp | grep "return QVersionNumber{ 0, "| head -n 1| cut -c32-40| sed -e 's/,/./g' -e 's/ //g') #Find major, minor, and micro version numbers in sources/qetversion.cp
|
2014-11-28 21:41:16 +00:00
|
|
|
|
|
2014-07-23 11:15:34 +00:00
|
|
|
|
# Dmg de la dernière revision déjà créé
|
2023-01-25 12:27:25 +01:00
|
|
|
|
if [ -e "build-aux/mac-osx/${APPNAME} $VERSION r$HEAD.dmg" ] ; then
|
2014-07-23 11:15:34 +00:00
|
|
|
|
echo "There are not new updates, make disk image can"
|
|
|
|
|
echo "take a lot of time (5 min). Can you continu?"
|
|
|
|
|
echo "[y/n]"
|
|
|
|
|
read userinput
|
|
|
|
|
if [ "$userinput" == "n" ] ; then
|
|
|
|
|
echo
|
2022-12-04 16:54:51 -05:00
|
|
|
|
echo "Process is stopped."
|
2014-07-23 11:15:34 +00:00
|
|
|
|
echo
|
|
|
|
|
exit
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### make install ####################################################
|
|
|
|
|
|
|
|
|
|
echo
|
|
|
|
|
echo "______________________________________________________________"
|
|
|
|
|
echo "Run make install:"
|
|
|
|
|
|
|
|
|
|
# pour effacer l’ancienne compilation
|
|
|
|
|
if [ -d $BUNDLE ] ; then
|
|
|
|
|
echo "Removing hold bundle..."
|
|
|
|
|
rm -rf $BUNDLE
|
|
|
|
|
fi
|
|
|
|
|
if [ -e Makefile ] ; then
|
|
|
|
|
echo "Removing hold Makefile..."
|
|
|
|
|
make clean
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# genere le Makefile
|
|
|
|
|
echo "Generating new makefile..."
|
2017-06-27 14:49:46 +00:00
|
|
|
|
qmake -spec macx-clang
|
2014-07-23 11:15:34 +00:00
|
|
|
|
|
|
|
|
|
# compilation
|
|
|
|
|
if [ -e Makefile.Release ] ; then
|
|
|
|
|
START_TIME=$SECONDS
|
2014-08-15 15:09:55 +00:00
|
|
|
|
|
|
|
|
|
# arret du script si erreur de compilation
|
|
|
|
|
testSuccessBuild () {
|
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
|
cleanVerionTag
|
|
|
|
|
ELAPSED_TIME=$(($SECONDS - $START_TIME))
|
|
|
|
|
echo
|
|
|
|
|
echo "make failed - $(($ELAPSED_TIME/60)) min $(($ELAPSED_TIME%60)) sec"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# utilise tout les coeurs pour une compilation plus rapide
|
|
|
|
|
coeur=$(sysctl hw.ncpu | awk '{print $2}')
|
2014-07-27 11:56:31 +00:00
|
|
|
|
if [ $? -ne 0 ]; then
|
2014-08-15 15:09:55 +00:00
|
|
|
|
make -f Makefile.Release
|
|
|
|
|
testSuccessBuild
|
|
|
|
|
else
|
|
|
|
|
make -j$(($coeur + 1)) -f Makefile.Release
|
|
|
|
|
testSuccessBuild
|
2014-07-27 11:56:31 +00:00
|
|
|
|
fi
|
2014-08-15 15:09:55 +00:00
|
|
|
|
|
2014-07-27 11:56:31 +00:00
|
|
|
|
cleanVerionTag
|
2014-07-23 11:15:34 +00:00
|
|
|
|
ELAPSED_TIME=$(($SECONDS - $START_TIME))
|
|
|
|
|
echo
|
|
|
|
|
echo "The time of compilation is $(($ELAPSED_TIME/60)) min $(($ELAPSED_TIME%60)) sec"
|
|
|
|
|
else
|
2017-06-27 14:49:46 +00:00
|
|
|
|
echo "ERROR: Makefile not found. This script requires the macx-clang makespec"
|
2014-07-23 11:15:34 +00:00
|
|
|
|
exit
|
|
|
|
|
fi
|
|
|
|
|
|
2016-12-02 11:58:38 +00:00
|
|
|
|
cp -R ${current_dir}/misc/Info.plist qelectrotech.app/Contents/
|
|
|
|
|
cp -R ${current_dir}/ico/mac_icon/*.icns qelectrotech.app/Contents/Resources/
|
2014-08-14 20:31:22 +00:00
|
|
|
|
# On rajoute le numero de version pour "cmd + i"
|
2023-01-25 12:27:25 +01:00
|
|
|
|
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $VERSION r$HEAD" "qelectrotech.app/Contents/Info.plist" # Version number
|
2014-07-23 11:15:34 +00:00
|
|
|
|
|
|
|
|
|
### copy over frameworks ############################################
|
|
|
|
|
|
|
|
|
|
echo
|
|
|
|
|
echo "______________________________________________________________"
|
|
|
|
|
echo "Copy Qt libraries and private frameworks:"
|
|
|
|
|
|
|
|
|
|
echo "Processing Mac deployment tool..."
|
|
|
|
|
if [ ! -d $BUNDLE ] ; then
|
|
|
|
|
echo "ERROR: cannot find application bundle \"$BUNDLE\" in current directory"
|
|
|
|
|
exit
|
|
|
|
|
fi
|
2015-10-12 12:48:32 +00:00
|
|
|
|
#~/Qt/5.5/clang_64/bin/macdeployqt $BUNDLE
|
|
|
|
|
macdeployqt $BUNDLE
|
2014-07-23 11:15:34 +00:00
|
|
|
|
|
|
|
|
|
### add file missing #######################################
|
|
|
|
|
|
|
|
|
|
echo
|
|
|
|
|
echo "______________________________________________________________"
|
|
|
|
|
echo "Copy file missing:"
|
|
|
|
|
|
|
|
|
|
# Dossier à ajouter
|
|
|
|
|
QET_ELMT_DIR="${current_dir}/elements/"
|
|
|
|
|
QET_TBT_DIR="${current_dir}/titleblocks/"
|
|
|
|
|
QET_LANG_DIR="${current_dir}/lang/"
|
|
|
|
|
|
2016-10-14 00:23:00 +00:00
|
|
|
|
|
|
|
|
|
# Add new folder for Qt dialog translation see
|
2016-10-14 14:59:18 +00:00
|
|
|
|
## see <https://download.tuxfamily.org/qet/Qt_lang/>.
|
2016-10-14 00:23:00 +00:00
|
|
|
|
|
|
|
|
|
LANG_DIR="${current_dir}/lang1/"
|
|
|
|
|
|
2014-07-23 11:15:34 +00:00
|
|
|
|
if [ -d "${QET_ELMT_DIR}" ]; then
|
|
|
|
|
echo "Copying add elements in the bundle..."
|
|
|
|
|
#mkdir $BUNDLE/Contents/Resources/elements
|
|
|
|
|
cp -R ${QET_ELMT_DIR} $BUNDLE/Contents/Resources/elements
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -d "${QET_TBT_DIR}" ]; then
|
|
|
|
|
echo "Copying titleblocks in the bundle..."
|
|
|
|
|
#mkdir $BUNDLE/Contents/Resources/titleblocks
|
|
|
|
|
cp -R ${QET_TBT_DIR} $BUNDLE/Contents/Resources/titleblocks
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -d "${QET_LANG_DIR}" ]; then
|
|
|
|
|
echo "Copying translations in the bundle... "
|
2016-10-14 14:59:18 +00:00
|
|
|
|
mkdir $BUNDLE/Contents/Resources/lang
|
2017-06-27 14:49:46 +00:00
|
|
|
|
cp ${current_dir}/lang/*.qm $BUNDLE/Contents/Resources/lang
|
2014-07-23 11:15:34 +00:00
|
|
|
|
fi
|
|
|
|
|
|
2016-10-14 00:23:00 +00:00
|
|
|
|
if [ -d "${LANG_DIR}" ]; then
|
2017-06-27 14:49:46 +00:00
|
|
|
|
echo "Copying translations in the bundle... "
|
|
|
|
|
cp ${current_dir}/lang1/*.qm $BUNDLE/Contents/Resources/lang
|
2016-10-14 14:59:18 +00:00
|
|
|
|
|
2016-10-14 00:23:00 +00:00
|
|
|
|
fi
|
|
|
|
|
|
2014-07-23 11:15:34 +00:00
|
|
|
|
|
|
|
|
|
### create disk image ###############################################
|
|
|
|
|
|
|
|
|
|
echo
|
|
|
|
|
echo "______________________________________________________________"
|
|
|
|
|
echo "Create disk image:"
|
|
|
|
|
|
|
|
|
|
# Direction
|
|
|
|
|
EX_Dir="examples"
|
2015-10-12 12:48:32 +00:00
|
|
|
|
DOC_Dir="docs/Documentation.webloc"
|
2014-07-23 11:15:34 +00:00
|
|
|
|
imagedir="/tmp/$APPNAME.$$"
|
|
|
|
|
|
|
|
|
|
# Remove any previous disk folder or DMG
|
|
|
|
|
echo 'Preparing (removing hold files)... '
|
|
|
|
|
if [ -e "/Volumes/${APPNAME}" ]; then
|
|
|
|
|
hdiutil detach -quiet "/Volumes/${APPNAME}"
|
|
|
|
|
fi
|
2023-01-25 12:27:25 +01:00
|
|
|
|
if [ -e "${APPNAME} $VERSION r$HEAD.dmg" ] ; then
|
|
|
|
|
rm -f "${APPNAME} $VERSION r$HEAD.dmg"
|
2014-07-23 11:15:34 +00:00
|
|
|
|
fi
|
2023-01-25 12:27:25 +01:00
|
|
|
|
if [ -e "build-aux/mac-osx/${APPNAME} $VERSION r$HEAD.dmg" ] ; then
|
|
|
|
|
rm -f "build-aux/mac-osx/${APPNAME} $VERSION r$HEAD.dmg"
|
2014-07-23 11:15:34 +00:00
|
|
|
|
fi
|
|
|
|
|
if [ -e $imagedir ] ; then
|
|
|
|
|
rm -rf $imagedir
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Create disk folder
|
|
|
|
|
echo 'Copying application bundle and examples... '
|
|
|
|
|
mkdir $imagedir
|
|
|
|
|
cp -Rf $BUNDLE $imagedir
|
|
|
|
|
cp -Rf $EX_Dir $imagedir
|
2014-08-15 15:09:55 +00:00
|
|
|
|
if [ -e $DOC_Dir ] ; then
|
|
|
|
|
cp $DOC_Dir $imagedir
|
|
|
|
|
else
|
|
|
|
|
echo "Documentation in ${DOC_Dir} not find."
|
|
|
|
|
fi
|
2014-08-14 20:31:22 +00:00
|
|
|
|
ln -s /Applications $imagedir/Applications
|
|
|
|
|
|
2014-07-23 11:15:34 +00:00
|
|
|
|
# Elimine les accents, symbole ...
|
|
|
|
|
strip "$imagedir/$APPBIN"
|
|
|
|
|
|
|
|
|
|
# Creating a disk image from a folder
|
|
|
|
|
echo 'Creating disk image... '
|
2023-01-25 12:27:25 +01:00
|
|
|
|
hdiutil create -quiet -ov -srcfolder $imagedir -format UDBZ -volname "${APPNAME}" "${APPNAME} $VERSION r$HEAD.dmg"
|
|
|
|
|
hdiutil internet-enable -yes -quiet "${APPNAME} $VERSION r$HEAD.dmg"
|
2014-07-23 11:15:34 +00:00
|
|
|
|
|
|
|
|
|
# Clean up disk folder
|
|
|
|
|
echo 'Cleaning up... '
|
2023-01-25 12:27:25 +01:00
|
|
|
|
cp -Rf "${APPNAME} $VERSION r$HEAD.dmg" "build-aux/mac-osx/${APPNAME} $VERSION r$HEAD.dmg"
|
|
|
|
|
rm -f "${APPNAME} $VERSION r$HEAD.dmg"
|
2014-07-23 11:15:34 +00:00
|
|
|
|
rm -rf $imagedir
|
|
|
|
|
rm -rf $BUNDLE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### The end, process is done ##########################################
|
|
|
|
|
|
|
|
|
|
echo
|
|
|
|
|
echo "______________________________________________________________"
|
|
|
|
|
echo "The process of creating deployable application bundle is done."
|
2020-02-14 14:57:38 +01:00
|
|
|
|
echo The disque image is in the folder \'build-aux/mac-osx\'.
|
2014-07-23 11:15:34 +00:00
|
|
|
|
# Affiche les mise à jour depuis l'ancienne revision
|
2019-08-30 14:09:08 +02:00
|
|
|
|
#if [ ! $(($HEAD - $revAv)) -eq 0 ] ; then
|
|
|
|
|
# echo
|
|
|
|
|
# echo "There are new updates. This numero of revision is $HEAD."
|
|
|
|
|
# svn log -l $(($HEAD - $revAv))
|
|
|
|
|
#else
|
|
|
|
|
# echo
|
|
|
|
|
# echo "There are not new updates. This numero of revision is $HEAD."
|
|
|
|
|
# fi
|
|
|
|
|
# echo
|
2014-07-23 11:15:34 +00:00
|
|
|
|
|
|
|
|
|
# La version en local n'est pas conforme à la dernière version svn
|
2019-08-30 14:09:08 +02:00
|
|
|
|
# svnversion | grep -q '[MS:]' ; if [ $? -eq 0 ] ; then
|
|
|
|
|
# echo Please note that the latest \local version is $(svnversion).
|
|
|
|
|
# echo This is not the same version as the deposit.
|
|
|
|
|
# echo You can use \'svn diff\' to see the differences.
|
|
|
|
|
# echo And use \'svn revert \<fichier\>\' to delete the difference.
|
|
|
|
|
# echo To go back, you can use svn update -r 360
|
|
|
|
|
# echo to go to revision number 360.
|
|
|
|
|
# echo
|
|
|
|
|
#fi
|
2014-07-23 11:15:34 +00:00
|
|
|
|
|
|
|
|
|
|
2016-12-02 11:58:38 +00:00
|
|
|
|
|
|
|
|
|
#rsync to TF DMG builds
|
2023-01-25 12:27:25 +01:00
|
|
|
|
echo -e "\033[1;31mWould you like to upload MacOS packages "${APPNAME}"-"$VERSION"_"r$HEAD.dmg", n/Y?.\033[m"
|
2016-12-02 11:58:38 +00:00
|
|
|
|
read a
|
|
|
|
|
if [[ $a == "Y" || $a == "y" ]]; then
|
2023-01-25 12:27:25 +01:00
|
|
|
|
cp -Rf "build-aux/mac-osx/${APPNAME} $VERSION r$HEAD.dmg" /Users/laurent/MAC_OS_X/
|
2019-08-30 14:09:08 +02:00
|
|
|
|
rsync -e ssh -av --delete-after --no-owner --no-g --chmod=g+w --progress --exclude='.DS_Store' /Users/laurent/MAC_OS_X/ scorpio810@ssh.tuxfamily.org:/home/qet/qet-repository/builds/MAC_OS_X/
|
2016-12-02 11:58:38 +00:00
|
|
|
|
if [ $? != 0 ]; then
|
|
|
|
|
{
|
2023-01-25 12:27:25 +01:00
|
|
|
|
echo "RSYNC ERROR: problem syncing ${APPNAME} $VERSION r$HEAD.dmg"
|
2019-08-30 14:09:08 +02:00
|
|
|
|
rsync -e ssh -av --delete-after --no-owner --no-g --chmod=g+w --progress --exclude='.DS_Store' /Users/laurent/MAC_OS_X/ scorpio810@ssh.tuxfamily.org:/home/qet/qet-repository/builds/MAC_OS_X/
|
2016-12-02 11:58:38 +00:00
|
|
|
|
|
|
|
|
|
} fi
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
echo -e "\033[1;33mExit.\033[m"
|
|
|
|
|
|
2017-06-27 14:49:46 +00:00
|
|
|
|
fi
|