build.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. set -e
  3. FullExecPath=$PWD
  4. pushd `dirname $0` > /dev/null
  5. FullScriptPath=`pwd`
  6. popd > /dev/null
  7. if [ ! -d "$FullScriptPath/../../../../DesktopPrivate" ]; then
  8. echo ""
  9. echo "This script is for building the production version of Telegram Desktop."
  10. echo ""
  11. echo "For building custom versions please visit the build instructions page at:"
  12. echo "https://github.com/telegramdesktop/tdesktop/#build-instructions"
  13. exit
  14. fi
  15. HomePath="$FullScriptPath/../.."
  16. cd $HomePath
  17. ProjectPath="$HomePath/../out"
  18. ReleasePath="$ProjectPath/Release"
  19. BinaryName="Telegram"
  20. if [ ! -f "/usr/bin/cmake" ]; then
  21. ln -s cmake3 /usr/bin/cmake
  22. fi
  23. ./configure.sh
  24. cd $ProjectPath
  25. cmake --build . --config Release --target Telegram
  26. cd $ReleasePath
  27. echo "$BinaryName build complete!"
  28. Error () {
  29. cd $FullExecPath
  30. echo "$1"
  31. exit 1
  32. }
  33. if [ ! -f "$ReleasePath/$BinaryName" ]; then
  34. Error "$BinaryName not found!"
  35. fi
  36. if [ ! -f "$ReleasePath/Updater" ]; then
  37. Error "Updater not found!"
  38. fi
  39. rm -rf "$ReleasePath/root"
  40. mkdir "$ReleasePath/root"
  41. mv "$ReleasePath/$BinaryName" "$ReleasePath/root/"
  42. mv "$ReleasePath/Updater" "$ReleasePath/root/"
  43. mv "$ReleasePath/Packer" "$ReleasePath/root/"