1{ lib, stdenv, fetchurl, pkg-config, SDL2, libpng, libiconv, libobjc }:
2
3stdenv.mkDerivation (finalAttrs: rec {
4 pname = "qrencode";
5 version = "4.1.1";
6
7 outputs = [ "bin" "out" "man" "dev" ];
8
9 src = fetchurl {
10 url = "https://fukuchi.org/works/qrencode/qrencode-${version}.tar.gz";
11 sha256 = "sha256-2kSO1PUqumvLDNSMrA3VG4aSvMxM0SdDFAL8pvgXHo4=";
12 };
13
14 nativeBuildInputs = [ pkg-config ];
15
16 buildInputs = [ libiconv libpng ]
17 ++ lib.optionals stdenv.isDarwin [ libobjc ];
18
19 nativeCheckInputs = [ SDL2 ];
20
21 doCheck = false;
22
23 checkPhase = ''
24 runHook preCheck
25
26 pushd tests
27 ./test_basic.sh
28 popd
29
30 runHook postCheck
31 '';
32
33 passthru.tests = finalAttrs.finalPackage.overrideAttrs (_: {
34 configureFlags = [ "--with-tests" ];
35 doCheck = true;
36 });
37
38 meta = with lib; {
39 homepage = "https://fukuchi.org/works/qrencode/";
40 description = "C library for encoding data in a QR Code symbol";
41 longDescription = ''
42 Libqrencode is a C library for encoding data in a QR Code symbol,
43 a kind of 2D symbology that can be scanned by handy terminals
44 such as a mobile phone with CCD.
45 '';
46 license = licenses.lgpl21Plus;
47 maintainers = with maintainers; [ adolfogc yana ];
48 platforms = platforms.all;
49 mainProgram = "qrencode";
50 };
51})