base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / zx / zxing / package.nix
blob175b15b22aecb4526bd10dd42fb482c745e106d4
1 { lib, stdenv, fetchurl, jre }:
2 stdenv.mkDerivation rec {
3   pname = "zxing";
4   version = "3.1.0";
5   # Maven builds are hard to get right
6   core_jar = fetchurl {
7     url = "http://repo1.maven.org/maven2/com/google/zxing/core/${version}/core-${version}.jar";
8     sha256 = "199l4xvlcpafqn69r3k9qjpqkw9lvkl02hzpm0ackvdhl7vk42zh";
9   };
10   javase_jar = fetchurl {
11     url = "http://repo1.maven.org/maven2/com/google/zxing/javase/${version}/javase-${version}.jar";
12     sha256 = "0fzxvvf5dqyrs5m9rqw4ffm9h1s27bi7q3jb1dam34s80q2rp2zq";
13   };
14   inherit jre;
15   dontUnpack = true;
16   installPhase = ''
17     mkdir -p "$out/lib/java" "$out/bin"
18     cp "${core_jar}" "${javase_jar}" "$out/lib/java"
19     substituteAll "${./java-zxing.sh}" "$out/bin/java-zxing"
20     substituteAll "${./zxing-cmdline-runner.sh}" "$out/bin/zxing-cmdline-runner"
21     substituteAll "${./zxing-cmdline-encoder.sh}" "$out/bin/zxing-cmdline-encoder"
22     substituteAll "${./zxing.sh}" "$out/bin/zxing"
23     chmod a+x "$out/bin"/*
24     cd "$out/lib/java"; for i in *.jar; do mv "$i" "''${i#*-}"; done
25   '';
26   meta = {
27     description = "1D and 2D code reading library";
28     sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
29     license = lib.licenses.asl20;
30     maintainers = [lib.maintainers.raskin];
31     platforms = lib.platforms.linux;
32     homepage = "https://github.com/zxing/zxing";
33   };