From 05cb4dca11cd3971c0a2a33ac90fd0f871a24a39 Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Sat, 27 Jan 2018 00:07:07 +0100 Subject: [PATCH] monero-gui: init at 0.11.1.0 --- .../altcoins/monero-gui/default.nix | 89 +++++++++++++++++++ .../altcoins/monero-gui/move-log-file.patch | 42 +++++++++ .../monero-gui/move-translations-dir.patch | 14 +++ pkgs/top-level/all-packages.nix | 2 + 4 files changed, 147 insertions(+) create mode 100644 pkgs/applications/altcoins/monero-gui/default.nix create mode 100644 pkgs/applications/altcoins/monero-gui/move-log-file.patch create mode 100644 pkgs/applications/altcoins/monero-gui/move-translations-dir.patch diff --git a/pkgs/applications/altcoins/monero-gui/default.nix b/pkgs/applications/altcoins/monero-gui/default.nix new file mode 100644 index 000000000000..0d2899b2e649 --- /dev/null +++ b/pkgs/applications/altcoins/monero-gui/default.nix @@ -0,0 +1,89 @@ +{ stdenv, fetchFromGitHub +, makeWrapper, makeDesktopItem +, qtbase, qmake, qtmultimedia, qttools +, qtgraphicaleffects, qtdeclarative +, qtlocation, qtquickcontrols, qtwebchannel +, qtwebengine, qtx11extras, qtxmlpatterns +, monero, unbound, readline, boost, libunwind +}: + +with stdenv.lib; + +stdenv.mkDerivation rec { + name = "monero-gui-${version}"; + version = "0.11.1.0"; + + src = fetchFromGitHub { + owner = "monero-project"; + repo = "monero-gui"; + rev = "v${version}"; + sha256 = "01d7apwrv8j8bh7plvvhlnll3ransaha3n6rx19nkgvfn319hswq"; + }; + + nativeBuildInputs = [ qmake ]; + + buildInputs = [ + qtbase qtmultimedia qtgraphicaleffects + qtdeclarative qtlocation qtquickcontrols + qtwebchannel qtwebengine qtx11extras + qtxmlpatterns monero unbound readline + boost libunwind makeWrapper + ]; + + patches = [ + ./move-log-file.patch + ./move-translations-dir.patch + ]; + + postPatch = '' + echo ' + var GUI_VERSION = "${version}"; + var GUI_MONERO_VERSION = "${getVersion monero}"; + ' > version.js + substituteInPlace monero-wallet-gui.pro \ + --replace '$$[QT_INSTALL_BINS]/lrelease' '${getDev qttools}/bin/lrelease' + substituteInPlace src/daemon/DaemonManager.cpp \ + --replace 'QApplication::applicationDirPath() + "' '"${monero}/bin' + ''; + + makeFlags = [ "INSTALL_ROOT=$(out)" ]; + + preBuild = '' + sed -i s#/opt/monero-wallet-gui##g Makefile + make -C src/zxcvbn-c + ''; + + desktopItem = makeDesktopItem { + name = "monero-wallet-gui"; + exec = "monero-wallet-gui"; + icon = "monero"; + desktopName = "Monero Wallet"; + genericName = "Wallet"; + categories = "Application;Network;Utility;"; + }; + + postInstall = '' + # install desktop entry + mkdir -p $out/share/applications + cp ${desktopItem}/share/applications/* $out/share/applications + + # install translations + cp -r release/bin/translations $out/share/ + + # install icons + for n in 16 24 32 48 64 96 128 256; do + size=$n"x"$n + mkdir -p $out/share/icons/hicolor/$size/apps + cp $src/images/appicons/$size.png \ + $out/share/icons/hicolor/$size/apps/monero.png + done; + ''; + + meta = { + description = "Private, secure, untraceable currency"; + homepage = https://getmonero.org/; + license = licenses.bsd3; + platforms = platforms.all; + maintainers = with maintainers; [ rnhmjoj ]; + }; +} diff --git a/pkgs/applications/altcoins/monero-gui/move-log-file.patch b/pkgs/applications/altcoins/monero-gui/move-log-file.patch new file mode 100644 index 000000000000..928fb32911f5 --- /dev/null +++ b/pkgs/applications/altcoins/monero-gui/move-log-file.patch @@ -0,0 +1,42 @@ +diff --git a/main.cpp b/main.cpp +index 1a9a979..2316929 100644 +--- a/main.cpp ++++ b/main.cpp +@@ -74,10 +74,6 @@ int main(int argc, char *argv[]) + // qDebug() << "High DPI auto scaling - enabled"; + //#endif + +- // Log settings +- Monero::Wallet::init(argv[0], "monero-wallet-gui"); +-// qInstallMessageHandler(messageHandler); +- + MainApp app(argc, argv); + + qDebug() << "app startd"; +@@ -86,6 +82,13 @@ int main(int argc, char *argv[]) + app.setOrganizationDomain("getmonero.org"); + app.setOrganizationName("monero-project"); + ++ // Log settings ++ QString logfile = ++ QStandardPaths::writableLocation(QStandardPaths::CacheLocation) ++ + "/monero-wallet-gui.log"; ++ Monero::Wallet::init(argv[0], logfile.toUtf8().constData()); ++ ++ + filter *eventFilter = new filter; + app.installEventFilter(eventFilter); + +diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp +index 8525bf3..6967b24 100644 +--- a/src/libwalletqt/Wallet.cpp ++++ b/src/libwalletqt/Wallet.cpp +@@ -613,7 +613,7 @@ QString Wallet::getDaemonLogPath() const + + QString Wallet::getWalletLogPath() const + { +- return QCoreApplication::applicationDirPath() + "/monero-wallet-gui.log"; ++ return QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/monero-wallet-gui.log"; + } + + Wallet::Wallet(Monero::Wallet *w, QObject *parent) diff --git a/pkgs/applications/altcoins/monero-gui/move-translations-dir.patch b/pkgs/applications/altcoins/monero-gui/move-translations-dir.patch new file mode 100644 index 000000000000..29bb56301547 --- /dev/null +++ b/pkgs/applications/altcoins/monero-gui/move-translations-dir.patch @@ -0,0 +1,14 @@ +diff --git a/TranslationManager.cpp b/TranslationManager.cpp +index fa39d35..5a410f7 100644 +--- a/TranslationManager.cpp ++++ b/TranslationManager.cpp +@@ -29,7 +29,7 @@ bool TranslationManager::setLanguage(const QString &language) + #ifdef Q_OS_MACX + QString dir = qApp->applicationDirPath() + "/../Resources/translations"; + #else +- QString dir = qApp->applicationDirPath() + "/translations"; ++ QString dir = qApp->applicationDirPath() + "/../share/translations"; + #endif + + QString filename = "monero-core_" + language; + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ecd3f937c07f..bffcba0951e1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16120,6 +16120,8 @@ with pkgs; monero = callPackage ../applications/altcoins/monero { }; + monero-gui = libsForQt5.callPackage ../applications/altcoins/monero-gui { }; + xmr-stak = callPackage ../applications/misc/xmr-stak { hwloc = hwloc-nox; };