summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicharda Butler <39577672+RikkiButler20@users.noreply.github.com>2021-06-15 17:50:04 -0700
committerGitHub <noreply@github.com>2021-06-15 17:50:04 -0700
commit1c44912f9bec9f5a7a9602b0bec8efe903385d7f (patch)
tree166609c176742fe5936b327733fc4b265b99149b
parent5971372be75e25dfc00947d48f353bdd52cddbd1 (diff)
downloadspack-1c44912f9bec9f5a7a9602b0bec8efe903385d7f.tar.gz
spack-1c44912f9bec9f5a7a9602b0bec8efe903385d7f.tar.bz2
spack-1c44912f9bec9f5a7a9602b0bec8efe903385d7f.tar.xz
spack-1c44912f9bec9f5a7a9602b0bec8efe903385d7f.zip
add irep and lua-lang virtual dependency (#22492)
This adds a package for `irep`, a tool for reading `lua` input decks from Fortran, C, and C++. `irep` can be built with either `lua` or `luajit`. To address this, we also add a virtual package for lua called `lua-lang`. `luajit` isn't, by default, a drop-in replacement for `lua`, but we add a `+lualinks` variant to it that adds symlinks that make it behave like `lua@5.1`. With this variant enabled, it provides the `lua-lang` virtual. `lua` always provides `lua-lang`. - [x] add `irep` package - [x] add `+lualinks` variant to `lua-luajit` - [x] create `lua-lang` virtual, provided by `lua` and `luajit+lualinks` Co-authored-by: Kayla Richarda Butler <butler59@quartz1148.llnl.gov> Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
-rw-r--r--etc/spack/defaults/packages.yaml1
-rw-r--r--var/spack/repos/builtin/packages/irep/package.py18
-rw-r--r--var/spack/repos/builtin/packages/lua-luajit/package.py29
-rw-r--r--var/spack/repos/builtin/packages/lua/package.py2
4 files changed, 50 insertions, 0 deletions
diff --git a/etc/spack/defaults/packages.yaml b/etc/spack/defaults/packages.yaml
index 17fb4e2be1..2d6b3da9be 100644
--- a/etc/spack/defaults/packages.yaml
+++ b/etc/spack/defaults/packages.yaml
@@ -34,6 +34,7 @@ packages:
java: [openjdk, jdk, ibm-java]
jpeg: [libjpeg-turbo, libjpeg]
lapack: [openblas, amdlibflame]
+ lua-lang: [lua, lua-luajit]
mariadb-client: [mariadb-c-client, mariadb]
mkl: [intel-mkl]
mpe: [mpe2]
diff --git a/var/spack/repos/builtin/packages/irep/package.py b/var/spack/repos/builtin/packages/irep/package.py
new file mode 100644
index 0000000000..3658dae19b
--- /dev/null
+++ b/var/spack/repos/builtin/packages/irep/package.py
@@ -0,0 +1,18 @@
+# Copyright 2013-2021 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)
+
+class Irep(CMakePackage):
+ """IREP is a tool that enables mixed-language simulation codes to use a
+ common, Lua-based format for their input decks. Essentially, the input
+ format is a set of tables -- Lua's one (and only?) data structure."""
+
+ homepage = "https://irep.readthedocs.io/"
+ url = "https://github.com/LLNL/irep/archive/refs/tags/v1.0.0.tar.gz"
+
+ maintainers = ['tomstitt', 'kennyweiss']
+
+ version('1.0.0', 'b84203ac92de824dbdc672de45cfdb9609373791c4ee84a5201fa6e4ccecc1a4')
+
+ depends_on('lua-lang')
diff --git a/var/spack/repos/builtin/packages/lua-luajit/package.py b/var/spack/repos/builtin/packages/lua-luajit/package.py
index d5a44325cc..3e791e6683 100644
--- a/var/spack/repos/builtin/packages/lua-luajit/package.py
+++ b/var/spack/repos/builtin/packages/lua-luajit/package.py
@@ -3,6 +3,7 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+import glob
import os
from spack import *
@@ -18,6 +19,34 @@ class LuaLuajit(MakefilePackage):
conflicts('@:2.0.5', when='target=aarch64:')
+ variant('lualinks', default=False, description="add symlinks to make lua-luajit a drop-in lua replacement")
+
+ provides("lua-lang", when="+lualinks")
+
+ @run_after("install")
+ def install_links(self):
+ if not self.spec.satisfies("+lualinks"):
+ return
+
+ with working_dir(self.prefix.bin):
+ luajit = os.readlink(self.prefix.bin.luajit)
+ symlink(luajit, "lua")
+
+ with working_dir(self.prefix.include):
+ luajit_include_subdirs = glob.glob(
+ os.path.join(self.prefix.include, "luajit*"))
+ assert len(luajit_include_subdirs) == 1
+ symlink(luajit_include_subdirs[0], "lua")
+
+ with working_dir(self.prefix.lib):
+ luajit_libnames = glob.glob(
+ os.path.join(self.prefix.lib, "libluajit*.so*"))
+ real_lib = next(
+ lib for lib in luajit_libnames
+ if os.path.isfile(lib) and not os.path.islink(lib)
+ )
+ symlink(real_lib, "liblua.so")
+
@property
def headers(self):
hdrs = find_headers('luajit', self.prefix.include, recursive=True)
diff --git a/var/spack/repos/builtin/packages/lua/package.py b/var/spack/repos/builtin/packages/lua/package.py
index db80713789..93d8d15649 100644
--- a/var/spack/repos/builtin/packages/lua/package.py
+++ b/var/spack/repos/builtin/packages/lua/package.py
@@ -34,6 +34,8 @@ class Lua(Package):
extendable = True
+ provides('lua-lang')
+
depends_on('ncurses+termlib')
depends_on('readline')
# luarocks needs unzip for some packages (e.g. lua-luaposix)