Skip to content

Commit 63c7263

Browse files
authored
nim: add latest versions (spack#47844)
* nim: add latest versions In addition: - Create separate build and install phases. - Remove koch nimble call as it's redundant with koch tools. - Install all additional tools bundled with Nim instead of only Nimble. * Fix 1.6 version * nim: add devel In addition: - Fix build accessing user config/cache
1 parent a7eacd7 commit 63c7263

File tree

1 file changed

+37
-11
lines changed

1 file changed

+37
-11
lines changed

var/spack/repos/builtin/packages/nim/package.py

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,22 @@ class Nim(Package):
1313
"""
1414

1515
homepage = "https://nim-lang.org/"
16-
url = "https://nim-lang.org/download/nim-1.4.4.tar.xz"
16+
url = "https://nim-lang.org/download/nim-2.2.0.tar.xz"
17+
git = "https://github.com/nim-lang/Nim.git"
1718

1819
license("MIT")
1920

21+
version("devel", branch="devel")
22+
version("2.2.0", sha256="ce9842849c9760e487ecdd1cdadf7c0f2844cafae605401c7c72ae257644893c")
23+
version("2.0.12", sha256="c4887949c5eb8d7f9a9f56f0aeb2bf2140fabf0aee0f0580a319e2a09815733a")
2024
version("2.0.4", sha256="71526bd07439dc8e378fa1a6eb407eda1298f1f3d4df4476dca0e3ca3cbe3f09")
2125
version("1.9.3", sha256="d8de7515db767f853d9b44730f88ee113bfe9c38dcccd5afabc773e2e13bf87c")
26+
version("1.6.20", sha256="ffed047504d1fcaf610f0dd7cf3e027be91a292b0c9c51161504c2f3b984ffb9")
27+
version("1.4.8", sha256="b798c577411d7d95b8631261dbb3676e9d1afd9e36740d044966a0555b41441a")
2228
version("1.4.4", sha256="6d73729def143f72fc2491ca937a9cab86d2a8243bd845a5d1403169ad20660e")
2329
version("1.4.2", sha256="03a47583777dd81380a3407aa6a788c9aa8a67df4821025770c9ac4186291161")
30+
version("1.2.18", sha256="a1739185508876f6e21a13f590a20e219ce3eec1b0583ea745e9058c37ad833e")
31+
version("1.0.10", sha256="28045fb6dcd86bd79748ead7874482d665ca25edca68f63d6cebc925b1428da5")
2432
version(
2533
"0.20.0",
2634
sha256="51f479b831e87b9539f7264082bb6a64641802b54d2691b3c6e68ac7e2699a90",
@@ -44,21 +52,39 @@ class Nim(Package):
4452
depends_on("pcre")
4553
depends_on("openssl")
4654

47-
def patch(self):
48-
install_sh_path = join_path(self.stage.source_path, "install.sh")
49-
filter_file("1/nim", "1", install_sh_path)
55+
resource(
56+
name="csources_v2",
57+
git="https://github.com/nim-lang/csources_v2.git",
58+
commit="86742fb02c6606ab01a532a0085784effb2e753e",
59+
when="@devel",
60+
)
5061

51-
def install(self, spec, prefix):
62+
phases = ["build", "install"]
63+
64+
def build(self, spec, prefix):
5265
bash = which("bash")
53-
bash("./build.sh")
66+
if spec.satisfies("@devel"):
67+
with working_dir("csources_v2"):
68+
bash("./build.sh")
69+
else:
70+
bash("./build.sh")
5471

5572
nim = Executable(join_path("bin", "nim"))
56-
nim("c", "koch")
73+
# Separate nimcache allows parallel compilation of different versions of the Nim compiler
74+
nim_flags = ["--skipUserCfg", "--skipParentCfg", "--nimcache:nimcache"]
75+
nim("c", *nim_flags, "koch")
5776

5877
koch = Executable("./koch")
59-
koch("boot", "-d:release")
60-
koch("tools")
61-
koch("nimble")
78+
koch("boot", "-d:release", *nim_flags)
79+
koch("tools", *nim_flags)
80+
81+
if spec.satisfies("@devel"):
82+
koch("geninstall")
6283

84+
def install(self, spec, prefix):
85+
filter_file("1/nim", "1", "install.sh")
86+
87+
bash = which("bash")
6388
bash("./install.sh", prefix)
64-
install(join_path("bin", "nimble"), join_path(prefix, "bin"))
89+
90+
install_tree("bin", prefix.bin)

0 commit comments

Comments
 (0)