1args :
2let
3 lib = args.lib;
4 fetchurl = args.fetchurl;
5 fullDepEntry = args.fullDepEntry;
6
7 version = lib.attrByPath ["version"] "0.9.3" args;
8 buildInputs = with args; [
9 libpng opencv
10 ];
11in
12rec {
13 src = fetchurl {
14 url = "mirror://debian/pool/main/libd/libdecodeqr/libdecodeqr_${version}.orig.tar.gz";
15 sha256 = "1kmljwx69h7zq6zlp2j19bbpz11px45z1abw03acrxjyzz5f1f13";
16 };
17
18 inherit buildInputs;
19 configureFlags = [];
20
21 /* doConfigure should be specified separately */
22 phaseNames = ["preConfigure" "doConfigure" "doMake"
23 "createDirs" "doMakeInstall" "postInstall"];
24
25 preConfigure = fullDepEntry ''
26 cd src
27 sed -e /LDCONFIG/d -i libdecodeqr/Makefile.in
28 sed -e '/#include <cv.h>/a#include <ml.h>' -i libdecodeqr/imagereader.h
29 export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${args.opencv}/include/opencv"
30 export NIX_LDFLAGS="$NIX_LDFLAGS -lcxcore"
31 '' ["doUnpack"];
32 postInstall = fullDepEntry ''
33 cp sample/simple/simpletest $out/bin/qrdecode
34 cd ..
35 '' ["doMake"];
36 createDirs = fullDepEntry ''
37 mkdir -p $out/bin $out/lib $out/include $out/share
38 '' ["defEnsureDir"];
39
40 name = "libdecodeqr-" + version;
41 meta = {
42 description = "QR code decoder library";
43 };
44}