Unverified Commit eee82df6 authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

Merge pull request #201087 from azahi/iaito

parents f877bb5c 1a047a95
Loading
Loading
Loading
Loading
+51 −29
Original line number Diff line number Diff line
@@ -9,52 +9,74 @@
, qttools
, radare2
, wrapQtAppsHook
, nix-update-script
}:

# TODO MacOS support.
# TODO Build and install translations.

stdenv.mkDerivation rec {
  pname = "iaito";
  version = "5.7.6";
  version = "5.7.8";

  src = fetchFromGitHub {
  srcs = [
    (fetchFromGitHub rec {
      owner = "radareorg";
    repo = pname;
      repo = "iaito";
      rev = version;
    sha256 = "sha256-PnIOoWPYLK30lMmLVctihCs7GBo0rTN8yetWAr21h9w=";
  };

  nativeBuildInputs = [ meson ninja pkg-config python3 qttools wrapQtAppsHook ];

  buildInputs = [ radare2 qtbase ];
      hash = "sha256-c36WLpVUnffeY6cXSEHvguo8BHyxaLAluN9hBKsQc0s=";
      name = repo;
    })
    (fetchFromGitHub rec {
      owner = "radareorg";
      repo = "iaito-translations";
      rev = "ab923335409fa298c39f0014588d78d926c6f3a2";
      hash = "sha256-qkIC67a6YRwOa2Sr16Vg6If1TmAiSKUV7hw13Wxwl/w=";
      name = repo;
    })
  ];
  sourceRoot = "iaito/src";

  postUnpack = ''
    sourceRoot=$sourceRoot/src
    chmod -R u+w iaito-translations
  '';

  postPatch = ''
    substituteInPlace common/ResourcePaths.cpp \
      --replace "/app/share/iaito/translations" "$out/share/iaito/translations"
  '';

  # 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 ];
  nativeBuildInputs = [
    meson
    ninja
    pkg-config
    python3
    qttools
    wrapQtAppsHook
  ];

  buildInputs = [
    qtbase
    radare2
  ];

  postBuild = ''
    pushd ../../../iaito-translations
    make build PREFIX=$out
    popd
  '';

  installPhase = ''
    runHook preInstall

    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
    install -m644 -Dt $out/share/metainfo ../org.radare.iaito.appdata.xml
    install -m644 -Dt $out/share/applications ../org.radare.iaito.desktop
    install -m644 -Dt $out/share/pixmaps ../img/iaito-o.svg

    pushd ../../../iaito-translations
    make install PREFIX=$out -j$NIX_BUILD_CORES
    popd

    runHook postInstall
  '';

  passthru.updateScript = nix-update-script {
    attrPath = pname;
  };

  meta = with lib; {
    description = "An official graphical interface of radare2";
    longDescription = ''
@@ -62,7 +84,7 @@ stdenv.mkDerivation rec {
      continuation of Cutter for radare2 after the Rizin fork.
    '';
    homepage = "https://radare.org/n/iaito.html";
    changelog = "https://github.com/radareorg/iaito/releases/tag/${src.rev}";
    changelog = "https://github.com/radareorg/iaito/releases/tag/${version}";
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [ azahi ];
    platforms = platforms.linux;
+0 −54
Original line number Diff line number Diff line
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()) {