Add OpenBSD build instructions.

GitOrigin-RevId: 89940edf0ec15563aea0e04eb941ffb00a491d65
This commit is contained in:
levlam 2019-08-02 05:30:31 +03:00
parent c369ec608c
commit b929fbf673
1 changed files with 31 additions and 9 deletions

View File

@ -163,16 +163,16 @@ function getSupportedOs(language) {
case 'Choose a programming language:':
return [];
case 'JavaScript':
return ['Windows (Node.js)', 'Linux (Node.js)', 'macOS (Node.js)', 'FreeBSD (Node.js)', 'Browser'];
return ['Windows (Node.js)', 'Linux (Node.js)', 'macOS (Node.js)', 'FreeBSD (Node.js)', 'OpenBSD (Node.js)', 'Browser'];
case 'Java':
return ['Windows', 'Linux', 'macOS', 'FreeBSD', 'Android'];
return ['Windows', 'Linux', 'macOS', 'FreeBSD', 'OpenBSD', 'Android'];
case 'C#':
return ['Windows (through C++/CLI)', 'Universal Windows Platform (through C++/CX)', 'Windows (.Net Core)', 'Linux (.Net Core)', 'macOS (.Net Core)', 'FreeBSD (.Net Core)'];
case 'Swift':
case 'Objective-C':
return ['Windows', 'Linux', 'macOS', 'iOS', 'tvOS', 'watchOS'];
default:
return ['Windows', 'Linux', 'macOS', 'FreeBSD'];
return ['Windows', 'Linux', 'macOS', 'FreeBSD', 'OpenBSD'];
}
}
@ -341,6 +341,7 @@ function onOptionsChanged() {
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 display_commands = 'block';
var linux_distro = 'none';
@ -355,7 +356,7 @@ function onOptionsChanged() {
}
document.getElementById('buildCommandsDiv').style.display = display_commands;
var use_clang = os_freebsd;
var use_clang = os_freebsd || os_openbsd;
if (os_linux && linux_distro !== 'Alpine') {
document.getElementById('buildCompilerDiv').style.display = 'block';
use_clang = document.getElementById('buildCompilerRadioClang').checked;
@ -364,7 +365,7 @@ function onOptionsChanged() {
}
var low_memory = false;
if (os_linux || os_freebsd) {
if (os_linux || os_freebsd || os_openbsd) {
low_memory = document.getElementById('buildLowMemoryCheckbox').checked;
document.getElementById('buildLowMemoryText').innerHTML = 'I have less than ' + (use_clang ? '1.5' : '3.5') +' GB of RAM.' +
(low_memory ? ' Now you will need only ' + (use_clang ? '0.5' : '1') +' GB of RAM to build TDLib.' : '');
@ -431,7 +432,7 @@ function onOptionsChanged() {
}
var sudo = 'sudo ';
if (use_root || linux_distro.includes('Debian') || os_freebsd) {
if (use_root || linux_distro.includes('Debian') || os_freebsd || os_openbsd) {
sudo = '';
}
@ -504,6 +505,9 @@ function onOptionsChanged() {
pre_text.push('Note that following instruction is for FreeBSD 11.');
pre_text.push('Note that following calls to <code>pkg</code> needs to be run as <code>root</code>.');
}
if (os_openbsd) {
pre_text.push('Note that following instruction is for OpenBSD 6.4 and default KSH shell.');
}
var terminal_name = (function () {
if (os_windows) {
@ -512,6 +516,9 @@ function onOptionsChanged() {
if (os_mac) {
return 'Terminal';
}
if (os_openbsd) {
return 'ksh';
}
if (use_csh) {
return 'tcsh/csh';
}
@ -538,6 +545,7 @@ function onOptionsChanged() {
var commands = [];
var php = "php";
if (os_mac) {
commands.push('xcode-select --install');
commands.push('/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"');
@ -617,6 +625,20 @@ function onOptionsChanged() {
packages += ' openjdk';
}
commands.push(sudo + 'pkg install ' + packages);
} else if (os_openbsd) {
if (!use_root) {
commands.push('su -');
}
var packages = 'git gperf php-7.2.10 cmake';
if (target === 'JNI') {
packages += ' jdk';
}
commands.push('pkg_add ' + packages);
if (!use_root) {
commands.push('exit');
}
php = "php-7.2";
}
commands.push('git clone https://github.com/tdlib/td.git');
@ -748,7 +770,7 @@ function onOptionsChanged() {
if (low_memory) {
commands.push('cmake --build . --target prepare_cross_compiling');
commands.push('cd ..');
commands.push('php SplitSource.php');
commands.push(php + ' SplitSource.php');
commands.push('cd build');
}
@ -790,7 +812,7 @@ function onOptionsChanged() {
if (os_freebsd) {
cmake_init_options.push('-DJAVA_HOME=/usr/local/openjdk7/');
}
var resolve_path = use_powershell ? 'Resolve-Path' : (os_mac ? 'greadlink -e' : (is_alpine || os_freebsd ? 'readlink -f' : 'readlink -e'));
var resolve_path = use_powershell ? 'Resolve-Path' : (os_mac ? 'greadlink -e' : (is_alpine || os_freebsd || os_openbsd ? 'readlink -f' : 'readlink -e'));
var resolved_path = resolve_path + ' ../td/lib/cmake/Td';
if (use_csh) {
cmake_init_options.push('-DTd_DIR:PATH=$td_dir');
@ -813,7 +835,7 @@ function onOptionsChanged() {
commands.push('git checkout td/telegram/Client.h td/telegram/Log.h td/tl/TlObject.h');
}
if (low_memory) {
commands.push('php SplitSource.php --undo');
commands.push(php + ' SplitSource.php --undo');
}
commands.push('cd ..');
}