about summary refs log tree commit diff
path: root/pkgs/development/tools/parsing
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2018-08-13 20:57:50 +0200
committerVladimír Čunát <vcunat@gmail.com>2018-08-13 20:57:50 +0200
commitded9a4b1aa68b8645271a63e9543ef56177ae642 (patch)
treed351102a17ab05c6e263e970f43ab3b30561112e /pkgs/development/tools/parsing
parent98df4f635136e63644cb0ab646b55d60cbb444a4 (diff)
parent5b0398dc36ce5746d8d54e04a1dfcab25939484a (diff)
Merge branch 'staging-next' into staging
Commits from master, conflict resolutions, etc.
Diffstat (limited to 'pkgs/development/tools/parsing')
-rw-r--r--pkgs/development/tools/parsing/antlr/2.7.7.nix1
-rw-r--r--pkgs/development/tools/parsing/antlr/3.4.nix3
-rw-r--r--pkgs/development/tools/parsing/antlr/3.5.nix3
-rw-r--r--pkgs/development/tools/parsing/antlr/4.7.nix110
4 files changed, 80 insertions, 37 deletions
diff --git a/pkgs/development/tools/parsing/antlr/2.7.7.nix b/pkgs/development/tools/parsing/antlr/2.7.7.nix
index 519540ef52aef..0c67baa960108 100644
--- a/pkgs/development/tools/parsing/antlr/2.7.7.nix
+++ b/pkgs/development/tools/parsing/antlr/2.7.7.nix
@@ -20,6 +20,7 @@ stdenv.mkDerivation {
       walk parse trees.
     '';
     homepage = http://www.antlr.org/;
+    license = licenses.bsd3;
     platforms = platforms.unix;
   };
 }
diff --git a/pkgs/development/tools/parsing/antlr/3.4.nix b/pkgs/development/tools/parsing/antlr/3.4.nix
index c892b8fa8eab9..8074b7c35ad9e 100644
--- a/pkgs/development/tools/parsing/antlr/3.4.nix
+++ b/pkgs/development/tools/parsing/antlr/3.4.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
   };
 
   unpackPhase = "true";
- 
+
   installPhase = ''
     mkdir -p "$out"/{lib/antlr,bin}
     cp "$src" "$out/lib/antlr/antlr-${version}-complete.jar"
@@ -33,6 +33,7 @@ stdenv.mkDerivation rec {
       walk parse trees.
     '';
     homepage = http://www.antlr.org/;
+    license = licenses.bsd3;
     platforms = platforms.linux ++ platforms.darwin;
   };
 }
diff --git a/pkgs/development/tools/parsing/antlr/3.5.nix b/pkgs/development/tools/parsing/antlr/3.5.nix
index 030a19e994050..35179b336026d 100644
--- a/pkgs/development/tools/parsing/antlr/3.5.nix
+++ b/pkgs/development/tools/parsing/antlr/3.5.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
   };
 
   unpackPhase = "true";
- 
+
   installPhase = ''
     mkdir -p "$out"/{lib/antlr,bin}
     cp "$src" "$out/lib/antlr/antlr-${version}-complete.jar"
@@ -33,6 +33,7 @@ stdenv.mkDerivation rec {
       walk parse trees.
     '';
     homepage = http://www.antlr.org/;
+    license = licenses.bsd3;
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/development/tools/parsing/antlr/4.7.nix b/pkgs/development/tools/parsing/antlr/4.7.nix
index e097b5b3d5a57..1ebf7d7dfe241 100644
--- a/pkgs/development/tools/parsing/antlr/4.7.nix
+++ b/pkgs/development/tools/parsing/antlr/4.7.nix
@@ -1,41 +1,81 @@
-{stdenv, fetchurl, jre}:
+{ stdenv, fetchurl, jre
+, fetchFromGitHub, cmake, ninja, pkgconfig, libuuid, darwin }:
 
-stdenv.mkDerivation rec {
-  name = "antlr-${version}";
+let
   version = "4.7.1";
-  src = fetchurl {
-    url ="https://www.antlr.org/download/antlr-${version}-complete.jar";
-    sha256 = "1236gwnzchama92apb2swmklnypj01m7bdwwfvwvl8ym85scw7gl";
+  source = fetchFromGitHub {
+    owner = "antlr";
+    repo = "antlr4";
+    rev = version;
+    sha256 = "1xb4d9bd4hw406v85s64gg8gwcrrsrw171vhga1gz4xj6pzfwxz7";
   };
 
-  unpackPhase = "true";
- 
-  installPhase = ''
-    mkdir -p "$out"/{share/java,bin}
-    cp "$src" "$out/share/java/antlr-${version}-complete.jar"
-
-    echo "#! ${stdenv.shell}" >> "$out/bin/antlr"
-    echo "'${jre}/bin/java' -cp '$out/share/java/antlr-${version}-complete.jar:$CLASSPATH' -Xmx500M org.antlr.v4.Tool \"\$@\"" >> "$out/bin/antlr"
-    
-    echo "#! ${stdenv.shell}" >> "$out/bin/grun"
-    echo "'${jre}/bin/java' -cp '$out/share/java/antlr-${version}-complete.jar:$CLASSPATH' org.antlr.v4.gui.TestRig \"\$@\"" >> "$out/bin/grun"
-
-    chmod a+x "$out/bin/antlr" "$out/bin/grun"
-    ln -s "$out/bin/antlr"{,4}
-  '';
-
-  inherit jre;
-
-  meta = with stdenv.lib; {
-    description = "Powerful parser generator";
-    longDescription = ''
-      ANTLR (ANother Tool for Language Recognition) is a powerful parser
-      generator for reading, processing, executing, or translating structured
-      text or binary files. It's widely used to build languages, tools, and
-      frameworks. From a grammar, ANTLR generates a parser that can build and
-      walk parse trees.
+  runtime = {
+    cpp = stdenv.mkDerivation {
+      name = "antlr-runtime-cpp-${version}";
+      src = source;
+
+      outputs = [ "out" "dev" "doc" ];
+
+      nativeBuildInputs = [ cmake ninja pkgconfig ];
+      buildInputs = stdenv.lib.optional stdenv.isLinux libuuid
+        ++ stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.CoreFoundation;
+
+      postUnpack = ''
+        export sourceRoot=$sourceRoot/runtime/Cpp
+      '';
+
+      meta = with stdenv.lib; {
+        description = "C++ target for ANTLR 4";
+        homepage = http://www.antlr.org/;
+        license = licenses.bsd3;
+        platforms = platforms.unix;
+      };
+    };
+  };
+
+  antlr = stdenv.mkDerivation {
+    name = "antlr-${version}";
+    src = fetchurl {
+      url ="https://www.antlr.org/download/antlr-${version}-complete.jar";
+      sha256 = "1236gwnzchama92apb2swmklnypj01m7bdwwfvwvl8ym85scw7gl";
+    };
+
+    unpackPhase = "true";
+
+    installPhase = ''
+      mkdir -p "$out"/{share/java,bin}
+      cp "$src" "$out/share/java/antlr-${version}-complete.jar"
+
+      echo "#! ${stdenv.shell}" >> "$out/bin/antlr"
+      echo "'${jre}/bin/java' -cp '$out/share/java/antlr-${version}-complete.jar:$CLASSPATH' -Xmx500M org.antlr.v4.Tool \"\$@\"" >> "$out/bin/antlr"
+
+      echo "#! ${stdenv.shell}" >> "$out/bin/grun"
+      echo "'${jre}/bin/java' -cp '$out/share/java/antlr-${version}-complete.jar:$CLASSPATH' org.antlr.v4.gui.TestRig \"\$@\"" >> "$out/bin/grun"
+
+      chmod a+x "$out/bin/antlr" "$out/bin/grun"
+      ln -s "$out/bin/antlr"{,4}
     '';
-    homepage = http://www.antlr.org/;
-    platforms = platforms.unix;
+
+    inherit jre;
+
+    passthru = {
+      inherit runtime;
+      jarLocation = "${antlr}/share/java/antlr-${version}-complete.jar";
+    };
+
+    meta = with stdenv.lib; {
+      description = "Powerful parser generator";
+      longDescription = ''
+        ANTLR (ANother Tool for Language Recognition) is a powerful parser
+        generator for reading, processing, executing, or translating structured
+        text or binary files. It's widely used to build languages, tools, and
+        frameworks. From a grammar, ANTLR generates a parser that can build and
+        walk parse trees.
+      '';
+      homepage = http://www.antlr.org/;
+      license = licenses.bsd3;
+      platforms = platforms.unix;
+    };
   };
-}
+in antlr