about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/graphics/zbar/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/graphics/zbar/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/graphics/zbar/default.nix44
1 files changed, 39 insertions, 5 deletions
diff --git a/nixpkgs/pkgs/tools/graphics/zbar/default.nix b/nixpkgs/pkgs/tools/graphics/zbar/default.nix
index b75df56e4327..31fd9742d236 100644
--- a/nixpkgs/pkgs/tools/graphics/zbar/default.nix
+++ b/nixpkgs/pkgs/tools/graphics/zbar/default.nix
@@ -3,6 +3,7 @@
 , fetchFromGitHub
 , imagemagickBig
 , pkg-config
+, withXorg ? true
 , libX11
 , libv4l
 , qtbase
@@ -21,11 +22,16 @@
   # see https://github.com/mchehab/zbar/issues/104
 , enableDbus ? false
 , libintl
+, libiconv
+, Foundation
+, bash
+, python3
+, argp-standalone
 }:
 
 stdenv.mkDerivation rec {
   pname = "zbar";
-  version = "0.23.90";
+  version = "0.23.92";
 
   outputs = [ "out" "lib" "dev" "doc" "man" ];
 
@@ -33,7 +39,7 @@ stdenv.mkDerivation rec {
     owner = "mchehab";
     repo = "zbar";
     rev = version;
-    sha256 = "sha256-FvV7TMc4JbOiRjWLka0IhtpGGqGm5fis7h870OmJw2U=";
+    sha256 = "sha256-VhVrngAX7pXZp+szqv95R6RGAJojp3svdbaRKigGb0w=";
   };
 
   nativeBuildInputs = [
@@ -41,16 +47,21 @@ stdenv.mkDerivation rec {
     xmlto
     autoreconfHook
     docbook_xsl
-    wrapQtAppsHook
+  ] ++ lib.optionals enableVideo [
     wrapGAppsHook
+    wrapQtAppsHook
   ];
 
   buildInputs = [
     imagemagickBig
-    libX11
     libintl
+  ] ++ lib.optionals stdenv.isDarwin [
+    libiconv
+    Foundation
   ] ++ lib.optionals enableDbus [
     dbus
+  ] ++ lib.optionals withXorg [
+    libX11
   ] ++ lib.optionals enableVideo [
     libv4l
     gtk3
@@ -58,8 +69,24 @@ stdenv.mkDerivation rec {
     qtx11extras
   ];
 
+  nativeCheckInputs = [
+    bash
+    python3
+  ];
+
+  checkInputs = lib.optionals stdenv.isDarwin [
+    argp-standalone
+  ];
+
+  # Note: postConfigure instead of postPatch in order to include some
+  # autoconf-generated files. The template files for the autogen'd scripts are
+  # not chmod +x, so patchShebangs misses them.
+  postConfigure = ''
+    patchShebangs test
+  '';
+
   # Disable assertions which include -dev QtBase file paths.
-  NIX_CFLAGS_COMPILE = "-DQT_NO_DEBUG";
+  env.NIX_CFLAGS_COMPILE = "-DQT_NO_DEBUG";
 
   configureFlags = [
     "--without-python"
@@ -75,6 +102,12 @@ stdenv.mkDerivation rec {
     "--without-qt"
   ]);
 
+  doCheck = true;
+
+  preCheck = lib.optionalString stdenv.isDarwin ''
+    export NIX_LDFLAGS="$NIX_LDFLAGS -largp"
+  '';
+
   dontWrapQtApps = true;
   dontWrapGApps = true;
 
@@ -98,5 +131,6 @@ stdenv.mkDerivation rec {
     platforms = platforms.unix;
     license = licenses.lgpl21;
     homepage = "https://github.com/mchehab/zbar";
+    mainProgram = "zbarimg";
   };
 }