summary refs log tree commit diff
path: root/pkgs/tools/graphics/quirc/default.nix
blob: dec2a1020c8932b0837a09d0a117c2b968fecb21 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{ lib, stdenv, fetchFromGitHub
, SDL_gfx, SDL, libjpeg, libpng, pkg-config
}:

stdenv.mkDerivation {
  pname = "quirc";
  version = "2020-04-16";

  src = fetchFromGitHub {
    owner = "dlbeer";
    repo = "quirc";
    rev = "ed455904f35270888bc902b9e8c0c9b3184a8302";
    sha256 = "1kqqvcnxcaxdgls9sibw5pqjz3g1gys2v64i4kfqp8wfcgd9771q";
  };

  nativeBuildInputs = [ pkg-config ];
  buildInputs = [ SDL SDL_gfx libjpeg libpng ];

  makeFlags = [ "PREFIX=$(out)" ];
  NIX_CFLAGS_COMPILE = "-I${SDL.dev}/include/SDL -I${SDL_gfx}/include/SDL";

  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}

    # install all binaries
    find -maxdepth 1 -type f -executable ! -name '*.so.*' | xargs cp -t "$out"/bin
  '';

  meta = {
    description = "A small QR code decoding library";
    license = lib.licenses.isc;
    maintainers = [lib.maintainers.raskin];
    platforms = lib.platforms.linux;
  };
}