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

speedcrunch: migrate to `qt6` (#454065)

parents cd40da01 55ce457f
Loading
Loading
Loading
Loading
+38 −0
Original line number Diff line number Diff line
# Sourced from https://bitbucket.org/heldercorreia/speedcrunch/pull-requests/140/commits

diff --git a/cmake/QtWin32Deploy.cmake b/cmake/QtWin32Deploy.cmake

--- a/cmake/QtWin32Deploy.cmake
+++ b/cmake/QtWin32Deploy.cmake
@@ -15,7 +15,7 @@ set(qtwin32_QMLPLUGIN_SUFFIX_DEBUG "plugin${qtwin32_DLL_SUFFIX_DEBUG}")
 
 # Determine the Qt minor version (so '6.4' or '6.5') for version checking. There's unlikely to be enough changes in
 # patch releases to make it worth distinguishing based on those.
-string(REGEX MATCH "[0-9]+[.][0-9]+" qtwin32_QT_MINOR_VERSION ${Qt6Core_VERSION_STRING})
+string(REGEX MATCH "[0-9]+[.][0-9]+" qtwin32_QT_MINOR_VERSION "${Qt6Core_VERSION}")
 
 
 # qtwin32_check_qt_version([STRICT] <version>...)
diff --git a/math/rational.h b/math/rational.h
--- a/math/rational.h
+++ b/math/rational.h
@@ -19,6 +19,8 @@
 #ifndef RATIONAL_H
 #define RATIONAL_H
 
+#include <QHash>
+
 class HNumber;
 class QString;
 
@@ -64,6 +66,10 @@ public:
     QString toString() const;
     HNumber toHNumber( )const;
     double toDouble() const;
+
+    friend size_t qHash(const Rational &r, size_t seed = 0) {
+        return qHashMulti(seed, r.m_num, r.m_denom, r.m_valid);
+    }
 };
 
 #endif // RATIONAL_H
+20 −15
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
  lib,
  fetchFromBitbucket,
  cmake,
  libsForQt5,
  qt6,
}:

stdenv.mkDerivation {
@@ -13,39 +13,44 @@ stdenv.mkDerivation {
  src = fetchFromBitbucket {
    owner = "heldercorreia";
    repo = "speedcrunch";
    rev = "db51fc5e547aa83834761d874d3518c06d0fec9e";
    hash = "sha256-rnl4z/HU3lAF9Y1JvdM8LZWIV1NGfR4q5gOMxlNU2EA=";
    rev = "3c1b4c18ccb275eb2891f9d8ff36a9205c0f566b";
    hash = "sha256-9/id5h+5aBntlcsEUGkyEzMJf7we7hMslnkqKDcbaNY=";
  };

  sourceRoot = "source/src";

  buildInputs = with libsForQt5; [
    qtbase
    qttools
  patches = [
    ./01-fix-qt6-build.patch
  ];

  nativeBuildInputs = [
    cmake
  ]
  ++ [
    libsForQt5.wrapQtAppsHook
    qt6.wrapQtAppsHook
  ];

  buildInputs = [
    qt6.qtbase
    qt6.qttools
  ];

  meta = {
    homepage = "https://speedcrunch.org";
    license = lib.licenses.gpl2Plus;
    description = "Fast power user calculator";
    description = "High-precision scientific calculator";
    mainProgram = "speedcrunch";
    longDescription = ''
      SpeedCrunch is a fast, high precision and powerful desktop calculator.
      Among its distinctive features are a scrollable display, up to 50 decimal
      precisions, unlimited variable storage, intelligent automatic completion
      full keyboard-friendly and more than 15 built-in math function.
      SpeedCrunch is a high-precision scientific calculator.
      Among its distinctive features are a syntax-highlighted scrollable display,
      up to 50 decimal places of precision, complex number support, various
      numeric bases, unit conversions, intelligent automatic completion of functions
      and variables, integrated formula book, over 150 built-in scientific constants,
      fully keyboard-driven interface, over 80 built-in mathematical functions and
      support for user-defined functions.
    '';
    maintainers = with lib.maintainers; [
      j0hax
    ];
    inherit (libsForQt5.qtbase.meta) platforms;
    inherit (qt6.qtbase.meta) platforms;
    broken = stdenv.hostPlatform.isDarwin;
  };
}