nixpkgs/pkgs/tools/graphics/quirc/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

54 lines
1.4 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchFromGitHub, SDL_gfx, SDL, libjpeg, libpng, opencv
, pkg-config }:
2021-05-02 09:30:04 +00:00
2017-10-10 15:22:48 +00:00
stdenv.mkDerivation {
2021-05-02 09:30:04 +00:00
pname = "quirc";
2022-04-13 03:46:12 +00:00
version = "2021-10-08";
2021-05-02 09:30:04 +00:00
src = fetchFromGitHub {
owner = "dlbeer";
repo = "quirc";
2022-04-13 03:46:12 +00:00
rev = "516d91a94d880ca1006fc1d57f318bdff8411f0d";
sha256 = "0jkaz5frm6jr9bxyfympvzh180nczrfvvb3z3qhk21djlas6nr5f";
2014-11-27 20:20:09 +00:00
};
2021-05-02 09:30:04 +00:00
nativeBuildInputs = [ pkg-config ];
2022-04-13 03:46:12 +00:00
buildInputs = [ SDL SDL_gfx libjpeg libpng opencv ];
2021-05-02 09:30:04 +00:00
makeFlags = [ "PREFIX=$(out)" ];
env.NIX_CFLAGS_COMPILE = "-I${lib.getDev SDL}/include/SDL -I${SDL_gfx}/include/SDL";
2021-05-02 09:30:04 +00:00
# Disable building of linux-only demos on darwin systems
patches = lib.optionals stdenv.isDarwin [ ./0001-dont-build-demos.patch ];
buildPhase = lib.optionalString stdenv.isDarwin ''
runHook preBuild
make libquirc.so
make qrtest
runHook postBuild
'';
2014-11-27 20:20:09 +00:00
configurePhase = ''
2021-05-02 09:30:04 +00:00
runHook preConfigure
# don't try to change ownership
2014-11-27 20:20:09 +00:00
sed -e 's/-[og] root//g' -i Makefile
2021-05-02 09:30:04 +00:00
runHook postConfigure
2014-11-27 20:20:09 +00:00
'';
2014-11-27 20:20:09 +00:00
preInstall = ''
mkdir -p "$out"/{bin,lib,include}
2021-05-02 09:30:04 +00:00
# install all binaries
find -maxdepth 1 -type f -executable ! -name '*.so.*' | xargs cp -t "$out"/bin
2014-11-27 20:20:09 +00:00
'';
2021-05-02 09:30:04 +00:00
2014-11-27 20:20:09 +00:00
meta = {
description = "A small QR code decoding library";
2021-01-15 09:19:50 +00:00
license = lib.licenses.isc;
maintainers = [ lib.maintainers.raskin ];
platforms = lib.platforms.linux ++ [ "x86_64-darwin" "aarch64-darwin" ];
2014-11-27 20:20:09 +00:00
};
}