about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/qrcodegen/default.nix
blob: 53ed6eeb80ec1b57f71acaaddfca5e11f022f89c (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
44
45
46
47
48
49
50
51
52
{ lib
, stdenv
, fetchFromGitHub
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "qrcodegen";
  version = "1.8.0";

  src = fetchFromGitHub {
    owner = "nayuki";
    repo = "QR-Code-generator";
    rev = "v${finalAttrs.version}";
    hash = "sha256-aci5SFBRNRrSub4XVJ2luHNZ2pAUegjgQ6pD9kpkaTY=";
  };

  sourceRoot = "${finalAttrs.src.name}/c";

  nativeBuildInputs = lib.optionals stdenv.cc.isClang [
    stdenv.cc.cc.libllvm.out
  ];

  makeFlags = lib.optionals stdenv.cc.isClang [ "AR=llvm-ar" ];

  doCheck = true;
  checkPhase = ''
    runHook preCheck

    ./qrcodegen-test

    runHook postCheck
  '';

  installPhase = ''
    runHook preInstall

    install -Dt $out/lib/ libqrcodegen.a
    install -Dt $out/include/qrcodegen/ qrcodegen.h

    runHook postInstall
  '';

  meta = {
    homepage = "https://www.nayuki.io/page/qr-code-generator-library";
    description = "High-quality QR Code generator library in many languages";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ AndersonTorres ];
    platforms = lib.platforms.unix;
  };
})
# TODO: build the other languages
# TODO: multiple outputs