diff options
author | WuK <i@wu-kan.cn> | 2024-01-13 02:07:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-12 10:07:44 -0800 |
commit | 3502fff12037ce2f12987406ffc9d41cddf05913 (patch) | |
tree | bb674e1cd1f140ad807b1f480ecf10ebac3143cc /var | |
parent | ea3ab4fcdcd19fcadf2a90753e41dd41607d28d3 (diff) | |
download | spack-3502fff12037ce2f12987406ffc9d41cddf05913.tar.gz spack-3502fff12037ce2f12987406ffc9d41cddf05913.tar.bz2 spack-3502fff12037ce2f12987406ffc9d41cddf05913.tar.xz spack-3502fff12037ce2f12987406ffc9d41cddf05913.zip |
add antlr4-cpp-runtime (#42048)
* add antlr4-cpp-runtime
* code format
* add setup_run_environment
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/repos/builtin/packages/antlr4-complete/package.py | 63 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/antlr4-cpp-runtime/package.py | 39 |
2 files changed, 102 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/antlr4-complete/package.py b/var/spack/repos/builtin/packages/antlr4-complete/package.py new file mode 100644 index 0000000000..ed4c92b94d --- /dev/null +++ b/var/spack/repos/builtin/packages/antlr4-complete/package.py @@ -0,0 +1,63 @@ +# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import glob + +from spack.package import * + + +class Antlr4Complete(Package): + """ + This package provides complete ANTLR tool, Java runtime and ST, + which lets you run the tool and the generated code by + version 4 of ANTLR (ANother Tool for Language Recognition). + """ + + homepage = "https://www.antlr.org" + url = "https://www.antlr.org/download/antlr-4.13.1-complete.jar" + + version( + "4.13.1", + sha256="bc13a9c57a8dd7d5196888211e5ede657cb64a3ce968608697e4f668251a8487", + expand=False, + ) + version( + "4.12.0", + sha256="88f18a2bfac0dde1009eda5c7dce358a52877faef7868f56223a5bcc15329e43", + expand=False, + ) + version( + "4.11.1", + sha256="62975e192b4af2622b72b5f0131553ee3cbce97f76dc2a41632dcc55e25473e1", + expand=False, + ) + version( + "4.10.1", + sha256="41949d41f20d31d5b8277187735dd755108df52b38db6c865108d3382040f918", + expand=False, + ) + version( + "4.9.3", + sha256="afcd40946d3de4d81e28d7c88d467289e0587285d27adb172aecc5494a17df36", + expand=False, + ) + version( + "4.7.2", + sha256="6852386d7975eff29171dae002cc223251510d35f291ae277948f381a7b380b4", + expand=False, + ) + + depends_on("java@8.0:", type="run", when="@4.10.0:") + depends_on("java@7.0:", type="run", when="@:4.9.3") + + def install(self, spec, prefix): + mkdirp(prefix.bin) + rename(glob.glob("antlr-*-complete.jar")[0], "antlr-complete.jar") + install("antlr-complete.jar", prefix.bin) + + def setup_run_environment(self, env): + env.set("ANTLR4_JAR_LOCATION", join_path(self.prefix.bin, "antlr-complete.jar")) + env.set("ANTLR_JAR_LOCATION", join_path(self.prefix.bin, "antlr-complete.jar")) + env.set("ANTLR_EXECUTABLE", join_path(self.prefix.bin, "antlr-complete.jar")) diff --git a/var/spack/repos/builtin/packages/antlr4-cpp-runtime/package.py b/var/spack/repos/builtin/packages/antlr4-cpp-runtime/package.py new file mode 100644 index 0000000000..281433c33f --- /dev/null +++ b/var/spack/repos/builtin/packages/antlr4-cpp-runtime/package.py @@ -0,0 +1,39 @@ +# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class Antlr4CppRuntime(CMakePackage): + """ + This package provides runtime libraries required to use parsers + generated for the Cpp language by version 4 of ANTLR (ANother Tool + for Language Recognition). + """ + + homepage = "https://www.antlr.org" + url = "https://www.antlr.org/download/antlr4-cpp-runtime-4.13.1-source.zip" + version("4.13.1", sha256="d350e09917a633b738c68e1d6dc7d7710e91f4d6543e154a78bb964cfd8eb4de") + version("4.12.0", sha256="642d59854ddc0cebb5b23b2233ad0a8723eef20e66ef78b5b898d0a67556893b") + version("4.11.1", sha256="8018c335316e61bb768e5bd4a743a9303070af4e1a8577fa902cd053c17249da") + version("4.10.1", sha256="2a6e602fd593e0a65d8d310c0952bbdfff34ef361362ae87b2a850b62d36f0b6") + version("4.9.3", sha256="5f0af6efd81f476c3e775c486eb0a71c25d6bbc14373e88a64690e2738d68e03") + version("4.7.2", sha256="8631a39116684638168663d295a969ad544cead3e6089605a44fea34ec01f31a") + + variant( + "clanglibcpp", default=False, description="Compile with clang libc++ instead of libstdc++" + ) + + depends_on("libuuid", type=["build", "link"], when="@:4.10.1") + + def cmake_args(self): + args = [ + self.define("ANTLR4_INSTALL", "On"), + self.define("ANTLR_BUILD_CPP_TESTS", "Off"), + self.define("WITH_DEMO", "Off"), + self.define("WITH_LIBCXX", "On" if "+clanglibcpp" in self.spec else "Off"), + self.define("WITH_STATIC_CRT", "Off"), + ] + return args |