summaryrefslogtreecommitdiff
path: root/pkgs/development/libraries/jabcode/default.nix
blob: b4480bd911f46e4490c1a05370422251b6553315 (plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{
  stdenv,
  fetchFromGitHub,
  lib,
  subproject ? "library", # one of "library", "reader" or  "writer"
  zlib,
  libpng,
  libtiff,
  jabcode,
}:
let
  subdir = lib.getAttr subproject {
    "library" = "jabcode";
    "reader" = "jabcodeReader";
    "writer" = "jabcodeWriter";
  };
in
stdenv.mkDerivation {
  pname = "jabcode-${subproject}";
  version = "unstable-2022-06-17";
  src = fetchFromGitHub {
    repo = "jabcode";
    owner = "jabcode";
    rev = "ee0e4c88b9f3c1da46d6f679ee8b69c547907c20";
    hash = "sha256-GjRkDWefQFdT4i9hRcQhYsY4beMUIXxy38I5lsQytyA=";
  };

  nativeBuildInputs = [
    zlib
    libpng
    libtiff
  ]
  ++ lib.optionals (subproject != "library") [ jabcode ];

  preConfigure = "cd src/${subdir}";

  installPhase =
    if subproject == "library" then
      ''
        mkdir -p $out/lib
        cp build/* $out/lib
      ''
    else
      ''
        mkdir -p $out/bin
        cp -RT bin $out/bin
      '';

  meta = {
    description = "High-capacity 2D color bar code (${subproject})";
    longDescription = "JAB Code (Just Another Bar Code) is a high-capacity 2D color bar code, which can encode more data than traditional black/white (QR) codes. This is the ${subproject} part.";
    homepage = "https://jabcode.org/";
    license = lib.licenses.lgpl21;
    maintainers = [ lib.maintainers.xaverdh ];
    platforms = lib.platforms.unix;
    broken = stdenv.hostPlatform.isDarwin; # never built on Hydra https://hydra.nixos.org/job/nixpkgs/trunk/jabcode.x86_64-darwin
  };
}