Expect different Homebrew install paths on Apple silicon/Intel.

This commit is contained in:
levlam 2021-12-23 15:04:56 +03:00
parent 6abdb73512
commit 14f11a9d0d

View File

@ -244,6 +244,13 @@
<p></p> <p></p>
</div> </div>
<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>
<div id="buildBitnessDiv" class="hide"> <div id="buildBitnessDiv" class="hide">
<span>Choose for which bitness you want to build the Telegram Bot API server:</span><br> <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="buildBitnessRadio64" name="buildBitnessRadio" onchange="onOptionsChanged()" checked/>64</label>
@ -363,6 +370,8 @@ function onOptionsChanged() {
var use_powershell = false; var use_powershell = false;
var use_cmd = false; var use_cmd = false;
var use_csh = false; var use_csh = false;
var homebrew_install_dir = '';
var os_mac_host_name = '';
if (os_windows) { if (os_windows) {
document.getElementById('buildShellDiv').style.display = 'block'; document.getElementById('buildShellDiv').style.display = 'block';
use_powershell = document.getElementById('buildShellRadioPowerShell').checked; use_powershell = document.getElementById('buildShellRadioPowerShell').checked;
@ -375,6 +384,18 @@ function onOptionsChanged() {
} else { } else {
document.getElementById('buildShellBsdDiv').style.display = 'none'; document.getElementById('buildShellBsdDiv').style.display = 'none';
} }
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';
}
var use_msvc = os_windows; var use_msvc = os_windows;
var use_vcpkg = os_windows; var use_vcpkg = os_windows;
@ -482,7 +503,7 @@ function onOptionsChanged() {
var cmake = 'cmake'; var cmake = 'cmake';
if (os_mac) { if (os_mac) {
commands.push('xcode-select --install'); commands.push('xcode-select --install');
commands.push('/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"'); commands.push('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"');
commands.push('brew install gperf cmake openssl'); commands.push('brew install gperf cmake openssl');
} else if (os_linux && linux_distro !== 'Other') { } else if (os_linux && linux_distro !== 'Other') {
switch (linux_distro) { switch (linux_distro) {
@ -605,7 +626,7 @@ function onOptionsChanged() {
cmake_init_options = getBacicCmakeInitOptions(); cmake_init_options = getBacicCmakeInitOptions();
if (os_mac) { if (os_mac) {
cmake_init_options.push('-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/'); cmake_init_options.push('-DOPENSSL_ROOT_DIR=' + homebrew_install_dir + '/opt/openssl/');
} }
cmake_init_options.push('-DCMAKE_INSTALL_PREFIX:PATH=' + install_dir); cmake_init_options.push('-DCMAKE_INSTALL_PREFIX:PATH=' + install_dir);
if (use_vcpkg) { if (use_vcpkg) {