Skip to content

Commit

Permalink
Build scripts improved, QtCreator build fixed.
Browse files Browse the repository at this point in the history
qmake and travis builds use -j4 for make.
  • Loading branch information
john-preston committed Apr 27, 2016
1 parent 0854dba commit fe6e3c5
Show file tree
Hide file tree
Showing 7 changed files with 234 additions and 98 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/Telegram/Target
/Telegram/build/target
/Telegram/GeneratedFiles/
/Telegram/SourceFiles/art/grid.png
/Telegram/SourceFiles/art/grid_125x.png
Expand Down
40 changes: 20 additions & 20 deletions .travis/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,37 +102,37 @@ build() {
./configure -prefix "$srcdir/qt" -release -opensource -confirm-license -qt-zlib \
-qt-libpng -qt-libjpeg -qt-freetype -qt-harfbuzz -qt-pcre -qt-xcb \
-qt-xkbcommon-x11 -no-opengl -static -nomake examples -nomake tests
make --silent -j
make --silent -j install
make --silent -j4
make --silent -j4 install

export PATH="$srcdir/qt/bin:$PATH"

info_msg "Build breakpad"
# Build breakpad
cd "$srcdir/Libraries/breakpad"
./configure
make --silent -j

info_msg "Build codegen_style"
# Build codegen_style
mkdir -p "$srcdir/tdesktop/Linux/obj/codegen_style/Debug"
cd "$srcdir/tdesktop/Linux/obj/codegen_style/Debug"
qmake CONFIG+=debug "../../../../Telegram/build/qmake/codegen_style/codegen_style.pro"
make --silent -j

info_msg "Build codegen_numbers"
# Build codegen_numbers
mkdir -p "$srcdir/tdesktop/Linux/obj/codegen_numbers/Debug"
cd "$srcdir/tdesktop/Linux/obj/codegen_numbers/Debug"
qmake CONFIG+=debug "../../../../Telegram/build/qmake/codegen_numbers/codegen_numbers.pro"
make --silent -j
make --silent -j4

info_msg "Build codegen_style"
# Build codegen_style
mkdir -p "$srcdir/tdesktop/Linux/obj/codegen_style/Debug"
cd "$srcdir/tdesktop/Linux/obj/codegen_style/Debug"
qmake CONFIG+=debug "../../../../Telegram/build/qmake/codegen_style/codegen_style.pro"
make --silent -j4

info_msg "Build codegen_numbers"
# Build codegen_numbers
mkdir -p "$srcdir/tdesktop/Linux/obj/codegen_numbers/Debug"
cd "$srcdir/tdesktop/Linux/obj/codegen_numbers/Debug"
qmake CONFIG+=debug "../../../../Telegram/build/qmake/codegen_numbers/codegen_numbers.pro"
make --silent -j4

info_msg "Build MetaLang"
# Build MetaLang
mkdir -p "$srcdir/tdesktop/Linux/DebugIntermediateLang"
cd "$srcdir/tdesktop/Linux/DebugIntermediateLang"
qmake CONFIG+=debug "../../Telegram/MetaLang.pro"
make --silent -j
make --silent -j4

info_msg "Build Telegram Desktop"
# Build Telegram Desktop
Expand All @@ -141,9 +141,9 @@ build() {

./../codegen/Debug/codegen_style "-I./../../Telegram/Resources" "-I./../../Telegram/SourceFiles" "-o./GeneratedFiles/styles" all_files.style --rebuild
./../codegen/Debug/codegen_numbers "-o./GeneratedFiles" "./../../Telegram/Resources/numbers.txt"
./../DebugLang/MetaLang -lang_in ./../../Telegram/Resources/lang.strings -lang_out ./GeneratedFiles/lang_auto
./../DebugLang/MetaLang -lang_in ./../../Telegram/Resources/langs/lang.strings -lang_out ./GeneratedFiles/lang_auto
qmake CONFIG+=debug "../../Telegram/Telegram.pro"
make -j
make -j4
}

check() {
Expand Down
6 changes: 5 additions & 1 deletion Telegram/build/build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,12 @@ if [ "$BuildTarget" == "linux" ] || [ "$BuildTarget" == "linux32" ]; then
mkdir -p "$WorkPath/ReleaseIntermediate"
cd "$WorkPath/ReleaseIntermediate"
"$QMakePath" "$HomePath/Telegram.pro" -r -spec linux-g++

eval "$HomePath/build/makefile_static.sh"
make
./../codegen/Debug/codegen_style "-I./../../Telegram/Resources" "-I./../../Telegram/SourceFiles" "-o./GeneratedFiles/styles" all_files.style --rebuild
./../codegen/Debug/codegen_numbers "-o./GeneratedFiles" "./../../Telegram/Resources/numbers.txt"
./../DebugLang/MetaLang -lang_in ./../../Telegram/Resources/langs/lang.strings -lang_out ./GeneratedFiles/lang_auto
make -j4
echo "$BinaryName build complete!"

if [ ! -f "$ReleasePath/$BinaryName" ]; then
Expand Down
88 changes: 46 additions & 42 deletions Telegram/build/deploy.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,59 @@ pushd `dirname $0` > /dev/null
FullScriptPath=`pwd`
popd > /dev/null

if [ ! -d "$FullScriptPath/../../../TelegramPrivate" ]; then
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
}

DeployTarget="$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 < Version
done < "$FullScriptPath/version"

if [ "$BetaVersion" != "0" ]; then
AppVersion="$BetaVersion"
AppVersionStrFull="${AppVersionStr}_${BetaVersion}"
DevParam="-beta $BetaVersion"
BetaKeyFile="tbeta_${AppVersion}_key"
elif [ "$DevChannel" == "0" ]; then
elif [ "$AlphaChannel" == "0" ]; then
AppVersionStrFull="$AppVersionStr"
DevParam=''
else
AppVersionStrFull="$AppVersionStr.dev"
DevParam='-dev'
AppVersionStrFull="$AppVersionStr.alpha"
fi

if [ ! -f "Target" ]; then
echo "Deploy target not found!"
exit 1
fi

while IFS='' read -r line || [[ -n "$line" ]]; do
BuildTarget="$line"
done < Target

echo ""
HomePath="$FullScriptPath/.."
if [ "$BuildTarget" == "linux" ]; then
echo "Deploying version $AppVersionStrFull for Linux 64bit.."
UpdateFile="tlinuxupd$AppVersion"
SetupFile="tsetup.$AppVersionStrFull.tar.xz"
ReleasePath="./../Linux/Release"
ReleasePath="$HomePath/../Linux/Release"
RemoteFolder="tlinux"
elif [ "$BuildTarget" == "linux32" ]; then
echo "Deploying version $AppVersionStrFull for Linux 32bit.."
UpdateFile="tlinux32upd$AppVersion"
SetupFile="tsetup32.$AppVersionStrFull.tar.xz"
ReleasePath="./../Linux/Release"
ReleasePath="$HomePath/../Linux/Release"
RemoteFolder="tlinux32"
elif [ "$BuildTarget" == "mac" ]; then
DeployMac="0"
Expand All @@ -71,27 +83,25 @@ elif [ "$BuildTarget" == "mac" ]; then
fi
UpdateFile="tmacupd$AppVersion"
SetupFile="tsetup.$AppVersionStrFull.dmg"
ReleasePath="./../Mac/Release"
ReleasePath="$HomePath/../Mac/Release"
RemoteFolder="tmac"
Mac32DeployPath="./../../tother/tmac32/$AppVersionStrMajor/$AppVersionStrFull"
Mac32DeployPath="$HomePath/../../tother/tmac32/$AppVersionStrMajor/$AppVersionStrFull"
Mac32UpdateFile="tmac32upd$AppVersion"
Mac32SetupFile="tsetup32.$AppVersionStrFull.dmg"
Mac32RemoteFolder="tmac32"
WinDeployPath="./../../tother/tsetup/$AppVersionStrMajor/$AppVersionStrFull"
WinDeployPath="$HomePath/../../tother/tsetup/$AppVersionStrMajor/$AppVersionStrFull"
WinUpdateFile="tupdate$AppVersion"
WinSetupFile="tsetup.$AppVersionStrFull.exe"
WinPortableFile="tportable.$AppVersionStrFull.zip"
WinRemoteFolder="tsetup"
DropboxPath="./../../../Dropbox/Telegram/deploy/$AppVersionStrMajor"
DropboxPath="/Volumes/Storage/Dropbox/Telegram/deploy/$AppVersionStrMajor"
DropboxDeployPath="$DropboxPath/$AppVersionStrFull"
DropboxSetupFile="$SetupFile"
DropboxMac32SetupFile="$Mac32SetupFile"
elif [ "$BuildTarget" == "mac32" ] || [ "$BuildTarget" = "macstore" ]; then
echo "No need to deploy this target."
exit
Error "No need to deploy this target."
else
echo "Invalid target!"
exit 1
Error "Invalid target!"
fi

DeployPath="$ReleasePath/deploy/$AppVersionStrMajor/$AppVersionStrFull"
Expand All @@ -105,8 +115,7 @@ if [ "$BetaVersion" != "0" ]; then
BetaFilePath="$DeployPath/$BetaKeyFile"
fi
if [ ! -f "$BetaFilePath" ]; then
echo "Beta key file for $AppVersionStrFull not found :("
exit 1
Error "Beta key file for $AppVersionStrFull not found :("
fi

while IFS='' read -r line || [[ -n "$line" ]]; do
Expand All @@ -131,45 +140,38 @@ fi

if [ "$BuildTarget" != "mac" ] || [ "$DeployMac" == "1" ]; then
if [ ! -f "$DeployPath/$UpdateFile" ]; then
echo "$UpdateFile not found!";
exit 1
Error "$UpdateFile not found!";
fi

if [ ! -f "$DeployPath/$SetupFile" ]; then
echo "$SetupFile not found!"
exit 1
Error "$SetupFile not found!"
fi
fi

if [ "$BuildTarget" == "mac" ]; then
if [ "$DeployMac32" == "1" ]; then
if [ ! -f "$Mac32DeployPath/$Mac32UpdateFile" ]; then
echo "$Mac32UpdateFile not found!"
exit 1
Error "$Mac32UpdateFile not found!"
fi

if [ ! -f "$Mac32DeployPath/$Mac32SetupFile" ]; then
echo "$Mac32SetupFile not found!"
exit 1
Error "$Mac32SetupFile not found!"
fi
fi

if [ "$DeployWin" == "1" ]; then
if [ ! -f "$WinDeployPath/$WinUpdateFile" ]; then
echo "$WinUpdateFile not found!"
exit 1
Error "$WinUpdateFile not found!"
fi

if [ "$BetaVersion" == "0" ]; then
if [ ! -f "$WinDeployPath/$WinSetupFile" ]; then
echo "$WinSetupFile not found!"
exit 1
Error "$WinSetupFile not found!"
fi
fi

if [ ! -f "$WinDeployPath/$WinPortableFile" ]; then
echo "$WinPortableFile not found!"
exit 1
Error "$WinPortableFile not found!"
fi
fi

Expand Down Expand Up @@ -221,4 +223,6 @@ if [ "$BuildTarget" == "linux" ] || [ "$BuildTarget" == "linux32" ] || [ "$Build
fi
fi

echo "Version $AppVersionStrFull was deployed!";
echo "Version $AppVersionStrFull was deployed!"
cd $FullExecPath

28 changes: 14 additions & 14 deletions Telegram/build/makefile_static.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ Replace () {
}

Replace '\-llzma' "$ArchDirPath\/liblzma\.a"
Replace '\-lXi' '$ArchDirPath\/libXi\.a $ArchDirPath\/libXext\.a'
Replace '\-lSM' '$ArchDirPath\/libSM\.a'
Replace '\-lICE' '$ArchDirPath\/libICE\.a'
Replace '\-lfontconfig' '$ArchDirPath\/libfontconfig\.a $ArchDirPath\/libexpat\.a'
Replace '\-lfreetype' '$ArchDirPath\/libfreetype\.a'
Replace '\-lXext' '$ArchDirPath\/libXext\.a'
Replace '\-lopus' '$LocalDirPath\/libopus\.a'
Replace '\-lopenal' '$LocalDirPath\/libopenal\.a'
Replace '\-lavformat' '$LocalDirPath\/libavformat\.a'
Replace '\-lavcodec' '$LocalDirPath\/libavcodec\.a'
Replace '\-lswresample' '$LocalDirPath\/libswresample\.a'
Replace '\-lswscale' '$LocalDirPath\/libswscale\.a'
Replace '\-lavutil' '$LocalDirPath\/libavutil\.a'
Replace '\-lva' '$LocalDirPath\/libva\.a'
Replace '\-lXi' "$ArchDirPath\/libXi\.a $ArchDirPath\/libXext\.a"
Replace '\-lSM' "$ArchDirPath\/libSM\.a"
Replace '\-lICE' "$ArchDirPath\/libICE\.a"
Replace '\-lfontconfig' "$ArchDirPath\/libfontconfig\.a $ArchDirPath\/libexpat\.a"
Replace '\-lfreetype' "$ArchDirPath\/libfreetype\.a"
Replace '\-lXext' "$ArchDirPath\/libXext\.a"
Replace '\-lopus' "$LocalDirPath\/libopus\.a"
Replace '\-lopenal' "$LocalDirPath\/libopenal\.a"
Replace '\-lavformat' "$LocalDirPath\/libavformat\.a"
Replace '\-lavcodec' "$LocalDirPath\/libavcodec\.a"
Replace '\-lswresample' "$LocalDirPath\/libswresample\.a"
Replace '\-lswscale' "$LocalDirPath\/libswscale\.a"
Replace '\-lavutil' "$LocalDirPath\/libavutil\.a"
Replace '\-lva' "$LocalDirPath\/libva\.a"
41 changes: 21 additions & 20 deletions Telegram/build/set_version.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set "InputVersion=%1"
for /F "tokens=1,2,3,4 delims=. " %%a in ("%InputVersion%") do (
set "VersionMajor=%%a"
set "VersionMinor=%%b"
set "VersionMicro=%%c"
set "VersionPatch=%%c"
if "%%d" == "" (
set "VersionBeta=0"
set "VersionAlpha=0"
Expand All @@ -30,9 +30,9 @@ if "%VersionMinorCleared%" neq "%VersionMinor%" (
echo Bad minor version!
exit /b 1
)
set /a "VersionMicroCleared=%VersionMicro% %% 1000"
if "%VersionMicroCleared%" neq "%VersionMicro%" (
echo Bad micro version!
set /a "VersionPatchCleared=%VersionPatch% %% 1000"
if "%VersionPatchCleared%" neq "%VersionPatch%" (
echo Bad patch version!
exit /b 1
)
if "%VersionAlpha%" neq "0" (
Expand All @@ -45,7 +45,7 @@ if "%VersionAlpha%" neq "0" (
set "VersionAlphaBool=false"
)

set /a "VersionFull=%VersionMajor% * 1000000 + %VersionMinor% * 1000 + %VersionMicro%"
set /a "VersionFull=%VersionMajor% * 1000000 + %VersionMinor% * 1000 + %VersionPatch%"
if "%VersionBeta%" neq "0" (
set /a "VersionBetaCleared=%VersionBeta% %% 1000"
if "!VersionBetaCleared!" neq "%VersionBeta%" (
Expand All @@ -58,18 +58,19 @@ if "%VersionBeta%" neq "0" (
set "VersionFullBeta=0"
)

set "VersionStr=%VersionMajor%.%VersionMinor%.%VersionMicro%"
set "VersionStrSmall=%VersionMajor%.%VersionMinor%"
if "%VersionMicro%" neq "0" (
set "VersionStrSmall=%VersionStrSmall%.%VersionMicro%"
set "VersionStr=%VersionMajor%.%VersionMinor%.%VersionPatch%"
if "%VersionPatch%" neq "0" (
set "VersionStrSmall=%VersionStr%"
) else (
set "VersionStrSmall=%VersionMajor%.%VersionMinor%"
)

if "%VersionAlpha%" neq "0" (
echo Setting version: %VersionMajor%.%VersionMinor%.%VersionMicro% alpha
echo Setting version: %VersionStr% alpha
) else if "%VersionBeta%" neq "0" (
echo Setting version: %VersionMajor%.%VersionMinor%.%VersionMicro%.%VersionBeta% closed beta
echo Setting version: %VersionStr%.%VersionBeta% closed beta
) else (
echo Setting version: %VersionMajor%.%VersionMinor%.%VersionMicro% stable
echo Setting version: %VersionStr% stable
)

echo Patching build/version...
Expand All @@ -95,17 +96,17 @@ call :repl "Replace=(TDESKTOP_VERSION\s+=) (\s*)[&hat;;]+/$1$2 %VersionStrSmall%

echo Patching Telegram.rc...
set "ResourcePath=%FullScriptPath%..\Resources\winrc\Telegram.rc"
call :repl "Replace=(FILEVERSION) (\s*)\d+,\d+,\d+,\d+/$1$2 %VersionMajor%,%VersionMinor%,%VersionMicro%,%VersionBeta%" "Filename=%ResourcePath%" || goto :error
call :repl "Replace=(PRODUCTVERSION) (\s*)\d+,\d+,\d+,\d+/$1$2 %VersionMajor%,%VersionMinor%,%VersionMicro%,%VersionBeta%" "Filename=%ResourcePath%" || goto :error
call :repl "Replace=(&quot;FileVersion&quot;,) (\s*)&quot;\d+.\d+.\d+.\d+&quot;/$1$2 &quot;%VersionMajor%.%VersionMinor%.%VersionMicro%.%VersionBeta%&quot;" "Filename=%ResourcePath%" || goto :error
call :repl "Replace=(&quot;ProductVersion&quot;,) (\s*)&quot;\d+.\d+.\d+.\d+&quot;/$1$2 &quot;%VersionMajor%.%VersionMinor%.%VersionMicro%.%VersionBeta%&quot;" "Filename=%ResourcePath%" || goto :error
call :repl "Replace=(FILEVERSION) (\s*)\d+,\d+,\d+,\d+/$1$2 %VersionMajor%,%VersionMinor%,%VersionPatch%,%VersionBeta%" "Filename=%ResourcePath%" || goto :error
call :repl "Replace=(PRODUCTVERSION) (\s*)\d+,\d+,\d+,\d+/$1$2 %VersionMajor%,%VersionMinor%,%VersionPatch%,%VersionBeta%" "Filename=%ResourcePath%" || goto :error
call :repl "Replace=(&quot;FileVersion&quot;,) (\s*)&quot;\d+.\d+.\d+.\d+&quot;/$1$2 &quot;%VersionMajor%.%VersionMinor%.%VersionPatch%.%VersionBeta%&quot;" "Filename=%ResourcePath%" || goto :error
call :repl "Replace=(&quot;ProductVersion&quot;,) (\s*)&quot;\d+.\d+.\d+.\d+&quot;/$1$2 &quot;%VersionMajor%.%VersionMinor%.%VersionPatch%.%VersionBeta%&quot;" "Filename=%ResourcePath%" || goto :error

echo Patching Updater.rc...
set "ResourcePath=%FullScriptPath%..\Resources\winrc\Updater.rc"
call :repl "Replace=(FILEVERSION) (\s*)\d+,\d+,\d+,\d+/$1$2 %VersionMajor%,%VersionMinor%,%VersionMicro%,%VersionBeta%" "Filename=%ResourcePath%" || goto :error
call :repl "Replace=(PRODUCTVERSION) (\s*)\d+,\d+,\d+,\d+/$1$2 %VersionMajor%,%VersionMinor%,%VersionMicro%,%VersionBeta%" "Filename=%ResourcePath%" || goto :error
call :repl "Replace=(&quot;FileVersion&quot;,) (\s*)&quot;\d+.\d+.\d+.\d+&quot;/$1$2 &quot;%VersionMajor%.%VersionMinor%.%VersionMicro%.%VersionBeta%&quot;" "Filename=%ResourcePath%" || goto :error
call :repl "Replace=(&quot;ProductVersion&quot;,) (\s*)&quot;\d+.\d+.\d+.\d+&quot;/$1$2 &quot;%VersionMajor%.%VersionMinor%.%VersionMicro%.%VersionBeta%&quot;" "Filename=%ResourcePath%" || goto :error
call :repl "Replace=(FILEVERSION) (\s*)\d+,\d+,\d+,\d+/$1$2 %VersionMajor%,%VersionMinor%,%VersionPatch%,%VersionBeta%" "Filename=%ResourcePath%" || goto :error
call :repl "Replace=(PRODUCTVERSION) (\s*)\d+,\d+,\d+,\d+/$1$2 %VersionMajor%,%VersionMinor%,%VersionPatch%,%VersionBeta%" "Filename=%ResourcePath%" || goto :error
call :repl "Replace=(&quot;FileVersion&quot;,) (\s*)&quot;\d+.\d+.\d+.\d+&quot;/$1$2 &quot;%VersionMajor%.%VersionMinor%.%VersionPatch%.%VersionBeta%&quot;" "Filename=%ResourcePath%" || goto :error
call :repl "Replace=(&quot;ProductVersion&quot;,) (\s*)&quot;\d+.\d+.\d+.\d+&quot;/$1$2 &quot;%VersionMajor%.%VersionMinor%.%VersionPatch%.%VersionBeta%&quot;" "Filename=%ResourcePath%" || goto :error

exit /b

Expand Down
Loading

0 comments on commit fe6e3c5

Please sign in to comment.