summary refs log tree commit diff
path: root/pkgs/tools/security/iaito
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2022-08-01 22:18:43 +0300
committerAzat Bahawi <azat@bahawi.net>2022-08-02 22:39:27 +0300
commitcf885915b321c17fd569198f94b016d6b73e8302 (patch)
tree8498aa97bb98e8878825ecab2b73524fed379746 /pkgs/tools/security/iaito
parent84cc06af6fc0bfded90c3bafd97c1588fb3c5702 (diff)
iaito: 5.7.0 -> 5.7.2
Diffstat (limited to 'pkgs/tools/security/iaito')
-rw-r--r--pkgs/tools/security/iaito/default.nix43
-rw-r--r--pkgs/tools/security/iaito/remove-broken-version-check.patch54
2 files changed, 80 insertions, 17 deletions
diff --git a/pkgs/tools/security/iaito/default.nix b/pkgs/tools/security/iaito/default.nix
index e2a4d37a9779f..d8bfc9e4747c5 100644
--- a/pkgs/tools/security/iaito/default.nix
+++ b/pkgs/tools/security/iaito/default.nix
@@ -1,44 +1,52 @@
 { lib
 , stdenv
 , fetchFromGitHub
+, meson
+, ninja
 , pkg-config
+, python3
 , qtbase
 , qttools
 , radare2
 , wrapQtAppsHook
-, zip
 , nix-update-script
 }:
 
+# TODO MacOS support.
+# TODO Build and install translations.
+
 stdenv.mkDerivation rec {
   pname = "iaito";
-  version = "5.7.0";
+  version = "5.7.2";
 
   src = fetchFromGitHub {
     owner = "radareorg";
     repo = pname;
     rev = version;
-    fetchSubmodules = true;
-    sha256 = "sha256-qEJTsS669eEwo2iiuybN72O5oopCaGEkju8+ekjw2zk=";
+    sha256 = "sha256-5/G5wfdc6aua90XLP3B7Ruy8F3NTXzWfQE6yVDZ0rX8=";
   };
 
-  nativeBuildInputs = [ pkg-config qttools wrapQtAppsHook zip ];
+  nativeBuildInputs = [ meson ninja pkg-config python3 qttools wrapQtAppsHook ];
+
   buildInputs = [ radare2 qtbase ];
 
-  postPatch = ''
-    substituteInPlace Makefile \
-      --replace "git submodule update --init" ""
+  postUnpack = ''
+    sourceRoot=$sourceRoot/src
   '';
 
-  NIX_CFLAGS_COMPILE = [ "-I${radare2}/include/libr" "-I${radare2}/include/libr/sdb" ];
+  # TODO Fix version checking and version information for r2.
+  # Version checking always fails due to values being empty strings for some
+  # reason. Meanwhile, we can safely assume that radare2's runtime and
+  # compile-time implementations are the same and remove this check.
+  patches = [ ./remove-broken-version-check.patch ];
 
   installPhase = ''
     runHook preInstall
 
-    install -Dm755 build/iaito $out/bin/iaito
-    install -Dm644 $src/src/org.radare.iaito.appdata.xml $out/share/metainfo/org.radare.iaito.appdata.xml
-    install -Dm644 $src/src/org.radare.iaito.desktop $out/share/applications/org.radare.iaito.desktop
-    install -Dm644 $src/src/img/iaito-o.svg $out/share/pixmaps/iaito-o.svg
+    install -m755 -Dt $out/bin iaito
+    install -m644 -Dt $out/share/metainfo $src/src/org.radare.iaito.appdata.xml
+    install -m644 -Dt $out/share/applications $src/src/org.radare.iaito.desktop
+    install -m644 -Dt $out/share/pixmaps $src/src/img/iaito-o.svg
 
     runHook postInstall
   '';
@@ -48,14 +56,15 @@ stdenv.mkDerivation rec {
   };
 
   meta = with lib; {
-    description = "Official frontend of radare2";
+    description = "An official graphical interface of radare2";
     longDescription = ''
-      The official graphical interface for radare2, a libre reverse engineering
-      framework.
+      iaito is the official graphical interface of radare2. It's the
+      continuation of Cutter for radare2 after the Rizin fork.
     '';
-    homepage = "https://github.com/radareorg/iaito";
+    homepage = "https://radare.org/n/iaito.html";
     changelog = "https://github.com/radareorg/iaito/releases/tag/${src.rev}";
     license = licenses.gpl3Plus;
     maintainers = with maintainers; [ azahi ];
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/tools/security/iaito/remove-broken-version-check.patch b/pkgs/tools/security/iaito/remove-broken-version-check.patch
new file mode 100644
index 0000000000000..7c4e3ef30ace3
--- /dev/null
+++ b/pkgs/tools/security/iaito/remove-broken-version-check.patch
@@ -0,0 +1,54 @@
+diff --git i/IaitoApplication.cpp w/IaitoApplication.cpp
+index 25b6a4e7..4cbde5c4 100644
+--- i/IaitoApplication.cpp
++++ w/IaitoApplication.cpp
+@@ -33,27 +33,6 @@
+ #include <R2GhidraDecompiler.h>
+ #endif
+ 
+-static bool versionCheck() {
+-    // Check r2 version
+-    QString a = r_core_version (); // runtime library version
+-    QString b = "" R2_GITTAP; // compiled version
+-    QStringList la = a.split(".");
+-    QStringList lb = b.split(".");
+-    if (la.size() < 2 && lb.size() < 2) {
+-      eprintf ("Invalid version string somwhere\n");
+-      return false;
+-    }
+-    if (la.at(0) != lb.at(0)) {
+-      eprintf ("Major version differs\n");
+-      return false;
+-    }
+-    if (la.at(1) != lb.at(1)) {
+-      eprintf ("Minor version differs\n");
+-      return false;
+-    }
+-    return true;
+-}
+-
+ IaitoApplication::IaitoApplication(int &argc, char **argv) : QApplication(argc, argv)
+ {
+     // Setup application information
+@@ -101,21 +80,6 @@ IaitoApplication::IaitoApplication(int &argc, char **argv) : QApplication(argc,
+         std::exit(1);
+     }
+ 
+-    if (!versionCheck ()) {
+-        QMessageBox msg;
+-        msg.setIcon(QMessageBox::Critical);
+-        msg.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
+-        msg.setWindowTitle(QObject::tr("Version mismatch!"));
+-        QString localVersion = r_core_version ();
+-        QString r2version = R2_GITTAP;
+-        msg.setText(QString(
+-                        QObject::tr("The version used to compile Iaito (%1) does not match the binary version of radare2 (%2). This could result in unexpected behaviour. Are you sure you want to continue?")).arg(
+-                        localVersion, r2version));
+-        if (msg.exec() == QMessageBox::No) {
+-            std::exit(1);
+-        }
+-    }
+-
+ #ifdef IAITO_ENABLE_PYTHON
+     // Init python
+     if (!clOptions.pythonHome.isEmpty()) {