about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/graphics/quirc/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/graphics/quirc/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/graphics/quirc/default.nix33
1 files changed, 19 insertions, 14 deletions
diff --git a/nixpkgs/pkgs/tools/graphics/quirc/default.nix b/nixpkgs/pkgs/tools/graphics/quirc/default.nix
index 88993dbe8ce6..aa6c0cfeb671 100644
--- a/nixpkgs/pkgs/tools/graphics/quirc/default.nix
+++ b/nixpkgs/pkgs/tools/graphics/quirc/default.nix
@@ -1,17 +1,24 @@
 { lib, stdenv, fetchFromGitHub, SDL_gfx, SDL, libjpeg, libpng, opencv
 , pkg-config }:
 
-stdenv.mkDerivation {
+stdenv.mkDerivation (finalAttrs: {
   pname = "quirc";
-  version = "2021-10-08";
+  version = "1.2";
 
   src = fetchFromGitHub {
     owner = "dlbeer";
     repo = "quirc";
-    rev = "516d91a94d880ca1006fc1d57f318bdff8411f0d";
-    sha256 = "0jkaz5frm6jr9bxyfympvzh180nczrfvvb3z3qhk21djlas6nr5f";
+    rev = "v${finalAttrs.version}";
+    hash = "sha256-zdq/YKL33jJXa10RqmQIl06rRYnrthWG+umT4dipft0=";
   };
 
+  postPatch = ''
+    # don't try to change ownership
+    substituteInPlace Makefile \
+      --replace-fail "-o root" "" \
+      --replace-fail "-g root" ""
+  '';
+
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ SDL SDL_gfx libjpeg libpng opencv ];
 
@@ -28,15 +35,6 @@ stdenv.mkDerivation {
     runHook postBuild
   '';
 
-  configurePhase = ''
-    runHook preConfigure
-
-    # don't try to change ownership
-    sed -e 's/-[og] root//g' -i Makefile
-
-    runHook postConfigure
-  '';
-
   preInstall = ''
     mkdir -p "$out"/{bin,lib,include}
 
@@ -44,10 +42,17 @@ stdenv.mkDerivation {
     find -maxdepth 1 -type f -executable ! -name '*.so.*' | xargs cp -t "$out"/bin
   '';
 
+  postInstall = ''
+    # don't install static library
+    rm $out/lib/libquirc.a
+
+    ln -s $out/lib/libquirc.so.* $out/lib/libquirc.so
+  '';
+
   meta = {
     description = "A small QR code decoding library";
     license = lib.licenses.isc;
     maintainers = [ lib.maintainers.raskin ];
     platforms = lib.platforms.linux ++ [ "x86_64-darwin" "aarch64-darwin" ];
   };
-}
+})