diff --git a/pkgs/applications/office/kitsas/default.nix b/pkgs/applications/office/kitsas/default.nix index e8d010aee22d..e7580f1dc53c 100644 --- a/pkgs/applications/office/kitsas/default.nix +++ b/pkgs/applications/office/kitsas/default.nix @@ -1,44 +1,39 @@ -{ lib, mkDerivation, fetchFromGitHub, qmake, qtsvg, qtcreator, poppler, libzip, pkg-config }: +{ lib, stdenv, fetchFromGitHub, qmake, qtbase, qtsvg, poppler, libzip, pkg-config, wrapQtAppsHook }: -mkDerivation rec { +stdenv.mkDerivation rec { pname = "kitsas"; - version = "3.0"; + version = "3.1.1"; src = fetchFromGitHub { owner = "artoh"; repo = "kitupiikki"; rev = "v${version}"; - sha256 = "sha256-UH2bFJZd83APRjlv6JR+Uy+ng4DWnnLmavAgjgSOiRo="; + sha256 = "sha256-nmlGLrVsTQawYHNgaax9EiutL4xgFdOD34Q4/rnB/D0="; }; - nativeBuildInputs = [ pkg-config ]; + # QList::swapItemsAt was introduced in Qt 5.13 + patches = lib.optional (lib.versionOlder qtbase.version "5.13") ./qt-512.patch; - buildInputs = [ qmake qtsvg poppler libzip ]; + nativeBuildInputs = [ pkg-config qmake wrapQtAppsHook ]; + + buildInputs = [ qtsvg poppler libzip ]; # We use a separate build-dir as otherwise ld seems to get confused between # directory and executable name on buildPhase. preConfigure = '' - mkdir build-linux - cd build-linux + mkdir build && cd build ''; - qmakeFlags = [ - "../kitsas/kitsas.pro" - "-spec" - "linux-g++" - "CONFIG+=release" - ]; + qmakeFlags = [ "../kitsas/kitsas.pro" ]; - preFixup = '' - make clean - rm Makefile - ''; - - installPhase = '' - mkdir -p $out/bin $out/share/applications - cp kitsas $out/bin - cp $src/kitsas.png $out/share/applications - cp $src/kitsas.desktop $out/share/applications + installPhase = if stdenv.isDarwin then '' + mkdir -p $out/Applications + mv kitsas.app $out/Applications + '' else '' + install -Dm755 kitsas -t $out/bin + install -Dm644 ../kitsas.svg -t $out/share/icons/hicolor/scalable/apps + install -Dm644 ../kitsas.png -t $out/share/icons/hicolor/256x256/apps + install -Dm644 ../kitsas.desktop -t $out/share/applications ''; meta = with lib; { @@ -46,6 +41,6 @@ mkDerivation rec { description = "An accounting tool suitable for Finnish associations and small business"; maintainers = with maintainers; [ gspia ]; license = licenses.gpl3Plus; - platforms = platforms.linux; + platforms = platforms.unix; }; } diff --git a/pkgs/applications/office/kitsas/qt-512.patch b/pkgs/applications/office/kitsas/qt-512.patch new file mode 100644 index 000000000000..b225b933104c --- /dev/null +++ b/pkgs/applications/office/kitsas/qt-512.patch @@ -0,0 +1,24 @@ +diff --git i/kitsas/apuri/siirtoapuri.cpp w/kitsas/apuri/siirtoapuri.cpp +index 9a2c51f3..9565200f 100644 +--- i/kitsas/apuri/siirtoapuri.cpp ++++ w/kitsas/apuri/siirtoapuri.cpp +@@ -25,6 +25,7 @@ + #include "db/tositetyyppimodel.h" + #include "tiliote/tiliotekirjaaja.h" + ++#include + #include + + SiirtoApuri::SiirtoApuri(QWidget *parent, Tosite *tosite) : +@@ -361,8 +362,9 @@ void SiirtoApuri::laskunmaksu() + TositeVienti eka = lista.at(0).toMap(); + tosite()->asetaPvm(eka.pvm()); + tosite()->asetaOtsikko( eka.selite() ); +- if( eka.kreditEuro() ) +- lista.swapItemsAt(0,1); ++ if( eka.kreditEuro() ) { ++ qSwap(lista.begin()[0], lista.begin()[1]); ++ } + tosite()->viennit()->asetaViennit(lista); + reset(); +