python312Packages.shiv: 1.0.7 -> 1.0.8 (#364744)
[NixPkgs.git] / pkgs / development / tools / parsing / antlr / 3.5.nix
blobae466260d039459852d2a378c6a13e327c0c050f
2   lib,
3   stdenv,
4   fetchpatch,
5   fetchurl,
6   fetchFromGitHub,
7   jre,
8 }:
10 stdenv.mkDerivation rec {
11   pname = "antlr";
12   version = "3.5.2";
13   jar = fetchurl {
14     url = "https://www.antlr3.org/download/antlr-${version}-complete.jar";
15     sha256 = "0srjwxipwsfzmpi0v32d1l5lzk9gi5in8ayg33sq8wyp8ygnbji6";
16   };
17   src = fetchFromGitHub {
18     owner = "antlr";
19     repo = "antlr3";
20     rev = "5c2a916a10139cdb5c7c8851ee592ed9c3b3d4ff";
21     sha256 = "1i0w2v9prrmczlwkfijfp4zfqfgrss90a7yk2hg3y0gkg2s4abbk";
22   };
24   patches = [
25     (fetchpatch {
26       url = "https://src.fedoraproject.org/rpms/antlr3/raw/f1bb8d639678047935e1761c3bf3c1c7da8d0f1d/f/0006-antlr3memory.hpp-fix-for-C-20-mode.patch";
27       sha256 = "0apk904afjqbad6c7z9r72a9lkbz69vwrl8j2a6zgxjn8dfb2p8b";
28     })
29   ];
31   installPhase = ''
32     mkdir -p "$out"/{lib/antlr,bin,include}
33     cp "$jar" "$out/lib/antlr/antlr-${version}-complete.jar"
34     cp runtime/Cpp/include/* $out/include/
36     echo "#! ${stdenv.shell}" >> "$out/bin/antlr"
37     echo "'${jre}/bin/java' -cp '$out/lib/antlr/antlr-${version}-complete.jar' -Xms200M -Xmx400M org.antlr.Tool \"\$@\"" >> "$out/bin/antlr"
39     chmod a+x "$out/bin/antlr"
40     ln -s "$out/bin/antlr"{,3}
41   '';
43   inherit jre;
45   meta = with lib; {
46     description = "Powerful parser generator";
47     longDescription = ''
48       ANTLR (ANother Tool for Language Recognition) is a powerful parser
49       generator for reading, processing, executing, or translating structured
50       text or binary files. It's widely used to build languages, tools, and
51       frameworks. From a grammar, ANTLR generates a parser that can build and
52       walk parse trees.
53     '';
54     homepage = "https://www.antlr.org/";
55     sourceProvenance = with sourceTypes; [ binaryBytecode ];
56     license = licenses.bsd3;
57     platforms = platforms.linux;
58     maintainers = [ lib.maintainers.farlion ];
59   };