diff --git a/pkgs/tools/graphics/quirc/0001-dont-build-demos.patch b/pkgs/tools/graphics/quirc/0001-dont-build-demos.patch index 9ecb6dda4e19..5e11a5207508 100644 --- a/pkgs/tools/graphics/quirc/0001-dont-build-demos.patch +++ b/pkgs/tools/graphics/quirc/0001-dont-build-demos.patch @@ -4,8 +4,8 @@ index 2d5b745..ecef988 100644 +++ b/Makefile @@ -37,7 +37,7 @@ DEMO_UTIL_OBJ = \ - OPENCV_CFLAGS != pkg-config --cflags opencv4 - OPENCV_LIBS != pkg-config --libs opencv4 + OPENCV_CFLAGS := $(shell pkg-config --cflags opencv4 2>&1) + OPENCV_LIBS = $(shell pkg-config --libs opencv4) -QUIRC_CXXFLAGS = $(QUIRC_CFLAGS) $(OPENCV_CFLAGS) --std=c++17 +QUIRC_CXXFLAGS = $(QUIRC_CFLAGS) --std=c++17 diff --git a/pkgs/tools/graphics/quirc/default.nix b/pkgs/tools/graphics/quirc/default.nix index 88993dbe8ce6..aa6c0cfeb671 100644 --- a/pkgs/tools/graphics/quirc/default.nix +++ b/pkgs/tools/graphics/quirc/default.nix @@ -1,17 +1,24 @@ { lib, stdenv, fetchFromGitHub, SDL_gfx, SDL, libjpeg, libpng, opencv , pkg-config }: -stdenv.mkDerivation { +stdenv.mkDerivation (finalAttrs: { pname = "quirc"; - version = "2021-10-08"; + version = "1.2"; src = fetchFromGitHub { owner = "dlbeer"; repo = "quirc"; - rev = "516d91a94d880ca1006fc1d57f318bdff8411f0d"; - sha256 = "0jkaz5frm6jr9bxyfympvzh180nczrfvvb3z3qhk21djlas6nr5f"; + rev = "v${finalAttrs.version}"; + hash = "sha256-zdq/YKL33jJXa10RqmQIl06rRYnrthWG+umT4dipft0="; }; + postPatch = '' + # don't try to change ownership + substituteInPlace Makefile \ + --replace-fail "-o root" "" \ + --replace-fail "-g root" "" + ''; + nativeBuildInputs = [ pkg-config ]; buildInputs = [ SDL SDL_gfx libjpeg libpng opencv ]; @@ -28,15 +35,6 @@ stdenv.mkDerivation { runHook postBuild ''; - configurePhase = '' - runHook preConfigure - - # don't try to change ownership - sed -e 's/-[og] root//g' -i Makefile - - runHook postConfigure - ''; - preInstall = '' mkdir -p "$out"/{bin,lib,include} @@ -44,10 +42,17 @@ stdenv.mkDerivation { find -maxdepth 1 -type f -executable ! -name '*.so.*' | xargs cp -t "$out"/bin ''; + postInstall = '' + # don't install static library + rm $out/lib/libquirc.a + + ln -s $out/lib/libquirc.so.* $out/lib/libquirc.so + ''; + meta = { description = "A small QR code decoding library"; license = lib.licenses.isc; maintainers = [ lib.maintainers.raskin ]; platforms = lib.platforms.linux ++ [ "x86_64-darwin" "aarch64-darwin" ]; }; -} +})