nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 209 lines 6.3 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 jre, 6 fetchFromGitHub, 7 cmake, 8 ninja, 9 pkg-config, 10 11 # ANTLR 4.8 & 4.9 12 libuuid, 13 14 # ANTLR 4.9 15 utf8cpp, 16}: 17 18let 19 20 mkAntlr = 21 { 22 version, 23 sourceSha256, 24 jarSha256, 25 extraCppBuildInputs ? [ ], 26 extraCppCmakeFlags ? [ ], 27 extraPatches ? [ ], 28 }: 29 rec { 30 source = fetchFromGitHub { 31 owner = "antlr"; 32 repo = "antlr4"; 33 tag = version; 34 sha256 = sourceSha256; 35 }; 36 37 antlr = stdenv.mkDerivation { 38 pname = "antlr"; 39 inherit version; 40 41 src = fetchurl { 42 url = "https://www.antlr.org/download/antlr-${version}-complete.jar"; 43 sha256 = jarSha256; 44 }; 45 46 dontUnpack = true; 47 48 installPhase = '' 49 mkdir -p "$out"/{share/java,bin} 50 ln -s "$src" "$out/share/java/antlr-${version}-complete.jar" 51 52 echo "#! ${stdenv.shell}" >> "$out/bin/antlr" 53 echo "'${jre}/bin/java' -cp '$out/share/java/antlr-${version}-complete.jar:$CLASSPATH' -Xmx500M org.antlr.v4.Tool \"\$@\"" >> "$out/bin/antlr" 54 55 echo "#! ${stdenv.shell}" >> "$out/bin/antlr-parse" 56 echo "'${jre}/bin/java' -cp '$out/share/java/antlr-${version}-complete.jar:$CLASSPATH' -Xmx500M org.antlr.v4.gui.Interpreter \"\$@\"" >> "$out/bin/antlr-parse" 57 58 echo "#! ${stdenv.shell}" >> "$out/bin/grun" 59 echo "'${jre}/bin/java' -cp '$out/share/java/antlr-${version}-complete.jar:$CLASSPATH' org.antlr.v4.gui.TestRig \"\$@\"" >> "$out/bin/grun" 60 61 chmod a+x "$out/bin/antlr" "$out/bin/antlr-parse" "$out/bin/grun" 62 ln -s "$out/bin/antlr"{,4} 63 ln -s "$out/bin/antlr"{,4}-parse 64 ''; 65 66 inherit jre; 67 68 passthru = { 69 inherit runtime; 70 jarLocation = antlr.src; 71 }; 72 73 meta = { 74 description = "Powerful parser generator"; 75 longDescription = '' 76 ANTLR (ANother Tool for Language Recognition) is a powerful parser 77 generator for reading, processing, executing, or translating structured 78 text or binary files. It's widely used to build languages, tools, and 79 frameworks. From a grammar, ANTLR generates a parser that can build and 80 walk parse trees. 81 ''; 82 homepage = "https://www.antlr.org/"; 83 sourceProvenance = with lib.sourceTypes; [ binaryBytecode ]; 84 license = lib.licenses.bsd3; 85 platforms = lib.platforms.unix; 86 maintainers = with lib.maintainers; [ sarahec ]; 87 }; 88 }; 89 90 runtime = { 91 cpp = stdenv.mkDerivation { 92 pname = "antlr-runtime-cpp"; 93 inherit version; 94 src = source; 95 96 patches = extraPatches; 97 98 outputs = [ 99 "out" 100 "dev" 101 "doc" 102 ]; 103 104 nativeBuildInputs = [ 105 cmake 106 ninja 107 pkg-config 108 ]; 109 buildInputs = extraCppBuildInputs; 110 111 cmakeDir = "../runtime/Cpp"; 112 113 cmakeFlags = extraCppCmakeFlags; 114 115 meta = { 116 description = "C++ target for ANTLR 4"; 117 homepage = "https://www.antlr.org/"; 118 license = lib.licenses.bsd3; 119 platforms = lib.platforms.unix; 120 maintainers = with lib.maintainers; [ sarahec ]; 121 }; 122 }; 123 }; 124 }; 125 126in 127{ 128 antlr4_13 = 129 (mkAntlr { 130 version = "4.13.2"; 131 sourceSha256 = "sha256-DxxRL+FQFA+x0RudIXtLhewseU50aScHKSCDX7DE9bY="; 132 jarSha256 = "sha256-6uLfoRmmQydERnKv9j6ew1ogGA3FuAkLemq4USXfTXY="; 133 extraCppCmakeFlags = [ 134 # Generate CMake config files, which are not installed by default. 135 (lib.cmakeBool "ANTLR4_INSTALL" true) 136 137 # Disable tests, since they require downloading googletest, which is 138 # not available in a sandboxed build. 139 (lib.cmakeBool "ANTLR_BUILD_CPP_TESTS" false) 140 ]; 141 extraPatches = [ 142 ./include-dir-issue-379757.patch 143 ]; 144 }).antlr; 145 146 antlr4_12 = 147 (mkAntlr { 148 version = "4.12.0"; 149 sourceSha256 = "sha256-0JMG8UYFT+IAWvARY2KnuXSr5X6LlVZN4LJHy5d4x08="; 150 jarSha256 = "sha256-iPGKK/rA3eEAntpcfc41ilKHf673ho9WIjpbzBUynkM="; 151 extraCppCmakeFlags = [ 152 # Generate CMake config files, which are not installed by default. 153 (lib.cmakeBool "ANTLR4_INSTALL" true) 154 155 # Disable tests, since they require downloading googletest, which is 156 # not available in a sandboxed build. 157 (lib.cmakeBool "ANTLR_BUILD_CPP_TESTS" false) 158 ]; 159 }).antlr; 160 161 antlr4_11 = 162 (mkAntlr { 163 version = "4.11.1"; 164 sourceSha256 = "sha256-SUeDgfqLjYQorC8r/CKlwbYooTThMOILkizwQV8pocc="; 165 jarSha256 = "sha256-YpdeGStK8mIrcrXwExVT7jy86X923CpBYy3MVeJUc+E="; 166 extraCppCmakeFlags = [ 167 # Generate CMake config files, which are not installed by default. 168 (lib.cmakeBool "ANTLR4_INSTALL" true) 169 170 # Disable tests, since they require downloading googletest, which is 171 # not available in a sandboxed build. 172 (lib.cmakeBool "ANTLR_BUILD_CPP_TESTS" false) 173 ]; 174 extraPatches = [ 175 ./4.11.runtime.cpp.cmake.patch 176 ]; 177 }).antlr; 178 179 antlr4_10 = 180 (mkAntlr { 181 version = "4.10.1"; 182 sourceSha256 = "sha256-Z1P81L0aPbimitzrHH/9rxsMCA6Qn3i42jFbUmVqu1E="; 183 jarSha256 = "sha256-QZSdQfINMdW4J3GHc13XVRCN9Ss422yGUQjTOCBA+Rg="; 184 extraCppBuildInputs = lib.optional stdenv.hostPlatform.isLinux libuuid; 185 extraCppCmakeFlags = [ 186 (lib.cmakeBool "ANTLR4_INSTALL" true) 187 (lib.cmakeBool "ANTLR_BUILD_CPP_TESTS" false) 188 ]; 189 extraPatches = [ 190 ./4.10.runtime.cpp.cmake.patch 191 ]; 192 }).antlr; 193 194 antlr4_9 = 195 (mkAntlr { 196 version = "4.9.3"; 197 sourceSha256 = "1af3cfqwk7lq1b5qsh1am0922fyhy7wmlpnrqdnvch3zzza9n1qm"; 198 jarSha256 = "0dnz2x54kigc58bxnynjhmr5iq49f938vj6p50gdir1xdna41kdg"; 199 extraCppBuildInputs = [ utf8cpp ] ++ lib.optional stdenv.hostPlatform.isLinux libuuid; 200 extraCppCmakeFlags = [ 201 (lib.cmakeFeature "CMAKE_CXX_FLAGS" "-I${lib.getDev utf8cpp}/include/utf8cpp") 202 (lib.cmakeFeature "CMAKE_POLICY_VERSION_MINIMUM" "3.5") 203 ]; 204 extraPatches = [ 205 ./utf8cpp.patch 206 ./4.9.runtime.cpp.cmake.patch 207 ]; 208 }).antlr; 209}