diff --git a/CMakeLists.txt b/CMakeLists.txt index 9fcba388..b2530c6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,6 +69,9 @@ if(TESTNET) add_definitions(-DTESTNET) endif() +set(OPENSSL_USE_STATIC_LIBS TRUE) # link statically +find_package(OpenSSL REQUIRED) + if(DISABLE_TOR) message("NOTICE: Building with disabled TOR support!") add_definitions(-DDISABLE_TOR) diff --git a/README.md b/README.md index c6ad2f56..13558e5f 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,11 @@ Be sure to clone the repository properly:\ ### Dependencies | component / version | minimum
(not recommended but may work) | recommended | most recent of what we have ever tested | |--|--|--|--| -| gcc (Linux) | 5.4.0 | 7.4.0 | 8.3.0 | +| gcc (Linux) | 5.4.0 | 7.5.0 | 8.3.0 | | llvm/clang (Linux) | UNKNOWN | 7.0.1 | 8.0.0 | -| [MSVC](https://visualstudio.microsoft.com/downloads/) (Windows) | 2015 (14.0 update 1) | 2017 (15.9.0) | 2019 | +| [MSVC](https://visualstudio.microsoft.com/downloads/) (Windows) | 2015 (14.0 update 1) | 2017 (15.9.0) | 2022 (17.4.2) | | [XCode](https://developer.apple.com/downloads/) (macOS) | 9.2 | 12.3 | 12.3 | -| [CMake](https://cmake.org/download/) | 2.8.6 | 3.15.5 | 3.20 | +| [CMake](https://cmake.org/download/) | 2.8.6 | 3.15.5 | 3.26.3 | | [Boost](https://www.boost.org/users/download/) | 1.70 | 1.70 | 1.76 | | [OpenSSL](https://www.openssl.org/source/) [(win)](https://slproweb.com/products/Win32OpenSSL.html) | - | 1.1.1n | 1.1.1n | | [Qt](https://download.qt.io/archive/qt/) (*only for GUI*) | 5.8.0 | 5.11.2 | 5.15.2 | @@ -45,7 +45,7 @@ Recommended OS version: Ubuntu 18.04 LTS. 2. Download and build Boost curl -OL https://boostorg.jfrog.io/artifactory/main/release/1.70.0/source/boost_1_70_0.tar.bz2 - tar -xjf boost_1_70_0.tar.bz2 + echo "430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778 boost_1_70_0.tar.bz2" | shasum -c && tar -xjf boost_1_70_0.tar.bz2 cd boost_1_70_0 ./bootstrap.sh --with-libraries=system,filesystem,thread,date_time,chrono,regex,serialization,atomic,program_options,locale,timer,log ./b2 @@ -63,10 +63,10 @@ Recommended OS version: Ubuntu 18.04 LTS. 4. Install OpenSSL - We recommend installing OpenSSL v1.1.1n locally unless you would like to use the same version system-wide. + We recommend installing OpenSSL v1.1.1n locally unless you would like to use the same version system-wide. Adjust the local path `/home/user/openssl` in the commands below according to your needs. curl -OL https://www.openssl.org/source/openssl-1.1.1n.tar.gz - tar xaf openssl-1.1.1n.tar.gz + echo "40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a openssl-1.1.1n.tar.gz" | shasum -c && tar xaf openssl-1.1.1n.tar.gz cd openssl-1.1.1n/ ./config --prefix=/home/user/openssl --openssldir=/home/user/openssl shared zlib make @@ -108,7 +108,7 @@ For instance, by adding the following lines to `~/.bashrc` 1. Build GUI: cd zano - utils/build_sript_linux.sh + utils/build_script_linux.sh 7. Look for the binaries in `build` folder diff --git a/contrib/eos_portable_archive/eos/portable_iarchive.hpp b/contrib/eos_portable_archive/eos/portable_iarchive.hpp index cd087f34..d5a39e08 100644 --- a/contrib/eos_portable_archive/eos/portable_iarchive.hpp +++ b/contrib/eos_portable_archive/eos/portable_iarchive.hpp @@ -88,6 +88,25 @@ // basic headers #include + +// The following sixteen lines disable annoying message in Boost 1.70 (The use of BOOST_*_ENDIAN and BOOST_BYTE_ORDER is deprecated.) +#if BOOST_VERSION == 107000 && !defined(BOOST_PREDEF_DETAIL_ENDIAN_COMPAT_H) +# define BOOST_PREDEF_DETAIL_ENDIAN_COMPAT_H +# include +#if BOOST_ENDIAN_BIG_BYTE +# define BOOST_BIG_ENDIAN +# define BOOST_BYTE_ORDER 4321 +#endif +#if BOOST_ENDIAN_LITTLE_BYTE +# define BOOST_LITTLE_ENDIAN +# define BOOST_BYTE_ORDER 1234 +#endif +#if BOOST_ENDIAN_LITTLE_WORD +# define BOOST_PDP_ENDIAN +# define BOOST_BYTE_ORDER 2134 +#endif +#endif + #include #include #include diff --git a/contrib/tor-connect b/contrib/tor-connect index 2e7176dc..b589edb1 160000 --- a/contrib/tor-connect +++ b/contrib/tor-connect @@ -1 +1 @@ -Subproject commit 2e7176dcea611c1933bec4133591e3f1885b8b37 +Subproject commit b589edb1906dccb387cfeded6ed12286c5f0405f diff --git a/resources/app_icon.svg b/resources/app_icon.svg new file mode 100644 index 00000000..d5ca861a --- /dev/null +++ b/resources/app_icon.svg @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/app_icon_256.png b/resources/app_icon_256.png new file mode 100644 index 00000000..c2cb1525 Binary files /dev/null and b/resources/app_icon_256.png differ diff --git a/src/common/pre_download.h b/src/common/pre_download.h index 3a3e8666..373c0bd4 100644 --- a/src/common/pre_download.h +++ b/src/common/pre_download.h @@ -21,8 +21,8 @@ namespace tools }; #ifndef TESTNET - static constexpr pre_download_entry c_pre_download_mdbx = { "http://95.217.42.247/pre-download/zano_mdbx_95_1569000.pak", "c2aff6fb65c2d7a40492738c75d1d04f2f35388d3c1a664aeb77420f2d90d644", 1740147926, 3221176320 }; - static constexpr pre_download_entry c_pre_download_lmdb = { "http://95.217.42.247/pre-download/zano_lmdb_95_1569000.pak", "f673636638b666b36c976168a3c64b2fd1fcf071c41b5d9cf01ed58a5924f80a", 2244905636, 3216977920 }; + static constexpr pre_download_entry c_pre_download_mdbx = { "http://95.217.42.247/pre-download/zano_mdbx_95_2200000.pak", "c3bd64c62495c3f266759750952519f13f32fc161b59547beaa8202b6e26d516", 2628767033, 5100195840 }; + static constexpr pre_download_entry c_pre_download_lmdb = { "http://95.217.42.247/pre-download/zano_lmdb_95_2200000.pak", "fcbf0ab3b23836e1a51fa675e719900fb94110cfb74790b3323cebce7fb9f5bd", 3426025872, 4954472448 }; #else static constexpr pre_download_entry c_pre_download_mdbx = { "", "", 0, 0 }; static constexpr pre_download_entry c_pre_download_lmdb = { "", "", 0, 0 }; diff --git a/src/currency_core/blockchain_storage.cpp b/src/currency_core/blockchain_storage.cpp index b398bd97..6ccb07aa 100644 --- a/src/currency_core/blockchain_storage.cpp +++ b/src/currency_core/blockchain_storage.cpp @@ -3921,9 +3921,6 @@ bool blockchain_storage::add_transaction_from_block(const transaction& tx, const if (need_to_profile && mixins_count > 0) { m_performance_data.tx_mixin_count.push(mixins_count); -#ifdef _DEBUG - LOG_PRINT_L0("[TX_MIXINS]: " << mixins_count); -#endif } //check if there is already transaction with this hash diff --git a/src/currency_core/checkpoints_create.h b/src/currency_core/checkpoints_create.h index e0152685..49d10037 100644 --- a/src/currency_core/checkpoints_create.h +++ b/src/currency_core/checkpoints_create.h @@ -26,6 +26,7 @@ namespace currency ADD_CHECKPOINT(900000, "2205b73cd79d4937b087b02a8b001171b73c34464bc4a952834eaf7c2bd63e86"); ADD_CHECKPOINT(1161000, "96990d851b484e30190678756ba2a4d3a2f92b987e2470728ac1e38b2bf35908"); ADD_CHECKPOINT(1480000, "5dd3381eec35e8b4eba4518bfd8eec682a4292761d92218fd59b9f0ffedad3fe"); + ADD_CHECKPOINT(2000000, "7b6698a8cc279aa78d6263f01fef186bd16f5b1ea263a7f4714abc1d506b9cb3"); #endif return true; diff --git a/src/currency_core/currency_core.cpp b/src/currency_core/currency_core.cpp index cd0b5d85..fde150f9 100644 --- a/src/currency_core/currency_core.cpp +++ b/src/currency_core/currency_core.cpp @@ -499,23 +499,24 @@ namespace currency //----------------------------------------------------------------------------------------------- bool core::add_new_block(const block& b, block_verification_context& bvc) { + uint64_t h = m_blockchain_storage.get_top_block_height(); + if (m_stop_after_height != 0 && h >= m_stop_after_height) + { + LOG_PRINT_YELLOW("Blockchain top block height is " << h << ", the daemon will now stop as requested", LOG_LEVEL_0); + if (m_critical_error_handler) + return m_critical_error_handler->on_immediate_stop_requested(); + return false; + } + bool r = m_blockchain_storage.add_new_block(b, bvc); if (r && bvc.m_added_to_main_chain) { - uint64_t h = get_block_height(b); + h = get_block_height(b); auto& crc = m_blockchain_storage.get_core_runtime_config(); if (h == crc.hard_fork_01_starts_after_height + 1) { LOG_PRINT_GREEN("Hardfork 1 activated at height " << h, LOG_LEVEL_0); } else if (h == crc.hard_fork_02_starts_after_height + 1) { LOG_PRINT_GREEN("Hardfork 2 activated at height " << h, LOG_LEVEL_0); } - - if (h == m_stop_after_height) - { - LOG_PRINT_YELLOW("Reached block " << h << ", the daemon will now stop as requested", LOG_LEVEL_0); - if (m_critical_error_handler) - return m_critical_error_handler->on_immediate_stop_requested(); - return false; - } } return r; } diff --git a/src/gui/qt-daemon/layout b/src/gui/qt-daemon/layout index 14def6ae..047a4602 160000 --- a/src/gui/qt-daemon/layout +++ b/src/gui/qt-daemon/layout @@ -1 +1 @@ -Subproject commit 14def6aef99d4f10e81990e2055a7cf490f2e797 +Subproject commit 047a4602748e0d3e40456f9d2fc2eeef1bc89b06 diff --git a/src/version.h.in b/src/version.h.in index e987e914..9b0be01a 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -5,9 +5,9 @@ #define PROJECT_MAJOR_VERSION "1" #define PROJECT_MINOR_VERSION "5" -#define PROJECT_REVISION "0" +#define PROJECT_REVISION "2" #define PROJECT_VERSION PROJECT_MAJOR_VERSION "." PROJECT_MINOR_VERSION "." PROJECT_REVISION -#define PROJECT_VERSION_BUILD_NO 145 +#define PROJECT_VERSION_BUILD_NO 150 #define PROJECT_VERSION_BUILD_NO_STR STRINGIFY_EXPAND(PROJECT_VERSION_BUILD_NO) #define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO_STR "[" BUILD_COMMIT_ID "]" diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 24476f13..7b7ffc09 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -31,12 +31,16 @@ using namespace epee; #include "version.h" #include "common/encryption_filter.h" #include "crypto/bitcoin/sha256_helper.h" + +#define DISABLE_TOR + #ifndef DISABLE_TOR #include "common/tor_helper.h" #endif #include "storages/levin_abstract_invoke2.h" + using namespace currency; @@ -3540,6 +3544,7 @@ bool wallet2::try_mint_pos() //------------------------------------------------------------------ bool wallet2::try_mint_pos(const currency::account_public_address& miner_address) { + TIME_MEASURE_START_MS(mining_duration_ms); mining_context ctx = AUTO_VAL_INIT(ctx); WLT_LOG_L2("Starting PoS mining iteration"); fill_mining_context(ctx); @@ -3569,8 +3574,9 @@ bool wallet2::try_mint_pos(const currency::account_public_address& miner_address { build_minted_block(ctx.sp, ctx.rsp, miner_address); } + TIME_MEASURE_FINISH_MS(mining_duration_ms); - WLT_LOG_L1("PoS mining: " << ctx.rsp.iterations_processed << " iterations finished, status: " << ctx.rsp.status << ", used " << ctx.sp.pos_entries.size() << " entries with total amount: " << print_money_brief(pos_entries_amount)); + WLT_LOG_L0("PoS mining: " << ctx.rsp.iterations_processed << " iterations finished (" << std::fixed << std::setprecision(2) << (mining_duration_ms / 1000.0f) << "s), status: " << ctx.rsp.status << ", used " << ctx.sp.pos_entries.size() << " entries with total amount: " << print_money_brief(pos_entries_amount)); return true; } @@ -3613,6 +3619,16 @@ bool wallet2::build_minted_block(const currency::COMMAND_RPC_SCAN_POS::request& tmpl_req.pos_index = req.pos_entries[rsp.index].index; tmpl_req.extra_text = m_miner_text_info; tmpl_req.stake_unlock_time = req.pos_entries[rsp.index].stake_unlock_time; + + // mark stake source as spent and make sure it will be restored in case of error + const std::vector stake_transfer_idx_vec{ req.pos_entries[rsp.index].wallet_index }; + mark_transfers_as_spent(stake_transfer_idx_vec, "stake source"); + bool gracefull_leaving = false; + auto stake_transfer_spent_flag_restorer = epee::misc_utils::create_scope_leave_handler([&](){ + if (!gracefull_leaving) + clear_transfers_from_flag(stake_transfer_idx_vec, WALLET_TRANSFER_DETAIL_FLAG_SPENT, "stake source"); + }); + //generate packing tx transaction pack_tx = AUTO_VAL_INIT(pack_tx); if (generate_packing_transaction_if_needed(pack_tx, 0)) @@ -3660,7 +3676,7 @@ bool wallet2::build_minted_block(const currency::COMMAND_RPC_SCAN_POS::request& keys_ptrs); WLT_CHECK_AND_ASSERT_MES(res, false, "Failed to prepare_and_sign_pos_block"); - WLT_LOG_GREEN("Block constructed <" << get_block_hash(b) << ">, sending to core...", LOG_LEVEL_0); + WLT_LOG_GREEN("Block " << get_block_hash(b) << " @ " << get_block_height(b) << " has been constructed, sending to core...", LOG_LEVEL_0); currency::COMMAND_RPC_SUBMITBLOCK2::request subm_req = AUTO_VAL_INIT(subm_req); currency::COMMAND_RPC_SUBMITBLOCK2::response subm_rsp = AUTO_VAL_INIT(subm_rsp); @@ -3677,6 +3693,7 @@ bool wallet2::build_minted_block(const currency::COMMAND_RPC_SCAN_POS::request& WLT_LOG_GREEN("POS block generated and accepted, congrats!", LOG_LEVEL_0); m_wcallback->on_pos_block_found(b); + gracefull_leaving = true; // to prevent source transfer flags be cleared in scope leave handler return true; } //---------------------------------------------------------------------------------------------------- diff --git a/src/wallet/wallets_manager.cpp b/src/wallet/wallets_manager.cpp index 4b06ef96..0b20459a 100644 --- a/src/wallet/wallets_manager.cpp +++ b/src/wallet/wallets_manager.cpp @@ -53,7 +53,6 @@ const command_line::arg_descriptor arg_alloc_win_console ( "alloc-win-console", "Allocates debug console with GUI", false ); const command_line::arg_descriptor arg_html_folder ( "html-path", "Manually set GUI html folder path"); -const command_line::arg_descriptor arg_xcode_stub ( "-NSDocumentRevisionsDebugMode", "Substitute for xcode bug"); const command_line::arg_descriptor arg_enable_gui_debug_mode ( "gui-debug-mode", "Enable debug options in GUI"); const command_line::arg_descriptor arg_qt_remote_debugging_port ( "remote-debugging-port", "Specify port for Qt remote debugging"); const command_line::arg_descriptor arg_remote_node ( "remote-node", "Switch GUI to work with remote node instead of local daemon"); @@ -62,6 +61,9 @@ const command_line::arg_descriptor arg_disable_logs_init("disable-logs-ini const command_line::arg_descriptor arg_qt_dev_tools ( "qt-dev-tools", "Enable main web page inspection with Chromium DevTools, [,scale], e.g. \"horizontal,1.3\"", ""); const command_line::arg_descriptor arg_disable_price_fetch("gui-disable-price-fetch", "Disable price fetching in UI(for privacy matter)"); +const command_line::arg_descriptor arg_xcode_stub("-NSDocumentRevisionsDebugMode", "Substitute for xcode bug"); +const command_line::arg_descriptor arg_sandbox_disable("no-sandbox", "Substitute for ubuntu/linux rendering problem"); + wallets_manager::wallets_manager():m_pview(&m_view_stub), m_stop_singal_sent(false), #ifndef MOBILE_WALLET_BUILD @@ -172,7 +174,9 @@ bool wallets_manager::init_command_line(int argc, char* argv[], std::string& fai command_line::add_arg(desc_cmd_sett, command_line::arg_log_level); command_line::add_arg(desc_cmd_sett, command_line::arg_console); command_line::add_arg(desc_cmd_only, command_line::arg_show_details); + command_line::add_arg(desc_cmd_sett, arg_alloc_win_console); + command_line::add_arg(desc_cmd_sett, arg_sandbox_disable); command_line::add_arg(desc_cmd_sett, arg_html_folder); command_line::add_arg(desc_cmd_only, arg_xcode_stub); command_line::add_arg(desc_cmd_sett, arg_enable_gui_debug_mode); @@ -331,7 +335,25 @@ bool wallets_manager::init(view::i_view* pview_handler) std::string path_to_html; if (!command_line::has_arg(m_vm, arg_html_folder)) { - path_to_html = string_tools::get_current_module_folder() + "/html"; + LOG_PRINT_L0("Detecting APPDIR... "); +#if defined(__unix__) || defined(__linux__) + const char* env_p = std::getenv("APPDIR"); + LOG_PRINT_L0("APPDIR = " << (void*)env_p); + if (env_p) + { + LOG_PRINT_L0("APPDIR: " << env_p); + } + if (env_p && std::strlen(env_p)) + { + //app running inside AppImage + LOG_PRINT_L0("APPDIR SET: " << env_p); + path_to_html = std::string(env_p) + "/usr/bin/html"; + } + else +#endif + { + path_to_html = string_tools::get_current_module_folder() + "/html"; + } } else { diff --git a/tests/core_tests/pos_validation.cpp b/tests/core_tests/pos_validation.cpp index 2fb6de17..1593d270 100644 --- a/tests/core_tests/pos_validation.cpp +++ b/tests/core_tests/pos_validation.cpp @@ -1029,6 +1029,12 @@ bool pos_minting_tx_packing::configure_core(currency::core& c, size_t ev_index, bool pos_minting_tx_packing::pos_minting_tx_packing::generate(std::vector& events) const { + // + // THIS TEST IS ONLY FOR PRE-ZARCANUM WALLET + // PLEASE, reject all changes made in master/release2/develop branches and use the version from cryptoassets/multiassets + // -- sowle + // + bool r = false; m_accounts.resize(TOTAL_ACCS_COUNT); account_base& miner_acc = m_accounts[MINER_ACC_IDX]; miner_acc.generate(); @@ -1039,12 +1045,12 @@ bool pos_minting_tx_packing::pos_minting_tx_packing::generate(std::vectorset_pos_mint_packing_size(m_pos_mint_packing_size); + alice_wlt->set_pos_mint_packing_size(100); // no coinbase tx outputs should be packed r = alice_wlt->try_mint_pos(); @@ -1096,7 +1102,7 @@ bool pos_minting_tx_packing::c1(currency::core& c, size_t ev_index, const std::v m_alice_start_amount + CURRENCY_BLOCK_REWARD * (m_pos_mint_packing_size + 1), // total true, UINT64_MAX, - m_alice_start_amount // unlocked (one output with amount == CURRENCY_BLOCK_REWARD * m_pos_mint_packing_size was spent as stake) + UINT64_MAX //m_alice_start_amount // unlocked (one output with amount == CURRENCY_BLOCK_REWARD * m_pos_mint_packing_size was spent as stake) ), false, ""); r = mine_next_pow_blocks_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c, WALLET_DEFAULT_TX_SPENDABLE_AGE); @@ -1109,7 +1115,8 @@ bool pos_minting_tx_packing::c1(currency::core& c, size_t ev_index, const std::v m_alice_start_amount + CURRENCY_BLOCK_REWARD * (m_pos_mint_packing_size + 1) // unlocked ), false, ""); - // coinbase tx outputs should be packed now, there's enough coinbase outputs (> m_pos_mint_packing_size) + // coinbase tx outputs still should NOT be packed now (it's only possible with the stake) + alice_wlt->set_pos_mint_packing_size(10); r = alice_wlt->try_mint_pos(); CHECK_AND_ASSERT_MES(r, false, "try_mint_pos failed"); @@ -1117,11 +1124,10 @@ bool pos_minting_tx_packing::c1(currency::core& c, size_t ev_index, const std::v m_alice_start_amount + CURRENCY_BLOCK_REWARD * (m_pos_mint_packing_size + 2), // total (+1 one block reward) true, UINT64_MAX, - // CURRENCY_BLOCK_REWARD * m_pos_mint_packing_size locked for stake - // CURRENCY_BLOCK_REWARD * (m_pos_mint_packing_size + 1) locked for packing tx - m_alice_start_amount + CURRENCY_BLOCK_REWARD - CURRENCY_BLOCK_REWARD * (m_pos_mint_packing_size + 1) // unlocked + m_alice_start_amount + CURRENCY_BLOCK_REWARD * (m_pos_mint_packing_size + 0) // unlocked ), false, ""); + alice_wlt->set_pos_mint_packing_size(8); r = alice_wlt->try_mint_pos(); CHECK_AND_ASSERT_MES(r, false, "try_mint_pos failed"); @@ -1129,8 +1135,7 @@ bool pos_minting_tx_packing::c1(currency::core& c, size_t ev_index, const std::v m_alice_start_amount + CURRENCY_BLOCK_REWARD * (m_pos_mint_packing_size + 3), // total (+1 one block reward) true, UINT64_MAX, - // CURRENCY_BLOCK_REWARD * m_pos_mint_packing_size locked for stake - m_alice_start_amount + CURRENCY_BLOCK_REWARD - CURRENCY_BLOCK_REWARD * (m_pos_mint_packing_size + 1) - CURRENCY_BLOCK_REWARD * m_pos_mint_packing_size // unlocked + 0 // unlocked ), false, ""); return true; diff --git a/utils/Zano.desktop b/utils/Zano.desktop new file mode 100644 index 00000000..8a912f57 --- /dev/null +++ b/utils/Zano.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Version=1.0 +Name=Zano +GenericName=Zano +Comment=Privacy blockchain +Icon=Zano +Terminal=true +Type=Application +Categories=Qt;Utility; +Name[en_US]=Zano +MimeType=x-scheme-handler/zano; + diff --git a/utils/Zano_appimage_wrapper.sh b/utils/Zano_appimage_wrapper.sh new file mode 100755 index 00000000..9c588e61 --- /dev/null +++ b/utils/Zano_appimage_wrapper.sh @@ -0,0 +1,48 @@ +#!/bin/bash +script_dir=$( dirname "$(readlink -f "$0")" ) + +out_dir=~/.local/share/applications +out_file_name="${out_dir}/Zano.desktop" + +export QTWEBENGINE_DISABLE_SANDBOX=1 + +call_app() +{ + pushd $script_dir + usr/bin/Zano "$@" + if [ $? -ne 0 ]; then + echo $'\n\n\x1b[1mIf Zano fails to launch, it might need to install xinerama extension for the X C Binding with this command:\n\x1b[2m sudo apt-get install libxcb-xinerama0\n\n' + fi + + popd + exit +} + + +create_desktop_icon() +{ + target_file_name=$1 + echo "Generating icon file: $target_file_name..." + rm -f "${out_dir}/Zano.png" + rm -f $target_file_name + cp -Rv "${APPDIR}/usr/share/icons/hicolor/256x256/apps/Zano.png" "${out_dir}/Zano.png" + echo [Desktop Entry] | tee -a $target_file_name > /dev/null + echo Version=1.0 | tee -a $target_file_name > /dev/null + echo Name=Zano | tee -a $target_file_name > /dev/null + echo GenericName=Zano | tee -a $target_file_name > /dev/null + echo Comment=Privacy blockchain | tee -a $target_file_name > /dev/null + echo Icon=${out_dir}/Zano.png | tee -a $target_file_name > /dev/null + echo Exec=$APPIMAGE --deeplink-params=%u | tee -a $target_file_name > /dev/null + echo Terminal=true | tee -a $target_file_name > /dev/null + echo Type=Application | tee -a $target_file_name > /dev/null + echo "Categories=Qt;Utility;" | tee -a $target_file_name > /dev/null + echo "MimeType=x-scheme-handler/zano;" | tee -a $target_file_name > /dev/null + echo "StartupWMClass=Zano" | tee -a $target_file_name > /dev/null +} + + +create_desktop_icon $out_file_name + +xdg-mime default Zano.desktop x-scheme-handler/zano + +call_app "$@" diff --git a/utils/build_mail.py b/utils/build_mail.py new file mode 100644 index 00000000..4b547204 --- /dev/null +++ b/utils/build_mail.py @@ -0,0 +1,36 @@ +import sys +import os +import smtplib +from email.message import EmailMessage + +def getenv(e): + t = os.getenv(e) + if t == None: + print("Error: environment variable " + e + " was not set") + exit(1) + return t + +zs_from = getenv("ZANO_SMTP_FROM") +zs_addr = getenv("ZANO_SMTP_ADDR") +zs_port = getenv("ZANO_SMTP_PORT") +zs_user = getenv("ZANO_SMTP_USER") +zs_pass = getenv("ZANO_SMTP_PASS") + +if len(sys.argv) != 4: + print("Usage: " + sys.argv[0] + " ") + exit(1) + +msg = EmailMessage() +msg['Subject'] = sys.argv[1] +msg['From'] = zs_from +msg['To'] = sys.argv[2] +msg.add_header('Content-Type','text/html') +msg.set_payload(sys.argv[3]) + +s = smtplib.SMTP(zs_addr, zs_port) +s.starttls() +s.login(zs_user, zs_pass) +s.send_message(msg) +s.quit() + +print("e-mail sent.") diff --git a/utils/build_script_linux.sh b/utils/build_script_linux.sh index fe5adbef..96bf6ea0 100755 --- a/utils/build_script_linux.sh +++ b/utils/build_script_linux.sh @@ -137,11 +137,11 @@ fi read checksum <<< $(sha256sum $package_filename | awk '/^/ { print $1 }' ) mail_msg="New ${build_prefix_label}${testnet_label}${copy_qt_dev_tools_label}build for linux-x64:
-https://build.zano.org/builds/$package_filename
+https://build.zano.org/builds/$package_filename
sha256: $checksum" echo "$mail_msg" -echo "$mail_msg" | mail -s "Zano linux-x64 ${build_prefix_label}${testnet_label}${copy_qt_dev_tools_label}build $version_str" ${emails} +python3 ../../utils/build_mail.py "Zano linux-x64 ${build_prefix_label}${testnet_label}${copy_qt_dev_tools_label}build $version_str" "${emails}" "$mail_msg" exit 0 diff --git a/utils/build_script_linux_appimage.sh b/utils/build_script_linux_appimage.sh new file mode 100755 index 00000000..dad4b69e --- /dev/null +++ b/utils/build_script_linux_appimage.sh @@ -0,0 +1,159 @@ +#!/bin/bash -x + +# Environment prerequisites: +# 1) QT_PREFIX_PATH should be set to Qt libs folder +# 2) BOOST_ROOT should be set to the root of Boost +# 3) OPENSSL_ROOT_DIR should be set to the root of OpenSSL +# +# for example, place these lines to the end of your ~/.bashrc : +# +# export BOOST_ROOT=/home/user/boost_1_66_0 +# export QT_PREFIX_PATH=/home/user/Qt5.10.1/5.10.1/gcc_64 +# export OPENSSL_ROOT_DIR=/home/user/openssl +# export LINUX_DEPLOY_QT=/home/user/QtDeployment.appimage +# export LINUX_APPIMAGE_TOOL=/home/user/AppImageTool.appimage + + +ARCHIVE_NAME_PREFIX=zano-linux-x64- + +: "${BOOST_ROOT:?BOOST_ROOT should be set to the root of Boost, ex.: /home/user/boost_1_66_0}" +: "${QT_PREFIX_PATH:?QT_PREFIX_PATH should be set to Qt libs folder, ex.: /home/user/Qt5.10.1/5.10.1/gcc_64}" +: "${OPENSSL_ROOT_DIR:?OPENSSL_ROOT_DIR should be set to OpenSSL root folder, ex.: /home/user/openssl}" + +if [ -n "$build_prefix" ]; then + ARCHIVE_NAME_PREFIX=${ARCHIVE_NAME_PREFIX}${build_prefix}- + build_prefix_label="$build_prefix " +fi + +if [ "$testnet" == true ]; then + testnet_def="-D TESTNET=TRUE" + testnet_label="testnet " + ARCHIVE_NAME_PREFIX=${ARCHIVE_NAME_PREFIX}testnet- +fi + +if [ "$testnet" == true ] || [ -n "$qt_dev_tools" ]; then + copy_qt_dev_tools=true + copy_qt_dev_tools_label="devtools " + ARCHIVE_NAME_PREFIX=${ARCHIVE_NAME_PREFIX}devtools- +fi + + +prj_root=$(pwd) + +if [ "$1" == "skip_build" ]; then + echo "Skipping build, only packing..." + cd build/release; +else +echo "---------------- BUILDING PROJECT ----------------" +echo "--------------------------------------------------" + +echo "Building...." + +rm -rf build; mkdir -p build/release; +cd build/release; +cmake $testnet_def -D STATIC=true -D ARCH=x86-64 -D BUILD_GUI=TRUE -D OPENSSL_ROOT_DIR="$OPENSSL_ROOT_DIR" -D CMAKE_PREFIX_PATH="$QT_PREFIX_PATH" -D CMAKE_BUILD_TYPE=Release ../.. +if [ $? -ne 0 ]; then + echo "Failed to run cmake" + exit 1 +fi + +make -j2 daemon simplewallet connectivity_tool +if [ $? -ne 0 ]; then + echo "Failed to make!" + exit 1 +fi + +make -j1 Zano +if [ $? -ne 0 ]; then + echo "Failed to make!" + exit 1 +fi + +fi + + + +read version_str <<< $(./src/zanod --version | awk '/^Zano/ { print $2 }') +version_str=${version_str} + +read commit_str <<< $(./src/zanod --version | grep -m 1 -P -o "(?<=\[)[0-9a-f]{7}") +commit_str=${commit_str} + +echo $version_str +echo $commit_str + + +rm -rf Zano; +mkdir -p Zano/usr/bin; +mkdir -p Zano/usr/lib; +mkdir -p Zano/usr/share/applications; +mkdir -p Zano/usr/share/icons/hicolor/scalable/apps; +mkdir -p Zano/usr/share/icons/hicolor/256x256/apps; + + +rsync -a ../../src/gui/qt-daemon/layout/html ./Zano/usr/bin --exclude less --exclude package.json --exclude gulpfile.js + +cp -Rv src/zanod src/Zano src/simplewallet src/connectivity_tool ./Zano/usr/bin +cp -Rv ../../utils/Zano.desktop ./Zano/usr/share/applications/Zano.desktop +cp -Rv ../../resources/app_icon.svg ./Zano/usr/share/icons/hicolor/scalable/apps/Zano.svg +cp -Rv ../../resources/app_icon_256.png ./Zano/usr/share/icons/hicolor/256x256/apps/Zano.png + + +echo "Exec=$prj_root/build/release/Zano/usr/bin/Zano" >> ./Zano/usr/share/applications/Zano.desktop +if [ $? -ne 0 ]; then + echo "Failed to append deskyop file" + exit 1 +fi + +$LINUX_DEPLOY_QT ./Zano/usr/share/applications/Zano.desktop -qmake=$QT_PREFIX_PATH/bin/qmake +if [ $? -ne 0 ]; then + echo "Failed to run linuxqtdeployment" + exit 1 +fi + +rm -f $prj_root/build/release/Zano/AppRun +cp -Rv ../../utils/Zano_appimage_wrapper.sh $prj_root/build/release/Zano/AppRun + +package_filename=${ARCHIVE_NAME_PREFIX}${version_str}.AppImage + +$LINUX_APPIMAGE_TOOL ./Zano ./$package_filename +if [ $? -ne 0 ]; then + echo "Failed to run appimagetool" + exit 1 +fi + + + + +#pattern="*.AppImage" +#files=( $pattern ) +#app_image_file=${files[0]} + + +#mv ./$app_image_file ./$package_filename + +echo "Build success" + +if [ -z "$upload_build" ]; then + exit 0 +fi + +echo "Uploading..." + +scp $package_filename zano_build_server:/var/www/html/builds +if [ $? -ne 0 ]; then + echo "Failed to upload to remote server" + exit $? +fi + +read checksum <<< $(sha256sum $package_filename | awk '/^/ { print $1 }' ) + +mail_msg="New ${build_prefix_label}${testnet_label}${copy_qt_dev_tools_label}build for linux-x64:
+https://build.zano.org/builds/$package_filename
+sha256: $checksum" + +echo "$mail_msg" + +python3 ../../utils/build_mail.py "Zano linux-x64 ${build_prefix_label}${testnet_label}${copy_qt_dev_tools_label}build $version_str" "${emails}" "$mail_msg" + +exit 0 diff --git a/utils/build_script_mac_osx.sh b/utils/build_script_mac_osx.sh index 15acd9e3..c26b8da9 100755 --- a/utils/build_script_mac_osx.sh +++ b/utils/build_script_mac_osx.sh @@ -148,25 +148,28 @@ echo "Build success" echo "############### Uploading... ################" -package_filepath=$package_filename +package_filepath="$(pwd)/$package_filename" -scp $package_filepath zano_build_server:/var/www/html/builds/ +#scp $package_filepath zano_build_server:/var/www/html/builds/ +source ../../../utils/macosx_build_uploader.sh +pushd . +upload_build $package_filepath if [ $? -ne 0 ]; then echo "Failed to upload to remote server" exit 1 fi +popd read checksum <<< $( shasum -a 256 $package_filepath | awk '/^/ { print $1 }' ) mail_msg="New ${build_prefix_label}${testnet_label}build for macOS-x64:
-https://build.zano.org/builds/$package_filename
+https://build.zano.org/builds/$package_filename
sha256: $checksum" echo "$mail_msg" -echo "$mail_msg" | mail -s "Zano macOS-x64 ${build_prefix_label}${testnet_label}build $version_str" ${emails} - +python3 ../../../utils/build_mail.py "Zano macOS-x64 ${build_prefix_label}${testnet_label}build $version_str" "${emails}" "$mail_msg" ###################### # notarization diff --git a/utils/build_script_windows.bat b/utils/build_script_windows.bat index 6ab41c90..ce180a66 100644 --- a/utils/build_script_windows.bat +++ b/utils/build_script_windows.bat @@ -168,31 +168,32 @@ IF %ERRORLEVEL% NEQ 0 ( set installer_file=%ACHIVE_NAME_PREFIX%%version%-installer.exe set installer_path=%BUILDS_PATH%\builds\%installer_file% -@echo " SIGNING ...." - -%ZANO_SIGN_CMD% %installer_path% -IF %ERRORLEVEL% NEQ 0 ( - @echo "failed to sign installer" - rem goto error -) +:: Signing temporary disable +::@echo " SIGNING ...." +:: +::%ZANO_SIGN_CMD% %installer_path% +::IF %ERRORLEVEL% NEQ 0 ( +:: @echo "failed to sign installer" +:: goto error +::) @echo " UPLOADING TO SERVER ...." -pscp -load zano_build_server %installer_path% build.zano.org:/var/www/html/builds +pscp %installer_path% zano_build_server:/var/www/html/builds IF %ERRORLEVEL% NEQ 0 ( @echo "FAILED TO UPLOAD EXE TO SERVER" goto error ) call :sha256 %installer_path% installer_checksum -pscp -load zano_build_server %build_zip_path% build.zano.org:/var/www/html/builds +pscp %build_zip_path% zano_build_server:/var/www/html/builds IF %ERRORLEVEL% NEQ 0 ( @echo "FAILED TO UPLOAD ZIP TO SERVER" goto error ) call :sha256 %build_zip_path% build_zip_checksum -set mail_msg="New %build_prefix% %TESTNET_LABEL%build for win-x64:
INST: https://build.zano.org/builds/%installer_file%
sha256: %installer_checksum%

ZIP: https://build.zano.org/builds/%build_zip_filename%
sha256: %build_zip_checksum%
" +set mail_msg="New %build_prefix% %TESTNET_LABEL%build for win-x64:
INST: https://build.zano.org/builds/%installer_file%
sha256: %installer_checksum%

ZIP: