summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorwanlinwang <32032219+wanlinwang@users.noreply.github.com>2022-08-18 02:18:24 +0800
committerGitHub <noreply@github.com>2022-08-17 12:18:24 -0600
commit4c040e02d1cb39bb37714ffcfe21bee7eb7953be (patch)
tree2ae28a033b279512093c38ab924e3e049e507a90 /var
parent73d25984ca898bcfeea6625d78961fb96c9b0f99 (diff)
downloadspack-4c040e02d1cb39bb37714ffcfe21bee7eb7953be.tar.gz
spack-4c040e02d1cb39bb37714ffcfe21bee7eb7953be.tar.bz2
spack-4c040e02d1cb39bb37714ffcfe21bee7eb7953be.tar.xz
spack-4c040e02d1cb39bb37714ffcfe21bee7eb7953be.zip
Add riscv-gnu-toolchain package. (#32047)
Create a package for riscv-gnu-toolchain, a cross-compilation tool.
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/riscv-gnu-toolchain/package.py66
1 files changed, 66 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/riscv-gnu-toolchain/package.py b/var/spack/repos/builtin/packages/riscv-gnu-toolchain/package.py
new file mode 100644
index 0000000000..d4f9602907
--- /dev/null
+++ b/var/spack/repos/builtin/packages/riscv-gnu-toolchain/package.py
@@ -0,0 +1,66 @@
+# Copyright 2013-2022 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 shlex
+from subprocess import Popen
+
+from spack.package import *
+
+
+class RiscvGnuToolchain(AutotoolsPackage):
+ """A cross-compilation tool for RISC-V."""
+
+ homepage = "https://spack-tutorial.readthedocs.io/"
+ git = "https://github.com/riscv-collab/riscv-gnu-toolchain.git"
+
+ maintainers = ["wanlinwang"]
+
+ version("develop", branch="master", submodules=True)
+ version("2022.08.08", tag="2022.08.08", submodules=True)
+
+ # Dependencies:
+ depends_on("pkg-config", type="build")
+ depends_on("autoconf", when="@main:", type="build")
+ depends_on("python", type="build")
+ depends_on("gawk", type="build")
+ depends_on("bison", type="build")
+ depends_on("flex@:2.6.1,2.6.4:", type="build")
+ depends_on("texinfo", type="build")
+ depends_on("patchutils", type="build")
+ depends_on("mpc", type="build")
+ depends_on("gmp", type="build")
+ depends_on("mpfr", type="build")
+ depends_on("zlib", type=("build", "link"))
+ depends_on("expat", type=("build", "link"))
+ depends_on("bzip2", type="build")
+ depends_on("gmake@4.3:", type="build")
+
+ conflicts("platform=windows", msg="Windows is not supported.")
+
+ variant(
+ "compiler_type",
+ default="newlib",
+ values=("newlib", "linux"),
+ description="Compiler back-end to build",
+ )
+
+ def build(self, spec, prefix):
+ """Makes the build targets specified by
+ :py:attr:``~.AutotoolsPackage.build_targets``
+ """
+ with working_dir(self.stage.source_path):
+ # modify Makefile not to git init submodules.
+ cmd = "/bin/sed -i.bak -r \
+ '/^# Rule for auto init submodules/,/git submodule update.*$/d' \
+ Makefile"
+ p = Popen(shlex.split(cmd))
+ p.wait()
+ p.communicate()
+
+ params = []
+ if self.spec.satisfies("compiler_type=linux"):
+ params.append("linux")
+
+ make(*params)