summary refs log tree commit diff
path: root/pkgs/applications/graphics/drawpile
diff options
context:
space:
mode:
authorPeter Hoeg <peter@hoeg.com>2020-08-24 15:54:17 +0800
committerPeter Hoeg <peter@hoeg.com>2020-08-24 15:54:17 +0800
commit375aca6f76ea638c05583656e34ef5d7e5ed4223 (patch)
tree1405a5e832511db882061fe148478566dbcc08f1 /pkgs/applications/graphics/drawpile
parent7bb2382432bd301db7d8c50f06a62cadff898924 (diff)
downloadnixpkgs-375aca6f76ea638c05583656e34ef5d7e5ed4223.tar
nixpkgs-375aca6f76ea638c05583656e34ef5d7e5ed4223.tar.gz
nixpkgs-375aca6f76ea638c05583656e34ef5d7e5ed4223.tar.bz2
nixpkgs-375aca6f76ea638c05583656e34ef5d7e5ed4223.tar.lz
nixpkgs-375aca6f76ea638c05583656e34ef5d7e5ed4223.tar.xz
nixpkgs-375aca6f76ea638c05583656e34ef5d7e5ed4223.tar.zst
nixpkgs-375aca6f76ea638c05583656e34ef5d7e5ed4223.zip
drawpile: make it build with a recent libmicrohttpd
Diffstat (limited to 'pkgs/applications/graphics/drawpile')
-rw-r--r--pkgs/applications/graphics/drawpile/default.nix69
1 files changed, 44 insertions, 25 deletions
diff --git a/pkgs/applications/graphics/drawpile/default.nix b/pkgs/applications/graphics/drawpile/default.nix
index 0ffcb5cdb41..20e295c85e9 100644
--- a/pkgs/applications/graphics/drawpile/default.nix
+++ b/pkgs/applications/graphics/drawpile/default.nix
@@ -1,7 +1,8 @@
-{ lib
+{ stdenv
+, lib
 , mkDerivation
-, fetchurl
-, cmake
+, fetchFromGitHub
+, fetchpatch
 , extra-cmake-modules
 
 # common deps
@@ -9,6 +10,7 @@
 
 # client deps
 , qtbase
+, qtkeychain
 , qtmultimedia
 , qtsvg
 , qttools
@@ -23,6 +25,8 @@
 # optional server deps
 , libmicrohttpd
 , libsodium
+, withSystemd ? stdenv.isLinux
+, systemd ? null
 
 # options
 , buildClient ? true
@@ -35,11 +39,9 @@
 with lib;
 
 let
-  commonDeps = [
-    karchive
-  ];
   clientDeps = [
     qtbase
+    qtkeychain
     qtmultimedia
     qtsvg
     qttools
@@ -49,40 +51,57 @@ let
     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";