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/wallet/wallets_manager.cpp b/src/wallet/wallets_manager.cpp index 161a6e13..f19203c6 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,12 +335,19 @@ bool wallets_manager::init(view::i_view* pview_handler) std::string path_to_html; if (!command_line::has_arg(m_vm, arg_html_folder)) { + 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 - path_to_html = std::string(env_p) + "usr/bin/html"; + LOG_PRINT_L0("APPDIR SET: " << env_p); + path_to_html = std::string(env_p) + "/usr/bin/html"; } else #endif 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..7aace196 --- /dev/null +++ b/utils/Zano_appimage_wrapper.sh @@ -0,0 +1,44 @@ +#!/bin/bash -x +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 "$@" + 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_script_linux_appimage.sh b/utils/build_script_linux_appimage.sh new file mode 100755 index 00000000..94cb3cce --- /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" + +echo "$mail_msg" | mail -s "Zano linux-x64 ${build_prefix_label}${testnet_label}${copy_qt_dev_tools_label}build $version_str" ${emails} + +exit 0 \ No newline at end of file