about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/misc/ili2c/default.nix
blob: d4ac13046377097f9bd9531a55c6a678cdf66f54 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{ lib
, stdenv
, fetchFromGitHub
, ant
, jdk8
, jre8
, makeWrapper
, stripJavaArchivesHook
}:

let
  jdk = jdk8;
  jre = jre8;
in
stdenv.mkDerivation (finalAttrs: {
  pname = "ili2c";
  version = "5.1.1"; # There are newer versions, but they use gradle

  nativeBuildInputs = [
    ant
    jdk
    makeWrapper
    stripJavaArchivesHook
  ];

  src = fetchFromGitHub {
    owner = "claeis";
    repo = "ili2c";
    rev = "ili2c-${finalAttrs.version}";
    hash = "sha256-FHhx+f253+UdbFjd2fOlUY1tpQ6pA2aVu9CBSwUVoKQ=";
  };

  patches = [
    # avoids modifying Version.properties file because that would insert the current timestamp into the file
    ./dont-use-build-timestamp.patch
  ];

  buildPhase = ''
    runHook preBuild
    ant jar
    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    install -Dm644 build/jar/ili2c.jar -t $out/share/ili2c
    makeWrapper ${jre}/bin/java $out/bin/ili2c \
        --add-flags "-jar $out/share/ili2c/ili2c.jar"

    runHook postInstall
  '';

  meta = with lib; {
    description = "The INTERLIS Compiler";
    longDescription = ''
      Checks the syntactical correctness of an INTERLIS data model.
    '';
    homepage = "https://www.interlis.ch/downloads/ili2c";
    sourceProvenance = with sourceTypes; [
      fromSource
      binaryBytecode # source bundles dependencies as jars
    ];
    license = licenses.lgpl21Plus;
    maintainers = with maintainers; teams.geospatial.members ++ [ das-g ];
    platforms = platforms.linux;
    mainProgram = "ili2c";
  };
})