init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
This commit is contained in:
411
Telegram/build/build.bat
Normal file
411
Telegram/build/build.bat
Normal file
@@ -0,0 +1,411 @@
|
||||
@echo OFF
|
||||
setlocal enabledelayedexpansion
|
||||
set "FullScriptPath=%~dp0"
|
||||
set "FullExecPath=%cd%"
|
||||
|
||||
if not exist "%FullScriptPath%..\..\..\DesktopPrivate" (
|
||||
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 /b
|
||||
)
|
||||
|
||||
FOR /F "tokens=1* delims= " %%i in (%FullScriptPath%target) do set "BuildTarget=%%i"
|
||||
|
||||
set "Build64=0"
|
||||
set "BuildARM=0"
|
||||
set "BuildUWP=0"
|
||||
if "%BuildTarget%" equ "win64" (
|
||||
set "Build64=1"
|
||||
) else if "%BuildTarget%" equ "winarm" (
|
||||
set "BuildARM=1"
|
||||
) else if "%BuildTarget%" equ "uwp" (
|
||||
set "BuildUWP=1"
|
||||
) else if "%BuildTarget%" equ "uwp64" (
|
||||
set "Build64=1"
|
||||
set "BuildUWP=1"
|
||||
) else if "%BuildTarget%" equ "uwparm" (
|
||||
set "BuildARM=1"
|
||||
set "BuildUWP=1"
|
||||
)
|
||||
|
||||
if %Build64% neq 0 (
|
||||
if "%Platform%" neq "x64" (
|
||||
echo Bad environment. Make sure to run from 'x64 Native Tools Command Prompt for VS 2022'.
|
||||
exit /b
|
||||
) else if "%VSCMD_ARG_HOST_ARCH%" neq "x64" (
|
||||
echo Bad environment. Make sure to run from 'x64 Native Tools Command Prompt for VS 2022'.
|
||||
exit /b
|
||||
) else if "%VSCMD_ARG_TGT_ARCH%" neq "x64" (
|
||||
echo Bad environment. Make sure to run from 'x64 Native Tools Command Prompt for VS 2022'.
|
||||
exit /b
|
||||
)
|
||||
) else if %BuildARM% neq 0 (
|
||||
if "%Platform%" neq "arm64" (
|
||||
echo Bad environment. Make sure to run from 'ARM64 Native Tools Command Prompt for VS 2022'.
|
||||
exit /b
|
||||
) else if "%VSCMD_ARG_HOST_ARCH%" neq "arm64" (
|
||||
echo Bad environment. Make sure to run from 'ARM64 Native Tools Command Prompt for VS 2022'.
|
||||
exit /b
|
||||
) else if "%VSCMD_ARG_TGT_ARCH%" neq "arm64" (
|
||||
echo Bad environment. Make sure to run from 'ARM64 Native Tools Command Prompt for VS 2022'.
|
||||
exit /b
|
||||
)
|
||||
) else (
|
||||
if "%Platform%" neq "x86" (
|
||||
echo Bad environment. Make sure to run from 'x86 Native Tools Command Prompt for VS 2022'.
|
||||
exit /b
|
||||
) else if "%VSCMD_ARG_HOST_ARCH%" neq "x86" (
|
||||
echo Bad environment. Make sure to run from 'x86 Native Tools Command Prompt for VS 2022'.
|
||||
exit /b
|
||||
) else if "%VSCMD_ARG_TGT_ARCH%" neq "x86" (
|
||||
echo Bad environment. Make sure to run from 'x86 Native Tools Command Prompt for VS 2022'.
|
||||
exit /b
|
||||
)
|
||||
)
|
||||
|
||||
FOR /F "tokens=1,2* delims= " %%i in (%FullScriptPath%version) do set "%%i=%%j"
|
||||
|
||||
set "VersionForPacker=%AppVersion%"
|
||||
if %AlphaVersion% neq 0 (
|
||||
set "AppVersion=%AlphaVersion%"
|
||||
set "AppVersionStrFull=%AppVersionStr%_%AlphaVersion%"
|
||||
set "AlphaBetaParam=-alpha %AlphaVersion%"
|
||||
set "AlphaKeyFile=talpha_%AlphaVersion%_key"
|
||||
) else (
|
||||
if %BetaChannel% neq 0 (
|
||||
set "AlphaBetaParam=-beta"
|
||||
set "AppVersionStrFull=%AppVersionStr%.beta"
|
||||
) else (
|
||||
set "AlphaBetaParam="
|
||||
set "AppVersionStrFull=%AppVersionStr%"
|
||||
)
|
||||
)
|
||||
|
||||
echo.
|
||||
if %BuildUWP% neq 0 (
|
||||
if %Build64% neq 0 (
|
||||
echo Building version %AppVersionStrFull% for UWP 64 bit..
|
||||
) else if %BuildARM% neq 0 (
|
||||
echo Building version %AppVersionStrFull% for UWP ARM..
|
||||
) else (
|
||||
echo Building version %AppVersionStrFull% for UWP..
|
||||
)
|
||||
) else (
|
||||
if %Build64% neq 0 (
|
||||
echo Building version %AppVersionStrFull% for Windows 64 bit..
|
||||
) else if %BuildARM% neq 0 (
|
||||
echo Building version %AppVersionStrFull% for Windows on ARM..
|
||||
) else (
|
||||
echo Building version %AppVersionStrFull% for Windows..
|
||||
)
|
||||
)
|
||||
echo.
|
||||
|
||||
set "HomePath=%FullScriptPath%.."
|
||||
set "ResourcesPath=%HomePath%\Resources"
|
||||
set "SolutionPath=%HomePath%\..\out"
|
||||
if %Build64% neq 0 (
|
||||
set "UpdateFile=tx64upd%AppVersion%"
|
||||
set "SetupFile=tsetup-x64.%AppVersionStrFull%.exe"
|
||||
set "PortableFile=tportable-x64.%AppVersionStrFull%.zip"
|
||||
set "DumpSymsPath=%SolutionPath%\..\..\Libraries\win64\breakpad\src\tools\windows\dump_syms\Release\dump_syms.exe"
|
||||
) else if %BuildARM% neq 0 (
|
||||
set "UpdateFile=tarm64upd%AppVersion%"
|
||||
set "SetupFile=tsetup-arm64.%AppVersionStrFull%.exe"
|
||||
set "PortableFile=tportable-arm64.%AppVersionStrFull%.zip"
|
||||
set "DumpSymsPath=%SolutionPath%\..\..\Libraries\breakpad\src\tools\windows\dump_syms\Release\dump_syms.exe"
|
||||
) else (
|
||||
set "UpdateFile=tupdate%AppVersion%"
|
||||
set "SetupFile=tsetup.%AppVersionStrFull%.exe"
|
||||
set "PortableFile=tportable.%AppVersionStrFull%.zip"
|
||||
set "DumpSymsPath=%SolutionPath%\..\..\Libraries\breakpad\src\tools\windows\dump_syms\Release\dump_syms.exe"
|
||||
)
|
||||
set "ReleasePath=%SolutionPath%\Release"
|
||||
set "DeployPath=%ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStrFull%"
|
||||
set "SignPath=%HomePath%\..\..\DesktopPrivate\Sign.bat"
|
||||
set "BinaryName=Telegram"
|
||||
set "DropboxSymbolsPath=Y:\Telegram\symbols"
|
||||
set "DropboxSymbolsPathFallback=%HomePath%\..\..\Dropbox\Telegram\symbols"
|
||||
set "FinalReleasePath=Z:\Projects\backup\tdesktop"
|
||||
set "FinalReleasePathFallback=%HomePath%\..\..\Projects\backup\tdesktop"
|
||||
|
||||
if not exist %DropboxSymbolsPath% (
|
||||
if exist %DropboxSymbolsPathFallback% (
|
||||
set "DropboxSymbolsPath=%DropboxSymbolsPathFallback%"
|
||||
) else (
|
||||
echo Dropbox path %DropboxSymbolsPath% not found!
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
if not exist %FinalReleasePath% (
|
||||
if exist %FinalReleasePathFallback% (
|
||||
set "FinalReleasePath=%FinalReleasePathFallback%"
|
||||
) else (
|
||||
echo Release path %FinalReleasePath% not found!
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
if %BuildUWP% neq 0 (
|
||||
if exist %ReleasePath%\AppX\ (
|
||||
echo Result folder out\Release\AppX already exists!
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
if %AlphaVersion% neq 0 (
|
||||
if exist %DeployPath%\ (
|
||||
echo Deploy folder for version %AppVersionStr% already exists!
|
||||
exit /b 1
|
||||
)
|
||||
if exist %ReleasePath%\%AlphaKeyFile% (
|
||||
echo Alpha version key file for version %AppVersion% already exists!
|
||||
exit /b 1
|
||||
)
|
||||
) else (
|
||||
if exist %ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStr%.alpha\ (
|
||||
echo Deploy folder for version %AppVersionStr%.alpha already exists!
|
||||
exit /b 1
|
||||
)
|
||||
if exist %ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStr%.beta\ (
|
||||
echo Deploy folder for version %AppVersionStr%.beta already exists!
|
||||
exit /b 1
|
||||
)
|
||||
if exist %ReleasePath%\deploy\%AppVersionStrMajor%\%AppVersionStr%\ (
|
||||
echo Deploy folder for version %AppVersionStr% already exists!
|
||||
exit /b 1
|
||||
)
|
||||
if exist %ReleasePath%\tupdate%AppVersion% (
|
||||
echo Update file for version %AppVersion% already exists!
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
cd "%HomePath%"
|
||||
|
||||
call configure.bat
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
cd "%SolutionPath%"
|
||||
call cmake --build . --config Release --target Telegram
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
echo.
|
||||
echo Version %AppVersionStrFull% build successfull. Preparing..
|
||||
echo.
|
||||
|
||||
if not exist "%DumpSymsPath%" (
|
||||
echo Utility dump_syms not found!
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Dumping debug symbols..
|
||||
call "%DumpSymsPath%" "%ReleasePath%\%BinaryName%.pdb" > "%ReleasePath%\%BinaryName%.sym"
|
||||
echo Done!
|
||||
|
||||
set "PATH=%PATH%;C:\Program Files\7-Zip;C:\Program Files (x86)\Inno Setup 5"
|
||||
|
||||
cd "%ReleasePath%"
|
||||
|
||||
:sign1
|
||||
call "%SignPath%" "%BinaryName%.exe"
|
||||
if %errorlevel% neq 0 (
|
||||
timeout /t 3
|
||||
goto sign1
|
||||
)
|
||||
|
||||
if %BuildUWP% equ 0 (
|
||||
:sign2
|
||||
call "%SignPath%" "Updater.exe"
|
||||
if %errorlevel% neq 0 (
|
||||
timeout /t 3
|
||||
goto sign2
|
||||
)
|
||||
|
||||
if %AlphaVersion% equ 0 (
|
||||
iscc /dMyAppVersion=%AppVersionStrSmall% /dMyAppVersionZero=%AppVersionStr% /dMyAppVersionFull=%AppVersionStrFull% "/dReleasePath=%ReleasePath%" "/dMyBuildTarget=%BuildTarget%" "%FullScriptPath%setup.iss"
|
||||
if %errorlevel% neq 0 goto error
|
||||
if not exist "%SetupFile%" goto error
|
||||
)
|
||||
|
||||
if %BuildARM% neq 0 (
|
||||
call Packer.exe -version %VersionForPacker% -path %BinaryName%.exe -path Updater.exe -target %BuildTarget% %AlphaBetaParam%
|
||||
) else (
|
||||
call Packer.exe -version %VersionForPacker% -path %BinaryName%.exe -path Updater.exe -path "modules\%Platform%\d3d\d3dcompiler_47.dll" -target %BuildTarget% %AlphaBetaParam%
|
||||
)
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
if %AlphaVersion% neq 0 (
|
||||
if not exist "%ReleasePath%\%AlphaKeyFile%" (
|
||||
echo Alpha version key file not found!
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
FOR /F "tokens=1* delims= " %%i in (%ReleasePath%\%AlphaKeyFile%) do set "AlphaSignature=%%i"
|
||||
)
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
if %AlphaVersion% neq 0 (
|
||||
set "UpdateFile=!UpdateFile!_!AlphaSignature!"
|
||||
set "PortableFile=talpha!AlphaVersion!_!AlphaSignature!.zip"
|
||||
)
|
||||
) else (
|
||||
:sign2
|
||||
call "%SignPath%" "StartupTask.exe"
|
||||
if %errorlevel% neq 0 (
|
||||
timeout /t 3
|
||||
goto sign2
|
||||
)
|
||||
)
|
||||
|
||||
for /f ^"usebackq^ eol^=^
|
||||
|
||||
^ delims^=^" %%a in (%ReleasePath%\%BinaryName%.sym) do (
|
||||
set "SymbolsHashLine=%%a"
|
||||
goto symbolslinedone
|
||||
)
|
||||
:symbolslinedone
|
||||
FOR /F "tokens=1,2,3,4* delims= " %%i in ("%SymbolsHashLine%") do set "SymbolsHash=%%l"
|
||||
|
||||
echo Copying %BinaryName%.sym to %DropboxSymbolsPath%\%BinaryName%.pdb\%SymbolsHash%
|
||||
if not exist %DropboxSymbolsPath%\%BinaryName%.pdb mkdir %DropboxSymbolsPath%\%BinaryName%.pdb
|
||||
if not exist %DropboxSymbolsPath%\%BinaryName%.pdb\%SymbolsHash% mkdir %DropboxSymbolsPath%\%BinaryName%.pdb\%SymbolsHash%
|
||||
move "%ReleasePath%\%BinaryName%.sym" %DropboxSymbolsPath%\%BinaryName%.pdb\%SymbolsHash%\
|
||||
echo Done!
|
||||
|
||||
if %BuildUWP% neq 0 (
|
||||
cd "%HomePath%"
|
||||
|
||||
if %BuildARM% equ 0 (
|
||||
mkdir "%ReleasePath%\AppX\modules\%Platform%\d3d"
|
||||
)
|
||||
xcopy "Resources\uwp\AppX\*" "%ReleasePath%\AppX\" /E
|
||||
set "ResourcePath=%ReleasePath%\AppX\AppxManifest.xml"
|
||||
call :repl "Argument= (ProcessorArchitecture=)"ARCHITECTURE"/ $1"%Platform%"" "Filename=!ResourcePath!" || goto error
|
||||
makepri new /pr Resources\uwp\AppX\ /cf Resources\uwp\priconfig.xml /mn %ReleasePath%\AppX\AppxManifest.xml /of %ReleasePath%\AppX\resources.pri
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
xcopy "%ReleasePath%\%BinaryName%.exe" "%ReleasePath%\AppX\"
|
||||
xcopy "%ReleasePath%\StartupTask.exe" "%ReleasePath%\AppX\"
|
||||
if %BuildARM% equ 0 (
|
||||
xcopy "%ReleasePath%\modules\%Platform%\d3d\d3dcompiler_47.dll" "%ReleasePath%\AppX\modules\%Platform%\d3d\"
|
||||
)
|
||||
|
||||
MakeAppx.exe pack /d "%ReleasePath%\AppX" /l /p ..\out\Release\%BinaryName%.%Platform%.appx
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
if not exist "%ReleasePath%\deploy" mkdir "%ReleasePath%\deploy"
|
||||
if not exist "%ReleasePath%\deploy\%AppVersionStrMajor%" mkdir "%ReleasePath%\deploy\%AppVersionStrMajor%"
|
||||
mkdir "%DeployPath%"
|
||||
|
||||
move "%ReleasePath%\%BinaryName%.pdb" "%DeployPath%\"
|
||||
move "%ReleasePath%\%BinaryName%.%Platform%.appx" "%DeployPath%\"
|
||||
move "%ReleasePath%\%BinaryName%.exe" "%DeployPath%\"
|
||||
|
||||
if "%AlphaBetaParam%" equ "" (
|
||||
move "%ReleasePath%\AppX" "%DeployPath%\AppX"
|
||||
) else (
|
||||
echo Leaving result in out\Release\AppX_arch for now..
|
||||
)
|
||||
) else (
|
||||
if not exist "%ReleasePath%\deploy" mkdir "%ReleasePath%\deploy"
|
||||
if not exist "%ReleasePath%\deploy\%AppVersionStrMajor%" mkdir "%ReleasePath%\deploy\%AppVersionStrMajor%"
|
||||
mkdir "%DeployPath%\%BinaryName%\modules\%Platform%\d3d"
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
move "%ReleasePath%\%BinaryName%.exe" "%DeployPath%\%BinaryName%\"
|
||||
xcopy "%ReleasePath%\modules\%Platform%\d3d\d3dcompiler_47.dll" "%DeployPath%\%BinaryName%\modules\%Platform%\d3d\"
|
||||
move "%ReleasePath%\Updater.exe" "%DeployPath%\"
|
||||
move "%ReleasePath%\%BinaryName%.pdb" "%DeployPath%\"
|
||||
move "%ReleasePath%\Updater.pdb" "%DeployPath%\"
|
||||
if %AlphaVersion% equ 0 (
|
||||
move "%ReleasePath%\%SetupFile%" "%DeployPath%\"
|
||||
) else (
|
||||
move "%ReleasePath%\%AlphaKeyFile%" "%DeployPath%\"
|
||||
)
|
||||
move "%ReleasePath%\%UpdateFile%" "%DeployPath%\"
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
cd "%DeployPath%"
|
||||
7z a -mx9 %PortableFile% %BinaryName%\
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
move "%DeployPath%\%BinaryName%\%BinaryName%.exe" "%DeployPath%\"
|
||||
rmdir "%DeployPath%\%BinaryName%"
|
||||
if %errorlevel% neq 0 goto error
|
||||
)
|
||||
|
||||
if %Build64% neq 0 (
|
||||
set "FinalDeployPath=%FinalReleasePath%\%AppVersionStrMajor%\%AppVersionStrFull%\tx64"
|
||||
) else if %BuildARM% neq 0 (
|
||||
set "FinalDeployPath=%FinalReleasePath%\%AppVersionStrMajor%\%AppVersionStrFull%\tarm64"
|
||||
) else (
|
||||
set "FinalDeployPath=%FinalReleasePath%\%AppVersionStrMajor%\%AppVersionStrFull%\tsetup"
|
||||
)
|
||||
|
||||
if %BuildUWP% equ 0 (
|
||||
echo.
|
||||
echo Version %AppVersionStrFull% is ready for deploy!
|
||||
echo.
|
||||
|
||||
if not exist "%DeployPath%\%UpdateFile%" goto error
|
||||
if not exist "%DeployPath%\%PortableFile%" goto error
|
||||
if %AlphaVersion% equ 0 (
|
||||
if not exist "%DeployPath%\%SetupFile%" goto error
|
||||
)
|
||||
if not exist "%DeployPath%\%BinaryName%.pdb" goto error
|
||||
if not exist "%DeployPath%\Updater.exe" goto error
|
||||
if not exist "%DeployPath%\Updater.pdb" goto error
|
||||
md "%FinalDeployPath%"
|
||||
|
||||
xcopy "%DeployPath%\%UpdateFile%" "%FinalDeployPath%\" /Y
|
||||
xcopy "%DeployPath%\%PortableFile%" "%FinalDeployPath%\" /Y
|
||||
if %AlphaVersion% equ 0 (
|
||||
xcopy "%DeployPath%\%SetupFile%" "%FinalDeployPath%\" /Y
|
||||
) else (
|
||||
xcopy "%DeployPath%\%AlphaKeyFile%" "%FinalDeployPath%\" /Y
|
||||
)
|
||||
)
|
||||
|
||||
echo Version %AppVersionStrFull% is ready!
|
||||
|
||||
cd "%FullExecPath%"
|
||||
exit /b
|
||||
|
||||
:error
|
||||
(
|
||||
set ErrorCode=%errorlevel%
|
||||
if !ErrorCode! neq 0 (
|
||||
echo Error !ErrorCode!
|
||||
) else (
|
||||
echo Error 666
|
||||
set ErrorCode=666
|
||||
)
|
||||
cd "%FullExecPath%"
|
||||
exit /b !ErrorCode!
|
||||
)
|
||||
|
||||
:repl
|
||||
(
|
||||
set %1
|
||||
set %2
|
||||
set "TempFilename=!Filename!__tmp__"
|
||||
cscript //Nologo "%FullScriptPath%replace.vbs" "Replace" "!Argument!" < "!Filename!" > "!TempFilename!" || goto :repl_finish
|
||||
xcopy /Y !TempFilename! !Filename! >NUL || goto :repl_finish
|
||||
goto :repl_finish
|
||||
)
|
||||
|
||||
:repl_finish
|
||||
(
|
||||
set ErrorCode=%errorlevel%
|
||||
if !ErrorCode! neq 0 (
|
||||
echo Replace error !ErrorCode!
|
||||
echo While replacing "%Replace%"
|
||||
echo In file "%Filename%"
|
||||
)
|
||||
del %TempFilename%
|
||||
exit /b !ErrorCode!
|
||||
)
|
||||
487
Telegram/build/build.sh
Executable file
487
Telegram/build/build.sh
Executable file
@@ -0,0 +1,487 @@
|
||||
set -e
|
||||
FullExecPath=$PWD
|
||||
pushd `dirname $0` > /dev/null
|
||||
FullScriptPath=`pwd`
|
||||
popd > /dev/null
|
||||
|
||||
arg1="$1"
|
||||
arg2="$2"
|
||||
arg3="$3"
|
||||
|
||||
if [ ! -d "$FullScriptPath/../../../DesktopPrivate" ]; 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
|
||||
}
|
||||
|
||||
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"
|
||||
if [ "$AlphaVersion" != "0" ]; then
|
||||
AppVersion="$AlphaVersion"
|
||||
AppVersionStrFull="${AppVersionStr}_${AlphaVersion}"
|
||||
AlphaBetaParam="-alpha $AlphaVersion"
|
||||
AlphaKeyFile="talpha_${AppVersion}_key"
|
||||
elif [ "$BetaChannel" == "0" ]; then
|
||||
AppVersionStrFull="$AppVersionStr"
|
||||
AlphaBetaParam=''
|
||||
else
|
||||
AppVersionStrFull="$AppVersionStr.beta"
|
||||
AlphaBetaParam='-beta'
|
||||
fi
|
||||
|
||||
echo ""
|
||||
HomePath="$FullScriptPath/.."
|
||||
if [ "$BuildTarget" == "linux" ]; then
|
||||
echo "Building version $AppVersionStrFull for Linux 64bit.."
|
||||
UpdateFile="tlinuxupd$AppVersion"
|
||||
SetupFile="tsetup.$AppVersionStrFull.tar.xz"
|
||||
ProjectPath="$HomePath/../out"
|
||||
ReleasePath="$ProjectPath/Release"
|
||||
BinaryName="Telegram"
|
||||
elif [ "$BuildTarget" == "mac" ] ; then
|
||||
if [ "$arg1" == "x86_64" ] || [ "$arg1" == "arm64" ]; then
|
||||
echo "Building version $AppVersionStrFull for macOS 10.13+ ($arg1).."
|
||||
MacArch="$arg1"
|
||||
if [ "$arg2" == "request_uuid" ] && [ "$arg3" != "" ]; then
|
||||
NotarizeRequestId="$arg3"
|
||||
fi
|
||||
else
|
||||
echo "Building version $AppVersionStrFull for macOS 10.13+.."
|
||||
if [ "$arg2" != "" ]; then
|
||||
if [ "$arg1" == "request_uuid_x86_64" ]; then
|
||||
NotarizeRequestIdAMD64="$arg2"
|
||||
elif [ "$arg1" == "request_uuid_arm64" ]; then
|
||||
NotarizeRequestIdARM64="$arg2"
|
||||
elif [ "$arg1" == "request_uuid" ]; then
|
||||
NotarizeRequestId="$arg2"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$AC_USERNAME" == "" ]; then
|
||||
Error "AC_USERNAME not found!"
|
||||
fi
|
||||
UpdateFileAMD64="tmacupd$AppVersion"
|
||||
UpdateFileARM64="tarmacupd$AppVersion"
|
||||
if [ "$MacArch" == "arm64" ]; then
|
||||
UpdateFile="$UpdateFileARM64"
|
||||
elif [ "$MacArch" == "x86_64" ]; then
|
||||
UpdateFile="$UpdateFileAMD64"
|
||||
fi
|
||||
ProjectPath="$HomePath/../out"
|
||||
ReleasePath="$ProjectPath/Release"
|
||||
BinaryName="Telegram"
|
||||
if [ "$MacArch" != "" ]; then
|
||||
BundleName="$BinaryName.$MacArch.app"
|
||||
SetupFile="tsetup.$MacArch.$AppVersionStrFull.dmg"
|
||||
else
|
||||
BundleName="$BinaryName.app"
|
||||
SetupFile="tsetup.$AppVersionStrFull.dmg"
|
||||
fi
|
||||
elif [ "$BuildTarget" == "macstore" ]; then
|
||||
if [ "$AlphaVersion" != "0" ]; then
|
||||
Error "Can't build macstore alpha version!"
|
||||
fi
|
||||
|
||||
echo "Building version $AppVersionStrFull for Mac App Store.."
|
||||
ProjectPath="$HomePath/../out"
|
||||
ReleasePath="$ProjectPath/Release"
|
||||
BinaryName="Telegram Lite"
|
||||
BundleName="$BinaryName.app"
|
||||
else
|
||||
Error "Invalid target!"
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
if [ -d "$ReleasePath/deploy/$AppVersionStrMajor/$AppVersionStr.beta" ]; then
|
||||
Error "Deploy folder for version $AppVersionStr.beta already exists!"
|
||||
fi
|
||||
|
||||
if [ -d "$ReleasePath/deploy/$AppVersionStrMajor/$AppVersionStr" ]; then
|
||||
Error "Deploy folder for version $AppVersionStr already exists!"
|
||||
fi
|
||||
|
||||
if [ -f "$ReleasePath/$UpdateFile" ]; then
|
||||
Error "Update file for version $AppVersion already exists!"
|
||||
fi
|
||||
fi
|
||||
|
||||
DeployPath="$ReleasePath/deploy/$AppVersionStrMajor/$AppVersionStrFull"
|
||||
|
||||
if [ "$BuildTarget" == "linux" ]; then
|
||||
|
||||
DropboxSymbolsPath="/media/psf/Dropbox/Telegram/symbols"
|
||||
if [ ! -d "$DropboxSymbolsPath" ]; then
|
||||
DropboxSymbolsPath="/mnt/c/Telegram/Dropbox/Telegram/symbols"
|
||||
if [ ! -d "$DropboxSymbolsPath" ]; then
|
||||
Error "Dropbox path not found!"
|
||||
fi
|
||||
fi
|
||||
|
||||
BackupPath="/media/psf/backup/tdesktop/$AppVersionStrMajor/$AppVersionStrFull/t$BuildTarget"
|
||||
if [ ! -d "/media/psf/backup/tdesktop" ]; then
|
||||
BackupPath="/mnt/c/Telegram/Projects/backup/tdesktop/$AppVersionStrMajor/$AppVersionStrFull/t$BuildTarget"
|
||||
if [ ! -d "/mnt/c/Telegram/Projects/backup/tdesktop" ]; then
|
||||
Error "Backup folder not found!"
|
||||
fi
|
||||
fi
|
||||
|
||||
./build/docker/centos_env/run.sh /usr/src/tdesktop/Telegram/build/docker/build.sh
|
||||
|
||||
echo "Copying from docker result folder."
|
||||
cp "$ReleasePath/root/$BinaryName" "$ReleasePath/$BinaryName"
|
||||
cp "$ReleasePath/root/Updater" "$ReleasePath/Updater"
|
||||
cp "$ReleasePath/root/Packer" "$ReleasePath/Packer"
|
||||
|
||||
echo "Dumping debug symbols.."
|
||||
"$ReleasePath/dump_syms" "$ReleasePath/$BinaryName" > "$ReleasePath/$BinaryName.sym"
|
||||
echo "Done!"
|
||||
|
||||
echo "Stripping the executable.."
|
||||
strip -s "$ReleasePath/$BinaryName"
|
||||
echo "Done!"
|
||||
|
||||
echo "Preparing version $AppVersionStrFull, executing Packer.."
|
||||
cd "$ReleasePath"
|
||||
"./Packer" -path "$BinaryName" -path Updater -version $VersionForPacker $AlphaBetaParam
|
||||
echo "Packer done!"
|
||||
|
||||
if [ "$AlphaVersion" != "0" ]; then
|
||||
if [ ! -f "$ReleasePath/$AlphaKeyFile" ]; then
|
||||
Error "Alpha version key file not found!"
|
||||
fi
|
||||
|
||||
while IFS='' read -r line || [[ -n "$line" ]]; do
|
||||
AlphaSignature="$line"
|
||||
done < "$ReleasePath/$AlphaKeyFile"
|
||||
|
||||
UpdateFile="${UpdateFile}_${AlphaSignature}"
|
||||
SetupFile="talpha${AlphaVersion}_${AlphaSignature}.tar.xz"
|
||||
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/"
|
||||
if [ "$AlphaVersion" != "0" ]; then
|
||||
mv "$ReleasePath/$AlphaKeyFile" "$DeployPath/"
|
||||
fi
|
||||
cd "$DeployPath"
|
||||
tar -cJvf "$SetupFile" "$BinaryName/"
|
||||
|
||||
mkdir -p $BackupPath
|
||||
cp "$SetupFile" "$BackupPath/"
|
||||
cp "$UpdateFile" "$BackupPath/"
|
||||
if [ "$AlphaVersion" != "0" ]; then
|
||||
cp -v "$AlphaKeyFile" "$BackupPath/"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "macstore" ]; then
|
||||
|
||||
DropboxSymbolsPath="$HOME/Dropbox/Telegram/symbols"
|
||||
if [ ! -d "$DropboxSymbolsPath" ]; then
|
||||
Error "Dropbox path not found!"
|
||||
fi
|
||||
|
||||
BackupPath="$HOME/Projects/backup/tdesktop/$AppVersionStrMajor/$AppVersionStrFull"
|
||||
if [ ! -d "$HOME/Projects/backup/tdesktop" ]; then
|
||||
Error "Backup path not found!"
|
||||
fi
|
||||
|
||||
if [ "$MacArch" != "" ]; then
|
||||
cd $ReleasePath
|
||||
|
||||
echo "Preparing single $MacArch .app.."
|
||||
rm -rf $BundleName
|
||||
cp -R $BinaryName.app $BundleName
|
||||
lipo -thin $MacArch $BinaryName.app/Contents/MacOS/$BinaryName -output $BundleName/Contents/MacOS/$BinaryName
|
||||
lipo -thin $MacArch $BinaryName.app/Contents/Frameworks/Updater -output $BundleName/Contents/Frameworks/Updater
|
||||
lipo -thin $MacArch $BinaryName.app/Contents/Helpers/crashpad_handler -output $BundleName/Contents/Helpers/crashpad_handler
|
||||
echo "Done!"
|
||||
elif [ "$NotarizeRequestId" == "" ]; then
|
||||
if [ "$NotarizeRequestIdAMD64" == "" ] && [ "$NotarizeRequestIdARM64" == "" ]; then
|
||||
if [ -f "$ReleasePath/$BinaryName.app/Contents/Info.plist" ]; then
|
||||
rm "$ReleasePath/$BinaryName.app/Contents/Info.plist"
|
||||
fi
|
||||
if [ -f "$ProjectPath/Telegram/CMakeFiles/Telegram.dir/Info.plist" ]; then
|
||||
rm "$ProjectPath/Telegram/CMakeFiles/Telegram.dir/Info.plist"
|
||||
fi
|
||||
rm -rf "$ReleasePath/$BinaryName.app/Contents/_CodeSignature"
|
||||
rm -rf "$ReleasePath/Updater"
|
||||
|
||||
./configure.sh -D DESKTOP_APP_MAC_ARCH="arm64;x86_64"
|
||||
|
||||
cd $ProjectPath
|
||||
cmake --build . --config Release --target Telegram
|
||||
fi
|
||||
|
||||
if [ ! -d "$ReleasePath/$BinaryName.app" ]; then
|
||||
Error "$BinaryName.app not found!"
|
||||
fi
|
||||
|
||||
cd $FullExecPath
|
||||
|
||||
if [ "$BuildTarget" == "mac" ]; then
|
||||
if [ "$NotarizeRequestIdAMD64" == "" ]; then
|
||||
echo "Preparing single arm64 update.."
|
||||
./$0 arm64 request_uuid $NotarizeRequestIdARM64
|
||||
fi
|
||||
|
||||
echo "Preparing single x86_64 update.."
|
||||
./$0 x86_64 request_uuid $NotarizeRequestIdAMD64
|
||||
|
||||
echo "Done."
|
||||
fi
|
||||
cd $ReleasePath
|
||||
fi
|
||||
if [ "$NotarizeRequestId" == "" ]; then
|
||||
if [ "$BuildTarget" == "mac" ]; then
|
||||
if [ ! -f "$ReleasePath/$BundleName/Contents/Frameworks/Updater" ]; then
|
||||
Error "Updater not found!"
|
||||
fi
|
||||
if [ ! -f "$ReleasePath/$BundleName/Contents/Helpers/crashpad_handler" ]; then
|
||||
Error "crashpad_handler not found!"
|
||||
fi
|
||||
fi
|
||||
if [ "$BuildTarget" == "macstore" ]; then
|
||||
if [ ! -d "$ReleasePath/$BundleName/Contents/Frameworks/Breakpad.framework" ]; then
|
||||
Error "Breakpad.framework not found!"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$MacArch" == "" ]; then
|
||||
echo "Dumping debug symbols x86_64 from universal.."
|
||||
"$HomePath/../../Libraries/breakpad/src/tools/mac/dump_syms/build/Release/dump_syms" "-a" "x86_64" "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName" > "$ReleasePath/$BinaryName.x86_64.sym" 2>/dev/null
|
||||
echo "Done!"
|
||||
|
||||
SymbolsHash=`head -n 1 "$ReleasePath/$BinaryName.x86_64.sym" | awk -F " " 'END {print $4}'`
|
||||
echo "Copying $BinaryName.x86_64.sym to $DropboxSymbolsPath/$BinaryName/$SymbolsHash"
|
||||
mkdir -p "$DropboxSymbolsPath/$BinaryName/$SymbolsHash"
|
||||
cp "$ReleasePath/$BinaryName.x86_64.sym" "$DropboxSymbolsPath/$BinaryName/$SymbolsHash/$BinaryName.sym"
|
||||
echo "Done!"
|
||||
|
||||
echo "Dumping debug symbols arm64 from universal.."
|
||||
"$HomePath/../../Libraries/breakpad/src/tools/mac/dump_syms/build/Release/dump_syms" "-a" "arm64" "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName" > "$ReleasePath/$BinaryName.arm64.sym" 2>/dev/null
|
||||
echo "Done!"
|
||||
|
||||
SymbolsHash=`head -n 1 "$ReleasePath/$BinaryName.arm64.sym" | awk -F " " 'END {print $4}'`
|
||||
echo "Copying $BinaryName.arm64.sym to $DropboxSymbolsPath/$BinaryName/$SymbolsHash"
|
||||
mkdir -p "$DropboxSymbolsPath/$BinaryName/$SymbolsHash"
|
||||
cp "$ReleasePath/$BinaryName.arm64.sym" "$DropboxSymbolsPath/$BinaryName/$SymbolsHash/$BinaryName.sym"
|
||||
echo "Done!"
|
||||
fi
|
||||
|
||||
echo "Stripping the executable.."
|
||||
strip "$ReleasePath/$BundleName/Contents/MacOS/$BinaryName"
|
||||
if [ "$BuildTarget" == "mac" ]; then
|
||||
strip "$ReleasePath/$BundleName/Contents/Frameworks/Updater"
|
||||
strip "$ReleasePath/$BundleName/Contents/Helpers/crashpad_handler"
|
||||
fi
|
||||
echo "Done!"
|
||||
|
||||
echo "Signing the application.."
|
||||
if [ "$BuildTarget" == "mac" ]; then
|
||||
codesign --force --deep --timestamp --options runtime --sign "Developer ID Application: Telegram FZ-LLC (C67CF9S4VU)" "$ReleasePath/$BundleName" --entitlements "$HomePath/Telegram/Telegram.entitlements"
|
||||
elif [ "$BuildTarget" == "macstore" ]; then
|
||||
codesign --force --timestamp --options runtime --sign "3rd Party Mac Developer Application: Telegram FZ-LLC (C67CF9S4VU)" "$ReleasePath/$BundleName/Contents/Frameworks/Breakpad.framework/Versions/A/Resources/breakpadUtilities.dylib" --entitlements "$HomePath/Telegram/Breakpad.entitlements"
|
||||
codesign --force --deep --timestamp --options runtime --sign "3rd Party Mac Developer Application: Telegram FZ-LLC (C67CF9S4VU)" "$ReleasePath/$BundleName" --entitlements "$HomePath/Telegram/Telegram Lite.entitlements"
|
||||
echo "Making an installer.."
|
||||
productbuild --sign "3rd Party Mac Developer Installer: Telegram FZ-LLC (C67CF9S4VU)" --component "$ReleasePath/$BundleName" /Applications "$ReleasePath/$BinaryName.pkg"
|
||||
fi
|
||||
echo "Done!"
|
||||
|
||||
if [ ! -f "$ReleasePath/$BundleName/Contents/Resources/Icon.icns" ]; then
|
||||
Error "Icon.icns not found in Resources!"
|
||||
fi
|
||||
|
||||
if [ ! -f "$ReleasePath/$BundleName/Contents/MacOS/$BinaryName" ]; then
|
||||
Error "$BinaryName not found in MacOS!"
|
||||
fi
|
||||
|
||||
if [ ! -d "$ReleasePath/$BundleName/Contents/_CodeSignature" ]; then
|
||||
Error "$BinaryName signature not found!"
|
||||
fi
|
||||
|
||||
if [ "$BuildTarget" == "macstore" ]; then
|
||||
if [ ! -f "$ReleasePath/$BinaryName.pkg" ]; then
|
||||
Error "$BinaryName.pkg not found!"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$BuildTarget" == "mac" ]; then
|
||||
cd "$ReleasePath"
|
||||
|
||||
if [ "$NotarizeRequestId" == "" ]; then
|
||||
if [ "$AlphaVersion" == "0" ]; then
|
||||
cp -f tsetup_template.dmg tsetup.temp.dmg
|
||||
TempDiskPath=`hdiutil attach -nobrowse -noautoopenrw -readwrite tsetup.temp.dmg | awk -F "\t" 'END {print $3}'`
|
||||
cp -R "./$BundleName" "$TempDiskPath/"
|
||||
bless --folder "$TempDiskPath/"
|
||||
hdiutil detach "$TempDiskPath"
|
||||
hdiutil convert tsetup.temp.dmg -format UDBZ -ov -o "$SetupFile"
|
||||
rm tsetup.temp.dmg
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$AlphaVersion" != "0" ]; then
|
||||
cd $ReleasePath
|
||||
"./Packer" -path "$BundleName" -target "$BuildTarget" -version $VersionForPacker $AlphaBetaParam -alphakey
|
||||
|
||||
if [ ! -f "$AlphaKeyFile" ]; then
|
||||
Error "Alpha version key file not found!"
|
||||
fi
|
||||
|
||||
while IFS='' read -r line || [[ -n "$line" ]]; do
|
||||
AlphaSignature="$line"
|
||||
done < "$ReleasePath/$AlphaKeyFile"
|
||||
|
||||
UpdateFile="${UpdateFile}_${AlphaSignature}"
|
||||
UpdateFileAMD64="${UpdateFileAMD64}_${AlphaSignature}"
|
||||
UpdateFileARM64="${UpdateFileARM64}_${AlphaSignature}"
|
||||
if [ "$MacArch" != "" ]; then
|
||||
SetupFile="talpha${AlphaVersion}_${MacArch}_${AlphaSignature}.zip"
|
||||
else
|
||||
SetupFile="talpha${AlphaVersion}_${AlphaSignature}.zip"
|
||||
fi
|
||||
|
||||
if [ "$NotarizeRequestId" == "" ]; then
|
||||
rm -rf "$ReleasePath/AlphaTemp"
|
||||
mkdir "$ReleasePath/AlphaTemp"
|
||||
mkdir "$ReleasePath/AlphaTemp/$BinaryName"
|
||||
cp -r "$ReleasePath/$BundleName" "$ReleasePath/AlphaTemp/$BinaryName/"
|
||||
cd "$ReleasePath/AlphaTemp"
|
||||
zip -r "$SetupFile" "$BinaryName"
|
||||
mv "$SetupFile" "$ReleasePath/"
|
||||
cd "$ReleasePath"
|
||||
fi
|
||||
fi
|
||||
echo "Beginning notarization process."
|
||||
xcrun notarytool submit "$SetupFile" --keychain-profile "preston" --wait
|
||||
xcrun stapler staple "$ReleasePath/$BundleName"
|
||||
|
||||
if [ "$MacArch" != "" ]; then
|
||||
rm "$ReleasePath/$SetupFile"
|
||||
echo "Setup file $SetupFile removed."
|
||||
elif [ "$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
|
||||
|
||||
if [ "$MacArch" != "" ]; then
|
||||
UpdatePackPath="$ReleasePath/update_pack_${MacArch}"
|
||||
rm -rf "$UpdatePackPath"
|
||||
mkdir "$UpdatePackPath"
|
||||
mv "$ReleasePath/$BundleName" "$UpdatePackPath/$BinaryName.app"
|
||||
cp "$ReleasePath/Packer" "$UpdatePackPath/"
|
||||
cd "$UpdatePackPath"
|
||||
"./Packer" -path "$BinaryName.app" -target "$BuildTarget" -version $VersionForPacker -arch $MacArch $AlphaBetaParam
|
||||
echo "Packer done!"
|
||||
mv "$UpdateFile" "$ReleasePath/"
|
||||
cd "$ReleasePath"
|
||||
rm -rf "$UpdatePackPath"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -d "$ReleasePath/deploy" ]; then
|
||||
mkdir "$ReleasePath/deploy"
|
||||
fi
|
||||
|
||||
if [ ! -d "$ReleasePath/deploy/$AppVersionStrMajor" ]; then
|
||||
mkdir "$ReleasePath/deploy/$AppVersionStrMajor"
|
||||
fi
|
||||
|
||||
if [ "$BuildTarget" == "mac" ]; then
|
||||
echo "Copying $BinaryName.app, $UpdateFileAMD64 and $UpdateFileARM64 to deploy/$AppVersionStrMajor/$AppVersionStr..";
|
||||
mkdir "$DeployPath"
|
||||
mkdir "$DeployPath/$BinaryName"
|
||||
cp -r "$ReleasePath/$BinaryName.app" "$DeployPath/$BinaryName/"
|
||||
if [ "$AlphaVersion" != "0" ]; then
|
||||
mv "$ReleasePath/$AlphaKeyFile" "$DeployPath/"
|
||||
fi
|
||||
rm "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName"
|
||||
rm "$ReleasePath/$BinaryName.app/Contents/Frameworks/Updater"
|
||||
mv "$ReleasePath/$UpdateFileAMD64" "$DeployPath/"
|
||||
mv "$ReleasePath/$UpdateFileARM64" "$DeployPath/"
|
||||
mv "$ReleasePath/$SetupFile" "$DeployPath/"
|
||||
|
||||
if [ "$BuildTarget" == "mac" ]; then
|
||||
mkdir -p "$BackupPath/tmac"
|
||||
cp "$DeployPath/$UpdateFileAMD64" "$BackupPath/tmac/"
|
||||
cp "$DeployPath/$UpdateFileARM64" "$BackupPath/tmac/"
|
||||
cp "$DeployPath/$SetupFile" "$BackupPath/tmac/"
|
||||
if [ "$AlphaVersion" != "0" ]; then
|
||||
cp -v "$DeployPath/$AlphaKeyFile" "$BackupPath/tmac/"
|
||||
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/"
|
||||
rm "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Version $AppVersionStrFull is ready!";
|
||||
echo -en "\007";
|
||||
sleep 1;
|
||||
echo -en "\007";
|
||||
sleep 1;
|
||||
echo -en "\007";
|
||||
77
Telegram/build/changelog2appstream.py
Executable file
77
Telegram/build/changelog2appstream.py
Executable file
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import re
|
||||
import datetime
|
||||
from xml.etree import ElementTree as ET
|
||||
import argparse
|
||||
|
||||
def parse_changelog(changelog_path):
|
||||
version_re = re.compile(r'([\d.-]+)\s+(\w+)?\s*\((\d{2}.\d{2}\.\d{2})\)')
|
||||
entry_re = re.compile(r'-\s(.*)')
|
||||
|
||||
with open(changelog_path, "r", encoding="utf-8") as f:
|
||||
changelog_lines = f.read().splitlines()
|
||||
|
||||
releases = []
|
||||
for l in changelog_lines:
|
||||
version_match = version_re.match(l)
|
||||
entry_match = entry_re.match(l)
|
||||
if version_match is not None:
|
||||
version, prerelease, date = version_match.groups()
|
||||
release = (version,
|
||||
prerelease,
|
||||
datetime.datetime.strptime(date, '%d.%m.%y').date(),
|
||||
[])
|
||||
releases.append(release)
|
||||
elif entry_match is not None:
|
||||
release[3].append(entry_match.group(1))
|
||||
|
||||
return releases
|
||||
|
||||
def get_release_xml(version, prerelease, date, changes):
|
||||
release = ET.Element("release")
|
||||
if prerelease is None:
|
||||
ver_str = version
|
||||
else:
|
||||
ver_str = f"{version}~{prerelease}"
|
||||
release.set("version", ver_str)
|
||||
release.set("date", date.isoformat())
|
||||
description = ET.SubElement(release, "description")
|
||||
changelist = ET.SubElement(description, "ul")
|
||||
for c in changes:
|
||||
change = ET.SubElement(changelist, "li")
|
||||
change.text = c
|
||||
return release
|
||||
|
||||
def get_changelog_xml(changelog, max_items=None):
|
||||
releases = ET.Element("releases")
|
||||
if max_items is not None:
|
||||
changelog = changelog[:max_items]
|
||||
for rel in changelog:
|
||||
release = get_release_xml(*rel)
|
||||
releases.append(release)
|
||||
return releases
|
||||
|
||||
def update_metadata(metadata_path, changelog, max_items=None):
|
||||
metadata = ET.parse(metadata_path)
|
||||
root = metadata.getroot()
|
||||
releases = root.find("releases")
|
||||
if releases is not None:
|
||||
root.remove(releases)
|
||||
root.append(
|
||||
get_changelog_xml(changelog, max_items)
|
||||
)
|
||||
metadata.write(metadata_path, encoding="utf-8", xml_declaration=True)
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser("Parse Telegram changelog")
|
||||
ap.add_argument("-c", "--changelog-path", default="changelog.txt")
|
||||
ap.add_argument("-m", "--metadata-path", default="lib/xdg/org.telegram.desktop.metainfo.xml")
|
||||
ap.add_argument("-n", "--num-releases", type=int, default=None)
|
||||
args = ap.parse_args()
|
||||
update_metadata(args.metadata_path,
|
||||
parse_changelog(args.changelog_path),
|
||||
max_items=args.num_releases)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
237
Telegram/build/deploy.sh
Executable file
237
Telegram/build/deploy.sh
Executable file
@@ -0,0 +1,237 @@
|
||||
set -e
|
||||
FullExecPath=$PWD
|
||||
pushd `dirname $0` > /dev/null
|
||||
FullScriptPath=`pwd`
|
||||
popd > /dev/null
|
||||
|
||||
if [ ! -d "$FullScriptPath/../../../DesktopPrivate" ]; 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 < "$FullScriptPath/version"
|
||||
|
||||
if [ "$AlphaVersion" != "0" ]; then
|
||||
AppVersion="$AlphaVersion"
|
||||
AppVersionStrFull="${AppVersionStr}_${AlphaVersion}"
|
||||
AlphaKeyFile="talpha_${AppVersion}_key"
|
||||
elif [ "$BetaChannel" == "0" ]; then
|
||||
AppVersionStrFull="$AppVersionStr"
|
||||
else
|
||||
AppVersionStrFull="$AppVersionStr.beta"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
HomePath="$FullScriptPath/.."
|
||||
DeployMac="0"
|
||||
DeployWin="0"
|
||||
DeployWin64="0"
|
||||
DeployWinArm="0"
|
||||
DeployLinux="0"
|
||||
if [ "$DeployTarget" == "mac" ]; then
|
||||
DeployMac="1"
|
||||
echo "Deploying version $AppVersionStrFull for macOS.."
|
||||
elif [ "$DeployTarget" == "win" ]; then
|
||||
DeployWin="1"
|
||||
echo "Deploying version $AppVersionStrFull for Windows 32 bit.."
|
||||
elif [ "$DeployTarget" == "win64" ]; then
|
||||
DeployWin64="1"
|
||||
echo "Deploying version $AppVersionStrFull for Windows 64 bit.."
|
||||
elif [ "$DeployTarget" == "winarm" ]; then
|
||||
DeployWinArm="1"
|
||||
echo "Deploying version $AppVersionStrFull for Windows on ARM.."
|
||||
elif [ "$DeployTarget" == "linux" ]; then
|
||||
DeployLinux="1"
|
||||
echo "Deploying version $AppVersionStrFull for Linux 64 bit.."
|
||||
else
|
||||
DeployMac="1"
|
||||
DeployWin="1"
|
||||
DeployWin64="1"
|
||||
DeployWinArm="1"
|
||||
DeployLinux="1"
|
||||
echo "Deploying five versions of $AppVersionStrFull: for Windows 32 bit / 64 bit / on ARM, macOS and Linux 64 bit.."
|
||||
fi
|
||||
if [ "$BuildTarget" == "mac" ]; then
|
||||
BackupPath="$HOME/Projects/backup/tdesktop"
|
||||
elif [ "$BuildTarget" == "linux" ]; then
|
||||
BackupPath="/media/psf/Home/Projects/backup/tdesktop"
|
||||
if [ ! -d "$BackupPath" ]; then
|
||||
BackupPath="/mnt/c/Telegram/Projects/backup/tdesktop"
|
||||
fi
|
||||
else
|
||||
Error "Can't deploy here"
|
||||
fi
|
||||
MacDeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull/tmac"
|
||||
MacUpdateFile="tmacupd$AppVersion"
|
||||
ARMacUpdateFile="tarmacupd$AppVersion"
|
||||
MacSetupFile="tsetup.$AppVersionStrFull.dmg"
|
||||
MacRemoteFolder="tmac"
|
||||
WinDeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull/tsetup"
|
||||
WinUpdateFile="tupdate$AppVersion"
|
||||
WinSetupFile="tsetup.$AppVersionStrFull.exe"
|
||||
WinPortableFile="tportable.$AppVersionStrFull.zip"
|
||||
WinRemoteFolder="tsetup"
|
||||
Win64DeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull/tx64"
|
||||
Win64UpdateFile="tx64upd$AppVersion"
|
||||
Win64SetupFile="tsetup-x64.$AppVersionStrFull.exe"
|
||||
Win64PortableFile="tportable-x64.$AppVersionStrFull.zip"
|
||||
Win64RemoteFolder="tx64"
|
||||
WinArmDeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull/tarm64"
|
||||
WinArmUpdateFile="tarm64upd$AppVersion"
|
||||
WinArmSetupFile="tsetup-arm64.$AppVersionStrFull.exe"
|
||||
WinArmPortableFile="tportable-arm64.$AppVersionStrFull.zip"
|
||||
WinArmRemoteFolder="tarm64"
|
||||
LinuxDeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull/tlinux"
|
||||
LinuxUpdateFile="tlinuxupd$AppVersion"
|
||||
LinuxSetupFile="tsetup.$AppVersionStrFull.tar.xz"
|
||||
LinuxRemoteFolder="tlinux"
|
||||
DeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull"
|
||||
|
||||
if [ "$AlphaVersion" != "0" ]; then
|
||||
if [ "$DeployTarget" == "win" ]; then
|
||||
AlphaFilePath="$WinDeployPath/$AlphaKeyFile"
|
||||
elif [ "$DeployTarget" == "win64" ]; then
|
||||
AlphaFilePath="$Win64DeployPath/$AlphaKeyFile"
|
||||
elif [ "$DeployTarget" == "winarm" ]; then
|
||||
AlphaFilePath="$WinArmDeployPath/$AlphaKeyFile"
|
||||
elif [ "$DeployTarget" == "linux" ]; then
|
||||
AlphaFilePath="$LinuxDeployPath/$AlphaKeyFile"
|
||||
else
|
||||
AlphaFilePath="$MacDeployPath/$AlphaKeyFile"
|
||||
fi
|
||||
if [ ! -f "$AlphaFilePath" ]; then
|
||||
Error "Alpha key file for $AppVersionStrFull not found."
|
||||
fi
|
||||
|
||||
while IFS='' read -r line || [[ -n "$line" ]]; do
|
||||
AlphaSignature="$line"
|
||||
done < "$AlphaFilePath"
|
||||
|
||||
MacUpdateFile="${MacUpdateFile}_${AlphaSignature}"
|
||||
ARMacUpdateFile="${ARMacUpdateFile}_${AlphaSignature}"
|
||||
MacSetupFile="talpha${AlphaVersion}_${AlphaSignature}.zip"
|
||||
WinUpdateFile="${WinUpdateFile}_${AlphaSignature}"
|
||||
WinPortableFile="talpha${AlphaVersion}_${AlphaSignature}.zip"
|
||||
Win64UpdateFile="${Win64UpdateFile}_${AlphaSignature}"
|
||||
Win64PortableFile="talpha${AlphaVersion}_${AlphaSignature}.zip"
|
||||
WinArmUpdateFile="${WinArmUpdateFile}_${AlphaSignature}"
|
||||
WinArmPortableFile="talpha${AlphaVersion}_${AlphaSignature}.zip"
|
||||
LinuxUpdateFile="${LinuxUpdateFile}_${AlphaSignature}"
|
||||
LinuxSetupFile="talpha${AlphaVersion}_${AlphaSignature}.tar.xz"
|
||||
fi
|
||||
|
||||
if [ "$DeployMac" == "1" ]; then
|
||||
if [ ! -f "$MacDeployPath/$MacUpdateFile" ]; then
|
||||
Error "$MacDeployPath/$MacUpdateFile not found!";
|
||||
fi
|
||||
if [ ! -f "$MacDeployPath/$ARMacUpdateFile" ]; then
|
||||
Error "$MacDeployPath/$ARMacUpdateFile not found!";
|
||||
fi
|
||||
if [ ! -f "$MacDeployPath/$MacSetupFile" ]; then
|
||||
Error "$MacDeployPath/$MacSetupFile not found!"
|
||||
fi
|
||||
fi
|
||||
if [ "$DeployWin" == "1" ]; then
|
||||
if [ ! -f "$WinDeployPath/$WinUpdateFile" ]; then
|
||||
Error "$WinUpdateFile not found!"
|
||||
fi
|
||||
if [ "$AlphaVersion" == "0" ]; then
|
||||
if [ ! -f "$WinDeployPath/$WinSetupFile" ]; then
|
||||
Error "$WinSetupFile not found!"
|
||||
fi
|
||||
fi
|
||||
if [ ! -f "$WinDeployPath/$WinPortableFile" ]; then
|
||||
Error "$WinPortableFile not found!"
|
||||
fi
|
||||
fi
|
||||
if [ "$DeployWin64" == "1" ]; then
|
||||
if [ ! -f "$Win64DeployPath/$Win64UpdateFile" ]; then
|
||||
Error "$Win64UpdateFile not found!"
|
||||
fi
|
||||
if [ "$AlphaVersion" == "0" ]; then
|
||||
if [ ! -f "$Win64DeployPath/$Win64SetupFile" ]; then
|
||||
Error "$Win64SetupFile not found!"
|
||||
fi
|
||||
fi
|
||||
if [ ! -f "$Win64DeployPath/$Win64PortableFile" ]; then
|
||||
Error "$Win64PortableFile not found!"
|
||||
fi
|
||||
fi
|
||||
if [ "$DeployWinArm" == "1" ]; then
|
||||
if [ ! -f "$WinArmDeployPath/$WinArmUpdateFile" ]; then
|
||||
Error "$WinArmUpdateFile not found!"
|
||||
fi
|
||||
if [ "$AlphaVersion" == "0" ]; then
|
||||
if [ ! -f "$WinArmDeployPath/$WinArmSetupFile" ]; then
|
||||
Error "$WinArmSetupFile not found!"
|
||||
fi
|
||||
fi
|
||||
if [ ! -f "$WinArmDeployPath/$WinArmPortableFile" ]; then
|
||||
Error "$WinArmPortableFile not found!"
|
||||
fi
|
||||
fi
|
||||
if [ "$DeployLinux" == "1" ]; then
|
||||
if [ ! -f "$LinuxDeployPath/$LinuxUpdateFile" ]; then
|
||||
Error "$LinuxDeployPath/$LinuxUpdateFile not found!"
|
||||
fi
|
||||
if [ ! -f "$LinuxDeployPath/$LinuxSetupFile" ]; then
|
||||
Error "$LinuxDeployPath/$LinuxSetupFile not found!"
|
||||
fi
|
||||
fi
|
||||
|
||||
$FullScriptPath/../../../DesktopPrivate/mount.sh
|
||||
|
||||
declare -a Files
|
||||
if [ "$DeployMac" == "1" ]; then
|
||||
Files+=("tmac/$MacUpdateFile" "tmac/$ARMacUpdateFile" "tmac/$MacSetupFile")
|
||||
fi
|
||||
if [ "$DeployWin" == "1" ]; then
|
||||
Files+=("tsetup/$WinUpdateFile" "tsetup/$WinPortableFile")
|
||||
if [ "$AlphaVersion" == "0" ]; then
|
||||
Files+=("tsetup/$WinSetupFile")
|
||||
fi
|
||||
fi
|
||||
if [ "$DeployWin64" == "1" ]; then
|
||||
Files+=("tx64/$Win64UpdateFile" "tx64/$Win64PortableFile")
|
||||
if [ "$AlphaVersion" == "0" ]; then
|
||||
Files+=("tx64/$Win64SetupFile")
|
||||
fi
|
||||
fi
|
||||
if [ "$DeployWinArm" == "1" ]; then
|
||||
Files+=("tarm64/$WinArmUpdateFile" "tarm64/$WinArmPortableFile")
|
||||
if [ "$AlphaVersion" == "0" ]; then
|
||||
Files+=("tarm64/$WinArmSetupFile")
|
||||
fi
|
||||
fi
|
||||
if [ "$DeployLinux" == "1" ]; then
|
||||
Files+=("tlinux/$LinuxUpdateFile" "tlinux/$LinuxSetupFile")
|
||||
fi
|
||||
cd $DeployPath
|
||||
rsync -avR --no-g --progress ${Files[@]} "$FullScriptPath/../../../DesktopPrivate/remote/files"
|
||||
|
||||
echo "Version $AppVersionStrFull was deployed!"
|
||||
cd $FullExecPath
|
||||
|
||||
55
Telegram/build/docker/build.sh
Executable file
55
Telegram/build/docker/build.sh
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
FullExecPath=$PWD
|
||||
pushd `dirname $0` > /dev/null
|
||||
FullScriptPath=`pwd`
|
||||
popd > /dev/null
|
||||
|
||||
if [ ! -d "$FullScriptPath/../../../../DesktopPrivate" ]; 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
|
||||
|
||||
HomePath="$FullScriptPath/../.."
|
||||
cd $HomePath
|
||||
|
||||
ProjectPath="$HomePath/../out"
|
||||
ReleasePath="$ProjectPath/Release"
|
||||
BinaryName="Telegram"
|
||||
|
||||
if [ ! -f "/usr/bin/cmake" ]; then
|
||||
ln -s cmake3 /usr/bin/cmake
|
||||
fi
|
||||
|
||||
./configure.sh
|
||||
|
||||
cd $ProjectPath
|
||||
cmake --build . --config Release --target Telegram
|
||||
cd $ReleasePath
|
||||
|
||||
echo "$BinaryName build complete!"
|
||||
|
||||
Error () {
|
||||
cd $FullExecPath
|
||||
echo "$1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ ! -f "$ReleasePath/$BinaryName" ]; then
|
||||
Error "$BinaryName not found!"
|
||||
fi
|
||||
|
||||
if [ ! -f "$ReleasePath/Updater" ]; then
|
||||
Error "Updater not found!"
|
||||
fi
|
||||
|
||||
rm -rf "$ReleasePath/root"
|
||||
mkdir "$ReleasePath/root"
|
||||
mv "$ReleasePath/$BinaryName" "$ReleasePath/root/"
|
||||
mv "$ReleasePath/Updater" "$ReleasePath/root/"
|
||||
mv "$ReleasePath/Packer" "$ReleasePath/root/"
|
||||
1
Telegram/build/docker/centos_env/.gitignore
vendored
Normal file
1
Telegram/build/docker/centos_env/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
__pycache__
|
||||
884
Telegram/build/docker/centos_env/Dockerfile
Normal file
884
Telegram/build/docker/centos_env/Dockerfile
Normal file
@@ -0,0 +1,884 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM rockylinux:8 AS builder
|
||||
ENV LANG=C.UTF-8
|
||||
ENV TOOLSET=gcc-toolset-14
|
||||
ENV PATH=/opt/rh/$TOOLSET/root/usr/bin:$PATH
|
||||
ENV LIBRARY_PATH=/opt/rh/$TOOLSET/root/usr/lib64:/opt/rh/$TOOLSET/root/usr/lib:/usr/local/lib64:/usr/local/lib:/lib64:/lib:/usr/lib64:/usr/lib
|
||||
ENV LD_LIBRARY_PATH=$LIBRARY_PATH
|
||||
ENV PKG_CONFIG_PATH=/opt/rh/$TOOLSET/root/usr/lib64/pkgconfig:/opt/rh/$TOOLSET/root/usr/lib/pkgconfig:/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig
|
||||
|
||||
RUN dnf -y install epel-release \
|
||||
&& dnf config-manager --set-enabled powertools \
|
||||
&& dnf -y install cmake autoconf automake libtool pkgconfig make patch git \
|
||||
python3.11-pip python3.11-devel gperf flex bison clang clang-tools-extra \
|
||||
lld nasm yasm file which wget perl-open perl-XML-Parser perl-IPC-Cmd \
|
||||
xorg-x11-util-macros $TOOLSET-gcc $TOOLSET-gcc-c++ $TOOLSET-binutils \
|
||||
$TOOLSET-gdb $TOOLSET-libasan-devel libffi-devel fontconfig-devel \
|
||||
freetype-devel libX11-devel wayland-devel alsa-lib-devel \
|
||||
pulseaudio-libs-devel mesa-libGL-devel mesa-libEGL-devel mesa-libgbm-devel \
|
||||
libdrm-devel vulkan-devel libva-devel libvdpau-devel libselinux-devel \
|
||||
libmount-devel systemd-devel glib2-devel gobject-introspection-devel \
|
||||
at-spi2-core-devel gtk3-devel boost1.78-devel \
|
||||
&& dnf clean all
|
||||
|
||||
RUN alternatives --set python3 /usr/bin/python3.11
|
||||
RUN python3 -m pip install meson ninja
|
||||
RUN cat <<EOF > /usr/local/bin/pkg-config && chmod +x /usr/local/bin/pkg-config
|
||||
#!/bin/sh
|
||||
for i in "\$@"; do
|
||||
[ "\$i" = "--version" ] && exec /usr/bin/pkg-config "\$i"
|
||||
done
|
||||
exec /usr/bin/pkg-config --static "\$@"
|
||||
EOF
|
||||
RUN sed -i '/CMAKE_${lang}_FLAGS_DEBUG_INIT/s/")/ -O0 {% if LTO %}-fno-lto -fno-use-linker-plugin{% endif %} -fuse-ld=lld")/' /usr/share/cmake/Modules/Compiler/GNU.cmake
|
||||
RUN sed -i 's/NO_DEFAULT_PATH//g; s/PKG_CONFIG_ALLOW_SYSTEM_LIBS/PKG_CONFIG_IS_DUMB/g' /usr/share/cmake/Modules/FindPkgConfig.cmake
|
||||
RUN sed -i 's/set(OpenGL_GL_PREFERENCE "")/set(OpenGL_GL_PREFERENCE "LEGACY")/' /usr/share/cmake/Modules/FindOpenGL.cmake
|
||||
RUN sed -i '/Requires.private: valgrind/d' /usr/lib64/pkgconfig/libdrm.pc
|
||||
RUN sed -i 's/-lharfbuzz//' /usr/lib64/pkgconfig/harfbuzz.pc
|
||||
RUN sed -i 's/-lpng16//' /usr/lib64/pkgconfig/libpng16.pc
|
||||
RUN echo set debuginfod enabled on > /opt/rh/$TOOLSET/root/etc/gdbinit.d/00-debuginfod.gdb
|
||||
RUN adduser user
|
||||
|
||||
WORKDIR /usr/src
|
||||
ENV AR=gcc-ar
|
||||
ENV RANLIB=gcc-ranlib
|
||||
ENV NM=gcc-nm
|
||||
ENV CFLAGS='{% if DEBUG %}-g{% endif %} -O3 {% if LTO %}-flto=auto -ffat-lto-objects{% endif %} -pipe -fPIC -fno-strict-aliasing -fexceptions -fasynchronous-unwind-tables -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fhardened -Wno-hardened'
|
||||
ENV CXXFLAGS=$CFLAGS
|
||||
ENV LDFLAGS='-static-libstdc++ -static-libgcc -static-libasan -pthread -Wl,--push-state,--no-as-needed,-ldl,--pop-state -Wl,--as-needed -Wl,-z,muldefs'
|
||||
|
||||
ENV CMAKE_GENERATOR=Ninja
|
||||
ENV CMAKE_BUILD_TYPE=None
|
||||
ENV CMAKE_BUILD_PARALLEL_LEVEL='{{ JOBS }}'
|
||||
|
||||
RUN git init Implib.so \
|
||||
&& cd Implib.so \
|
||||
&& git remote add origin https://github.com/yugr/Implib.so.git \
|
||||
&& git fetch --depth=1 origin ecf7bb51a92a0fb16834c5b698570ab25f9f1d21 \
|
||||
&& git reset --hard FETCH_HEAD \
|
||||
&& mkdir build \
|
||||
&& cd build \
|
||||
&& implib() { \
|
||||
LIBFILE=$(basename $1); \
|
||||
LIBNAME=$(basename $1 .so); \
|
||||
../implib-gen.py -q $1; \
|
||||
gcc $CFLAGS -c -o $LIBFILE.tramp.o $LIBFILE.tramp.S; \
|
||||
gcc $CFLAGS -c -o $LIBFILE.init.o $LIBFILE.init.c; \
|
||||
ar rcs /usr/local/lib64/$LIBNAME.a $LIBFILE.tramp.o $LIBFILE.init.o; \
|
||||
} \
|
||||
&& implib /usr/lib64/libgtk-3.so \
|
||||
&& implib /usr/lib64/libgdk-3.so \
|
||||
&& implib /usr/lib64/libgdk_pixbuf-2.0.so \
|
||||
&& implib /usr/lib64/libpango-1.0.so \
|
||||
&& implib /usr/lib64/libvdpau.so \
|
||||
&& implib /usr/lib64/libva-x11.so \
|
||||
&& implib /usr/lib64/libva-drm.so \
|
||||
&& implib /usr/lib64/libva.so \
|
||||
&& implib /usr/lib64/libEGL.so \
|
||||
&& implib /usr/lib64/libGL.so \
|
||||
&& implib /usr/lib64/libdrm.so \
|
||||
&& implib /usr/lib64/libwayland-egl.so \
|
||||
&& implib /usr/lib64/libwayland-cursor.so \
|
||||
&& implib /usr/lib64/libwayland-client.so \
|
||||
&& implib /usr/lib64/libwayland-server.so \
|
||||
&& implib /usr/lib64/libX11-xcb.so \
|
||||
&& implib /usr/lib64/libxcb.so \
|
||||
&& cd ../.. \
|
||||
&& rm -rf Implib.so
|
||||
|
||||
FROM builder AS patches
|
||||
RUN git init patches \
|
||||
&& cd patches \
|
||||
&& git remote add origin https://github.com/desktop-app/patches.git \
|
||||
&& git fetch --depth=1 origin 859556cab51d17585ff76d3db62ff1c7502bc850 \
|
||||
&& git reset --hard FETCH_HEAD \
|
||||
&& rm -rf .git
|
||||
|
||||
FROM builder AS zlib
|
||||
RUN git clone -b v1.3.1 --depth=1 https://github.com/madler/zlib.git \
|
||||
&& cd zlib \
|
||||
&& cmake -B build . -DZLIB_BUILD_EXAMPLES=OFF \
|
||||
&& cmake --build build \
|
||||
&& export DESTDIR=/usr/src/zlib-cache \
|
||||
&& cmake --install build \
|
||||
&& rm $DESTDIR/usr/local/lib/libz.so* \
|
||||
&& cd .. \
|
||||
&& rm -rf zlib
|
||||
|
||||
FROM builder AS xz
|
||||
RUN git clone -b v5.8.1 --depth=1 https://github.com/tukaani-project/xz.git \
|
||||
&& cd xz \
|
||||
&& cmake -B build . \
|
||||
&& cmake --build build \
|
||||
&& DESTDIR=/usr/src/xz-cache cmake --install build \
|
||||
&& cd .. \
|
||||
&& rm -rf xz
|
||||
|
||||
FROM builder AS protobuf
|
||||
RUN git clone -b v30.2 --depth=1 --recursive --shallow-submodules https://github.com/protocolbuffers/protobuf.git \
|
||||
&& cd protobuf \
|
||||
&& cmake -B build . \
|
||||
-Dprotobuf_BUILD_TESTS=OFF \
|
||||
-Dprotobuf_BUILD_PROTOBUF_BINARIES=ON \
|
||||
-Dprotobuf_BUILD_LIBPROTOC=ON \
|
||||
-Dprotobuf_WITH_ZLIB=OFF \
|
||||
&& cmake --build build \
|
||||
&& DESTDIR=/usr/src/protobuf-cache cmake --install build \
|
||||
&& cd .. \
|
||||
&& rm -rf protobuf
|
||||
|
||||
FROM builder AS lcms2
|
||||
RUN git clone -b lcms2.15 --depth=1 https://github.com/mm2/Little-CMS.git \
|
||||
&& cd Little-CMS \
|
||||
&& meson build \
|
||||
--buildtype=plain \
|
||||
--default-library=static \
|
||||
&& meson compile -C build \
|
||||
&& DESTDIR=/usr/src/lcms2-cache meson install -C build \
|
||||
&& cd .. \
|
||||
&& rm -rf Little-CMS
|
||||
|
||||
FROM builder AS brotli
|
||||
RUN git clone -b v1.1.0 --depth=1 https://github.com/google/brotli.git \
|
||||
&& cd brotli \
|
||||
&& cmake -B build . \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DBROTLI_DISABLE_TESTS=ON \
|
||||
&& cmake --build build \
|
||||
&& DESTDIR=/usr/src/brotli-cache cmake --install build \
|
||||
&& cd .. \
|
||||
&& rm -rf brotli
|
||||
|
||||
FROM builder AS highway
|
||||
RUN git clone -b 1.0.7 --depth=1 https://github.com/google/highway.git \
|
||||
&& cd highway \
|
||||
&& cmake -B build . \
|
||||
-DBUILD_TESTING=OFF \
|
||||
-DHWY_ENABLE_CONTRIB=OFF \
|
||||
-DHWY_ENABLE_EXAMPLES=OFF \
|
||||
&& cmake --build build \
|
||||
&& DESTDIR=/usr/src/highway-cache cmake --install build \
|
||||
&& cd .. \
|
||||
&& rm -rf highway
|
||||
|
||||
FROM builder AS opus
|
||||
RUN git clone -b v1.5.2 --depth=1 https://github.com/xiph/opus.git \
|
||||
&& cd opus \
|
||||
&& cmake -B build . \
|
||||
&& cmake --build build \
|
||||
&& DESTDIR=/usr/src/opus-cache cmake --install build \
|
||||
&& cd .. \
|
||||
&& rm -rf opus
|
||||
|
||||
FROM builder AS dav1d
|
||||
RUN git clone -b 1.5.1 --depth=1 https://github.com/videolan/dav1d.git \
|
||||
&& cd dav1d \
|
||||
&& meson build \
|
||||
--buildtype=plain \
|
||||
--default-library=static \
|
||||
-Denable_tools=false \
|
||||
-Denable_tests=false \
|
||||
&& meson compile -C build \
|
||||
&& DESTDIR=/usr/src/dav1d-cache meson install -C build \
|
||||
&& cd .. \
|
||||
&& rm -rf dav1d
|
||||
|
||||
FROM builder AS openh264
|
||||
RUN git clone -b v2.6.0 --depth=1 https://github.com/cisco/openh264.git \
|
||||
&& cd openh264 \
|
||||
&& meson build \
|
||||
--buildtype=plain \
|
||||
--default-library=static \
|
||||
&& meson compile -C build \
|
||||
&& DESTDIR=/usr/src/openh264-cache meson install -C build \
|
||||
&& cd .. \
|
||||
&& rm -rf openh264
|
||||
|
||||
FROM builder AS de265
|
||||
RUN git clone -b v1.0.16 --depth=1 https://github.com/strukturag/libde265.git \
|
||||
&& cd libde265 \
|
||||
&& cmake -B build . \
|
||||
-DCMAKE_BUILD_TYPE=None \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DENABLE_DECODER=OFF \
|
||||
-DENABLE_SDL=OFF \
|
||||
&& cmake --build build \
|
||||
&& DESTDIR=/usr/src/de265-cache cmake --install build \
|
||||
&& cd .. \
|
||||
&& rm -rf libde265
|
||||
|
||||
FROM builder AS vpx
|
||||
RUN git init libvpx \
|
||||
&& cd libvpx \
|
||||
&& git remote add origin https://github.com/webmproject/libvpx.git \
|
||||
&& git fetch --depth=1 origin 12f3a2ac603e8f10742105519e0cd03c3b8f71dd \
|
||||
&& git reset --hard FETCH_HEAD \
|
||||
&& CFLAGS="$CFLAGS -fno-lto" CXXFLAGS="$CXXFLAGS -fno-lto" ./configure \
|
||||
--disable-examples \
|
||||
--disable-unit-tests \
|
||||
--disable-tools \
|
||||
--disable-docs \
|
||||
--enable-vp8 \
|
||||
--enable-vp9 \
|
||||
--enable-webm-io \
|
||||
--size-limit=4096x4096 \
|
||||
&& make -j$(nproc) \
|
||||
&& make DESTDIR=/usr/src/vpx-cache install \
|
||||
&& cd .. \
|
||||
&& rm -rf libvpx
|
||||
|
||||
FROM builder AS webp
|
||||
RUN git clone -b v1.5.0 --depth=1 https://github.com/webmproject/libwebp.git \
|
||||
&& cd libwebp \
|
||||
&& cmake -B build . \
|
||||
-DWEBP_BUILD_ANIM_UTILS=OFF \
|
||||
-DWEBP_BUILD_CWEBP=OFF \
|
||||
-DWEBP_BUILD_DWEBP=OFF \
|
||||
-DWEBP_BUILD_GIF2WEBP=OFF \
|
||||
-DWEBP_BUILD_IMG2WEBP=OFF \
|
||||
-DWEBP_BUILD_VWEBP=OFF \
|
||||
-DWEBP_BUILD_WEBPMUX=OFF \
|
||||
-DWEBP_BUILD_WEBPINFO=OFF \
|
||||
-DWEBP_BUILD_EXTRAS=OFF \
|
||||
&& cmake --build build \
|
||||
&& DESTDIR=/usr/src/webp-cache cmake --install build \
|
||||
&& cd .. \
|
||||
&& rm -rf libwebp
|
||||
|
||||
FROM builder AS avif
|
||||
COPY --link --from=dav1d /usr/src/dav1d-cache /
|
||||
|
||||
RUN git clone -b v1.3.0 --depth=1 https://github.com/AOMediaCodec/libavif.git \
|
||||
&& cd libavif \
|
||||
&& cmake -B build . \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DAVIF_CODEC_DAV1D=SYSTEM \
|
||||
-DAVIF_LIBYUV=OFF \
|
||||
&& cmake --build build \
|
||||
&& DESTDIR=/usr/src/avif-cache cmake --install build \
|
||||
&& cd .. \
|
||||
&& rm -rf libavif
|
||||
|
||||
FROM builder AS heif
|
||||
COPY --link --from=de265 /usr/src/de265-cache /
|
||||
|
||||
RUN git clone -b v1.19.8 --depth=1 https://github.com/strukturag/libheif.git \
|
||||
&& cd libheif \
|
||||
&& cmake -B build . \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=ON \
|
||||
-DBUILD_TESTING=OFF \
|
||||
-DENABLE_PLUGIN_LOADING=OFF \
|
||||
-DWITH_X265=OFF \
|
||||
-DWITH_AOM_DECODER=OFF \
|
||||
-DWITH_AOM_ENCODER=OFF \
|
||||
-DWITH_OpenH264_DECODER=OFF \
|
||||
-DWITH_RAV1E=OFF \
|
||||
-DWITH_RAV1E_PLUGIN=OFF \
|
||||
-DWITH_SvtEnc=OFF \
|
||||
-DWITH_SvtEnc_PLUGIN=OFF \
|
||||
-DWITH_DAV1D=OFF \
|
||||
-DWITH_LIBSHARPYUV=OFF \
|
||||
-DWITH_EXAMPLES=OFF \
|
||||
&& cmake --build build \
|
||||
&& DESTDIR=/usr/src/heif-cache cmake --install build \
|
||||
&& cd .. \
|
||||
&& rm -rf libheif
|
||||
|
||||
FROM builder AS jxl
|
||||
COPY --link --from=lcms2 /usr/src/lcms2-cache /
|
||||
COPY --link --from=brotli /usr/src/brotli-cache /
|
||||
COPY --link --from=highway /usr/src/highway-cache /
|
||||
|
||||
RUN git clone -b v0.11.1 --depth=1 https://github.com/libjxl/libjxl.git \
|
||||
&& cd libjxl \
|
||||
&& git submodule update --init --recursive --depth=1 third_party/libjpeg-turbo \
|
||||
&& curl -sSL https://github.com/libjxl/libjxl/commit/ee3955b1553bcc10304d45b85dfef9afa9349d72.patch | sed 's/offset + t/offset + i/' | git apply \
|
||||
&& cmake -B build . \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DBUILD_TESTING=OFF \
|
||||
-DJPEGXL_ENABLE_DEVTOOLS=OFF \
|
||||
-DJPEGXL_ENABLE_TOOLS=OFF \
|
||||
-DJPEGXL_INSTALL_JPEGLI_LIBJPEG=ON \
|
||||
-DJPEGXL_ENABLE_DOXYGEN=OFF \
|
||||
-DJPEGXL_ENABLE_MANPAGES=OFF \
|
||||
-DJPEGXL_ENABLE_BENCHMARK=OFF \
|
||||
-DJPEGXL_ENABLE_EXAMPLES=OFF \
|
||||
-DJPEGXL_ENABLE_JNI=OFF \
|
||||
-DJPEGXL_ENABLE_SJPEG=OFF \
|
||||
-DJPEGXL_ENABLE_OPENEXR=OFF \
|
||||
-DJPEGXL_ENABLE_SKCMS=OFF \
|
||||
&& cmake --build build \
|
||||
&& export DESTDIR=/usr/src/jxl-cache \
|
||||
&& cmake --install build \
|
||||
&& sed -i 's/-lstdc++//' $DESTDIR/usr/local/lib64/pkgconfig/libjxl*.pc \
|
||||
&& rm $DESTDIR/usr/local/lib64/libjpeg.so* \
|
||||
&& cp build/lib/libjpegli-static.a $DESTDIR/usr/local/lib64/libjpeg.a \
|
||||
&& mkdir build/hwy \
|
||||
&& ar --output=build/hwy x /usr/local/lib64/libhwy.a \
|
||||
&& ar rcs $DESTDIR/usr/local/lib64/libjpeg.a build/lib/CMakeFiles/jpegli-libjpeg-obj.dir/jpegli/libjpeg_wrapper.cc.o build/hwy/* \
|
||||
&& cd .. \
|
||||
&& rm -rf libjxl
|
||||
|
||||
FROM builder AS rnnoise
|
||||
RUN git clone -b v0.2 --depth=1 https://github.com/xiph/rnnoise.git \
|
||||
&& cd rnnoise \
|
||||
&& ./autogen.sh \
|
||||
&& ./configure --enable-static --disable-shared \
|
||||
&& make -j$(nproc) \
|
||||
&& make DESTDIR=/usr/src/rnnoise-cache install \
|
||||
&& cd .. \
|
||||
&& rm -rf rnnoise
|
||||
|
||||
FROM builder AS xcb-proto
|
||||
RUN git clone -b xcb-proto-1.16.0 --depth=1 https://github.com/gitlab-freedesktop-mirrors/xcbproto.git \
|
||||
&& cd xcbproto \
|
||||
&& ./autogen.sh \
|
||||
&& make -j$(nproc) \
|
||||
&& make DESTDIR=/usr/src/xcb-proto-cache install \
|
||||
&& cd .. \
|
||||
&& rm -rf xcbproto
|
||||
|
||||
FROM builder AS xcb
|
||||
COPY --link --from=xcb-proto /usr/src/xcb-proto-cache /
|
||||
|
||||
RUN git clone -b libxcb-1.16 --depth=1 https://github.com/gitlab-freedesktop-mirrors/libxcb.git \
|
||||
&& cd libxcb \
|
||||
&& ./autogen.sh --enable-static --disable-shared \
|
||||
&& make -j$(nproc) \
|
||||
&& export DESTDIR=/usr/src/xcb-cache \
|
||||
&& make install \
|
||||
&& rm $DESTDIR/usr/local/lib/{libxcb.{,l}a,pkgconfig/xcb.pc} \
|
||||
&& cd .. \
|
||||
&& rm -rf libxcb
|
||||
|
||||
FROM builder AS xcb-wm
|
||||
RUN git clone -b xcb-util-wm-0.4.2 --depth=1 --recursive --shallow-submodules https://github.com/gitlab-freedesktop-mirrors/libxcb-wm.git \
|
||||
&& cd libxcb-wm \
|
||||
&& ./autogen.sh --enable-static --disable-shared \
|
||||
&& make -j$(nproc) \
|
||||
&& make DESTDIR=/usr/src/xcb-wm-cache install \
|
||||
&& cd .. \
|
||||
&& rm -rf libxcb-wm
|
||||
|
||||
FROM builder AS xcb-util
|
||||
RUN git clone -b xcb-util-0.4.1-gitlab --depth=1 --recursive --shallow-submodules https://github.com/gitlab-freedesktop-mirrors/libxcb-util.git \
|
||||
&& cd libxcb-util \
|
||||
&& ./autogen.sh --enable-static --disable-shared \
|
||||
&& make -j$(nproc) \
|
||||
&& make DESTDIR=/usr/src/xcb-util-cache install \
|
||||
&& cd .. \
|
||||
&& rm -rf libxcb-util
|
||||
|
||||
FROM builder AS xcb-image
|
||||
COPY --link --from=xcb-util /usr/src/xcb-util-cache /
|
||||
|
||||
RUN git clone -b xcb-util-image-0.4.1-gitlab --depth=1 --recursive --shallow-submodules https://github.com/gitlab-freedesktop-mirrors/libxcb-image.git \
|
||||
&& cd libxcb-image \
|
||||
&& ./autogen.sh --enable-static --disable-shared \
|
||||
&& make -j$(nproc) \
|
||||
&& make DESTDIR=/usr/src/xcb-image-cache install \
|
||||
&& cd .. \
|
||||
&& rm -rf libxcb-image
|
||||
|
||||
FROM builder AS xcb-keysyms
|
||||
RUN git init libxcb-keysyms \
|
||||
&& cd libxcb-keysyms \
|
||||
&& git remote add origin https://github.com/gitlab-freedesktop-mirrors/libxcb-keysyms.git \
|
||||
&& git fetch --depth=1 origin ef5cb393d27511ba511c68a54f8ff7b9aab4a384 \
|
||||
&& git reset --hard FETCH_HEAD \
|
||||
&& git submodule update --init --recursive --depth=1 \
|
||||
&& ./autogen.sh --enable-static --disable-shared \
|
||||
&& make -j$(nproc) \
|
||||
&& make DESTDIR=/usr/src/xcb-keysyms-cache install \
|
||||
&& cd .. \
|
||||
&& rm -rf libxcb-keysyms
|
||||
|
||||
FROM builder AS xcb-render-util
|
||||
RUN git init libxcb-render-util \
|
||||
&& cd libxcb-render-util \
|
||||
&& git remote add origin https://github.com/gitlab-freedesktop-mirrors/libxcb-render-util.git \
|
||||
&& git fetch --depth=1 origin 5ad9853d6ddcac394d42dd2d4e34436b5db9da39 \
|
||||
&& git reset --hard FETCH_HEAD \
|
||||
&& git submodule update --init --recursive --depth=1 \
|
||||
&& ./autogen.sh --enable-static --disable-shared \
|
||||
&& make -j$(nproc) \
|
||||
&& make DESTDIR=/usr/src/xcb-render-util-cache install \
|
||||
&& cd .. \
|
||||
&& rm -rf libxcb-render-util
|
||||
|
||||
FROM builder AS xcb-cursor
|
||||
COPY --link --from=xcb-util /usr/src/xcb-util-cache /
|
||||
COPY --link --from=xcb-image /usr/src/xcb-image-cache /
|
||||
COPY --link --from=xcb-render-util /usr/src/xcb-render-util-cache /
|
||||
|
||||
RUN git init libxcb-cursor \
|
||||
&& cd libxcb-cursor \
|
||||
&& git remote add origin https://github.com/gitlab-freedesktop-mirrors/libxcb-cursor.git \
|
||||
&& git fetch --depth=1 origin 4929f6051658ba5424b41703a1fb63f9db896065 \
|
||||
&& git reset --hard FETCH_HEAD \
|
||||
&& git submodule update --init --recursive --depth=1 \
|
||||
&& ./autogen.sh --enable-static --disable-shared --with-cursorpath='~/.local/share/icons:~/.icons:/usr/share/icons:/usr/share/pixmaps' \
|
||||
&& make -j$(nproc) \
|
||||
&& make DESTDIR=/usr/src/xcb-cursor-cache install \
|
||||
&& cd .. \
|
||||
&& rm -rf libxcb-cursor
|
||||
|
||||
FROM builder AS xext
|
||||
RUN git clone -b libXext-1.3.5 --depth=1 https://github.com/gitlab-freedesktop-mirrors/libxext.git \
|
||||
&& cd libxext \
|
||||
&& ./autogen.sh --enable-static --disable-shared \
|
||||
&& make -j$(nproc) \
|
||||
&& make DESTDIR=/usr/src/xext-cache install \
|
||||
&& cd .. \
|
||||
&& rm -rf libxext
|
||||
|
||||
FROM builder AS xtst
|
||||
RUN git clone -b libXtst-1.2.4 --depth=1 https://github.com/gitlab-freedesktop-mirrors/libxtst.git \
|
||||
&& cd libxtst \
|
||||
&& ./autogen.sh --enable-static --disable-shared \
|
||||
&& make -j$(nproc) \
|
||||
&& make DESTDIR=/usr/src/xtst-cache install \
|
||||
&& cd .. \
|
||||
&& rm -rf libxtst
|
||||
|
||||
FROM builder AS xfixes
|
||||
RUN git clone -b libXfixes-5.0.3 --depth=1 https://github.com/gitlab-freedesktop-mirrors/libxfixes.git \
|
||||
&& cd libxfixes \
|
||||
&& ./autogen.sh --enable-static --disable-shared \
|
||||
&& make -j$(nproc) \
|
||||
&& make DESTDIR=/usr/src/xfixes-cache install \
|
||||
&& cd .. \
|
||||
&& rm -rf libxfixes
|
||||
|
||||
FROM builder AS xv
|
||||
COPY --link --from=xext /usr/src/xext-cache /
|
||||
|
||||
RUN git clone -b libXv-1.0.12 --depth=1 https://github.com/gitlab-freedesktop-mirrors/libxv.git \
|
||||
&& cd libxv \
|
||||
&& ./autogen.sh --enable-static --disable-shared \
|
||||
&& make -j$(nproc) \
|
||||
&& make DESTDIR=/usr/src/xv-cache install \
|
||||
&& cd .. \
|
||||
&& rm -rf libxv
|
||||
|
||||
FROM builder AS xrandr
|
||||
RUN git clone -b libXrandr-1.5.3 --depth=1 https://github.com/gitlab-freedesktop-mirrors/libxrandr.git \
|
||||
&& cd libxrandr \
|
||||
&& ./autogen.sh --enable-static --disable-shared \
|
||||
&& make -j$(nproc) \
|
||||
&& make DESTDIR=/usr/src/xrandr-cache install \
|
||||
&& cd .. \
|
||||
&& rm -rf libxrandr
|
||||
|
||||
FROM builder AS xrender
|
||||
RUN git clone -b libXrender-0.9.11 --depth=1 https://github.com/gitlab-freedesktop-mirrors/libxrender.git \
|
||||
&& cd libxrender \
|
||||
&& ./autogen.sh --enable-static --disable-shared \
|
||||
&& make -j$(nproc) \
|
||||
&& make DESTDIR=/usr/src/xrender-cache install \
|
||||
&& cd .. \
|
||||
&& rm -rf libxrender
|
||||
|
||||
FROM builder AS xdamage
|
||||
RUN git clone -b libXdamage-1.1.6 --depth=1 https://github.com/gitlab-freedesktop-mirrors/libxdamage.git \
|
||||
&& cd libxdamage \
|
||||
&& ./autogen.sh --enable-static --disable-shared \
|
||||
&& make -j$(nproc) \
|
||||
&& make DESTDIR=/usr/src/xdamage-cache install \
|
||||
&& cd .. \
|
||||
&& rm -rf libxdamage
|
||||
|
||||
FROM builder AS xcomposite
|
||||
RUN git clone -b libXcomposite-0.4.6 --depth=1 https://github.com/gitlab-freedesktop-mirrors/libxcomposite.git \
|
||||
&& cd libxcomposite \
|
||||
&& ./autogen.sh --enable-static --disable-shared \
|
||||
&& make -j$(nproc) \
|
||||
&& make DESTDIR=/usr/src/xcomposite-cache install \
|
||||
&& cd .. \
|
||||
&& rm -rf libxcomposite
|
||||
|
||||
FROM builder AS nv-codec-headers
|
||||
RUN git clone -b n12.1.14.0 --depth=1 https://github.com/FFmpeg/nv-codec-headers.git \
|
||||
&& DESTDIR=/usr/src/nv-codec-headers-cache make -C nv-codec-headers install \
|
||||
&& rm -rf nv-codec-headers
|
||||
|
||||
FROM builder AS ffmpeg
|
||||
COPY --link --from=opus /usr/src/opus-cache /
|
||||
COPY --link --from=openh264 /usr/src/openh264-cache /
|
||||
COPY --link --from=dav1d /usr/src/dav1d-cache /
|
||||
COPY --link --from=vpx /usr/src/vpx-cache /
|
||||
COPY --link --from=xext /usr/src/xext-cache /
|
||||
COPY --link --from=xv /usr/src/xv-cache /
|
||||
COPY --link --from=nv-codec-headers /usr/src/nv-codec-headers-cache /
|
||||
|
||||
RUN git clone -b n6.1.1 --depth=1 https://github.com/FFmpeg/FFmpeg.git \
|
||||
&& cd FFmpeg \
|
||||
&& ./configure \
|
||||
--extra-cflags="-fno-lto -DCONFIG_SAFE_BITSTREAM_READER=1" \
|
||||
--extra-cxxflags="-fno-lto -DCONFIG_SAFE_BITSTREAM_READER=1" \
|
||||
--extra-ldflags="-Wl,--push-state,--no-as-needed,-lstdc++,--pop-state" \
|
||||
--disable-debug \
|
||||
--disable-programs \
|
||||
--disable-doc \
|
||||
--disable-network \
|
||||
--disable-autodetect \
|
||||
--disable-everything \
|
||||
--enable-libdav1d \
|
||||
--enable-libopenh264 \
|
||||
--enable-libopus \
|
||||
--enable-libvpx \
|
||||
--enable-vaapi \
|
||||
--enable-vdpau \
|
||||
--enable-xlib \
|
||||
--enable-libdrm \
|
||||
--enable-ffnvcodec \
|
||||
--enable-nvdec \
|
||||
--enable-cuvid \
|
||||
--enable-protocol=file \
|
||||
--enable-hwaccel=av1_vaapi \
|
||||
--enable-hwaccel=av1_nvdec \
|
||||
--enable-hwaccel=h264_vaapi \
|
||||
--enable-hwaccel=h264_vdpau \
|
||||
--enable-hwaccel=h264_nvdec \
|
||||
--enable-hwaccel=hevc_vaapi \
|
||||
--enable-hwaccel=hevc_vdpau \
|
||||
--enable-hwaccel=hevc_nvdec \
|
||||
--enable-hwaccel=mpeg2_vaapi \
|
||||
--enable-hwaccel=mpeg2_vdpau \
|
||||
--enable-hwaccel=mpeg2_nvdec \
|
||||
--enable-hwaccel=mpeg4_vaapi \
|
||||
--enable-hwaccel=mpeg4_vdpau \
|
||||
--enable-hwaccel=mpeg4_nvdec \
|
||||
--enable-hwaccel=vp8_vaapi \
|
||||
--enable-hwaccel=vp8_nvdec \
|
||||
--enable-decoder=aac \
|
||||
--enable-decoder=aac_fixed \
|
||||
--enable-decoder=aac_latm \
|
||||
--enable-decoder=aasc \
|
||||
--enable-decoder=ac3 \
|
||||
--enable-decoder=alac \
|
||||
--enable-decoder=av1 \
|
||||
--enable-decoder=av1_cuvid \
|
||||
--enable-decoder=eac3 \
|
||||
--enable-decoder=flac \
|
||||
--enable-decoder=gif \
|
||||
--enable-decoder=h264 \
|
||||
--enable-decoder=hevc \
|
||||
--enable-decoder=libdav1d \
|
||||
--enable-decoder=libvpx_vp8 \
|
||||
--enable-decoder=libvpx_vp9 \
|
||||
--enable-decoder=mp1 \
|
||||
--enable-decoder=mp1float \
|
||||
--enable-decoder=mp2 \
|
||||
--enable-decoder=mp2float \
|
||||
--enable-decoder=mp3 \
|
||||
--enable-decoder=mp3adu \
|
||||
--enable-decoder=mp3adufloat \
|
||||
--enable-decoder=mp3float \
|
||||
--enable-decoder=mp3on4 \
|
||||
--enable-decoder=mp3on4float \
|
||||
--enable-decoder=mpeg4 \
|
||||
--enable-decoder=msmpeg4v2 \
|
||||
--enable-decoder=msmpeg4v3 \
|
||||
--enable-decoder=opus \
|
||||
--enable-decoder=pcm_alaw \
|
||||
--enable-decoder=pcm_f32be \
|
||||
--enable-decoder=pcm_f32le \
|
||||
--enable-decoder=pcm_f64be \
|
||||
--enable-decoder=pcm_f64le \
|
||||
--enable-decoder=pcm_lxf \
|
||||
--enable-decoder=pcm_mulaw \
|
||||
--enable-decoder=pcm_s16be \
|
||||
--enable-decoder=pcm_s16be_planar \
|
||||
--enable-decoder=pcm_s16le \
|
||||
--enable-decoder=pcm_s16le_planar \
|
||||
--enable-decoder=pcm_s24be \
|
||||
--enable-decoder=pcm_s24daud \
|
||||
--enable-decoder=pcm_s24le \
|
||||
--enable-decoder=pcm_s24le_planar \
|
||||
--enable-decoder=pcm_s32be \
|
||||
--enable-decoder=pcm_s32le \
|
||||
--enable-decoder=pcm_s32le_planar \
|
||||
--enable-decoder=pcm_s64be \
|
||||
--enable-decoder=pcm_s64le \
|
||||
--enable-decoder=pcm_s8 \
|
||||
--enable-decoder=pcm_s8_planar \
|
||||
--enable-decoder=pcm_u16be \
|
||||
--enable-decoder=pcm_u16le \
|
||||
--enable-decoder=pcm_u24be \
|
||||
--enable-decoder=pcm_u24le \
|
||||
--enable-decoder=pcm_u32be \
|
||||
--enable-decoder=pcm_u32le \
|
||||
--enable-decoder=pcm_u8 \
|
||||
--enable-decoder=pcm_zork \
|
||||
--enable-decoder=vorbis \
|
||||
--enable-decoder=vp8 \
|
||||
--enable-decoder=wavpack \
|
||||
--enable-decoder=wmalossless \
|
||||
--enable-decoder=wmapro \
|
||||
--enable-decoder=wmav1 \
|
||||
--enable-decoder=wmav2 \
|
||||
--enable-decoder=wmavoice \
|
||||
--enable-encoder=aac \
|
||||
--enable-encoder=libopenh264 \
|
||||
--enable-encoder=libopus \
|
||||
--enable-encoder=pcm_s16le \
|
||||
--enable-filter=atempo \
|
||||
--enable-parser=aac \
|
||||
--enable-parser=aac_latm \
|
||||
--enable-parser=flac \
|
||||
--enable-parser=gif \
|
||||
--enable-parser=h264 \
|
||||
--enable-parser=hevc \
|
||||
--enable-parser=mpeg4video \
|
||||
--enable-parser=mpegaudio \
|
||||
--enable-parser=opus \
|
||||
--enable-parser=vorbis \
|
||||
--enable-demuxer=aac \
|
||||
--enable-demuxer=flac \
|
||||
--enable-demuxer=gif \
|
||||
--enable-demuxer=h264 \
|
||||
--enable-demuxer=hevc \
|
||||
--enable-demuxer=matroska \
|
||||
--enable-demuxer=m4v \
|
||||
--enable-demuxer=mov \
|
||||
--enable-demuxer=mp3 \
|
||||
--enable-demuxer=ogg \
|
||||
--enable-demuxer=wav \
|
||||
--enable-muxer=mp4 \
|
||||
--enable-muxer=ogg \
|
||||
--enable-muxer=opus \
|
||||
--enable-muxer=wav \
|
||||
&& make -j$(nproc) \
|
||||
&& make DESTDIR=/usr/src/ffmpeg-cache install \
|
||||
&& cd .. \
|
||||
&& rm -rf ffmpeg
|
||||
|
||||
FROM builder AS pipewire
|
||||
RUN git clone -b 0.3.62 --depth=1 https://github.com/PipeWire/pipewire.git \
|
||||
&& cd pipewire \
|
||||
&& meson build \
|
||||
--buildtype=plain \
|
||||
-Dtests=disabled \
|
||||
-Dexamples=disabled \
|
||||
-Dspa-plugins=disabled \
|
||||
-Dsession-managers= \
|
||||
&& meson compile -C build \
|
||||
&& DESTDIR=/usr/src/pipewire-cache meson install -C build \
|
||||
&& cd .. \
|
||||
&& rm -rf pipewire
|
||||
|
||||
FROM builder AS openal
|
||||
COPY --link --from=pipewire /usr/src/pipewire-cache /
|
||||
|
||||
RUN git clone -b 1.24.3 --depth=1 https://github.com/kcat/openal-soft.git \
|
||||
&& cd openal-soft \
|
||||
&& cmake -B build . \
|
||||
-DLIBTYPE:STRING=STATIC \
|
||||
-DALSOFT_EXAMPLES=OFF \
|
||||
-DALSOFT_UTILS=OFF \
|
||||
-DALSOFT_INSTALL_CONFIG=OFF \
|
||||
&& cmake --build build \
|
||||
&& DESTDIR=/usr/src/openal-cache cmake --install build \
|
||||
&& cd .. \
|
||||
&& rm -rf openal-soft
|
||||
|
||||
FROM builder AS openssl
|
||||
RUN git clone -b openssl-3.2.1 --depth=1 https://github.com/openssl/openssl.git \
|
||||
&& cd openssl \
|
||||
&& ./config \
|
||||
--openssldir=/etc/ssl \
|
||||
no-shared \
|
||||
no-tests \
|
||||
no-dso \
|
||||
&& make -j$(nproc) \
|
||||
&& make DESTDIR=/usr/src/openssl-cache install_sw \
|
||||
&& cd .. \
|
||||
&& rm -rf openssl
|
||||
|
||||
FROM builder AS xkbcommon
|
||||
COPY --link --from=xcb /usr/src/xcb-cache /
|
||||
|
||||
RUN git clone -b xkbcommon-1.6.0 --depth=1 https://github.com/xkbcommon/libxkbcommon.git \
|
||||
&& cd libxkbcommon \
|
||||
&& meson build \
|
||||
--buildtype=plain \
|
||||
--default-library=static \
|
||||
-Denable-docs=false \
|
||||
-Denable-wayland=false \
|
||||
-Denable-xkbregistry=false \
|
||||
-Dxkb-config-root=/usr/share/X11/xkb \
|
||||
-Dxkb-config-extra-path=/etc/xkb \
|
||||
-Dx-locale-root=/usr/share/X11/locale \
|
||||
&& meson compile -C build \
|
||||
&& DESTDIR=/usr/src/xkbcommon-cache meson install -C build \
|
||||
&& cd .. \
|
||||
&& rm -rf libxkbcommon
|
||||
|
||||
FROM patches AS qt
|
||||
COPY --link --from=zlib /usr/src/zlib-cache /
|
||||
COPY --link --from=lcms2 /usr/src/lcms2-cache /
|
||||
COPY --link --from=webp /usr/src/webp-cache /
|
||||
COPY --link --from=jxl /usr/src/jxl-cache /
|
||||
COPY --link --from=xcb /usr/src/xcb-cache /
|
||||
COPY --link --from=xcb-wm /usr/src/xcb-wm-cache /
|
||||
COPY --link --from=xcb-util /usr/src/xcb-util-cache /
|
||||
COPY --link --from=xcb-image /usr/src/xcb-image-cache /
|
||||
COPY --link --from=xcb-keysyms /usr/src/xcb-keysyms-cache /
|
||||
COPY --link --from=xcb-render-util /usr/src/xcb-render-util-cache /
|
||||
COPY --link --from=xcb-cursor /usr/src/xcb-cursor-cache /
|
||||
COPY --link --from=openssl /usr/src/openssl-cache /
|
||||
COPY --link --from=xkbcommon /usr/src/xkbcommon-cache /
|
||||
|
||||
ENV QT=6.10.1
|
||||
RUN git clone -b v$QT --depth=1 https://github.com/qt/qt5.git \
|
||||
&& cd qt5 \
|
||||
&& git submodule update --init --recursive --depth=1 qtbase qtdeclarative qtwayland qtimageformats qtsvg qtshadertools \
|
||||
&& cd qtbase \
|
||||
&& find ../../patches/qtbase_$QT -type f -print0 | sort -z | xargs -r0 git apply \
|
||||
&& cd ../qtwayland \
|
||||
&& find ../../patches/qtwayland_$QT -type f -print0 | sort -z | xargs -r0 git apply \
|
||||
&& cd .. \
|
||||
&& cmake -B build . \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr/local \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
{%- if ASAN %}
|
||||
-DFEATURE_sanitize_address=ON \
|
||||
{%- endif %}
|
||||
-DQT_QPA_PLATFORMS="wayland;xcb" \
|
||||
-DINPUT_libpng=qt \
|
||||
-DINPUT_harfbuzz=qt \
|
||||
-DINPUT_pcre=qt \
|
||||
-DFEATURE_icu=OFF \
|
||||
-DFEATURE_xcb_sm=OFF \
|
||||
-DFEATURE_eglfs=OFF \
|
||||
-DINPUT_dbus=runtime \
|
||||
-DINPUT_openssl=linked \
|
||||
&& cmake --build build \
|
||||
&& DESTDIR=/usr/src/qt-cache cmake --install build \
|
||||
&& cd .. \
|
||||
&& rm -rf qt5
|
||||
|
||||
FROM builder AS breakpad
|
||||
RUN git clone -b v2024.02.16 --depth=1 https://chromium.googlesource.com/breakpad/breakpad.git \
|
||||
&& cd breakpad \
|
||||
&& git clone -b v2024.02.01 --depth=1 https://chromium.googlesource.com/linux-syscall-support.git src/third_party/lss \
|
||||
&& CFLAGS="$CFLAGS -fno-lto" CXXFLAGS="$CXXFLAGS -fno-lto" ./configure \
|
||||
&& make -j$(nproc) \
|
||||
&& make DESTDIR=/usr/src/breakpad-cache install \
|
||||
&& cd .. \
|
||||
&& rm -rf breakpad
|
||||
|
||||
FROM builder AS webrtc
|
||||
COPY --link --from=zlib /usr/src/zlib-cache /
|
||||
COPY --link --from=opus /usr/src/opus-cache /
|
||||
COPY --link --from=openh264 /usr/src/openh264-cache /
|
||||
COPY --link --from=dav1d /usr/src/dav1d-cache /
|
||||
COPY --link --from=vpx /usr/src/vpx-cache /
|
||||
COPY --link --from=jxl /usr/src/jxl-cache /
|
||||
COPY --link --from=ffmpeg /usr/src/ffmpeg-cache /
|
||||
COPY --link --from=openssl /usr/src/openssl-cache /
|
||||
COPY --link --from=xext /usr/src/xext-cache /
|
||||
COPY --link --from=xfixes /usr/src/xfixes-cache /
|
||||
COPY --link --from=xtst /usr/src/xtst-cache /
|
||||
COPY --link --from=xrandr /usr/src/xrandr-cache /
|
||||
COPY --link --from=xrender /usr/src/xrender-cache /
|
||||
COPY --link --from=xdamage /usr/src/xdamage-cache /
|
||||
COPY --link --from=xcomposite /usr/src/xcomposite-cache /
|
||||
COPY --link --from=pipewire /usr/src/pipewire-cache /
|
||||
|
||||
# Shallow clone on a specific commit.
|
||||
RUN git init tg_owt \
|
||||
&& cd tg_owt \
|
||||
&& git remote add origin https://github.com/desktop-app/tg_owt.git \
|
||||
&& git fetch --depth=1 origin 5c5c71258777d0196dbb3a09cc37d2f56ead28ab \
|
||||
&& git reset --hard FETCH_HEAD \
|
||||
&& git submodule update --init --recursive --depth=1 \
|
||||
&& cmake -B build . -DTG_OWT_DLOPEN_PIPEWIRE=ON \
|
||||
&& cmake --build build \
|
||||
&& DESTDIR=/usr/src/webrtc-cache cmake --install build \
|
||||
&& cd .. \
|
||||
&& rm -rf tg_owt
|
||||
|
||||
FROM builder AS ada
|
||||
RUN git clone -b v3.2.4 --depth=1 https://github.com/ada-url/ada.git \
|
||||
&& cd ada \
|
||||
&& cmake -B build . \
|
||||
-D ADA_TESTING=OFF \
|
||||
-D ADA_TOOLS=OFF \
|
||||
-D ADA_INCLUDE_URL_PATTERN=OFF \
|
||||
&& cmake --build build \
|
||||
&& DESTDIR=/usr/src/ada-cache cmake --install build \
|
||||
&& cd .. \
|
||||
&& rm -rf ada
|
||||
|
||||
FROM builder AS tde2e
|
||||
COPY --link --from=zlib /usr/src/zlib-cache /
|
||||
COPY --link --from=openssl /usr/src/openssl-cache /
|
||||
|
||||
# Shallow clone on a specific commit.
|
||||
RUN git init tde2e \
|
||||
&& cd tde2e \
|
||||
&& git remote add origin https://github.com/tdlib/td.git \
|
||||
&& git fetch --depth=1 origin 51743dfd01dff6179e2d8f7095729caa4e2222e9 \
|
||||
&& git reset --hard FETCH_HEAD \
|
||||
&& cmake -B build . -DTD_E2E_ONLY=ON \
|
||||
&& cmake --build build \
|
||||
&& DESTDIR=/usr/src/tde2e-cache cmake --install build \
|
||||
&& cd .. \
|
||||
&& rm -rf tde2e
|
||||
|
||||
FROM builder
|
||||
COPY --link --from=zlib /usr/src/zlib-cache /
|
||||
COPY --link --from=xz /usr/src/xz-cache /
|
||||
COPY --link --from=protobuf /usr/src/protobuf-cache /
|
||||
COPY --link --from=lcms2 /usr/src/lcms2-cache /
|
||||
COPY --link --from=brotli /usr/src/brotli-cache /
|
||||
COPY --link --from=highway /usr/src/highway-cache /
|
||||
COPY --link --from=opus /usr/src/opus-cache /
|
||||
COPY --link --from=dav1d /usr/src/dav1d-cache /
|
||||
COPY --link --from=openh264 /usr/src/openh264-cache /
|
||||
COPY --link --from=de265 /usr/src/de265-cache /
|
||||
COPY --link --from=vpx /usr/src/vpx-cache /
|
||||
COPY --link --from=webp /usr/src/webp-cache /
|
||||
COPY --link --from=avif /usr/src/avif-cache /
|
||||
COPY --link --from=heif /usr/src/heif-cache /
|
||||
COPY --link --from=jxl /usr/src/jxl-cache /
|
||||
COPY --link --from=rnnoise /usr/src/rnnoise-cache /
|
||||
COPY --link --from=xcb /usr/src/xcb-cache /
|
||||
COPY --link --from=xcb-wm /usr/src/xcb-wm-cache /
|
||||
COPY --link --from=xcb-util /usr/src/xcb-util-cache /
|
||||
COPY --link --from=xcb-image /usr/src/xcb-image-cache /
|
||||
COPY --link --from=xcb-keysyms /usr/src/xcb-keysyms-cache /
|
||||
COPY --link --from=xcb-render-util /usr/src/xcb-render-util-cache /
|
||||
COPY --link --from=xcb-cursor /usr/src/xcb-cursor-cache /
|
||||
COPY --link --from=xext /usr/src/xext-cache /
|
||||
COPY --link --from=xfixes /usr/src/xfixes-cache /
|
||||
COPY --link --from=xv /usr/src/xv-cache /
|
||||
COPY --link --from=xtst /usr/src/xtst-cache /
|
||||
COPY --link --from=xrandr /usr/src/xrandr-cache /
|
||||
COPY --link --from=xrender /usr/src/xrender-cache /
|
||||
COPY --link --from=xdamage /usr/src/xdamage-cache /
|
||||
COPY --link --from=xcomposite /usr/src/xcomposite-cache /
|
||||
COPY --link --from=ffmpeg /usr/src/ffmpeg-cache /
|
||||
COPY --link --from=openal /usr/src/openal-cache /
|
||||
COPY --link --from=openssl /usr/src/openssl-cache /
|
||||
COPY --link --from=xkbcommon /usr/src/xkbcommon-cache /
|
||||
COPY --link --from=qt /usr/src/qt-cache /
|
||||
COPY --link --from=breakpad /usr/src/breakpad-cache /
|
||||
COPY --link --from=webrtc /usr/src/webrtc-cache /
|
||||
COPY --link --from=ada /usr/src/ada-cache /
|
||||
COPY --link --from=tde2e /usr/src/tde2e-cache /
|
||||
|
||||
COPY --link --from=patches /usr/src/patches patches
|
||||
RUN patch -p1 -d /usr/lib64/gobject-introspection -i $PWD/patches/gobject-introspection.patch && rm -rf patches
|
||||
|
||||
WORKDIR /usr/src/tdesktop
|
||||
ENV BOOST_INCLUDEDIR=/usr/include/boost1.78
|
||||
ENV BOOST_LIBRARYDIR=/usr/lib64/boost1.78
|
||||
|
||||
USER user
|
||||
VOLUME [ "/usr/src/tdesktop" ]
|
||||
CMD [ "/usr/src/tdesktop/Telegram/build/docker/centos_env/build.sh" ]
|
||||
6
Telegram/build/docker/centos_env/build.sh
Executable file
6
Telegram/build/docker/centos_env/build.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
cd Telegram
|
||||
./configure.sh "$@"
|
||||
cmake --build ../out --config "${CONFIG:-Release}"
|
||||
1
Telegram/build/docker/centos_env/centos_env/__init__.py
Normal file
1
Telegram/build/docker/centos_env/centos_env/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
20
Telegram/build/docker/centos_env/gen_dockerfile.py
Executable file
20
Telegram/build/docker/centos_env/gen_dockerfile.py
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python3
|
||||
from os import environ
|
||||
from os.path import dirname
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
def checkEnv(envName, defaultValue):
|
||||
if isinstance(defaultValue, bool):
|
||||
return bool(len(environ[envName])) if envName in environ else defaultValue
|
||||
return environ[envName] if envName in environ else defaultValue
|
||||
|
||||
def main():
|
||||
print(Environment(loader=FileSystemLoader(dirname(__file__))).get_template("Dockerfile").render(
|
||||
DEBUG=checkEnv("DEBUG", True),
|
||||
LTO=checkEnv("LTO", True),
|
||||
ASAN=checkEnv("ASAN", False),
|
||||
JOBS=checkEnv("JOBS", ""),
|
||||
))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
74
Telegram/build/docker/centos_env/poetry.lock
generated
Normal file
74
Telegram/build/docker/centos_env/poetry.lock
generated
Normal file
@@ -0,0 +1,74 @@
|
||||
# This file is automatically @generated by Poetry 2.1.1 and should not be changed by hand.
|
||||
|
||||
[[package]]
|
||||
name = "jinja2"
|
||||
version = "3.1.6"
|
||||
description = "A very fast and expressive template engine."
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
groups = ["main"]
|
||||
files = [
|
||||
{file = "jinja2-3.1.6-py3-none-any.whl", hash = "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67"},
|
||||
{file = "jinja2-3.1.6.tar.gz", hash = "sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
MarkupSafe = ">=2.0"
|
||||
|
||||
[package.extras]
|
||||
i18n = ["Babel (>=2.7)"]
|
||||
|
||||
[[package]]
|
||||
name = "markupsafe"
|
||||
version = "2.1.1"
|
||||
description = "Safely add untrusted strings to HTML/XML markup."
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
groups = ["main"]
|
||||
files = [
|
||||
{file = "MarkupSafe-2.1.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:86b1f75c4e7c2ac2ccdaec2b9022845dbb81880ca318bb7a0a01fbf7813e3812"},
|
||||
{file = "MarkupSafe-2.1.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:f121a1420d4e173a5d96e47e9a0c0dcff965afdf1626d28de1460815f7c4ee7a"},
|
||||
{file = "MarkupSafe-2.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a49907dd8420c5685cfa064a1335b6754b74541bbb3706c259c02ed65b644b3e"},
|
||||
{file = "MarkupSafe-2.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:10c1bfff05d95783da83491be968e8fe789263689c02724e0c691933c52994f5"},
|
||||
{file = "MarkupSafe-2.1.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b7bd98b796e2b6553da7225aeb61f447f80a1ca64f41d83612e6139ca5213aa4"},
|
||||
{file = "MarkupSafe-2.1.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:b09bf97215625a311f669476f44b8b318b075847b49316d3e28c08e41a7a573f"},
|
||||
{file = "MarkupSafe-2.1.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:694deca8d702d5db21ec83983ce0bb4b26a578e71fbdbd4fdcd387daa90e4d5e"},
|
||||
{file = "MarkupSafe-2.1.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:efc1913fd2ca4f334418481c7e595c00aad186563bbc1ec76067848c7ca0a933"},
|
||||
{file = "MarkupSafe-2.1.1-cp310-cp310-win32.whl", hash = "sha256:4a33dea2b688b3190ee12bd7cfa29d39c9ed176bda40bfa11099a3ce5d3a7ac6"},
|
||||
{file = "MarkupSafe-2.1.1-cp310-cp310-win_amd64.whl", hash = "sha256:dda30ba7e87fbbb7eab1ec9f58678558fd9a6b8b853530e176eabd064da81417"},
|
||||
{file = "MarkupSafe-2.1.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:671cd1187ed5e62818414afe79ed29da836dde67166a9fac6d435873c44fdd02"},
|
||||
{file = "MarkupSafe-2.1.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3799351e2336dc91ea70b034983ee71cf2f9533cdff7c14c90ea126bfd95d65a"},
|
||||
{file = "MarkupSafe-2.1.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e72591e9ecd94d7feb70c1cbd7be7b3ebea3f548870aa91e2732960fa4d57a37"},
|
||||
{file = "MarkupSafe-2.1.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6fbf47b5d3728c6aea2abb0589b5d30459e369baa772e0f37a0320185e87c980"},
|
||||
{file = "MarkupSafe-2.1.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:d5ee4f386140395a2c818d149221149c54849dfcfcb9f1debfe07a8b8bd63f9a"},
|
||||
{file = "MarkupSafe-2.1.1-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:bcb3ed405ed3222f9904899563d6fc492ff75cce56cba05e32eff40e6acbeaa3"},
|
||||
{file = "MarkupSafe-2.1.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:e1c0b87e09fa55a220f058d1d49d3fb8df88fbfab58558f1198e08c1e1de842a"},
|
||||
{file = "MarkupSafe-2.1.1-cp37-cp37m-win32.whl", hash = "sha256:8dc1c72a69aa7e082593c4a203dcf94ddb74bb5c8a731e4e1eb68d031e8498ff"},
|
||||
{file = "MarkupSafe-2.1.1-cp37-cp37m-win_amd64.whl", hash = "sha256:97a68e6ada378df82bc9f16b800ab77cbf4b2fada0081794318520138c088e4a"},
|
||||
{file = "MarkupSafe-2.1.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:e8c843bbcda3a2f1e3c2ab25913c80a3c5376cd00c6e8c4a86a89a28c8dc5452"},
|
||||
{file = "MarkupSafe-2.1.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:0212a68688482dc52b2d45013df70d169f542b7394fc744c02a57374a4207003"},
|
||||
{file = "MarkupSafe-2.1.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8e576a51ad59e4bfaac456023a78f6b5e6e7651dcd383bcc3e18d06f9b55d6d1"},
|
||||
{file = "MarkupSafe-2.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4b9fe39a2ccc108a4accc2676e77da025ce383c108593d65cc909add5c3bd601"},
|
||||
{file = "MarkupSafe-2.1.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:96e37a3dc86e80bf81758c152fe66dbf60ed5eca3d26305edf01892257049925"},
|
||||
{file = "MarkupSafe-2.1.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:6d0072fea50feec76a4c418096652f2c3238eaa014b2f94aeb1d56a66b41403f"},
|
||||
{file = "MarkupSafe-2.1.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:089cf3dbf0cd6c100f02945abeb18484bd1ee57a079aefd52cffd17fba910b88"},
|
||||
{file = "MarkupSafe-2.1.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:6a074d34ee7a5ce3effbc526b7083ec9731bb3cbf921bbe1d3005d4d2bdb3a63"},
|
||||
{file = "MarkupSafe-2.1.1-cp38-cp38-win32.whl", hash = "sha256:421be9fbf0ffe9ffd7a378aafebbf6f4602d564d34be190fc19a193232fd12b1"},
|
||||
{file = "MarkupSafe-2.1.1-cp38-cp38-win_amd64.whl", hash = "sha256:fc7b548b17d238737688817ab67deebb30e8073c95749d55538ed473130ec0c7"},
|
||||
{file = "MarkupSafe-2.1.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:e04e26803c9c3851c931eac40c695602c6295b8d432cbe78609649ad9bd2da8a"},
|
||||
{file = "MarkupSafe-2.1.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b87db4360013327109564f0e591bd2a3b318547bcef31b468a92ee504d07ae4f"},
|
||||
{file = "MarkupSafe-2.1.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:99a2a507ed3ac881b975a2976d59f38c19386d128e7a9a18b7df6fff1fd4c1d6"},
|
||||
{file = "MarkupSafe-2.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:56442863ed2b06d19c37f94d999035e15ee982988920e12a5b4ba29b62ad1f77"},
|
||||
{file = "MarkupSafe-2.1.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3ce11ee3f23f79dbd06fb3d63e2f6af7b12db1d46932fe7bd8afa259a5996603"},
|
||||
{file = "MarkupSafe-2.1.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:33b74d289bd2f5e527beadcaa3f401e0df0a89927c1559c8566c066fa4248ab7"},
|
||||
{file = "MarkupSafe-2.1.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:43093fb83d8343aac0b1baa75516da6092f58f41200907ef92448ecab8825135"},
|
||||
{file = "MarkupSafe-2.1.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:8e3dcf21f367459434c18e71b2a9532d96547aef8a871872a5bd69a715c15f96"},
|
||||
{file = "MarkupSafe-2.1.1-cp39-cp39-win32.whl", hash = "sha256:d4306c36ca495956b6d568d276ac11fdd9c30a36f1b6eb928070dc5360b22e1c"},
|
||||
{file = "MarkupSafe-2.1.1-cp39-cp39-win_amd64.whl", hash = "sha256:46d00d6cfecdde84d40e572d63735ef81423ad31184100411e6e3388d405e247"},
|
||||
{file = "MarkupSafe-2.1.1.tar.gz", hash = "sha256:7f91197cc9e48f989d12e4e6fbc46495c446636dfc81b9ccf50bb0ec74b91d4b"},
|
||||
]
|
||||
|
||||
[metadata]
|
||||
lock-version = "2.1"
|
||||
python-versions = "^3.7"
|
||||
content-hash = "375b9a134584d381be4e5f1a5a3a6935f2ff7852fdf3fef8b128d3d1e89263f8"
|
||||
18
Telegram/build/docker/centos_env/pyproject.toml
Normal file
18
Telegram/build/docker/centos_env/pyproject.toml
Normal file
@@ -0,0 +1,18 @@
|
||||
[tool.poetry]
|
||||
name = "centos_env"
|
||||
version = "0.1.0"
|
||||
description = ""
|
||||
authors = []
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.7"
|
||||
Jinja2 = "^3.1.6"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
|
||||
[tool.poetry.scripts]
|
||||
gen_dockerfile = "gen_dockerfile:main"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
21
Telegram/build/docker/centos_env/run.sh
Executable file
21
Telegram/build/docker/centos_env/run.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
set -e
|
||||
FullExecPath=$PWD
|
||||
pushd `dirname $0` > /dev/null
|
||||
FullScriptPath=`pwd`
|
||||
popd > /dev/null
|
||||
|
||||
if [ ! -d "$FullScriptPath/../../../../../DesktopPrivate" ]; 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
|
||||
|
||||
Command="$1"
|
||||
if [ "$Command" == "" ]; then
|
||||
Command="bash"
|
||||
fi
|
||||
|
||||
docker run -it --rm --cpus=8 --memory=22g -u $(id -u) -v $HOME/Telegram/DesktopPrivate:/usr/src/DesktopPrivate -v $HOME/Telegram/tdesktop:/usr/src/tdesktop tdesktop:centos_env $Command
|
||||
73
Telegram/build/mac_store_upload.sh
Executable file
73
Telegram/build/mac_store_upload.sh
Executable file
@@ -0,0 +1,73 @@
|
||||
set -e
|
||||
FullExecPath=$PWD
|
||||
pushd `dirname $0` > /dev/null
|
||||
FullScriptPath=`pwd`
|
||||
popd > /dev/null
|
||||
|
||||
if [ ! -d "$FullScriptPath/../../../DesktopPrivate" ]; 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
|
||||
}
|
||||
|
||||
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"
|
||||
if [ "$AlphaVersion" != "0" ]; then
|
||||
AppVersion="$AlphaVersion"
|
||||
AppVersionStrFull="${AppVersionStr}_${AlphaVersion}"
|
||||
AlphaBetaParam="-alpha $AlphaVersion"
|
||||
AlphaKeyFile="talpha_${AppVersion}_key"
|
||||
elif [ "$BetaChannel" == "0" ]; then
|
||||
AppVersionStrFull="$AppVersionStr"
|
||||
AlphaBetaParam=''
|
||||
else
|
||||
AppVersionStrFull="$AppVersionStr.beta"
|
||||
AlphaBetaParam='-beta'
|
||||
fi
|
||||
|
||||
echo ""
|
||||
HomePath="$FullScriptPath/.."
|
||||
if [ "$BuildTarget" != "macstore" ]; then
|
||||
Error "Invalid target!"
|
||||
fi
|
||||
if [ "$AlphaVersion" != "0" ]; then
|
||||
Error "Can't upload macstore alpha version!"
|
||||
fi
|
||||
|
||||
echo "Uploading version $AppVersionStrFull to Mac App Store.."
|
||||
ProjectPath="$HomePath/../out"
|
||||
ReleasePath="$ProjectPath/Release"
|
||||
BinaryName="Telegram Lite"
|
||||
DeployPath="$ReleasePath/deploy/$AppVersionStrMajor/$AppVersionStrFull"
|
||||
PackageFile="$DeployPath/$BinaryName.pkg"
|
||||
|
||||
set +e
|
||||
xcrun altool --upload-app --username "$AC_USERNAME" --password "@keychain:AC_PASSWORD" -t macOS -f "$PackageFile"
|
||||
set -e
|
||||
|
||||
echo -en "\007";
|
||||
sleep 1;
|
||||
echo -en "\007";
|
||||
sleep 1;
|
||||
echo -en "\007";
|
||||
13
Telegram/build/prepare/linux.sh
Executable file
13
Telegram/build/prepare/linux.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
FullExecPath=$PWD
|
||||
pushd `dirname $0` > /dev/null
|
||||
FullScriptPath=`pwd`
|
||||
popd > /dev/null
|
||||
|
||||
|
||||
cd $FullScriptPath/../docker/centos_env
|
||||
poetry install
|
||||
poetry run gen_dockerfile | DOCKER_BUILDKIT=1 docker build -t tdesktop:centos_env -
|
||||
cd $FullExecPath
|
||||
7
Telegram/build/prepare/mac.sh
Executable file
7
Telegram/build/prepare/mac.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
set -e
|
||||
FullExecPath=$PWD
|
||||
pushd `dirname $0` > /dev/null
|
||||
FullScriptPath=`pwd`
|
||||
popd > /dev/null
|
||||
|
||||
python3 $FullScriptPath/prepare.py "$@"
|
||||
2014
Telegram/build/prepare/prepare.py
Normal file
2014
Telegram/build/prepare/prepare.py
Normal file
File diff suppressed because it is too large
Load Diff
12
Telegram/build/prepare/win.bat
Normal file
12
Telegram/build/prepare/win.bat
Normal file
@@ -0,0 +1,12 @@
|
||||
@echo OFF
|
||||
|
||||
set "FullScriptPath=%~dp0"
|
||||
|
||||
python %FullScriptPath%prepare.py %*
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
exit /b
|
||||
|
||||
:error
|
||||
echo FAILED
|
||||
exit /b 1
|
||||
13
Telegram/build/qt_version.py
Normal file
13
Telegram/build/qt_version.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import sys, os
|
||||
|
||||
def resolve(arch):
|
||||
if sys.platform == 'darwin':
|
||||
os.environ['QT'] = '6.2.13'
|
||||
elif sys.platform == 'win32':
|
||||
if arch == 'arm' or 'qt6' in sys.argv:
|
||||
print('Choosing Qt 6.')
|
||||
os.environ['QT'] = '6.10.1'
|
||||
else:
|
||||
print('Choosing Qt 5.')
|
||||
os.environ['QT'] = '5.15.18'
|
||||
return True
|
||||
351
Telegram/build/release.py
Normal file
351
Telegram/build/release.py
Normal file
@@ -0,0 +1,351 @@
|
||||
import os, sys, requests, pprint, re, json
|
||||
from uritemplate import URITemplate, expand
|
||||
from subprocess import call, Popen, PIPE
|
||||
from os.path import expanduser
|
||||
|
||||
changelog_file = '../../changelog.txt'
|
||||
token_file = '../../../DesktopPrivate/github-releases-token.txt'
|
||||
|
||||
version = ''
|
||||
commit = ''
|
||||
for arg in sys.argv:
|
||||
if re.match(r'\d+\.\d+', arg):
|
||||
version = arg
|
||||
elif re.match(r'^[a-f0-9]{40}$', arg):
|
||||
commit = arg
|
||||
|
||||
# thanks http://stackoverflow.com/questions/13909900/progress-of-python-requests-post
|
||||
class upload_in_chunks(object):
|
||||
def __init__(self, filename, chunksize=1 << 13):
|
||||
self.filename = filename
|
||||
self.chunksize = chunksize
|
||||
self.totalsize = os.path.getsize(filename)
|
||||
self.readsofar = 0
|
||||
|
||||
def __iter__(self):
|
||||
with open(self.filename, 'rb') as file:
|
||||
while True:
|
||||
data = file.read(self.chunksize)
|
||||
if not data:
|
||||
sys.stderr.write("\n")
|
||||
break
|
||||
self.readsofar += len(data)
|
||||
percent = self.readsofar * 1e2 / self.totalsize
|
||||
sys.stderr.write("\r{percent:3.0f}%".format(percent=percent))
|
||||
yield data
|
||||
|
||||
def __len__(self):
|
||||
return self.totalsize
|
||||
|
||||
class IterableToFileAdapter(object):
|
||||
def __init__(self, iterable):
|
||||
self.iterator = iter(iterable)
|
||||
self.length = len(iterable)
|
||||
|
||||
def read(self, size=-1): # TBD: add buffer for `len(data) > size` case
|
||||
return next(self.iterator, b'')
|
||||
|
||||
def __len__(self):
|
||||
return self.length
|
||||
|
||||
def checkResponseCode(result, right_code):
|
||||
if (result.status_code != right_code):
|
||||
print('Wrong result code: ' + str(result.status_code) + ', should be ' + str(right_code))
|
||||
sys.exit(1)
|
||||
|
||||
def getOutput(command):
|
||||
p = Popen(command.split(), stdout=PIPE)
|
||||
output, err = p.communicate()
|
||||
if err != None or p.returncode != 0:
|
||||
print('ERROR!')
|
||||
print(err)
|
||||
print(p.returncode)
|
||||
sys.exit(1)
|
||||
return output.decode('utf-8')
|
||||
|
||||
def invoke(command):
|
||||
return call(command.split()) == 0
|
||||
|
||||
def appendSubmodules(appendTo, root, rootRevision):
|
||||
startpath = os.getcwd()
|
||||
lines = getOutput('git submodule foreach').split('\n')
|
||||
for line in lines:
|
||||
if len(line) == 0:
|
||||
continue
|
||||
match = re.match(r"^Entering '([^']+)'$", line)
|
||||
if not match:
|
||||
print('Bad line: ' + line)
|
||||
return False
|
||||
path = match.group(1)
|
||||
subroot = root + '/' + path
|
||||
revision = getOutput('git rev-parse ' + rootRevision + ':' + path).split('\n')[0]
|
||||
print('Adding submodule ' + path + '...')
|
||||
os.chdir(path)
|
||||
tmppath = appendTo + '_tmp'
|
||||
if not invoke('git archive --prefix=' + subroot + '/ ' + revision + ' -o ' + tmppath + '.tar'):
|
||||
os.remove(appendTo + '.tar')
|
||||
os.remove(tmppath + '.tar')
|
||||
return False
|
||||
if not appendSubmodules(tmppath, subroot, revision):
|
||||
return False
|
||||
tar = 'tar' if sys.platform == 'linux' else 'gtar'
|
||||
if not invoke(tar + ' --concatenate --file=' + appendTo + '.tar ' + tmppath + '.tar'):
|
||||
os.remove(appendTo + '.tar')
|
||||
os.remove(tmppath + '.tar')
|
||||
return False
|
||||
os.remove(tmppath + '.tar')
|
||||
os.chdir(startpath)
|
||||
return True
|
||||
|
||||
def prepareSources():
|
||||
workpath = os.getcwd()
|
||||
os.chdir('../..')
|
||||
rootpath = os.getcwd()
|
||||
finalpart = rootpath + '/out/Release/sources'
|
||||
finalpath = finalpart + '.tar'
|
||||
if os.path.exists(finalpath):
|
||||
os.remove(finalpath)
|
||||
if os.path.exists(finalpath + '.gz'):
|
||||
os.remove(finalpath + '.gz')
|
||||
tmppath = rootpath + '/out/Release/tmp.tar'
|
||||
print('Preparing source tarball...')
|
||||
revision = 'v' + version
|
||||
targetRoot = 'tdesktop-' + version + '-full';
|
||||
if not invoke('git archive --prefix=' + targetRoot + '/ -o ' + finalpath + ' ' + revision):
|
||||
os.remove(finalpath)
|
||||
sys.exit(1)
|
||||
if not appendSubmodules(finalpart, targetRoot, revision):
|
||||
sys.exit(1)
|
||||
print('Compressing...')
|
||||
if not invoke('gzip -9 ' + finalpath):
|
||||
os.remove(finalpath)
|
||||
sys.exit(1)
|
||||
os.chdir(workpath)
|
||||
return finalpath + '.gz'
|
||||
|
||||
pp = pprint.PrettyPrinter(indent=2)
|
||||
url = 'https://api.github.com/'
|
||||
|
||||
version_parts = version.split('.')
|
||||
|
||||
stable = 1
|
||||
beta = 0
|
||||
|
||||
if len(version_parts) < 2:
|
||||
print('Error: expected at least major version ' + version)
|
||||
sys.exit(1)
|
||||
if len(version_parts) > 4:
|
||||
print('Error: bad version passed ' + version)
|
||||
sys.exit(1)
|
||||
version_major = version_parts[0] + '.' + version_parts[1]
|
||||
if len(version_parts) == 2:
|
||||
version = version_major + '.0'
|
||||
version_full = version
|
||||
else:
|
||||
version = version_major + '.' + version_parts[2]
|
||||
version_full = version
|
||||
if len(version_parts) == 4:
|
||||
if version_parts[3] == 'beta':
|
||||
beta = 1
|
||||
stable = 0
|
||||
version_full = version + '.beta'
|
||||
else:
|
||||
print('Error: unexpected version part ' + version_parts[3])
|
||||
sys.exit(1)
|
||||
|
||||
access_token = ''
|
||||
if os.path.isfile(token_file):
|
||||
with open(token_file) as f:
|
||||
for line in f:
|
||||
access_token = line.replace('\n', '')
|
||||
|
||||
if access_token == '':
|
||||
print('Access token not found!')
|
||||
sys.exit(1)
|
||||
|
||||
print('Version: ' + version_full)
|
||||
local_base = expanduser("~") + '/Projects/backup/tdesktop'
|
||||
if not os.path.isdir(local_base):
|
||||
local_base = '/mnt/c/Telegram/Projects/backup/tdesktop'
|
||||
if not os.path.isdir(local_base):
|
||||
print('Backup path not found: ' + local_base)
|
||||
sys.exit(1)
|
||||
local_folder = local_base + '/' + version_major + '/' + version_full
|
||||
|
||||
if stable == 1:
|
||||
if os.path.isdir(local_folder + '.beta'):
|
||||
beta = 1
|
||||
stable = 0
|
||||
version_full = version + '.beta'
|
||||
local_folder = local_folder + '.beta'
|
||||
|
||||
if not os.path.isdir(local_folder):
|
||||
print('Storage path not found: ' + local_folder)
|
||||
sys.exit(1)
|
||||
|
||||
local_folder = local_folder + '/'
|
||||
|
||||
files = []
|
||||
files.append({
|
||||
'local': 'sources',
|
||||
'remote': 'tdesktop-' + version + '-full.tar.gz',
|
||||
'mime': 'application/x-gzip',
|
||||
'label': 'Source code (tar.gz, full)',
|
||||
})
|
||||
files.append({
|
||||
'local': 'tsetup.' + version_full + '.exe',
|
||||
'remote': 'tsetup.' + version_full + '.exe',
|
||||
'backup_folder': 'tsetup',
|
||||
'mime': 'application/octet-stream',
|
||||
'label': 'Windows 32 bit: Installer',
|
||||
})
|
||||
files.append({
|
||||
'local': 'tportable.' + version_full + '.zip',
|
||||
'remote': 'tportable.' + version_full + '.zip',
|
||||
'backup_folder': 'tsetup',
|
||||
'mime': 'application/zip',
|
||||
'label': 'Windows 32 bit: Portable',
|
||||
})
|
||||
files.append({
|
||||
'local': 'tsetup-x64.' + version_full + '.exe',
|
||||
'remote': 'tsetup-x64.' + version_full + '.exe',
|
||||
'backup_folder': 'tx64',
|
||||
'mime': 'application/octet-stream',
|
||||
'label': 'Windows 64 bit: Installer',
|
||||
})
|
||||
files.append({
|
||||
'local': 'tportable-x64.' + version_full + '.zip',
|
||||
'remote': 'tportable-x64.' + version_full + '.zip',
|
||||
'backup_folder': 'tx64',
|
||||
'mime': 'application/zip',
|
||||
'label': 'Windows 64 bit: Portable',
|
||||
})
|
||||
files.append({
|
||||
'local': 'tsetup-arm64.' + version_full + '.exe',
|
||||
'remote': 'tsetup-arm64.' + version_full + '.exe',
|
||||
'backup_folder': 'tarm64',
|
||||
'mime': 'application/octet-stream',
|
||||
'label': 'Windows on ARM: Installer',
|
||||
})
|
||||
files.append({
|
||||
'local': 'tportable-arm64.' + version_full + '.zip',
|
||||
'remote': 'tportable-arm64.' + version_full + '.zip',
|
||||
'backup_folder': 'tarm64',
|
||||
'mime': 'application/zip',
|
||||
'label': 'Windows on ARM: Portable',
|
||||
})
|
||||
files.append({
|
||||
'local': 'tsetup.' + version_full + '.dmg',
|
||||
'remote': 'tsetup.' + version_full + '.dmg',
|
||||
'backup_folder': 'tmac',
|
||||
'mime': 'application/octet-stream',
|
||||
'label': 'macOS 10.13+: Installer',
|
||||
})
|
||||
files.append({
|
||||
'local': 'tsetup.' + version_full + '.tar.xz',
|
||||
'remote': 'tsetup.' + version_full + '.tar.xz',
|
||||
'backup_folder': 'tlinux',
|
||||
'mime': 'application/octet-stream',
|
||||
'label': 'Linux 64 bit: Binary',
|
||||
})
|
||||
|
||||
r = requests.get(url + 'repos/telegramdesktop/tdesktop/releases/tags/v' + version)
|
||||
if r.status_code == 404:
|
||||
print('Release not found, creating.')
|
||||
if commit == '':
|
||||
print('Error: specify the commit.')
|
||||
sys.exit(1)
|
||||
if not os.path.isfile(changelog_file):
|
||||
print('Error: Changelog file not found.')
|
||||
sys.exit(1)
|
||||
changelog = ''
|
||||
started = 0
|
||||
with open(changelog_file) as f:
|
||||
for line in f:
|
||||
if started == 1:
|
||||
if re.match(r'^\d+\.\d+', line):
|
||||
break
|
||||
changelog += line
|
||||
else:
|
||||
if re.match(r'^\d+\.\d+', line):
|
||||
if line[0:len(version) + 1] == version + ' ':
|
||||
started = 1
|
||||
elif line[0:len(version_major) + 1] == version_major + ' ':
|
||||
if version_major + '.0' == version:
|
||||
started = 1
|
||||
if started != 1:
|
||||
print('Error: Changelog not found.')
|
||||
sys.exit(1)
|
||||
|
||||
changelog = changelog.strip()
|
||||
print('Changelog: ')
|
||||
print(changelog)
|
||||
|
||||
r = requests.post(url + 'repos/telegramdesktop/tdesktop/releases', headers={'Authorization': 'token ' + access_token}, data=json.dumps({
|
||||
'tag_name': 'v' + version,
|
||||
'target_commitish': commit,
|
||||
'name': 'v ' + version,
|
||||
'body': changelog,
|
||||
'prerelease': (beta == 1),
|
||||
}))
|
||||
checkResponseCode(r, 201)
|
||||
|
||||
tagname = 'v' + version
|
||||
invoke("git fetch origin")
|
||||
if stable == 1:
|
||||
invoke("git push launchpad {}:master".format(tagname))
|
||||
else:
|
||||
invoke("git push launchpad {}:beta".format(tagname))
|
||||
invoke("git push --tags launchpad")
|
||||
|
||||
r = requests.get(url + 'repos/telegramdesktop/tdesktop/releases/tags/v' + version)
|
||||
checkResponseCode(r, 200)
|
||||
|
||||
release_data = r.json()
|
||||
#pp.pprint(release_data)
|
||||
|
||||
release_id = release_data['id']
|
||||
print('Release ID: ' + str(release_id))
|
||||
|
||||
r = requests.get(url + 'repos/telegramdesktop/tdesktop/releases/' + str(release_id) + '/assets')
|
||||
checkResponseCode(r, 200)
|
||||
|
||||
assets = release_data['assets']
|
||||
for asset in assets:
|
||||
name = asset['name']
|
||||
found = 0
|
||||
for file in files:
|
||||
if file['remote'] == name:
|
||||
print('Already uploaded: ' + name)
|
||||
file['already'] = 1
|
||||
found = 1
|
||||
break
|
||||
if found == 0:
|
||||
print('Warning: strange asset: ' + name)
|
||||
|
||||
for file in files:
|
||||
if 'already' in file:
|
||||
continue
|
||||
if file['local'] == 'sources':
|
||||
file_path = prepareSources()
|
||||
else:
|
||||
file_path = local_folder + file['backup_folder'] + '/' + file['local']
|
||||
if not os.path.isfile(file_path):
|
||||
print('Warning: file not found ' + file['local'])
|
||||
continue
|
||||
|
||||
upload_url = expand(release_data['upload_url'], {'name': file['remote'], 'label': file['label']})
|
||||
|
||||
content = upload_in_chunks(file_path, 10)
|
||||
|
||||
print('Uploading: ' + file['remote'] + ' (' + str(round(len(content) / 10000) / 100.) + ' MB)')
|
||||
r = requests.post(upload_url, headers={'Content-Type': file['mime'], 'Authorization': 'token ' + access_token}, data=IterableToFileAdapter(content))
|
||||
|
||||
checkResponseCode(r, 201)
|
||||
|
||||
print('Success! Removing.')
|
||||
if not invoke('rm ' + file_path):
|
||||
print('Bad rm return code :(')
|
||||
sys.exit(1)
|
||||
|
||||
sys.exit()
|
||||
44
Telegram/build/release.sh
Executable file
44
Telegram/build/release.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
set -e
|
||||
FullExecPath=$PWD
|
||||
pushd `dirname $0` > /dev/null
|
||||
FullScriptPath=`pwd`
|
||||
popd > /dev/null
|
||||
|
||||
Param1="$1"
|
||||
Param2="$2"
|
||||
Param3="$3"
|
||||
Param4="$4"
|
||||
|
||||
if [ ! -d "$FullScriptPath/../../../DesktopPrivate" ]; 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
|
||||
}
|
||||
|
||||
while IFS='' read -r line || [[ -n "$line" ]]; do
|
||||
set $line
|
||||
eval $1="$2"
|
||||
done < "$FullScriptPath/version"
|
||||
|
||||
VersionForPacker="$AppVersion"
|
||||
if [ "$AlphaVersion" != "0" ]; then
|
||||
Error "No releases for closed alpha versions"
|
||||
elif [ "$BetaChannel" == "0" ]; then
|
||||
AppVersionStrFull="$AppVersionStr"
|
||||
AlphaBetaParam=''
|
||||
else
|
||||
AppVersionStrFull="$AppVersionStr.beta"
|
||||
AlphaBetaParam='-beta'
|
||||
fi
|
||||
|
||||
cd "$FullScriptPath"
|
||||
python3 release.py $AppVersionStr $Param1 $Param2 $Param3 $Param4
|
||||
35
Telegram/build/replace.vbs
Normal file
35
Telegram/build/replace.vbs
Normal file
@@ -0,0 +1,35 @@
|
||||
Dim action, pat, patparts, rxp, inp, matchCount
|
||||
action = WScript.Arguments(0)
|
||||
pat = WScript.Arguments(1)
|
||||
pat = Replace(pat, """, chr(34))
|
||||
pat = Replace(pat, "&hat;", "^")
|
||||
pat = Replace(pat, "&", "&")
|
||||
|
||||
Set rxp = new RegExp
|
||||
rxp.Global = True
|
||||
rxp.Multiline = False
|
||||
If action = "Replace" Then
|
||||
patparts = Split(pat, "/")
|
||||
rxp.Pattern = patparts(0)
|
||||
Else
|
||||
rxp.Pattern = pat
|
||||
End If
|
||||
|
||||
matchCount = 0
|
||||
Do While Not WScript.StdIn.AtEndOfStream
|
||||
inp = WScript.StdIn.ReadLine()
|
||||
If rxp.Test(inp) Then
|
||||
matchCount = matchCount + 1
|
||||
End If
|
||||
If action = "Replace" Then
|
||||
WScript.Echo rxp.Replace(inp, patparts(1))
|
||||
End If
|
||||
Loop
|
||||
|
||||
If action = "Replace" Then
|
||||
If matchCount = 0 Then
|
||||
WScript.Quit(2)
|
||||
End If
|
||||
Else
|
||||
WScript.Echo matchCount
|
||||
End If
|
||||
12
Telegram/build/set_version.bat
Normal file
12
Telegram/build/set_version.bat
Normal file
@@ -0,0 +1,12 @@
|
||||
@echo OFF
|
||||
|
||||
set "FullScriptPath=%~dp0"
|
||||
|
||||
python %FullScriptPath%set_version.py %1
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
exit /b
|
||||
|
||||
:error
|
||||
echo FAILED
|
||||
exit /b 1
|
||||
153
Telegram/build/set_version.py
Normal file
153
Telegram/build/set_version.py
Normal file
@@ -0,0 +1,153 @@
|
||||
'''
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
'''
|
||||
import sys, os, re, subprocess, io
|
||||
|
||||
def finish(code):
|
||||
global executePath
|
||||
os.chdir(executePath)
|
||||
sys.exit(code)
|
||||
|
||||
if sys.platform == 'win32' and not 'COMSPEC' in os.environ:
|
||||
print('[ERROR] COMSPEC environment variable is not set.')
|
||||
finish(1)
|
||||
|
||||
executePath = os.getcwd()
|
||||
scriptPath = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
inputVersion = ''
|
||||
versionOriginal = ''
|
||||
versionMajor = ''
|
||||
versionMinor = ''
|
||||
versionPatch = ''
|
||||
versionAlpha = '0'
|
||||
versionBeta = False
|
||||
for arg in sys.argv:
|
||||
match = re.match(r'^\s*(\d+)\.(\d+)(\.(\d+)(\.(\d+|beta))?)?\s*$', arg)
|
||||
if match:
|
||||
inputVersion = arg
|
||||
versionOriginal = inputVersion
|
||||
versionMajor = match.group(1)
|
||||
versionMinor = match.group(2)
|
||||
versionPatch = match.group(4) if match.group(4) else '0'
|
||||
versionAlphaBeta = match.group(5) if match.group(5) else ''
|
||||
if len(versionAlphaBeta) > 0:
|
||||
if match.group(6) == 'beta':
|
||||
versionBeta = True
|
||||
else:
|
||||
versionAlpha = match.group(6)
|
||||
|
||||
if not len(versionMajor):
|
||||
print("Wrong version parameter")
|
||||
finish(1)
|
||||
|
||||
def checkVersionPart(part):
|
||||
cleared = int(part) % 1000 if len(part) > 0 else 0
|
||||
if str(cleared) != part:
|
||||
print("Bad version part: " + part)
|
||||
finish(1)
|
||||
|
||||
checkVersionPart(versionMajor)
|
||||
checkVersionPart(versionMinor)
|
||||
checkVersionPart(versionPatch)
|
||||
checkVersionPart(versionAlpha)
|
||||
|
||||
versionFull = str(int(versionMajor) * 1000000 + int(versionMinor) * 1000 + int(versionPatch))
|
||||
versionFullAlpha = '0'
|
||||
if versionAlpha != '0':
|
||||
versionFullAlpha = str(int(versionFull) * 1000 + int(versionAlpha))
|
||||
|
||||
versionStr = versionMajor + '.' + versionMinor + '.' + versionPatch
|
||||
versionStrSmall = versionStr if versionPatch != '0' else versionMajor + '.' + versionMinor
|
||||
|
||||
if versionBeta:
|
||||
print('Setting version: ' + versionStr + ' beta')
|
||||
elif versionAlpha != '0':
|
||||
print('Setting version: ' + versionStr + '.' + versionAlpha + ' closed alpha')
|
||||
else:
|
||||
print('Setting version: ' + versionStr + ' stable')
|
||||
|
||||
#def replaceInFile(path, replaces):
|
||||
|
||||
def checkChangelog():
|
||||
global scriptPath, versionStr, versionStrSmall
|
||||
|
||||
count = 0
|
||||
with io.open(scriptPath + '/../../changelog.txt', encoding='utf-8') as f:
|
||||
for line in f:
|
||||
if line.startswith(versionStr + ' ') or line.startswith(versionStrSmall + ' '):
|
||||
count = count + 1
|
||||
if count == 0:
|
||||
print('Changelog entry not found!')
|
||||
finish(1)
|
||||
elif count != 1:
|
||||
print('Wrong changelog entries count found: ' + count)
|
||||
finish(1)
|
||||
|
||||
checkChangelog()
|
||||
|
||||
def replaceInFile(path, replacements):
|
||||
content = ''
|
||||
foundReplacements = {}
|
||||
updated = False
|
||||
with open(path, 'r') as f:
|
||||
for line in f:
|
||||
for replacement in replacements:
|
||||
if re.search(replacement[0], line):
|
||||
changed = re.sub(replacement[0], replacement[1], line)
|
||||
if changed != line:
|
||||
line = changed
|
||||
updated = True
|
||||
foundReplacements[replacement[0]] = True
|
||||
content = content + line
|
||||
for replacement in replacements:
|
||||
if not replacement[0] in foundReplacements:
|
||||
print('Could not find "' + replacement[0] + '" in "' + path + '".')
|
||||
finish(1)
|
||||
if updated:
|
||||
with open(path, 'w') as f:
|
||||
f.write(content)
|
||||
|
||||
print('Patching build/version...')
|
||||
replaceInFile(scriptPath + '/version', [
|
||||
[ r'(AppVersion\s+)\d+', r'\g<1>' + versionFull ],
|
||||
[ r'(AppVersionStrMajor\s+)\d[\d\.]*', r'\g<1>' + versionMajor + '.' + versionMinor ],
|
||||
[ r'(AppVersionStrSmall\s+)\d[\d\.]*', r'\g<1>' + versionStrSmall ],
|
||||
[ r'(AppVersionStr\s+)\d[\d\.]*', r'\g<1>' + versionStr ],
|
||||
[ r'(BetaChannel\s+)\d', r'\g<1>' + ('1' if versionBeta else '0') ],
|
||||
[ r'(AlphaVersion\s+)\d+', r'\g<1>' + versionFullAlpha ],
|
||||
[ r'(AppVersionOriginal\s+)\d[\d\.beta]*', r'\g<1>' + versionOriginal ],
|
||||
])
|
||||
|
||||
print('Patching core/version.h...')
|
||||
replaceInFile(scriptPath + '/../SourceFiles/core/version.h', [
|
||||
[ r'(TDESKTOP_REQUESTED_ALPHA_VERSION\s+)\(\d+ULL\)', r'\g<1>(' + versionFullAlpha + 'ULL)' ],
|
||||
[ r'(AppVersion\s+=\s+)\d+', r'\g<1>' + versionFull ],
|
||||
[ r'(AppVersionStr\s+=\s+)[^;]+', r'\g<1>"' + versionStrSmall + '"' ],
|
||||
[ r'(AppBetaVersion\s+=\s+)[a-z]+', r'\g<1>' + ('true' if versionBeta else 'false') ],
|
||||
])
|
||||
|
||||
parts = [versionMajor, versionMinor, versionPatch, versionAlpha]
|
||||
withcomma = ','.join(parts)
|
||||
withdot = '.'.join(parts)
|
||||
rcReplaces = [
|
||||
[ r'(FILEVERSION\s+)\d+,\d+,\d+,\d+', r'\g<1>' + withcomma ],
|
||||
[ r'(PRODUCTVERSION\s+)\d+,\d+,\d+,\d+', r'\g<1>' + withcomma ],
|
||||
[ r'("FileVersion",\s+)"\d+\.\d+\.\d+\.\d+"', r'\g<1>"' + withdot + '"' ],
|
||||
[ r'("ProductVersion",\s+)"\d+\.\d+\.\d+\.\d+"', r'\g<1>"' + withdot + '"' ],
|
||||
]
|
||||
|
||||
print('Patching Telegram.rc...')
|
||||
replaceInFile(scriptPath + '/../Resources/winrc/Telegram.rc', rcReplaces)
|
||||
|
||||
print('Patching Updater.rc...')
|
||||
replaceInFile(scriptPath + '/../Resources/winrc/Updater.rc', rcReplaces)
|
||||
|
||||
print('Patching appxmanifest.xml...')
|
||||
replaceInFile(scriptPath + '/../Resources/uwp/AppX/AppxManifest.xml', [
|
||||
[ r'( Version=)"\d+\.\d+\.\d+\.\d+"', r'\g<1>"' + withdot + '"' ],
|
||||
])
|
||||
9
Telegram/build/set_version.sh
Executable file
9
Telegram/build/set_version.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
set -e
|
||||
|
||||
pushd `dirname $0` > /dev/null
|
||||
FullScriptPath=`pwd`
|
||||
popd > /dev/null
|
||||
|
||||
python3 $FullScriptPath/set_version.py $1
|
||||
|
||||
exit
|
||||
148
Telegram/build/setup.iss
Normal file
148
Telegram/build/setup.iss
Normal file
@@ -0,0 +1,148 @@
|
||||
#define MyAppShortName "Telegram"
|
||||
#define MyAppName "Telegram Desktop"
|
||||
#define MyAppPublisher "Telegram FZ-LLC"
|
||||
#define MyAppURL "https://desktop.telegram.org"
|
||||
#define MyAppExeName "Telegram.exe"
|
||||
#define MyAppId "53F49750-6209-4FBF-9CA8-7A333C87D1ED"
|
||||
#define CurrentYear GetDateTimeString('yyyy','','')
|
||||
|
||||
[Setup]
|
||||
; NOTE: The value of AppId uniquely identifies this application.
|
||||
; Do not use the same AppId value in installers for other applications.
|
||||
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
|
||||
AppId={{{#MyAppId}}
|
||||
AppName={#MyAppName}
|
||||
AppVersion={#MyAppVersion}
|
||||
AppCopyright={#MyAppPublisher} 2014-{#CurrentYear}
|
||||
AppPublisher={#MyAppPublisher}
|
||||
AppPublisherURL={#MyAppURL}
|
||||
AppSupportURL={#MyAppURL}
|
||||
AppUpdatesURL={#MyAppURL}
|
||||
DefaultDirName={userappdata}\{#MyAppName}
|
||||
DefaultGroupName={#MyAppName}
|
||||
AllowNoIcons=yes
|
||||
OutputDir={#ReleasePath}
|
||||
SetupIconFile={#SourcePath}..\Resources\art\icon256.ico
|
||||
UninstallDisplayName={#MyAppName}
|
||||
UninstallDisplayIcon={app}\Telegram.exe
|
||||
Compression=lzma
|
||||
SolidCompression=yes
|
||||
DisableStartupPrompt=yes
|
||||
PrivilegesRequired=lowest
|
||||
VersionInfoVersion={#MyAppVersion}.0
|
||||
CloseApplications=force
|
||||
DisableDirPage=no
|
||||
DisableProgramGroupPage=no
|
||||
WizardStyle=modern
|
||||
SignTool=sha256
|
||||
|
||||
#if MyBuildTarget == "winarm"
|
||||
ArchitecturesAllowed="arm64"
|
||||
OutputBaseFilename=tsetup-arm64.{#MyAppVersionFull}
|
||||
#define ArchModulesFolder "arm64"
|
||||
AppVerName={#MyAppName} {#MyAppVersion} arm64
|
||||
#elif MyBuildTarget == "win64"
|
||||
ArchitecturesAllowed="x64compatible"
|
||||
ArchitecturesInstallIn64BitMode="x64compatible"
|
||||
OutputBaseFilename=tsetup-x64.{#MyAppVersionFull}
|
||||
#define ArchModulesFolder "x64"
|
||||
AppVerName={#MyAppName} {#MyAppVersion} 64bit
|
||||
#else
|
||||
OutputBaseFilename=tsetup.{#MyAppVersionFull}
|
||||
#define ArchModulesFolder "x86"
|
||||
AppVerName={#MyAppName} {#MyAppVersion} 32bit
|
||||
#endif
|
||||
|
||||
#define ModulesFolder "modules\" + ArchModulesFolder
|
||||
|
||||
[Languages]
|
||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
Name: "it"; MessagesFile: "compiler:Languages\Italian.isl"
|
||||
Name: "es"; MessagesFile: "compiler:Languages\Spanish.isl"
|
||||
Name: "de"; MessagesFile: "compiler:Languages\German.isl"
|
||||
Name: "nl"; MessagesFile: "compiler:Languages\Dutch.isl"
|
||||
Name: "pt_BR"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"
|
||||
Name: "ru"; MessagesFile: "compiler:Languages\Russian.isl"
|
||||
Name: "fr"; MessagesFile: "compiler:Languages\French.isl"
|
||||
Name: "ua"; MessagesFile: "compiler:Languages\Ukrainian.isl"
|
||||
|
||||
[Tasks]
|
||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"
|
||||
|
||||
[Files]
|
||||
Source: "{#ReleasePath}\Telegram.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "{#ReleasePath}\Updater.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
#if MyBuildTarget != "winarm"
|
||||
Source: "{#ReleasePath}\{#ModulesFolder}\d3d\d3dcompiler_47.dll"; DestDir: "{app}\{#ModulesFolder}\d3d"; Flags: ignoreversion
|
||||
#endif
|
||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||
|
||||
[Icons]
|
||||
Name: "{group}\{#MyAppShortName}"; Filename: "{app}\{#MyAppExeName}"
|
||||
Name: "{group}\{cm:UninstallProgram,{#MyAppShortName}}"; Filename: "{uninstallexe}"
|
||||
Name: "{userdesktop}\{#MyAppShortName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
|
||||
|
||||
[Run]
|
||||
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppShortName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
||||
|
||||
[UninstallDelete]
|
||||
Type: files; Name: "{app}\data"
|
||||
Type: files; Name: "{app}\data_config"
|
||||
Type: files; Name: "{app}\log.txt"
|
||||
Type: filesandordirs; Name: "{app}\DebugLogs"
|
||||
Type: filesandordirs; Name: "{app}\tupdates"
|
||||
Type: filesandordirs; Name: "{app}\tdata"
|
||||
Type: filesandordirs; Name: "{app}\tcache"
|
||||
Type: filesandordirs; Name: "{app}\tdumps"
|
||||
Type: filesandordirs; Name: "{app}\modules"
|
||||
Type: dirifempty; Name: "{app}"
|
||||
Type: files; Name: "{userappdata}\{#MyAppName}\data"
|
||||
Type: files; Name: "{userappdata}\{#MyAppName}\data_config"
|
||||
Type: files; Name: "{userappdata}\{#MyAppName}\log.txt"
|
||||
Type: filesandordirs; Name: "{userappdata}\{#MyAppName}\DebugLogs"
|
||||
Type: filesandordirs; Name: "{userappdata}\{#MyAppName}\tupdates"
|
||||
Type: filesandordirs; Name: "{userappdata}\{#MyAppName}\tdata"
|
||||
Type: filesandordirs; Name: "{userappdata}\{#MyAppName}\tcache"
|
||||
Type: filesandordirs; Name: "{userappdata}\{#MyAppName}\tdumps"
|
||||
Type: filesandordirs; Name: "{userappdata}\{#MyAppName}\modules"
|
||||
Type: dirifempty; Name: "{userappdata}\{#MyAppName}"
|
||||
|
||||
[Code]
|
||||
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
|
||||
var ResultCode: Integer;
|
||||
begin
|
||||
if CurUninstallStep = usUninstall then
|
||||
begin
|
||||
ShellExec('', ExpandConstant('{app}\{#MyAppExeName}'), '-cleanup', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
|
||||
end;
|
||||
end;
|
||||
|
||||
const CSIDL_DESKTOPDIRECTORY = $0010;
|
||||
CSIDL_COMMON_DESKTOPDIRECTORY = $0019;
|
||||
|
||||
procedure CurStepChanged(CurStep: TSetupStep);
|
||||
var ResultCode: Integer;
|
||||
HasOldKey: Boolean;
|
||||
HasNewKey: Boolean;
|
||||
HasOldLnk: Boolean;
|
||||
HasNewLnk: Boolean;
|
||||
UserDesktopLnk: String;
|
||||
CommonDesktopLnk: String;
|
||||
begin
|
||||
if CurStep = ssPostInstall then
|
||||
begin
|
||||
HasNewKey := RegKeyExists(HKEY_CURRENT_USER, 'Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{{#MyAppId}}_is1') or RegKeyExists(HKEY_CURRENT_USER, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{{#MyAppId}}_is1');
|
||||
HasOldKey := RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{{#MyAppId}}_is1') or RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{{#MyAppId}}_is1');
|
||||
UserDesktopLnk := ExpandFileName(GetShellFolderByCSIDL(CSIDL_DESKTOPDIRECTORY, False) + '\{#MyAppShortName}.lnk');
|
||||
CommonDesktopLnk := ExpandFileName(GetShellFolderByCSIDL(CSIDL_COMMON_DESKTOPDIRECTORY, False) + '\{#MyAppShortName}.lnk');
|
||||
HasNewLnk := FileExists(UserDesktopLnk);
|
||||
HasOldLnk := FileExists(CommonDesktopLnk) and (UserDesktopLnk <> CommonDesktopLnk);
|
||||
if (HasOldKey and HasNewKey) or (HasOldLnk and HasNewLnk) then
|
||||
begin
|
||||
if (GetWindowsVersion >= $06000000) then // Vista or later
|
||||
ShellExec('runas', ExpandConstant('{app}\{#MyAppExeName}'), '-fixprevious', '', SW_SHOW, ewWaitUntilTerminated, ResultCode)
|
||||
else
|
||||
ShellExec('', ExpandConstant('{app}\{#MyAppExeName}'), '-fixprevious', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
81
Telegram/build/test_package.bat
Normal file
81
Telegram/build/test_package.bat
Normal file
@@ -0,0 +1,81 @@
|
||||
@echo OFF
|
||||
setlocal enabledelayedexpansion
|
||||
set "FullScriptPath=%~dp0"
|
||||
set "FullExecPath=%cd%"
|
||||
|
||||
if not exist "%FullScriptPath%..\..\..\DesktopPrivate" (
|
||||
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 /b
|
||||
)
|
||||
|
||||
set "HomePath=%FullScriptPath%.."
|
||||
set "SignAppxPath=%HomePath%\..\..\DesktopPrivate\AppxSign.bat"
|
||||
set "ResourcesPath=%HomePath%\Resources"
|
||||
set "SolutionPath=%HomePath%\.."
|
||||
set "ReleasePath=%HomePath%\..\out\Debug"
|
||||
set "BinaryName=Telegram"
|
||||
|
||||
if exist %ReleasePath%\AppX\ (
|
||||
echo Result folder out\Debug\AppX already exists!
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
cd "%HomePath%"
|
||||
|
||||
call gyp\refresh.bat
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
cd "%SolutionPath%"
|
||||
call ninja -C out/Debug Telegram
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
cd "%HomePath%"
|
||||
|
||||
mkdir "%ReleasePath%\AppX"
|
||||
xcopy "Resources\uwp\AppX\*" "%ReleasePath%\AppX\" /E
|
||||
|
||||
set "ResourcePath=%ReleasePath%\AppX\AppxManifest.xml"
|
||||
call :repl "Argument= (Publisher=)"CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"/ $1"CN=Telegram FZ-LLC, O=Telegram FZ-LLC, L=Dubai, C=AE"" "Filename=%ResourcePath%" || goto :error
|
||||
call :repl "Argument= (ProcessorArchitecture=)"ARCHITECTURE"/ $1"x64"" "Filename=%ResourcePath%" || goto :error
|
||||
|
||||
makepri new /pr Resources\uwp\AppX\ /cf Resources\uwp\priconfig.xml /mn %ReleasePath%\AppX\AppxManifest.xml /of %ReleasePath%\AppX\resources.pri
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
xcopy "%ReleasePath%\%BinaryName%.exe" "%ReleasePath%\AppX\"
|
||||
|
||||
MakeAppx.exe pack /d "%ReleasePath%\AppX" /l /p ..\out\Debug\%BinaryName%.appx
|
||||
if %errorlevel% neq 0 goto error
|
||||
|
||||
call "%SignAppxPath%" "..\out\Debug\%BinaryName%.appx"
|
||||
|
||||
move "%ReleasePath%\%BinaryName%.appx" "%ReleasePath%\AppX\"
|
||||
|
||||
echo Done.
|
||||
|
||||
exit /b
|
||||
|
||||
:repl
|
||||
(
|
||||
set %1
|
||||
set %2
|
||||
set "TempFilename=!Filename!__tmp__"
|
||||
cscript //Nologo "%FullScriptPath%replace.vbs" "Replace" "!Argument!" < "!Filename!" > "!TempFilename!" || goto :repl_finish
|
||||
xcopy /Y !TempFilename! !Filename! >NUL || goto :repl_finish
|
||||
goto :repl_finish
|
||||
)
|
||||
|
||||
:repl_finish
|
||||
(
|
||||
set ErrorCode=%errorlevel%
|
||||
if !ErrorCode! neq 0 (
|
||||
echo Replace error !ErrorCode!
|
||||
echo While replacing "%Replace%"
|
||||
echo In file "%Filename%"
|
||||
)
|
||||
del %TempFilename%
|
||||
exit /b !ErrorCode!
|
||||
)
|
||||
208
Telegram/build/updates.py
Normal file
208
Telegram/build/updates.py
Normal file
@@ -0,0 +1,208 @@
|
||||
import os, sys, re, subprocess, datetime, time
|
||||
|
||||
executePath = os.getcwd()
|
||||
scriptPath = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
lastCommit = ''
|
||||
today = ''
|
||||
uuid = ''
|
||||
nextLast = False
|
||||
nextDate = False
|
||||
nextUuid = False
|
||||
building = True
|
||||
composing = False
|
||||
conf = 'Release'
|
||||
for arg in sys.argv:
|
||||
if nextLast:
|
||||
lastCommit = arg
|
||||
nextLast = False
|
||||
elif nextDate:
|
||||
today = arg
|
||||
nextDate = False
|
||||
elif nextUuid:
|
||||
uuid = arg
|
||||
nextUuid = False
|
||||
elif arg == 'send':
|
||||
building = False
|
||||
composing = False
|
||||
elif arg == 'from':
|
||||
nextLast = True
|
||||
building = False
|
||||
composing = True
|
||||
elif arg == 'date':
|
||||
nextDate = True
|
||||
elif arg == 'request_uuid':
|
||||
nextUuid = True
|
||||
elif arg == 'debug':
|
||||
conf = 'Debug'
|
||||
|
||||
def finish(code, error = ''):
|
||||
if error != '':
|
||||
print('[ERROR] ' + error)
|
||||
global executePath
|
||||
os.chdir(executePath)
|
||||
sys.exit(code)
|
||||
|
||||
os.chdir(scriptPath + '/..')
|
||||
|
||||
if 'AC_USERNAME' not in os.environ:
|
||||
finish(1, 'AC_USERNAME not found!')
|
||||
username = os.environ['AC_USERNAME']
|
||||
|
||||
if today == '':
|
||||
today = datetime.datetime.now().strftime("%d_%m_%y")
|
||||
outputFolder = 'updates/' + today
|
||||
|
||||
archive = 'tdesktop_macOS_' + today + '.zip'
|
||||
|
||||
if building:
|
||||
print('Building ' + conf + ' version for OS X 10.13+..')
|
||||
|
||||
if os.path.exists('../out/' + conf + '/' + outputFolder):
|
||||
finish(1, 'Todays updates version exists.')
|
||||
|
||||
if uuid == '':
|
||||
result = subprocess.call('./configure.sh', shell=True)
|
||||
if result != 0:
|
||||
finish(1, 'While calling GYP.')
|
||||
|
||||
os.chdir('../out')
|
||||
if uuid == '':
|
||||
result = subprocess.call('cmake --build . --config ' + conf + ' --target Telegram', shell=True)
|
||||
if result != 0:
|
||||
finish(1, 'While building Telegram.')
|
||||
|
||||
os.chdir(conf);
|
||||
if uuid == '':
|
||||
if not os.path.exists('Telegram.app'):
|
||||
finish(1, 'Telegram.app not found.')
|
||||
|
||||
result = subprocess.call('strip Telegram.app/Contents/MacOS/Telegram', shell=True)
|
||||
if result != 0:
|
||||
finish(1, 'While stripping Telegram.')
|
||||
|
||||
result = subprocess.call('codesign --force --deep --timestamp --options runtime --sign "Developer ID Application: Telegram FZ-LLC (C67CF9S4VU)" Telegram.app --entitlements "../../Telegram/Telegram/Telegram.entitlements"', shell=True)
|
||||
if result != 0:
|
||||
finish(1, 'While signing Telegram.')
|
||||
|
||||
if not os.path.exists('Telegram.app/Contents/Frameworks/Updater'):
|
||||
finish(1, 'Updater not found.')
|
||||
elif not os.path.exists('Telegram.app/Contents/Helpers/crashpad_handler'):
|
||||
finish(1, 'crashpad_handler not found.')
|
||||
elif not os.path.exists('Telegram.app/Contents/_CodeSignature'):
|
||||
finish(1, 'Signature not found.')
|
||||
|
||||
if os.path.exists(today):
|
||||
subprocess.call('rm -rf ' + today, shell=True)
|
||||
result = subprocess.call('mkdir -p ' + today + '/TelegramForcePortable', shell=True)
|
||||
if result != 0:
|
||||
finish(1, 'Creating folder ' + today + '/TelegramForcePortable')
|
||||
|
||||
result = subprocess.call('cp -r Telegram.app ' + today + '/', shell=True)
|
||||
if result != 0:
|
||||
finish(1, 'Cloning Telegram.app to ' + today + '.')
|
||||
|
||||
result = subprocess.call('zip -r ' + archive + ' ' + today, shell=True)
|
||||
if result != 0:
|
||||
finish(1, 'Adding tdesktop to archive.')
|
||||
|
||||
print('Beginning notarization process.')
|
||||
result = subprocess.call('xcrun notarytool submit "' + archive + '" --keychain-profile "preston" --wait', shell=True)
|
||||
if result != 0:
|
||||
finish(1, 'Notarizing the archive.')
|
||||
result = subprocess.call('xcrun stapler staple Telegram.app', shell=True)
|
||||
if result != 0:
|
||||
finish(1, 'Error calling stapler')
|
||||
|
||||
subprocess.call('rm -rf ' + today + '/Telegram.app', shell=True)
|
||||
subprocess.call('rm ' + archive, shell=True)
|
||||
result = subprocess.call('cp -r Telegram.app ' + today + '/', shell=True)
|
||||
if result != 0:
|
||||
finish(1, 'Re-Cloning Telegram.app to ' + today + '.')
|
||||
|
||||
result = subprocess.call('zip -r ' + archive + ' ' + today, shell=True)
|
||||
if result != 0:
|
||||
finish(1, 'Re-Adding tdesktop to archive.')
|
||||
print('Re-Archived.')
|
||||
|
||||
subprocess.call('mkdir -p ' + outputFolder, shell=True)
|
||||
subprocess.call('mv ' + archive + ' ' + outputFolder + '/', shell=True)
|
||||
subprocess.call('rm -rf ' + today, shell=True)
|
||||
print('Finished.')
|
||||
finish(0)
|
||||
|
||||
commandPath = scriptPath + '/../../out/' + conf + '/' + outputFolder + '/command.txt'
|
||||
|
||||
if composing:
|
||||
templatePath = scriptPath + '/../../../DesktopPrivate/updates_template.txt'
|
||||
if not os.path.exists(templatePath):
|
||||
finish(1, 'Template file "' + templatePath + '" not found.')
|
||||
|
||||
if not re.match(r'^[a-f0-9]{9,40}$', lastCommit):
|
||||
finish(1, 'Wrong last commit: ' + lastCommit)
|
||||
|
||||
log = subprocess.check_output(['git', 'log', lastCommit+'..HEAD']).decode('utf-8')
|
||||
logLines = log.split('\n')
|
||||
firstCommit = ''
|
||||
commits = []
|
||||
for line in logLines:
|
||||
if line.startswith('commit '):
|
||||
commit = line.split(' ')[1]
|
||||
if not len(firstCommit):
|
||||
firstCommit = commit
|
||||
commits.append('')
|
||||
elif line.startswith(' '):
|
||||
stripped = line[4:]
|
||||
if not len(stripped):
|
||||
continue
|
||||
elif not len(commits):
|
||||
print(log)
|
||||
finish(1, 'Bad git log output.')
|
||||
if len(commits[len(commits) - 1]):
|
||||
commits[len(commits) - 1] += '\n' + stripped
|
||||
else:
|
||||
commits[len(commits) - 1] = '- ' + stripped
|
||||
commits.reverse()
|
||||
if not len(commits):
|
||||
finish(1, 'No commits since last build :(')
|
||||
|
||||
changelog = '\n'.join(commits)
|
||||
print('\n\nReady! File: ' + archive + '\nChangelog:\n' + changelog)
|
||||
with open(templatePath, 'r') as template:
|
||||
with open(commandPath, 'w') as f:
|
||||
for line in template:
|
||||
if line.startswith('//'):
|
||||
continue
|
||||
line = line.replace('{path}', scriptPath + '/../../out/' + conf + '/' + outputFolder + '/' + archive)
|
||||
line = line.replace('{caption}', 'TDesktop at ' + today.replace('_', '.') + ':\n\n' + changelog)
|
||||
f.write(line)
|
||||
print('\n\nEdit:\n')
|
||||
print('vi ' + commandPath)
|
||||
finish(0)
|
||||
|
||||
if not os.path.exists(commandPath):
|
||||
finish(1, 'Command file not found.')
|
||||
|
||||
readingCaption = False
|
||||
caption = ''
|
||||
with open(commandPath, 'r') as f:
|
||||
for line in f:
|
||||
if readingCaption:
|
||||
caption = caption + line
|
||||
elif line.startswith('caption: '):
|
||||
readingCaption = True
|
||||
caption = line[len('caption: '):]
|
||||
if not caption.startswith('TDesktop at ' + today.replace('_', '.') + ':'):
|
||||
finish(1, 'Wrong caption start.')
|
||||
print('\n\nSending! File: ' + archive + '\nChangelog:\n' + caption)
|
||||
if len(caption) > 1024:
|
||||
print('Length: ' + str(len(caption)))
|
||||
print('vi ' + commandPath)
|
||||
finish(1, 'Too large.')
|
||||
|
||||
if not os.path.exists('../out/' + conf + '/' + outputFolder + '/' + archive):
|
||||
finish(1, 'Not built yet.')
|
||||
|
||||
subprocess.call(scriptPath + '/../../out/' + conf + '/Telegram.app/Contents/MacOS/Telegram -sendpath interpret://' + scriptPath + '/../../out/' + conf + '/' + outputFolder + '/command.txt', shell=True)
|
||||
|
||||
finish(0)
|
||||
22
Telegram/build/updates.sh
Executable file
22
Telegram/build/updates.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
set -e
|
||||
FullExecPath=$PWD
|
||||
pushd `dirname $0` > /dev/null
|
||||
FullScriptPath=`pwd`
|
||||
popd > /dev/null
|
||||
|
||||
if [ ! -d "$FullScriptPath/../../../DesktopPrivate" ]; 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
|
||||
|
||||
pushd `dirname $0` > /dev/null
|
||||
FullScriptPath=`pwd`
|
||||
popd > /dev/null
|
||||
|
||||
python3 $FullScriptPath/updates.py $1 $2 $3 $4 $5 $6
|
||||
|
||||
exit
|
||||
7
Telegram/build/version
Normal file
7
Telegram/build/version
Normal file
@@ -0,0 +1,7 @@
|
||||
AppVersion 6003010
|
||||
AppVersionStrMajor 6.3
|
||||
AppVersionStrSmall 6.3.10
|
||||
AppVersionStr 6.3.10
|
||||
BetaChannel 1
|
||||
AlphaVersion 0
|
||||
AppVersionOriginal 6.3.10.beta
|
||||
Reference in New Issue
Block a user