diff --git a/var/spack/repos/builtin/packages/lua/package.py b/var/spack/repos/builtin/packages/lua/package.py index 683657882359f0..8f791b5cd867b7 100644 --- a/var/spack/repos/builtin/packages/lua/package.py +++ b/var/spack/repos/builtin/packages/lua/package.py @@ -12,6 +12,23 @@ from spack.package import * from spack.util.executable import Executable +# This is the template for a pkgconfig file for rpm +# https://github.com/guix-mirror/guix/raw/dcaf70897a0bad38a4638a2905aaa3c46b1f1402/gnu/packages/patches/lua-pkgconfig.patch +_LUA_PC_TEMPLATE = """prefix={0} +libdir={0}/lib +includedir={0}/include +bindir={0}/bin +INSTALL_LMOD={0}/share/lua/{1} +INSTALL_CMOD={0}/lib/lua/{1} +INTERPRETER=${{bindir}}/lua +COMPILER=${{bindir}}/luac +Name: Lua +Description: A powerful, fast, lightweight, embeddable scripting language +Version: {2} +Libs: -L${{libdir}} -llua -lm +Cflags: -I${{includedir}} +""" + class LuaImplPackage(MakefilePackage): """Specialized class for lua *implementations* @@ -226,7 +243,6 @@ class Lua(LuaImplPackage): depends_on("c", type="build") # generated depends_on("cxx", type="build") # generated - variant("pcfile", default=False, description="Add patch for lua.pc generation") variant("shared", default=True, description="Builds a shared version of the library") provides("lua-lang@5.1", when="@5.1:5.1.99") @@ -237,12 +253,6 @@ class Lua(LuaImplPackage): depends_on("ncurses+termlib") depends_on("readline") - patch( - "http://lua.2524044.n2.nabble.com/attachment/7666421/0/pkg-config.patch", - sha256="208316c2564bdd5343fa522f3b230d84bd164058957059838df7df56876cb4ae", - when="+pcfile @:5.3.9999", - ) - def build(self, spec, prefix): if spec.satisfies("platform=darwin"): target = "macosx" @@ -289,10 +299,10 @@ def install(self, spec, prefix): os.symlink(src_path, dest_path) @run_after("install") - def link_pkg_config(self): - if self.spec.satisfies("+pcfile"): - versioned_pc_file_name = "lua{0}.pc".format(self.version.up_to(2)) - symlink( - join_path(self.prefix.lib, "pkgconfig", versioned_pc_file_name), - join_path(self.prefix.lib, "pkgconfig", "lua.pc"), - ) + def generate_pkg_config(self): + mkdirp(self.prefix.lib.pkgconfig) + versioned_pc_file_name = "lua{0}.pc".format(self.version.up_to(2)) + versioned_pc_file_path = join_path(self.prefix.lib.pkgconfig, versioned_pc_file_name) + with open(versioned_pc_file_path, "w") as pcfile: + pcfile.write(_LUA_PC_TEMPLATE.format(self.prefix, self.version.up_to(2), self.version)) + symlink(versioned_pc_file_path, join_path(self.prefix.lib.pkgconfig, "lua.pc")) diff --git a/var/spack/repos/builtin/packages/rpm/package.py b/var/spack/repos/builtin/packages/rpm/package.py index 18d373f299e9ec..39d2d44af4d848 100644 --- a/var/spack/repos/builtin/packages/rpm/package.py +++ b/var/spack/repos/builtin/packages/rpm/package.py @@ -60,8 +60,8 @@ class Rpm(AutotoolsPackage): # Always required depends_on("popt") - # Without this file patch, we don't detect lua - depends_on("lua+pcfile@5.3.5:", when="+lua") + # support for embedded Lua interpreter + depends_on("lua@5.3.5:", when="+lua") # Enable POSIX.1e draft 15 file capabilities support depends_on("libcap", when="+posix")