about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/graphics/drawpile/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/graphics/drawpile/default.nix')
-rw-r--r--nixpkgs/pkgs/applications/graphics/drawpile/default.nix71
1 files changed, 46 insertions, 25 deletions
diff --git a/nixpkgs/pkgs/applications/graphics/drawpile/default.nix b/nixpkgs/pkgs/applications/graphics/drawpile/default.nix
index 0ffcb5cdb410..e210d03406b7 100644
--- a/nixpkgs/pkgs/applications/graphics/drawpile/default.nix
+++ b/nixpkgs/pkgs/applications/graphics/drawpile/default.nix
@@ -1,7 +1,8 @@
-{ lib
+{ stdenv
+, lib
 , mkDerivation
-, fetchurl
-, cmake
+, fetchFromGitHub
+, fetchpatch
 , extra-cmake-modules
 
 # common deps
@@ -9,9 +10,11 @@
 
 # client deps
 , qtbase
+, qtkeychain
 , qtmultimedia
 , qtsvg
 , qttools
+, libsecret
 
 # optional client deps
 , giflib
@@ -23,6 +26,8 @@
 # optional server deps
 , libmicrohttpd
 , libsodium
+, withSystemd ? stdenv.isLinux
+, systemd ? null
 
 # options
 , buildClient ? true
@@ -35,54 +40,70 @@
 with lib;
 
 let
-  commonDeps = [
-    karchive
-  ];
   clientDeps = [
     qtbase
+    qtkeychain
     qtmultimedia
     qtsvg
     qttools
+    libsecret
     # optional:
     giflib # gif animation export support
     kdnssd # local server discovery with Zeroconf
     libvpx # WebM video export
     miniupnpc # automatic port forwarding
   ];
+
   serverDeps = [
     # optional:
     libmicrohttpd # HTTP admin api
     libsodium # ext-auth support
-  ];
+  ] ++ optional withSystemd systemd;
+
   kisDeps = [
     qtx11extras
   ];
 
+  boolToFlag = bool:
+    if bool then "ON" else "OFF";
+
 in mkDerivation rec {
   pname = "drawpile";
   version = "2.1.17";
 
-  src = fetchurl {
-    url = "https://drawpile.net/files/src/drawpile-${version}.tar.gz";
-    sha256 = "11lhn1mymhqk9g5sh384xhj3qw8h9lv88pr768y9q6kg3sl7nzzf";
+  src = fetchFromGitHub {
+    owner = "drawpile";
+    repo = "drawpile";
+    rev = "${version}";
+    sha256 = "sha256-AFFY+FcY9ExAur13OoWR9285RZtBe6jnRIrwi5raiCM=";
   };
 
-  nativeBuildInputs = [
-    cmake
-    extra-cmake-modules
+  patches = [
+    # fix for libmicrohttpd 0.9.71
+    (fetchpatch {
+      url = "https://github.com/drawpile/Drawpile/commit/ed1a75deb113da2d1df91a28f557509c4897130e.diff";
+      sha256 = "sha256-54wabH5F3Hf+6vv9rpCwCRdhjSaUFtuF/mE1/U+CpOA=";
+      name = "mhdfix.patch"; })
+  ];
+
+  nativeBuildInputs = [ extra-cmake-modules ];
+
+  buildInputs = [
+    karchive
+  ]
+  ++ optionals buildClient      clientDeps
+  ++ optionals buildServer      serverDeps
+  ++ optionals enableKisTablet  kisDeps;
+
+  cmakeFlags = [
+    "-Wno-dev"
+    "-DINITSYS=systemd"
+    "-DCLIENT=${boolToFlag buildClient}"
+    "-DSERVER=${boolToFlag buildServer}"
+    "-DSERVERGUI=${boolToFlag buildServerGui}"
+    "-DTOOLS=${boolToFlag buildExtraTools}"
+    "-DKIS_TABLET=${boolToFlag enableKisTablet}"
   ];
-  buildInputs =
-    commonDeps ++
-    optionals buildClient      clientDeps ++
-    optionals buildServer      serverDeps ++
-    optionals enableKisTablet  kisDeps    ;
-
-  cmakeFlags =
-    optional (!buildClient    )  "-DCLIENT=off" ++
-    optional (!buildServer    )  "-DSERVER=off" ++
-    optional (!buildServerGui )  "-DSERVERGUI=off" ++
-    optional ( buildExtraTools)  "-DTOOLS=on" ++
-    optional ( enableKisTablet)  "-DKIS_TABLET=on";
 
   meta = {
     description = "A collaborative drawing program that allows multiple users to sketch on the same canvas simultaneously";