about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/graphics/quirc/default.nix
blob: 8ca8ecf2c893be5faace28286e1cdcaf9dc87634 (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
{lib, stdenv, fetchgit, SDL_gfx, SDL, libjpeg, libpng, pkg-config}:
let
  s =
  rec {
    date = "2016-08-16";
    version = "git-${date}";
    baseName = "quirc";
    name = "${baseName}-${version}";
    url = "https://github.com/dlbeer/quirc";
    rev = "5b262480091d5f84a67a4a56c728fc8b39844339";
    sha256 = "1w5qvjafn14s6jjs7kiwsqirlsqbgv0p152hrsq463pm34hp0lzy";
  };
in
stdenv.mkDerivation {
  inherit (s) name version;
  nativeBuildInputs = [ pkg-config ];
  buildInputs = [
    SDL SDL_gfx libjpeg libpng
  ];
  src = fetchgit {
    inherit (s) url sha256 rev;
  };
  NIX_CFLAGS_COMPILE="-I${SDL.dev}/include/SDL -I${SDL_gfx}/include/SDL";
  configurePhase = ''
    sed -e 's/-[og] root//g' -i Makefile
  '';
  preInstall = ''
    mkdir -p "$out"/{bin,lib,include}
    find . -maxdepth 1 -type f -perm -0100 -exec cp '{}' "$out"/bin ';'
  '';
  makeFlags = [ "PREFIX=$(out)" ];
  meta = {
    inherit (s) version;
    description = "A small QR code decoding library";
    license = lib.licenses.isc;
    maintainers = [lib.maintainers.raskin];
    platforms = lib.platforms.linux;
  };
}