summary refs log tree commit diff
path: root/pkgs/tools/text/xml/jing-trang/default.nix
blob: 36ff976a6c1683cffc566870c021f32d8189e451 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{ stdenv, fetchFromGitHub, jre, jdk, ant, saxon }:

stdenv.mkDerivation rec {
  name = "jing-trang-${version}";
  version = "20150603";

  src = fetchFromGitHub {
    owner = "relaxng";
    repo = "jing-trang";
    rev = "54b9b1f4e67cd79c7987750d8c9dcfc014af98c3"; # needed to compile with jdk8
    sha256 = "0wa569xjb7ihhcaazz32y2b0dv092lisjz77isz1gfb1wvf53di5";
  };

  buildInputs = [ jdk ant saxon ];

  preBuild = "ant";

  installPhase = ''
    mkdir -p "$out"/{share/java,bin}
    cp ./build/*.jar "$out/share/java/"

    for tool in jing trang; do
    cat > "$out/bin/$tool" <<EOF
    #! $SHELL
    export JAVA_HOME='${jre}'
    exec '${jre}/bin/java' -jar '$out/share/java/$tool.jar' "\$@"
    EOF
    done

    chmod +x "$out"/bin/*
  '';

  meta = with stdenv.lib; {
    description = "A RELAX NG validator in Java";
    # The homepage is www.thaiopensource.com, but it links to googlecode.com
    # for downloads and call it the "project site".
    homepage = http://www.thaiopensource.com/relaxng/jing.html;
    platforms = platforms.linux;
    maintainers = [ maintainers.bjornfor ];
  };
}