2020-11-03 16:34:10 +00:00
<!DOCTYPE html>
< html >
< head >
< title > Telegram Bot API server build instructions< / title >
2021-12-14 04:28:27 +00:00
< style >
:root {
--background: #fafafa;
--color: black;
--color-primary: #0088ff;
--color-code-block: #ebf9ff;
--color-select-border: rgb(211, 211, 211);
--color-checkbox-background: rgb(211, 211, 211);
--color-checkbox-tick: #ffffff;
--color-copy-success-background: #c1ffc6;
--color-copy-success-border: rgb(0, 255, 0);
--color-copy-fail-background: #ffcbcb;
--color-copy-fail-border: rgb(255, 0, 0);
color: var(--color);
background: var(--background);
}
@media (prefers-color-scheme: dark) {
:root {
--background: #0e0e0e;
--color: rgb(190, 190, 190);
--color-primary: #0088ff;
--color-code-block: #101315;
--color-select-border: rgb(54, 54, 54);
--color-checkbox-background: rgb(51, 51, 51);
--color-checkbox-tick: #ffffff;
--color-copy-success-background: #001f00;
--color-copy-success-border: rgb(0, 255, 0);
--color-copy-fail-background: #1f0000;
--color-copy-fail-border: rgb(255, 0, 0);
}
}
body {
font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
}
.hide {
display: none;
}
div.main {
max-width: 1250px;
padding: 25px;
margin: auto;
font-size: 16px;
}
p {
margin: 0;
}
.main > div {
margin-bottom: 20px;
}
#buildCommands {
font-family: Consolas, monospace;
margin-left: 40px;
background: var(--color-code-block);
padding: 5px;
margin-bottom: 0;
display: block;
}
#buildCommands ul {
list-style: '$ ';
}
a {
color: var(--color-primary);
text-decoration-color: transparent;
transition: text-decoration-color 200ms;
}
a:hover {
text-decoration: underline;
}
select, button {
border: 1px solid var(--color-select-border);
background-color: var(--background);
color: var(--color);
padding: 5px;
margin-top: 5px;
transition: border 200ms, padding 200ms;
border-radius: 999em;
font-size: 16px;
cursor: pointer;
}
select:focus, button:focus {
outline: none;
border-color: var(--color-primary);
border-width: 2px;
padding: 4px;
}
label * {
vertical-align: middle;
}
input[type=checkbox] {
margin-right: 5px;
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
background-color: var(--color-checkbox-background);
height: 20px;
width: 20px;
border-radius: 3px;
position: relative;
transition: background-color 200ms;
}
input[type=checkbox]::after {
content: "";
transition: border-color 200ms;
position: absolute;
left: 6px;
top: 2px;
width: 5px;
height: 10px;
border: solid transparent;
border-width: 0 3px 3px 0;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
input[type=checkbox]:checked {
background-color: var(--color-primary);
}
input[type=checkbox]:checked::after {
border-color: var(--color-checkbox-tick);
}
input[type=radio] {
margin-right: 5px;
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
background-color: var(--color-checkbox-background);
height: 20px;
width: 20px;
border-radius: 100%;
position: relative;
transition: background-color 200ms;
}
input[type=radio]::after {
content: "";
transition: border-color 200ms;
position: absolute;
left: 10px;
top: 10px;
width: 0;
height: 0;
border-radius: 100%;
background-color: transparent;
transition: width 200ms, height 200ms, left 200ms, top 200ms, background-color 100ms;
}
input[type=radio]:checked::after {
background-color: var(--color-primary);
left: 2px;
top: 2px;
width: 16px;
height: 16px;
}
#copyBuildCommandsButton {
margin-left: 40px;
}
#copyBuildCommandsButton.success {
background: var(--color-copy-success-background);
border-color: var(--color-copy-success-border);
}
#copyBuildCommandsButton.fail {
background: var(--color-copy-fail-background);
border-color: var(--color-copy-fail-border);
}
< / style >
2020-11-03 16:34:10 +00:00
< / head >
< body onload = "onLoad(true)" onpopstate = "onLoad(false)" >
< div class = "main" >
2021-12-14 04:31:35 +00:00
< div id = "osSelectDiv" class = "large" >
2022-06-30 17:27:08 +00:00
< p > Choose an operating system on which you want to use the Telegram Bot API server:< / p >
2020-11-03 16:34:10 +00:00
< select id = "osSelect" onchange = "onOsChanged(false)" autofocus class = "large" >
< option > Choose an operating system:< / option >
< option > Windows< / option >
< option > Linux< / option >
< option > macOS< / option >
< option > FreeBSD< / option >
< option > OpenBSD< / option >
< option > NetBSD< / option >
< / select >
< p > < / p >
< / div >
2021-12-14 04:31:35 +00:00
< div id = "linuxSelectDiv" class = "hide" >
2022-06-30 17:27:08 +00:00
< p > Choose a Linux distro on which you want to use the Telegram Bot API server:< / p >
2020-11-03 16:34:10 +00:00
< select id = "linuxSelect" onchange = "onOsChanged(false)" class = "large" >
< option > Choose a Linux distro:< / option >
< option > Alpine< / option >
2020-11-08 15:53:28 +00:00
< option > CentOS 7< / option >
< option > CentOS 8< / option >
2021-09-12 17:55:52 +00:00
< option > Debian 8/9< / option >
< option > Debian 10+< / option >
2020-11-03 16:34:10 +00:00
< option > Ubuntu 14< / option >
< option > Ubuntu 16< / option >
< option > Ubuntu 18< / option >
< option > Ubuntu 20< / option >
2022-07-12 17:26:44 +00:00
< option > Ubuntu 22< / option >
2020-11-03 16:34:10 +00:00
< option > Other< / option >
< / select >
< p > < / p >
< / div >
2021-12-14 04:31:35 +00:00
< div id = "buildOptionsDiv" class = "hide" >
2020-11-03 16:34:10 +00:00
< div id = "buildDebugDiv" class = "hide" >
< label > < input type = "checkbox" id = "buildDebugCheckbox" onchange = "onOptionsChanged()" / > Build the debug binary. Debug binaries are much larger and slower than the release one.< / label >
< / div >
< div id = "buildInstallLocalDiv" class = "hide" >
< label > < input type = "checkbox" id = "buildInstallLocalCheckbox" onchange = "onOptionsChanged()" / > Install the built Telegram Bot API server to /usr/local instead of placing the files to telegram-bot-api/bin.< / label >
< / div >
< p > < / p >
< div id = "buildCompilerDiv" class = "hide" >
< span > Choose which compiler you want to use to build the Telegram Bot API server:< / span > < br >
< label > < input type = "radio" id = "buildCompilerRadioGcc" name = "buildCompilerRadio" onchange = "onOptionsChanged()" checked / > g++< / label >
2020-11-08 18:08:13 +00:00
< label > < input type = "radio" id = "buildCompilerRadioClang" name = "buildCompilerRadio" onchange = "onOptionsChanged()" / > clang (recommended)< / label >
2020-11-03 16:34:10 +00:00
< p > < / p >
< / div >
< div id = "buildShellDiv" class = "hide" >
< span > Choose which shell application you want to use for building:< / span > < br >
< label > < input type = "radio" id = "buildShellRadioPowerShell" name = "buildShellRadio" onchange = "onOptionsChanged()" checked / > PowerShell< / label >
< label > < input type = "radio" id = "buildShellRadioBash" name = "buildShellRadio" onchange = "onOptionsChanged()" / > mintty/Bash< / label >
< p > < / p >
< / div >
< div id = "buildShellBsdDiv" class = "hide" >
< span > Choose which shell application you want to use for building:< / span > < br >
< label > < input type = "radio" id = "buildShellBsdRadioCsh" name = "buildShellRadioBsd" onchange = "onOptionsChanged()" checked / > tcsh/csh< / label >
< label > < input type = "radio" id = "buildShellBsdRadioBash" name = "buildShellRadioBsd" onchange = "onOptionsChanged()" / > Bash< / label >
< p > < / p >
< / div >
2021-12-23 12:04:56 +00:00
< div id = "buildMacOsHostDiv" class = "hide" >
< span > Choose host architecture:< / span > < br >
< label > < input type = "radio" id = "buildMacOsHostRadioAppleSilicon" name = "buildMacOsHostRadio" onchange = "onOptionsChanged()" checked / > Apple silicon< / label >
< label > < input type = "radio" id = "buildMacOsHostRadioIntel" name = "buildMacOsHostRadio" onchange = "onOptionsChanged()" / > Intel< / label >
< p > < / p >
< / div >
2020-11-03 16:34:10 +00:00
< div id = "buildBitnessDiv" class = "hide" >
< span > Choose for which bitness you want to build the Telegram Bot API server:< / span > < br >
< label > < input type = "radio" id = "buildBitnessRadio64" name = "buildBitnessRadio" onchange = "onOptionsChanged()" checked / > 64< / label >
< label > < input type = "radio" id = "buildBitnessRadio32" name = "buildBitnessRadio" onchange = "onOptionsChanged()" / > 32< / label >
< p > < / p >
< / div >
< div id = "buildRootDiv" class = "hide" >
< label > < input type = "checkbox" id = "buildRootCheckbox" onchange = "onOptionsChanged()" / > Build from root user (unrecommended).< / label >
< / div >
< p > < / p >
< / div >
2021-12-14 04:31:35 +00:00
< div id = "buildTextDiv" class = "hide" >
2020-11-03 16:34:10 +00:00
< p id = "buildText" > Hidden text< / p >
< / div >
2021-12-14 04:31:35 +00:00
< div id = "buildCommandsDiv" class = "hide" >
2020-11-03 16:34:10 +00:00
< p id = "buildPre" > Hidden text< / p >
< code id = "buildCommands" > Empty commands< / code >
2021-12-14 04:36:23 +00:00
< button id = "copyBuildCommandsButton" onclick = "copyBuildInstructions()" >
< span id = "copyBuildCommandsText" > Copy< / span >
< / button >
2020-11-03 16:34:10 +00:00
< / div >
< / div >
< script >
function onLoad(initial) {
var url = new URL(window.location.href);
var os = url.searchParams.get('os');
if (!os) {
os = '';
}
var os_options = document.getElementById('osSelect').options;
for (var i = 0; i < os_options.length ; i + + ) {
os_options[i].selected = os_options[i].text.toLowerCase() === os.toLowerCase();
}
onOsChanged(initial || !history.state);
}
function onOsChanged(initial) {
var os = document.getElementById('osSelect').value;
if (os.includes('Choose ')) {
2021-06-08 16:22:52 +00:00
if (history.state !== '' & & history.state !== null) {
2020-11-03 16:34:10 +00:00
history.pushState('', '', 'build.html');
}
document.getElementById('linuxSelectDiv').style.display = 'none';
document.getElementById('buildTextDiv').style.display = 'none';
document.getElementById('buildOptionsDiv').style.display = 'none';
document.getElementById('buildCommandsDiv').style.display = 'none';
return;
}
if (!initial & & history.state !== os) {
history.pushState(os, '', 'build.html?os=' + encodeURIComponent(os));
}
var os_linux = os.includes('Linux');
if (os_linux) {
document.getElementById('linuxSelectDiv').style.display = 'block';
var linux_distro = document.getElementById('linuxSelect').value;
if (linux_distro.includes('Choose ')) {
document.getElementById('buildTextDiv').style.display = 'none';
document.getElementById('buildOptionsDiv').style.display = 'none';
document.getElementById('buildCommandsDiv').style.display = 'none';
return;
}
} else {
document.getElementById('linuxSelectDiv').style.display = 'none';
}
document.getElementById('buildTextDiv').style.display = 'block';
document.getElementById('buildText').innerHTML = 'Here is complete instruction for building Telegram Bot API Server on ' + os + ':';
document.getElementById('buildOptionsDiv').style.display = 'block';
onOptionsChanged();
}
function onOptionsChanged() {
var os = document.getElementById('osSelect').value;
var os_windows = os.includes('Windows');
var os_linux = os.includes('Linux');
var os_mac = os.includes('macOS');
var os_freebsd = os.includes('FreeBSD');
var os_openbsd = os.includes('OpenBSD');
var os_netbsd = os.includes('NetBSD');
var linux_distro = 'none';
if (os_linux) {
linux_distro = document.getElementById('linuxSelect').value;
}
document.getElementById('buildCommandsDiv').style.display = 'block';
var use_clang = os_freebsd || os_openbsd;
2020-11-08 15:53:28 +00:00
if (os_linux & & linux_distro !== 'Alpine' & & !linux_distro.includes('CentOS')) {
2020-11-03 16:34:10 +00:00
document.getElementById('buildCompilerDiv').style.display = 'block';
use_clang = document.getElementById('buildCompilerRadioClang').checked;
} else {
document.getElementById('buildCompilerDiv').style.display = 'none';
}
var use_root = false;
if ((os_linux & & linux_distro !== 'Other') || os_openbsd || os_netbsd) {
use_root = document.getElementById('buildRootCheckbox').checked;
document.getElementById('buildRootDiv').style.display = 'block';
} else {
document.getElementById('buildRootDiv').style.display = 'none';
}
var use_powershell = false;
var use_cmd = false;
var use_csh = false;
2021-12-23 12:04:56 +00:00
var homebrew_install_dir = '';
var os_mac_host_name = '';
2020-11-03 16:34:10 +00:00
if (os_windows) {
document.getElementById('buildShellDiv').style.display = 'block';
use_powershell = document.getElementById('buildShellRadioPowerShell').checked;
} else {
document.getElementById('buildShellDiv').style.display = 'none';
}
if (os_freebsd) {
document.getElementById('buildShellBsdDiv').style.display = 'block';
use_csh = document.getElementById('buildShellBsdRadioCsh').checked;
} else {
document.getElementById('buildShellBsdDiv').style.display = 'none';
}
2021-12-23 12:04:56 +00:00
if (os_mac) {
document.getElementById('buildMacOsHostDiv').style.display = 'block';
if (document.getElementById('buildMacOsHostRadioAppleSilicon').checked) {
homebrew_install_dir = '/opt/homebrew';
os_mac_host_name = 'Apple silicon';
} else {
homebrew_install_dir = '/usr/local';
os_mac_host_name = 'Intel';
}
} else {
document.getElementById('buildMacOsHostDiv').style.display = 'none';
}
2020-11-03 16:34:10 +00:00
var use_msvc = os_windows;
var use_vcpkg = os_windows;
var is_debug_build = document.getElementById('buildDebugCheckbox').checked;
document.getElementById('buildDebugDiv').style.display = 'block';
var sudo = 'sudo ';
if (use_root || linux_distro.includes('Debian') || os_freebsd || os_openbsd || os_netbsd) {
sudo = '';
}
var build_32bit = false;
var build_64bit = false;
if (use_msvc) {
document.getElementById('buildBitnessDiv').style.display = 'block';
build_32bit = document.getElementById('buildBitnessRadio32').checked;
build_64bit = document.getElementById('buildBitnessRadio64').checked;
} else {
document.getElementById('buildBitnessDiv').style.display = 'none';
}
var local = './';
if (use_cmd) {
local = '.\\';
}
var install_dir = 'telegram-bot-api/bin';
if (!os_windows) {
document.getElementById('buildInstallLocalDiv').style.display = 'block';
if (document.getElementById('buildInstallLocalCheckbox').checked) {
install_dir = '/usr/local';
}
} else {
document.getElementById('buildInstallLocalDiv').style.display = 'none';
}
var pre_text = [];
if (os_windows) {
pre_text.push('Note that Windows Subsystem for Linux (WSL) and Cygwin are not Windows environments, so you need to use instructions for Linux for them instead.');
pre_text.push('Download and install < a href = "https://visualstudio.microsoft.com/ru/vs/community/" > Microsoft Visual Studio< / a > . Enable C++ support while installing.');
pre_text.push('Download and install < a href = "https://cmake.org/download/" > CMake< / a > ; choose "Add CMake to the system PATH" option while installing.');
pre_text.push('Download and install < a href = "https://git-scm.com/download/win" > Git< / a > .');
}
if (os_linux & & linux_distro === 'Other') {
2021-10-26 11:27:03 +00:00
var compiler = use_clang ? 'clang >= 3.4, libc++' : 'g++ >= 4.9.2';
2020-11-03 16:34:10 +00:00
pre_text.push('Install Git, ' + compiler + ', make, CMake >= 3.0.2, OpenSSL-dev, zlib-dev, gperf using your package manager.');
}
if (os_freebsd) {
pre_text.push('Note that the following instruction is for FreeBSD 11.');
pre_text.push('Note that the following calls to < code > pkg< / code > needs to be run as < code > root< / code > .');
}
if (os_openbsd) {
pre_text.push('Note that the following instruction is for OpenBSD 6.7 and default KSH shell.');
pre_text.push('Note that building requires a lot of memory, so you may need to increase allowed per-process memory usage in /etc/login.conf or build from root.');
}
if (os_netbsd) {
2022-09-06 16:02:57 +00:00
pre_text.push('Note that the following instruction is for NetBSD 8+ and default SH shell.');
2020-11-03 16:34:10 +00:00
}
var terminal_name = (function () {
if (os_windows) {
return use_powershell ? 'PowerShell' : 'mintty/Bash';
}
if (os_mac) {
return 'Terminal';
}
if (os_openbsd) {
return 'ksh';
}
if (os_netbsd) {
return 'sh';
}
if (use_csh) {
return 'tcsh/csh';
}
return 'Bash';
})();
if (os_windows) {
pre_text.push('Close and re-open ' + terminal_name + ' if the PATH environment variable was changed.');
}
pre_text.push('Run these commands in ' + terminal_name + ' to build Bot API server and to install it to ' + install_dir + ':');
document.getElementById('buildPre').innerHTML = '< ul > < li > ' + pre_text.join('< / li > < li > ') + '< / li > < / ul > ';
document.getElementById('buildPre').style.display = 'block';
if (install_dir !== '/usr/local') {
install_dir = '..';
}
function getClangVersionSuffix() {
switch (linux_distro) {
case 'Ubuntu 14':
return '-3.9';
case 'Ubuntu 18':
return '-6.0';
case 'Ubuntu 20':
return '-10';
2022-07-12 17:26:44 +00:00
case 'Ubuntu 22':
return '-14';
2020-11-03 16:34:10 +00:00
default:
return ''; // use default version
}
}
var commands = [];
2020-11-08 15:53:28 +00:00
var cmake = 'cmake';
2020-11-03 16:34:10 +00:00
if (os_mac) {
commands.push('xcode-select --install');
2021-12-23 12:04:56 +00:00
commands.push('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"');
2020-11-03 16:34:10 +00:00
commands.push('brew install gperf cmake openssl');
} else if (os_linux & & linux_distro !== 'Other') {
switch (linux_distro) {
case 'Alpine':
commands.push(sudo + 'apk update');
commands.push(sudo + 'apk upgrade');
var packages = 'alpine-sdk linux-headers git zlib-dev openssl-dev gperf cmake';
commands.push(sudo + 'apk add --update ' + packages);
break;
2020-11-08 15:53:28 +00:00
case 'CentOS 7':
case 'CentOS 8':
commands.push(sudo + 'yum update -y');
var packages = 'gcc-c++ make git zlib-devel openssl-devel';
if (linux_distro === 'CentOS 7') {
commands.push(sudo + 'yum install -y centos-release-scl-rh epel-release');
commands.push(sudo + 'yum install -y devtoolset-9-gcc devtoolset-9-gcc-c++');
cmake = 'cmake3';
packages += ' gperf';
} else {
2021-08-12 17:43:24 +00:00
commands.push(sudo + 'dnf --enablerepo=powertools install gperf');
2020-11-08 15:53:28 +00:00
}
packages += ' ' + cmake;
commands.push(sudo + 'yum install -y ' + packages);
break;
2021-09-12 17:55:52 +00:00
case 'Debian 8/9':
case 'Debian 10+':
2020-11-03 16:34:10 +00:00
case 'Ubuntu 14':
case 'Ubuntu 16':
case 'Ubuntu 18':
case 'Ubuntu 20':
2022-07-12 17:26:44 +00:00
case 'Ubuntu 22':
2020-11-03 16:34:10 +00:00
if (linux_distro.includes('Debian') & & !use_root) {
commands.push('su -');
}
if (linux_distro === 'Ubuntu 14' & & !use_clang) {
commands.push(sudo + 'add-apt-repository ppa:ubuntu-toolchain-r/test');
}
commands.push(sudo + 'apt-get update');
commands.push(sudo + 'apt-get upgrade');
var packages = 'make git zlib1g-dev libssl-dev gperf';
if (linux_distro === 'Ubuntu 14') {
packages += ' cmake3';
} else {
packages += ' cmake';
}
if (use_clang) {
packages += ' clang' + getClangVersionSuffix() + ' libc++-dev';
2022-07-12 17:26:44 +00:00
if (linux_distro === 'Debian 10+' || linux_distro === 'Ubuntu 18' || linux_distro === 'Ubuntu 20' || linux_distro === 'Ubuntu 22') {
2020-11-03 16:34:10 +00:00
packages += ' libc++abi-dev';
}
} else {
packages += ' g++';
if (linux_distro === 'Ubuntu 14') {
packages += '-4.9';
}
}
commands.push(sudo + 'apt-get install ' + packages);
if (linux_distro.includes('Debian') & & !use_root) {
commands.push('exit');
}
break;
}
} else if (os_freebsd) {
commands.push(sudo + 'pkg upgrade');
var packages = 'git gperf cmake';
commands.push(sudo + 'pkg install ' + packages);
} else if (os_openbsd) {
if (!use_root) {
commands.push('su -');
}
2020-11-05 20:38:57 +00:00
var packages = 'git gperf php-7.2.10 cmake';
2020-11-03 16:34:10 +00:00
commands.push('pkg_add -z ' + packages);
if (!use_root) {
commands.push('exit');
}
} else if (os_netbsd) {
if (!use_root) {
commands.push('su -');
}
2022-09-06 16:02:57 +00:00
commands.push('export PKG_PATH=http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r)/All');
var packages = 'git gperf cmake openssl gcc12-libs mozilla-rootcerts-openssl';
2020-11-03 16:34:10 +00:00
commands.push('pkg_add ' + packages);
if (!use_root) {
commands.push('exit');
}
}
commands.push('git clone --recursive https://github.com/tdlib/telegram-bot-api.git');
commands.push('cd telegram-bot-api');
if (use_vcpkg) {
commands.push('git clone https://github.com/Microsoft/vcpkg.git');
commands.push('cd vcpkg');
commands.push(local + 'bootstrap-vcpkg.bat');
if (build_64bit) {
2021-09-15 07:16:53 +00:00
commands.push(local + 'vcpkg.exe install gperf:x64-windows openssl:x64-windows zlib:x64-windows');
2020-11-03 16:34:10 +00:00
} else {
2021-09-15 07:16:53 +00:00
commands.push(local + 'vcpkg.exe install gperf:x86-windows openssl:x86-windows zlib:x86-windows');
2020-11-03 16:34:10 +00:00
}
commands.push('cd ..');
}
function getBacicCmakeInitOptions() {
var options = [];
if (!use_msvc) {
options.push('-DCMAKE_BUILD_TYPE=' + (is_debug_build ? 'Debug' : 'Release'));
}
if (use_msvc) {
if (build_64bit) {
options.push('-A x64');
} else {
options.push('-A Win32');
}
}
return options;
}
commands.push(use_powershell ? 'Remove-Item build -Force -Recurse -ErrorAction SilentlyContinue' : 'rm -rf build');
commands.push('mkdir build');
commands.push('cd build');
cmake_init_options = getBacicCmakeInitOptions();
if (os_mac) {
2021-12-23 12:04:56 +00:00
cmake_init_options.push('-DOPENSSL_ROOT_DIR=' + homebrew_install_dir + '/opt/openssl/');
2020-11-03 16:34:10 +00:00
}
cmake_init_options.push('-DCMAKE_INSTALL_PREFIX:PATH=' + install_dir);
if (use_vcpkg) {
cmake_init_options.push('-DCMAKE_TOOLCHAIN_FILE:FILEPATH=../vcpkg/scripts/buildsystems/vcpkg.cmake');
}
function getCmakeInitCommand(options) {
var prefix = '';
if (os_linux) {
if (use_clang) {
var clang_version_suffix = getClangVersionSuffix();
2020-11-08 18:08:13 +00:00
prefix = 'CXXFLAGS="-stdlib=libc++" CC=/usr/bin/clang' + clang_version_suffix + ' CXX=/usr/bin/clang++' + clang_version_suffix + ' ';
2020-11-03 16:34:10 +00:00
} else if (linux_distro === 'Ubuntu 14') {
prefix = 'CC=/usr/bin/gcc-4.9 CXX=/usr/bin/g++-4.9 ';
2020-11-08 15:53:28 +00:00
} else if (linux_distro === 'CentOS 7') {
prefix = 'CC=/opt/rh/devtoolset-9/root/usr/bin/gcc CXX=/opt/rh/devtoolset-9/root/usr/bin/g++ ';
2020-11-03 16:34:10 +00:00
}
}
2020-11-08 15:53:28 +00:00
return prefix + cmake + ' ' + options.join(' ') + ' ..';
2020-11-03 16:34:10 +00:00
}
commands.push(getCmakeInitCommand(cmake_init_options));
2020-11-05 20:38:57 +00:00
if (os_openbsd) {
2020-11-08 15:53:28 +00:00
commands.push(cmake + ' --build . --target prepare_cross_compiling');
2020-11-05 20:38:57 +00:00
commands.push('cd ../td');
commands.push('php-7.2 SplitSource.php');
commands.push('cd ../build');
}
2020-11-08 15:53:28 +00:00
let build_command = cmake + ' --build . --target install';
2020-11-03 16:34:10 +00:00
if (use_msvc) {
if (!is_debug_build) {
commands.push(build_command + ' --config Release');
}
if (is_debug_build) {
commands.push(build_command + ' --config Debug');
}
} else {
commands.push(build_command);
}
2020-11-05 20:38:57 +00:00
if (os_openbsd) {
commands.push('cd ../td');
commands.push('php-7.2 SplitSource.php --undo');
}
2020-11-03 16:34:10 +00:00
commands.push('cd ../..');
if (install_dir !== '/usr/local') {
install_dir = 'telegram-bot-api';
}
commands.push((use_powershell ? 'dir ' : 'ls -l ') + install_dir + '/bin/telegram-bot-api*');
document.getElementById('buildCommands').innerHTML = '< ul > < li > ' + commands.join('< / li > < li > ') + '< / li > < / ul > ';
2021-12-14 04:36:23 +00:00
document.getElementById('copyBuildCommandsButton').style.display = commands.includes('exit') ? 'none' : 'block';
}
2022-01-25 15:18:44 +00:00
2021-12-14 04:36:23 +00:00
function copyBuildInstructions() {
var text = document.getElementById('buildCommands').innerText;
function resetButtonState (state) {
document.getElementById('copyBuildCommandsButton').classList.remove(state);
document.getElementById('copyBuildCommandsText').innerText = "Copy";
}
navigator.clipboard.writeText(text).then(result => {
document.getElementById('copyBuildCommandsButton').classList.add('success');
document.getElementById('copyBuildCommandsText').innerText = "Copied!";
setTimeout(() => resetButtonState('success'), 5000);
}, error => {
document.getElementById('copyBuildCommandsButton').classList.add('fail');
document.getElementById('copyBuildCommandsText').innerText = "Couldn't copy :(";
setTimeout(() => resetButtonState('fail'), 5000);
})
2020-11-03 16:34:10 +00:00
}
< / script >
< / body >
< / html >