Files
2026-05-13 21:51:16 -04:00

65 lines
1.6 KiB
Nix

{
stdenv,
fetchFromGitHub,
lib,
subproject ? "library", # one of "library", "reader" or "writer"
zlib,
libpng,
libtiff,
jabcode,
}:
let
subdir = lib.getAttr subproject {
"library" = "jabcode";
"reader" = "jabcodeReader";
"writer" = "jabcodeWriter";
};
in
stdenv.mkDerivation {
pname = "jabcode-${subproject}";
version = "unstable-2022-06-17";
src = fetchFromGitHub {
repo = "jabcode";
owner = "jabcode";
rev = "ee0e4c88b9f3c1da46d6f679ee8b69c547907c20";
hash = "sha256-GjRkDWefQFdT4i9hRcQhYsY4beMUIXxy38I5lsQytyA=";
};
nativeBuildInputs = [
zlib
libpng
libtiff
]
++ lib.optionals (subproject != "library") [ jabcode ];
postPatch = ''
substituteInPlace src/jabcode/Makefile src/jabcodeReader/Makefile src/jabcodeWriter/Makefile \
--replace-fail "CC = \$(PREFIX)gcc" ""
# remove bundled library binaries to force using system libraries
rm -rf src/jabcode/lib
'';
preConfigure = "cd src/${subdir}";
installPhase =
if subproject == "library" then
''
mkdir -p $out/lib
cp build/* $out/lib
''
else
''
mkdir -p $out/bin
cp -RT bin $out/bin
'';
meta = {
description = "High-capacity 2D color bar code (${subproject})";
longDescription = "JAB Code (Just Another Bar Code) is a high-capacity 2D color bar code, which can encode more data than traditional black/white (QR) codes. This is the ${subproject} part.";
homepage = "https://jabcode.org/";
license = lib.licenses.lgpl21;
maintainers = [ lib.maintainers.xaverdh ];
platforms = lib.platforms.unix;
};
}