mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-15 13:37:21 +03:00
Add a binary distribution of ZXing 1D/2D code library
This commit is contained in:
parent
9f82cc2684
commit
e511865580
34
pkgs/tools/graphics/zxing/default.nix
Normal file
34
pkgs/tools/graphics/zxing/default.nix
Normal file
@ -0,0 +1,34 @@
|
||||
{stdenv, fetchurl, openjre, jre ? openjre}:
|
||||
stdenv.mkDerivation rec {
|
||||
name = "zxing-${version}";
|
||||
version = "3.1.0";
|
||||
# Maven builds are hard to get right
|
||||
core_jar = fetchurl {
|
||||
url = "http://repo1.maven.org/maven2/com/google/zxing/core/${version}/core-${version}.jar";
|
||||
sha256 = "199l4xvlcpafqn69r3k9qjpqkw9lvkl02hzpm0ackvdhl7vk42zh";
|
||||
};
|
||||
javase_jar = fetchurl {
|
||||
url = "http://repo1.maven.org/maven2/com/google/zxing/javase/${version}/javase-${version}.jar";
|
||||
sha256 = "0fzxvvf5dqyrs5m9rqw4ffm9h1s27bi7q3jb1dam34s80q2rp2zq";
|
||||
};
|
||||
inherit jre;
|
||||
unpackPhase = ''true'';
|
||||
installPhase = ''
|
||||
mkdir -p "$out/lib/java" "$out/bin"
|
||||
cp "${core_jar}" "${javase_jar}" "$out/lib/java"
|
||||
substituteAll "${./java-zxing.sh}" "$out/bin/java-zxing"
|
||||
substituteAll "${./zxing-cmdline-runner.sh}" "$out/bin/zxing-cmdline-runner"
|
||||
substituteAll "${./zxing-cmdline-encoder.sh}" "$out/bin/zxing-cmdline-encoder"
|
||||
substituteAll "${./zxing.sh}" "$out/bin/zxing"
|
||||
chmod a+x "$out/bin"/*
|
||||
cd "$out/lib/java"; for i in *.jar; do mv "$i" "''${i#*-}"; done
|
||||
'';
|
||||
meta = {
|
||||
inherit version;
|
||||
description = ''1D and 2D code reading library'';
|
||||
license = stdenv.lib.licenses.asl20;
|
||||
maintainers = [stdenv.lib.maintainers.raskin];
|
||||
platforms = stdenv.lib.platforms.linux;
|
||||
homepage = "https://github.com/zxing/zxing";
|
||||
};
|
||||
}
|
3
pkgs/tools/graphics/zxing/java-zxing.sh
Normal file
3
pkgs/tools/graphics/zxing/java-zxing.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#! /bin/sh
|
||||
|
||||
@jre@/bin/java -cp @out@/lib/java/core-@version@.jar:@out@/lib/java/javase-@version@.jar "$@"
|
3
pkgs/tools/graphics/zxing/zxing-cmdline-encoder.sh
Normal file
3
pkgs/tools/graphics/zxing/zxing-cmdline-encoder.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#! /bin/sh
|
||||
|
||||
java-zxing com.google.zxing.client.j2se.CommandLineEncoder "$@"
|
3
pkgs/tools/graphics/zxing/zxing-cmdline-runner.sh
Normal file
3
pkgs/tools/graphics/zxing/zxing-cmdline-runner.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#! /bin/sh
|
||||
|
||||
java-zxing com.google.zxing.client.j2se.CommandLineRunner "$@"
|
11
pkgs/tools/graphics/zxing/zxing.sh
Normal file
11
pkgs/tools/graphics/zxing/zxing.sh
Normal file
@ -0,0 +1,11 @@
|
||||
#! /bin/sh
|
||||
choice="$1";
|
||||
shift
|
||||
case "$choice" in
|
||||
encode | create | write | CommandLineEncoder)
|
||||
zxing-cmdline-encoder "$@";
|
||||
;;
|
||||
decode | read | run | CommandLineRunner)
|
||||
zxing-cmdline-runner "$@";
|
||||
;;
|
||||
esac
|
@ -2855,6 +2855,8 @@ let
|
||||
|
||||
zsync = callPackage ../tools/compression/zsync { };
|
||||
|
||||
zxing = callPackage ../tools/graphics/zxing {};
|
||||
|
||||
|
||||
### SHELLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user