2016-04-27 12:03:10 +00:00
|
|
|
set -e
|
|
|
|
FullExecPath=$PWD
|
|
|
|
pushd `dirname $0` > /dev/null
|
|
|
|
FullScriptPath=`pwd`
|
|
|
|
popd > /dev/null
|
|
|
|
|
2019-09-26 09:52:36 +00:00
|
|
|
if [ ! -d "$FullScriptPath/../../../DesktopPrivate" ]; then
|
2016-04-27 12:03:10 +00:00
|
|
|
echo ""
|
|
|
|
echo "This script is for building the production version of Telegram Desktop."
|
|
|
|
echo ""
|
|
|
|
echo "For building custom versions please visit the build instructions page at:"
|
|
|
|
echo "https://github.com/telegramdesktop/tdesktop/#build-instructions"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
Error () {
|
|
|
|
cd $FullExecPath
|
|
|
|
echo "$1"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ ! -f "$FullScriptPath/target" ]; then
|
|
|
|
Error "Build target not found!"
|
|
|
|
fi
|
|
|
|
|
|
|
|
while IFS='' read -r line || [[ -n "$line" ]]; do
|
|
|
|
BuildTarget="$line"
|
|
|
|
done < "$FullScriptPath/target"
|
|
|
|
|
|
|
|
while IFS='' read -r line || [[ -n "$line" ]]; do
|
|
|
|
set $line
|
|
|
|
eval $1="$2"
|
|
|
|
done < "$FullScriptPath/version"
|
|
|
|
|
|
|
|
VersionForPacker="$AppVersion"
|
2018-09-26 14:58:09 +00:00
|
|
|
if [ "$AlphaVersion" != "0" ]; then
|
|
|
|
AppVersion="$AlphaVersion"
|
|
|
|
AppVersionStrFull="${AppVersionStr}_${AlphaVersion}"
|
|
|
|
AlphaBetaParam="-alpha $AlphaVersion"
|
|
|
|
AlphaKeyFile="talpha_${AppVersion}_key"
|
|
|
|
elif [ "$BetaChannel" == "0" ]; then
|
2016-04-27 12:03:10 +00:00
|
|
|
AppVersionStrFull="$AppVersionStr"
|
|
|
|
AlphaBetaParam=''
|
|
|
|
else
|
2018-09-26 14:58:09 +00:00
|
|
|
AppVersionStrFull="$AppVersionStr.beta"
|
|
|
|
AlphaBetaParam='-beta'
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
HomePath="$FullScriptPath/.."
|
|
|
|
if [ "$BuildTarget" == "linux" ]; then
|
|
|
|
echo "Building version $AppVersionStrFull for Linux 64bit.."
|
|
|
|
UpdateFile="tlinuxupd$AppVersion"
|
|
|
|
SetupFile="tsetup.$AppVersionStrFull.tar.xz"
|
2019-12-06 11:10:44 +00:00
|
|
|
ProjectPath="$HomePath/../out"
|
|
|
|
ReleasePath="$ProjectPath/Release"
|
2016-04-27 12:03:10 +00:00
|
|
|
BinaryName="Telegram"
|
|
|
|
elif [ "$BuildTarget" == "linux32" ]; then
|
|
|
|
echo "Building version $AppVersionStrFull for Linux 32bit.."
|
|
|
|
UpdateFile="tlinux32upd$AppVersion"
|
|
|
|
SetupFile="tsetup32.$AppVersionStrFull.tar.xz"
|
2019-12-06 11:10:44 +00:00
|
|
|
ProjectPath="$HomePath/../out"
|
|
|
|
ReleasePath="$ProjectPath/Release"
|
2016-04-27 12:03:10 +00:00
|
|
|
BinaryName="Telegram"
|
|
|
|
elif [ "$BuildTarget" == "mac" ]; then
|
2019-11-05 12:27:42 +00:00
|
|
|
echo "Building version $AppVersionStrFull for macOS 10.12+.."
|
2019-04-19 11:40:42 +00:00
|
|
|
if [ "$AC_USERNAME" == "" ]; then
|
|
|
|
Error "AC_USERNAME not found!"
|
|
|
|
fi
|
2016-04-27 12:03:10 +00:00
|
|
|
UpdateFile="tmacupd$AppVersion"
|
|
|
|
SetupFile="tsetup.$AppVersionStrFull.dmg"
|
2019-12-06 11:10:44 +00:00
|
|
|
ProjectPath="$HomePath/../out"
|
|
|
|
ReleasePath="$ProjectPath/Release"
|
2016-04-27 12:03:10 +00:00
|
|
|
BinaryName="Telegram"
|
2019-11-05 12:27:42 +00:00
|
|
|
elif [ "$BuildTarget" == "osx" ]; then
|
|
|
|
echo "Building version $AppVersionStrFull for OS X 10.10 and 10.11.."
|
|
|
|
UpdateFile="tosxupd$AppVersion"
|
|
|
|
SetupFile="tsetup-osx.$AppVersionStrFull.dmg"
|
2019-12-06 11:10:44 +00:00
|
|
|
ProjectPath="$HomePath/../out"
|
|
|
|
ReleasePath="$ProjectPath/Release"
|
2016-04-27 12:03:10 +00:00
|
|
|
BinaryName="Telegram"
|
|
|
|
elif [ "$BuildTarget" == "macstore" ]; then
|
2018-09-26 14:58:09 +00:00
|
|
|
if [ "$AlphaVersion" != "0" ]; then
|
|
|
|
Error "Can't build macstore alpha version!"
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Building version $AppVersionStrFull for Mac App Store.."
|
2019-12-06 11:10:44 +00:00
|
|
|
ProjectPath="$HomePath/../out"
|
|
|
|
ReleasePath="$ProjectPath/Release"
|
2016-04-27 12:03:10 +00:00
|
|
|
BinaryName="Telegram Desktop"
|
|
|
|
else
|
|
|
|
Error "Invalid target!"
|
|
|
|
fi
|
|
|
|
|
2019-11-05 12:27:42 +00:00
|
|
|
if [ "$AlphaVersion" != "0" ]; then
|
|
|
|
if [ -d "$ReleasePath/deploy/$AppVersionStrMajor/$AppVersionStrFull" ]; then
|
|
|
|
Error "Deploy folder for version $AppVersionStrFull already exists!"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
if [ -d "$ReleasePath/deploy/$AppVersionStrMajor/$AppVersionStr.alpha" ]; then
|
|
|
|
Error "Deploy folder for version $AppVersionStr.alpha already exists!"
|
|
|
|
fi
|
2016-04-27 12:03:10 +00:00
|
|
|
|
2019-11-05 12:27:42 +00:00
|
|
|
if [ -d "$ReleasePath/deploy/$AppVersionStrMajor/$AppVersionStr.beta" ]; then
|
|
|
|
Error "Deploy folder for version $AppVersionStr.beta already exists!"
|
|
|
|
fi
|
2016-04-27 12:03:10 +00:00
|
|
|
|
2019-11-05 12:27:42 +00:00
|
|
|
if [ -d "$ReleasePath/deploy/$AppVersionStrMajor/$AppVersionStr" ]; then
|
|
|
|
Error "Deploy folder for version $AppVersionStr already exists!"
|
|
|
|
fi
|
2016-04-27 12:03:10 +00:00
|
|
|
|
2019-11-05 12:27:42 +00:00
|
|
|
if [ -f "$ReleasePath/$UpdateFile" ]; then
|
|
|
|
Error "Update file for version $AppVersion already exists!"
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
2019-11-05 12:27:42 +00:00
|
|
|
fi
|
2016-04-27 12:03:10 +00:00
|
|
|
|
2019-11-05 12:27:42 +00:00
|
|
|
DeployPath="$ReleasePath/deploy/$AppVersionStrMajor/$AppVersionStrFull"
|
2016-04-27 12:03:10 +00:00
|
|
|
|
|
|
|
if [ "$BuildTarget" == "linux" ] || [ "$BuildTarget" == "linux32" ]; then
|
|
|
|
|
|
|
|
DropboxSymbolsPath="/media/psf/Dropbox/Telegram/symbols"
|
2016-05-10 08:57:55 +00:00
|
|
|
if [ ! -d "$DropboxSymbolsPath" ]; then
|
|
|
|
Error "Dropbox path not found!"
|
|
|
|
fi
|
2016-04-27 12:03:10 +00:00
|
|
|
|
2019-11-05 21:27:20 +00:00
|
|
|
BackupPath="/media/psf/backup/tdesktop/$AppVersionStrMajor/$AppVersionStrFull/t$BuildTarget"
|
|
|
|
if [ ! -d "/media/psf/backup/tdesktop" ]; then
|
2018-04-08 13:17:56 +00:00
|
|
|
Error "Backup folder not found!"
|
|
|
|
fi
|
|
|
|
|
2019-12-06 11:10:44 +00:00
|
|
|
./configure.sh
|
2016-10-24 20:37:43 +00:00
|
|
|
|
2019-12-06 11:10:44 +00:00
|
|
|
cd $ProjectPath
|
|
|
|
cmake --build . --config Release --target Telegram -- -j8
|
2016-09-09 06:15:11 +00:00
|
|
|
cd $ReleasePath
|
2019-12-06 11:10:44 +00:00
|
|
|
|
2016-04-27 12:03:10 +00:00
|
|
|
echo "$BinaryName build complete!"
|
|
|
|
|
|
|
|
if [ ! -f "$ReleasePath/$BinaryName" ]; then
|
|
|
|
Error "$BinaryName not found!"
|
|
|
|
fi
|
|
|
|
|
2019-10-13 11:38:43 +00:00
|
|
|
# BadCount=`objdump -T $ReleasePath/$BinaryName | grep GLIBC_2\.1[6-9] | wc -l`
|
|
|
|
# if [ "$BadCount" != "0" ]; then
|
|
|
|
# Error "Bad GLIBC usages found: $BadCount"
|
|
|
|
# fi
|
|
|
|
|
|
|
|
# BadCount=`objdump -T $ReleasePath/$BinaryName | grep GLIBC_2\.2[0-9] | wc -l`
|
|
|
|
# if [ "$BadCount" != "0" ]; then
|
|
|
|
# Error "Bad GLIBC usages found: $BadCount"
|
|
|
|
# fi
|
|
|
|
|
2019-11-05 11:51:03 +00:00
|
|
|
BadCount=`objdump -T $ReleasePath/$BinaryName | grep GCC_4\.[3-9] | wc -l`
|
|
|
|
if [ "$BadCount" != "0" ]; then
|
|
|
|
Error "Bad GCC usages found: $BadCount"
|
|
|
|
fi
|
2019-10-13 11:38:43 +00:00
|
|
|
|
2019-11-05 11:51:03 +00:00
|
|
|
BadCount=`objdump -T $ReleasePath/$BinaryName | grep GCC_[5-9]\. | wc -l`
|
|
|
|
if [ "$BadCount" != "0" ]; then
|
|
|
|
Error "Bad GCC usages found: $BadCount"
|
|
|
|
fi
|
2017-09-28 09:40:26 +00:00
|
|
|
|
2016-04-27 12:03:10 +00:00
|
|
|
if [ ! -f "$ReleasePath/Updater" ]; then
|
|
|
|
Error "Updater not found!"
|
|
|
|
fi
|
|
|
|
|
2017-11-23 05:29:56 +00:00
|
|
|
BadCount=`objdump -T $ReleasePath/Updater | grep GLIBC_2\.1[6-9] | wc -l`
|
|
|
|
if [ "$BadCount" != "0" ]; then
|
|
|
|
Error "Bad GLIBC usages found: $BadCount"
|
|
|
|
fi
|
|
|
|
|
|
|
|
BadCount=`objdump -T $ReleasePath/Updater | grep GLIBC_2\.2[0-9] | wc -l`
|
|
|
|
if [ "$BadCount" != "0" ]; then
|
|
|
|
Error "Bad GLIBC usages found: $BadCount"
|
|
|
|
fi
|
|
|
|
|
|
|
|
BadCount=`objdump -T $ReleasePath/Updater | grep GCC_4\.[3-9] | wc -l`
|
|
|
|
if [ "$BadCount" != "0" ]; then
|
|
|
|
Error "Bad GCC usages found: $BadCount"
|
|
|
|
fi
|
|
|
|
|
|
|
|
BadCount=`objdump -T $ReleasePath/Updater | grep GCC_[5-9]\. | wc -l`
|
|
|
|
if [ "$BadCount" != "0" ]; then
|
|
|
|
Error "Bad GCC usages found: $BadCount"
|
|
|
|
fi
|
|
|
|
|
2016-04-27 12:03:10 +00:00
|
|
|
echo "Dumping debug symbols.."
|
2017-09-28 09:40:26 +00:00
|
|
|
"$HomePath/../../Libraries/breakpad/out/Default/dump_syms" "$ReleasePath/$BinaryName" > "$ReleasePath/$BinaryName.sym"
|
2016-04-27 12:03:10 +00:00
|
|
|
echo "Done!"
|
|
|
|
|
|
|
|
echo "Stripping the executable.."
|
|
|
|
strip -s "$ReleasePath/$BinaryName"
|
|
|
|
echo "Done!"
|
|
|
|
|
2018-09-20 07:30:41 +00:00
|
|
|
echo "Removing RPATH.."
|
|
|
|
chrpath -d "$ReleasePath/$BinaryName"
|
|
|
|
echo "Done!"
|
|
|
|
|
2016-04-27 12:03:10 +00:00
|
|
|
echo "Preparing version $AppVersionStrFull, executing Packer.."
|
|
|
|
cd "$ReleasePath"
|
|
|
|
"./Packer" -path "$BinaryName" -path Updater -version $VersionForPacker $AlphaBetaParam
|
|
|
|
echo "Packer done!"
|
|
|
|
|
2018-09-26 14:58:09 +00:00
|
|
|
if [ "$AlphaVersion" != "0" ]; then
|
|
|
|
if [ ! -f "$ReleasePath/$AlphaKeyFile" ]; then
|
|
|
|
Error "Alpha version key file not found!"
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
while IFS='' read -r line || [[ -n "$line" ]]; do
|
2018-09-26 14:58:09 +00:00
|
|
|
AlphaSignature="$line"
|
|
|
|
done < "$ReleasePath/$AlphaKeyFile"
|
2016-04-27 12:03:10 +00:00
|
|
|
|
2018-09-26 14:58:09 +00:00
|
|
|
UpdateFile="${UpdateFile}_${AlphaSignature}"
|
|
|
|
SetupFile="talpha${AlphaVersion}_${AlphaSignature}.tar.xz"
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
SymbolsHash=`head -n 1 "$ReleasePath/$BinaryName.sym" | awk -F " " 'END {print $4}'`
|
|
|
|
echo "Copying $BinaryName.sym to $DropboxSymbolsPath/$BinaryName/$SymbolsHash"
|
|
|
|
mkdir -p "$DropboxSymbolsPath/$BinaryName/$SymbolsHash"
|
|
|
|
cp "$ReleasePath/$BinaryName.sym" "$DropboxSymbolsPath/$BinaryName/$SymbolsHash/"
|
|
|
|
echo "Done!"
|
|
|
|
|
|
|
|
if [ ! -d "$ReleasePath/deploy" ]; then
|
|
|
|
mkdir "$ReleasePath/deploy"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d "$ReleasePath/deploy/$AppVersionStrMajor" ]; then
|
|
|
|
mkdir "$ReleasePath/deploy/$AppVersionStrMajor"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Copying $BinaryName, Updater and $UpdateFile to deploy/$AppVersionStrMajor/$AppVersionStrFull..";
|
|
|
|
mkdir "$DeployPath"
|
|
|
|
mkdir "$DeployPath/$BinaryName"
|
|
|
|
mv "$ReleasePath/$BinaryName" "$DeployPath/$BinaryName/"
|
|
|
|
mv "$ReleasePath/Updater" "$DeployPath/$BinaryName/"
|
|
|
|
mv "$ReleasePath/$UpdateFile" "$DeployPath/"
|
2018-09-26 14:58:09 +00:00
|
|
|
if [ "$AlphaVersion" != "0" ]; then
|
|
|
|
mv "$ReleasePath/$AlphaKeyFile" "$DeployPath/"
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
cd "$DeployPath"
|
|
|
|
tar -cJvf "$SetupFile" "$BinaryName/"
|
2018-04-08 13:17:56 +00:00
|
|
|
|
|
|
|
mkdir -p $BackupPath
|
|
|
|
cp "$SetupFile" "$BackupPath/"
|
|
|
|
cp "$UpdateFile" "$BackupPath/"
|
2018-09-26 14:58:09 +00:00
|
|
|
if [ "$AlphaVersion" != "0" ]; then
|
|
|
|
cp -v "$AlphaKeyFile" "$BackupPath/"
|
2018-04-08 13:17:56 +00:00
|
|
|
fi
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
|
2019-11-05 12:27:42 +00:00
|
|
|
if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "osx" ] || [ "$BuildTarget" == "macstore" ]; then
|
2016-04-27 12:03:10 +00:00
|
|
|
|
2017-10-13 19:23:19 +00:00
|
|
|
DropboxSymbolsPath="$HOME/Dropbox/Telegram/symbols"
|
2016-05-10 08:57:55 +00:00
|
|
|
if [ ! -d "$DropboxSymbolsPath" ]; then
|
|
|
|
Error "Dropbox path not found!"
|
|
|
|
fi
|
2016-04-27 12:03:10 +00:00
|
|
|
|
2019-11-05 21:27:20 +00:00
|
|
|
BackupPath="$HOME/Projects/backup/tdesktop/$AppVersionStrMajor/$AppVersionStrFull"
|
|
|
|
if [ ! -d "$HOME/Projects/backup/tdesktop" ]; then
|
2018-04-08 13:17:56 +00:00
|
|
|
Error "Backup path not found!"
|
|
|
|
fi
|
|
|
|
|
2019-12-06 11:10:44 +00:00
|
|
|
./configure.sh
|
|
|
|
|
|
|
|
cd $ProjectPath
|
|
|
|
cmake --build . --config Release --target Telegram
|
|
|
|
cd $ReleasePath
|
2016-04-27 12:03:10 +00:00
|
|
|
|
|
|
|
if [ ! -d "$ReleasePath/$BinaryName.app" ]; then
|
|
|
|
Error "$BinaryName.app not found!"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d "$ReleasePath/$BinaryName.app.dSYM" ]; then
|
|
|
|
Error "$BinaryName.app.dSYM not found!"
|
|
|
|
fi
|
|
|
|
|
2019-11-05 12:27:42 +00:00
|
|
|
if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "osx" ]; then
|
2016-08-31 17:58:46 +00:00
|
|
|
if [ ! -f "$ReleasePath/$BinaryName.app/Contents/Frameworks/Updater" ]; then
|
|
|
|
Error "Updater not found!"
|
|
|
|
fi
|
|
|
|
if [ ! -f "$ReleasePath/$BinaryName.app/Contents/Helpers/crashpad_handler" ]; then
|
|
|
|
Error "crashpad_handler not found!"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ "$BuildTarget" == "macstore" ]; then
|
|
|
|
if [ ! -d "$ReleasePath/$BinaryName.app/Contents/Frameworks/Breakpad.framework" ]; then
|
|
|
|
Error "Breakpad.framework not found!"
|
|
|
|
fi
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Dumping debug symbols.."
|
2016-04-27 15:55:13 +00:00
|
|
|
"$HomePath/../../Libraries/breakpad/src/tools/mac/dump_syms/build/Release/dump_syms" "$ReleasePath/$BinaryName.app.dSYM" > "$ReleasePath/$BinaryName.sym" 2>/dev/null
|
2016-04-27 12:03:10 +00:00
|
|
|
echo "Done!"
|
|
|
|
|
|
|
|
echo "Stripping the executable.."
|
|
|
|
strip "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName"
|
|
|
|
echo "Done!"
|
|
|
|
|
|
|
|
echo "Signing the application.."
|
2019-11-05 12:27:42 +00:00
|
|
|
if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "osx" ]; then
|
2019-07-18 10:30:48 +00:00
|
|
|
codesign --force --deep --timestamp --options runtime --sign "Developer ID Application: John Preston" "$ReleasePath/$BinaryName.app" --entitlements "$HomePath/Telegram/Telegram.entitlements"
|
2016-04-27 12:03:10 +00:00
|
|
|
elif [ "$BuildTarget" == "macstore" ]; then
|
2016-08-31 17:58:46 +00:00
|
|
|
codesign --force --deep --sign "3rd Party Mac Developer Application: TELEGRAM MESSENGER LLP (6N38VWS5BX)" "$ReleasePath/$BinaryName.app" --entitlements "$HomePath/Telegram/Telegram Desktop.entitlements"
|
|
|
|
echo "Making an installer.."
|
|
|
|
productbuild --sign "3rd Party Mac Developer Installer: TELEGRAM MESSENGER LLP (6N38VWS5BX)" --component "$ReleasePath/$BinaryName.app" /Applications "$ReleasePath/$BinaryName.pkg"
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
echo "Done!"
|
|
|
|
|
|
|
|
AppUUID=`dwarfdump -u "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName" | awk -F " " '{print $2}'`
|
|
|
|
DsymUUID=`dwarfdump -u "$ReleasePath/$BinaryName.app.dSYM" | awk -F " " '{print $2}'`
|
|
|
|
if [ "$AppUUID" != "$DsymUUID" ]; then
|
|
|
|
Error "UUID of binary '$AppUUID' and dSYM '$DsymUUID' differ!"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f "$ReleasePath/$BinaryName.app/Contents/Resources/Icon.icns" ]; then
|
|
|
|
Error "Icon.icns not found in Resources!"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName" ]; then
|
|
|
|
Error "$BinaryName not found in MacOS!"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d "$ReleasePath/$BinaryName.app/Contents/_CodeSignature" ]; then
|
|
|
|
Error "$BinaryName signature not found!"
|
|
|
|
fi
|
|
|
|
|
2019-11-05 12:27:42 +00:00
|
|
|
if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "osx" ]; then
|
2016-04-27 12:03:10 +00:00
|
|
|
if [ ! -f "$ReleasePath/$BinaryName.app/Contents/Frameworks/Updater" ]; then
|
|
|
|
Error "Updater not found in Frameworks!"
|
|
|
|
fi
|
|
|
|
elif [ "$BuildTarget" == "macstore" ]; then
|
|
|
|
if [ ! -f "$ReleasePath/$BinaryName.pkg" ]; then
|
|
|
|
Error "$BinaryName.pkg not found!"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
SymbolsHash=`head -n 1 "$ReleasePath/$BinaryName.sym" | awk -F " " 'END {print $4}'`
|
|
|
|
echo "Copying $BinaryName.sym to $DropboxSymbolsPath/$BinaryName/$SymbolsHash"
|
|
|
|
mkdir -p "$DropboxSymbolsPath/$BinaryName/$SymbolsHash"
|
|
|
|
cp "$ReleasePath/$BinaryName.sym" "$DropboxSymbolsPath/$BinaryName/$SymbolsHash/"
|
|
|
|
echo "Done!"
|
|
|
|
|
2019-11-05 12:27:42 +00:00
|
|
|
if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "osx" ]; then
|
2019-04-19 11:40:42 +00:00
|
|
|
cd "$ReleasePath"
|
2018-09-26 14:58:09 +00:00
|
|
|
if [ "$AlphaVersion" == "0" ]; then
|
2016-10-24 20:37:43 +00:00
|
|
|
cp -f tsetup_template.dmg tsetup.temp.dmg
|
2016-10-24 13:31:36 +00:00
|
|
|
TempDiskPath=`hdiutil attach -nobrowse -noautoopenrw -readwrite tsetup.temp.dmg | awk -F "\t" 'END {print $3}'`
|
|
|
|
cp -R "./$BinaryName.app" "$TempDiskPath/"
|
|
|
|
bless --folder "$TempDiskPath/" --openfolder "$TempDiskPath/"
|
|
|
|
hdiutil detach "$TempDiskPath"
|
2016-10-24 20:37:43 +00:00
|
|
|
hdiutil convert tsetup.temp.dmg -format UDZO -imagekey zlib-level=9 -ov -o "$SetupFile"
|
2016-10-24 13:31:36 +00:00
|
|
|
rm tsetup.temp.dmg
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
|
2018-09-26 14:58:09 +00:00
|
|
|
if [ "$AlphaVersion" != "0" ]; then
|
2019-04-19 11:40:42 +00:00
|
|
|
"./Packer" -path "$BinaryName.app" -target "$BuildTarget" -version $VersionForPacker $AlphaBetaParam -alphakey
|
|
|
|
|
2018-09-26 14:58:09 +00:00
|
|
|
if [ ! -f "$ReleasePath/$AlphaKeyFile" ]; then
|
|
|
|
Error "Alpha version key file not found!"
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
while IFS='' read -r line || [[ -n "$line" ]]; do
|
2018-09-26 14:58:09 +00:00
|
|
|
AlphaSignature="$line"
|
|
|
|
done < "$ReleasePath/$AlphaKeyFile"
|
2016-04-27 12:03:10 +00:00
|
|
|
|
2018-09-26 14:58:09 +00:00
|
|
|
UpdateFile="${UpdateFile}_${AlphaSignature}"
|
|
|
|
SetupFile="talpha${AlphaVersion}_${AlphaSignature}.zip"
|
2019-04-19 11:40:42 +00:00
|
|
|
|
|
|
|
rm -rf "$ReleasePath/AlphaTemp"
|
|
|
|
mkdir "$ReleasePath/AlphaTemp"
|
|
|
|
mkdir "$ReleasePath/AlphaTemp/$BinaryName"
|
|
|
|
cp -r "$ReleasePath/$BinaryName.app" "$ReleasePath/AlphaTemp/$BinaryName/"
|
|
|
|
cd "$ReleasePath/AlphaTemp"
|
|
|
|
zip -r "$SetupFile" "$BinaryName"
|
|
|
|
mv "$SetupFile" "$ReleasePath/"
|
|
|
|
cd "$ReleasePath"
|
|
|
|
fi
|
|
|
|
if [ "$BuildTarget" == "mac" ]; then
|
|
|
|
echo "Beginning notarization process."
|
2019-07-26 12:13:31 +00:00
|
|
|
set +e
|
2019-04-19 11:40:42 +00:00
|
|
|
xcrun altool --notarize-app --primary-bundle-id "com.tdesktop.Telegram" --username "$AC_USERNAME" --password "@keychain:AC_PASSWORD" --file "$SetupFile" 2> request_uuid.txt
|
2019-07-26 12:13:31 +00:00
|
|
|
set -e
|
2019-04-19 11:40:42 +00:00
|
|
|
while IFS='' read -r line || [[ -n "$line" ]]; do
|
|
|
|
Prefix=$(echo $line | cut -d' ' -f 1)
|
|
|
|
Value=$(echo $line | cut -d' ' -f 3)
|
|
|
|
if [ "$Prefix" == "RequestUUID" ]; then
|
|
|
|
RequestUUID=$Value
|
|
|
|
fi
|
|
|
|
done < "request_uuid.txt"
|
|
|
|
if [ "$RequestUUID" == "" ]; then
|
2019-07-26 12:13:31 +00:00
|
|
|
cat request_uuid.txt
|
|
|
|
Error "Could not extract Request UUID."
|
2019-04-19 11:40:42 +00:00
|
|
|
fi
|
|
|
|
echo "Request UUID: $RequestUUID"
|
|
|
|
rm request_uuid.txt
|
|
|
|
|
|
|
|
RequestStatus=
|
|
|
|
LogFile=
|
|
|
|
while [[ "$RequestStatus" == "" ]]; do
|
|
|
|
sleep 5
|
|
|
|
xcrun altool --notarization-info "$RequestUUID" --username "$AC_USERNAME" --password "@keychain:AC_PASSWORD" 2> request_result.txt
|
|
|
|
while IFS='' read -r line || [[ -n "$line" ]]; do
|
|
|
|
Prefix=$(echo $line | cut -d' ' -f 1)
|
|
|
|
Value=$(echo $line | cut -d' ' -f 2)
|
|
|
|
if [ "$Prefix" == "LogFileURL:" ]; then
|
|
|
|
LogFile=$Value
|
|
|
|
fi
|
|
|
|
if [ "$Prefix" == "Status:" ]; then
|
|
|
|
if [ "$Value" == "in" ]; then
|
|
|
|
echo "In progress..."
|
|
|
|
else
|
|
|
|
RequestStatus=$Value
|
|
|
|
echo "Status: $RequestStatus"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done < "request_result.txt"
|
|
|
|
done
|
|
|
|
if [ "$RequestStatus" != "success" ]; then
|
|
|
|
echo "Notarization problems, response:"
|
|
|
|
cat request_result.txt
|
|
|
|
if [ "$LogFile" != "" ]; then
|
|
|
|
echo "Requesting log..."
|
|
|
|
curl $LogFile
|
|
|
|
fi
|
|
|
|
Error "Notarization FAILED."
|
|
|
|
fi
|
|
|
|
rm request_result.txt
|
|
|
|
|
|
|
|
if [ "$LogFile" != "" ]; then
|
|
|
|
echo "Requesting log..."
|
|
|
|
curl $LogFile > request_log.txt
|
|
|
|
fi
|
|
|
|
|
|
|
|
xcrun stapler staple "$ReleasePath/$BinaryName.app"
|
|
|
|
|
|
|
|
if [ "$AlphaVersion" != "0" ]; then
|
|
|
|
rm -rf "$ReleasePath/AlphaTemp"
|
|
|
|
mkdir "$ReleasePath/AlphaTemp"
|
|
|
|
mkdir "$ReleasePath/AlphaTemp/$BinaryName"
|
|
|
|
cp -r "$ReleasePath/$BinaryName.app" "$ReleasePath/AlphaTemp/$BinaryName/"
|
|
|
|
cd "$ReleasePath/AlphaTemp"
|
|
|
|
zip -r "$SetupFile" "$BinaryName"
|
|
|
|
mv "$SetupFile" "$ReleasePath/"
|
|
|
|
cd "$ReleasePath"
|
|
|
|
echo "Alpha archive re-created."
|
|
|
|
else
|
|
|
|
xcrun stapler staple "$ReleasePath/$SetupFile"
|
|
|
|
fi
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
|
2019-05-09 15:45:18 +00:00
|
|
|
"./Packer" -path "$BinaryName.app" -target "$BuildTarget" -version $VersionForPacker $AlphaBetaParam
|
|
|
|
echo "Packer done!"
|
|
|
|
fi
|
2019-04-19 11:40:42 +00:00
|
|
|
|
2016-04-27 12:03:10 +00:00
|
|
|
if [ ! -d "$ReleasePath/deploy" ]; then
|
|
|
|
mkdir "$ReleasePath/deploy"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d "$ReleasePath/deploy/$AppVersionStrMajor" ]; then
|
|
|
|
mkdir "$ReleasePath/deploy/$AppVersionStrMajor"
|
|
|
|
fi
|
|
|
|
|
2019-11-05 12:27:42 +00:00
|
|
|
if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "osx" ]; then
|
2016-04-27 12:03:10 +00:00
|
|
|
echo "Copying $BinaryName.app and $UpdateFile to deploy/$AppVersionStrMajor/$AppVersionStr..";
|
|
|
|
mkdir "$DeployPath"
|
|
|
|
mkdir "$DeployPath/$BinaryName"
|
|
|
|
cp -r "$ReleasePath/$BinaryName.app" "$DeployPath/$BinaryName/"
|
2018-09-26 14:58:09 +00:00
|
|
|
if [ "$AlphaVersion" != "0" ]; then
|
|
|
|
mv "$ReleasePath/$AlphaKeyFile" "$DeployPath/"
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
mv "$ReleasePath/$BinaryName.app.dSYM" "$DeployPath/"
|
|
|
|
rm "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName"
|
|
|
|
rm "$ReleasePath/$BinaryName.app/Contents/Frameworks/Updater"
|
2016-10-19 18:56:56 +00:00
|
|
|
rm "$ReleasePath/$BinaryName.app/Contents/Info.plist"
|
2016-04-27 12:03:10 +00:00
|
|
|
rm -rf "$ReleasePath/$BinaryName.app/Contents/_CodeSignature"
|
|
|
|
mv "$ReleasePath/$UpdateFile" "$DeployPath/"
|
|
|
|
mv "$ReleasePath/$SetupFile" "$DeployPath/"
|
|
|
|
|
2018-04-08 13:17:56 +00:00
|
|
|
if [ "$BuildTarget" == "mac" ]; then
|
|
|
|
mkdir -p "$BackupPath/tmac"
|
|
|
|
cp "$DeployPath/$UpdateFile" "$BackupPath/tmac/"
|
|
|
|
cp "$DeployPath/$SetupFile" "$BackupPath/tmac/"
|
2018-09-26 14:58:09 +00:00
|
|
|
if [ "$AlphaVersion" != "0" ]; then
|
|
|
|
cp -v "$DeployPath/$AlphaKeyFile" "$BackupPath/tmac/"
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
2018-04-08 13:17:56 +00:00
|
|
|
fi
|
2019-11-05 12:27:42 +00:00
|
|
|
if [ "$BuildTarget" == "osx" ]; then
|
|
|
|
mkdir -p "$BackupPath/tosx"
|
|
|
|
cp "$DeployPath/$UpdateFile" "$BackupPath/tosx/"
|
|
|
|
cp "$DeployPath/$SetupFile" "$BackupPath/tosx/"
|
2018-09-26 14:58:09 +00:00
|
|
|
if [ "$AlphaVersion" != "0" ]; then
|
2019-11-05 12:27:42 +00:00
|
|
|
cp -v "$DeployPath/$AlphaKeyFile" "$BackupPath/tosx/"
|
2016-04-27 12:03:10 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
elif [ "$BuildTarget" == "macstore" ]; then
|
|
|
|
echo "Copying $BinaryName.app to deploy/$AppVersionStrMajor/$AppVersionStr..";
|
|
|
|
mkdir "$DeployPath"
|
|
|
|
cp -r "$ReleasePath/$BinaryName.app" "$DeployPath/"
|
|
|
|
mv "$ReleasePath/$BinaryName.pkg" "$DeployPath/"
|
|
|
|
mv "$ReleasePath/$BinaryName.app.dSYM" "$DeployPath/"
|
|
|
|
rm "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName"
|
2016-10-19 18:56:56 +00:00
|
|
|
rm "$ReleasePath/$BinaryName.app/Contents/Info.plist"
|
2016-04-27 12:03:10 +00:00
|
|
|
rm -rf "$ReleasePath/$BinaryName.app/Contents/_CodeSignature"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Version $AppVersionStrFull is ready!";
|
2017-12-11 14:45:29 +00:00
|
|
|
echo -en "\007";
|
|
|
|
sleep 1;
|
|
|
|
echo -en "\007";
|
|
|
|
sleep 1;
|
|
|
|
echo -en "\007";
|
2019-04-19 11:40:42 +00:00
|
|
|
|
|
|
|
if [ "$BuildTarget" == "mac" ]; then
|
|
|
|
if [ -f "$ReleasePath/request_log.txt" ]; then
|
|
|
|
DisplayingLog=
|
|
|
|
while IFS='' read -r line || [[ -n "$line" ]]; do
|
|
|
|
if [ "$DisplayingLog" == "1" ]; then
|
|
|
|
echo $line
|
|
|
|
else
|
|
|
|
Prefix=$(echo $line | cut -d' ' -f 1)
|
|
|
|
Value=$(echo $line | cut -d' ' -f 2)
|
|
|
|
if [ "$Prefix" == '"issues":' ]; then
|
|
|
|
if [ "$Value" != "null" ]; then
|
|
|
|
echo "NB! Notarization log issues:"
|
|
|
|
echo $line
|
|
|
|
DisplayingLog=1
|
|
|
|
else
|
|
|
|
DisplayingLog=0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done < "$ReleasePath/request_log.txt"
|
|
|
|
if [ "$DisplayingLog" != "0" ] && [ "$DisplayingLog" != "1" ]; then
|
|
|
|
echo "NB! Notarization issues not found:"
|
|
|
|
cat "$ReleasePath/request_log.txt"
|
|
|
|
else
|
|
|
|
rm "$ReleasePath/request_log.txt"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "NB! Notarization log not found :("
|
|
|
|
fi
|
|
|
|
fi
|