3
0
Fork 0
forked from mirrors/nixpkgs

Add a binary distribution of ZXing 1D/2D code library

This commit is contained in:
Michael Raskin 2014-11-23 02:35:04 +03:00
parent 9f82cc2684
commit e511865580
6 changed files with 56 additions and 0 deletions

View 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";
};
}

View file

@ -0,0 +1,3 @@
#! /bin/sh
@jre@/bin/java -cp @out@/lib/java/core-@version@.jar:@out@/lib/java/javase-@version@.jar "$@"

View file

@ -0,0 +1,3 @@
#! /bin/sh
java-zxing com.google.zxing.client.j2se.CommandLineEncoder "$@"

View file

@ -0,0 +1,3 @@
#! /bin/sh
java-zxing com.google.zxing.client.j2se.CommandLineRunner "$@"

View 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

View file

@ -2855,6 +2855,8 @@ let
zsync = callPackage ../tools/compression/zsync { };
zxing = callPackage ../tools/graphics/zxing {};
### SHELLS