diff options
Diffstat (limited to 'var/spack/repos/builtin/packages/lua/package.py')
-rw-r--r-- | var/spack/repos/builtin/packages/lua/package.py | 68 |
1 files changed, 35 insertions, 33 deletions
diff --git a/var/spack/repos/builtin/packages/lua/package.py b/var/spack/repos/builtin/packages/lua/package.py index 46d1e5c094..ceb816a5d7 100644 --- a/var/spack/repos/builtin/packages/lua/package.py +++ b/var/spack/repos/builtin/packages/lua/package.py @@ -1,27 +1,8 @@ -############################################################################## -# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. +# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. # -# This file is part of Spack. -# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. -# LLNL-CODE-647188 -# -# For details, see https://github.com/spack/spack -# Please also see the NOTICE and LICENSE files for our notice and the LGPL. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License (as -# published by the Free Software Foundation) version 2.1, February 1999. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and -# conditions of the GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -############################################################################## +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + from spack import * import os @@ -49,6 +30,8 @@ class Lua(Package): depends_on('ncurses') depends_on('readline') + # luarocks needs unzip for some packages (e.g. lua-luaposix) + depends_on('unzip', type='run') resource( name="luarocks", @@ -64,28 +47,41 @@ class Lua(Package): else: target = 'linux' make('INSTALL_TOP=%s' % prefix, - 'MYCFLAGS=%s' % ( - self.compiler.pic_flag), 'MYLDFLAGS=-L%s -L%s' % ( spec['readline'].prefix.lib, spec['ncurses'].prefix.lib), 'MYLIBS=-lncursesw', - 'CC=%s -std=gnu99' % spack_cc, + 'CC=%s -std=gnu99 %s' % (spack_cc, + self.compiler.pic_flag), target) make('INSTALL_TOP=%s' % prefix, - 'MYCFLAGS=%s' % ( - self.compiler.pic_flag), - 'MYLDFLAGS=-L%s -L%s' % ( - spec['readline'].prefix.lib, - spec['ncurses'].prefix.lib), - 'MYLIBS=-lncursesw', - 'CC=%s -std=gnu99' % spack_cc, 'install') static_to_shared_library(join_path(prefix.lib, 'liblua.a'), arguments=['-lm'], version=self.version, compat_version=self.version.up_to(2)) + # compatibility with ax_lua.m4 from autoconf-archive + # https://www.gnu.org/software/autoconf-archive/ax_lua.html + with working_dir(prefix.lib): + # e.g., liblua.so.5.1.5 + src_path = 'liblua.{0}.{1}'.format(dso_suffix, + str(self.version.up_to(3))) + + # For lua version 5.1.X, the symlinks should be: + # liblua5.1.so + # liblua51.so + # liblua-5.1.so + # liblua-51.so + version_formats = [str(self.version.up_to(2)), + Version(str(self.version.up_to(2))).joined] + for version_str in version_formats: + for joiner in ['', '-']: + dest_path = 'liblua{0}{1}.{2}'.format(joiner, + version_str, + dso_suffix) + os.symlink(src_path, dest_path) + with working_dir(os.path.join('luarocks', 'luarocks')): configure('--prefix=' + prefix, '--with-lua=' + prefix) make('build') @@ -102,6 +98,7 @@ class Lua(Package): deptypes=('build', 'run'), deptype_query='run'): if d.package.extends(self.spec): lua_paths.append(os.path.join(d.prefix, self.lua_lib_dir)) + lua_paths.append(os.path.join(d.prefix, self.lua_lib64_dir)) lua_paths.append(os.path.join(d.prefix, self.lua_share_dir)) lua_patterns = [] @@ -112,6 +109,7 @@ class Lua(Package): # Always add this package's paths for p in (os.path.join(self.spec.prefix, self.lua_lib_dir), + os.path.join(self.spec.prefix, self.lua_lib64_dir), os.path.join(self.spec.prefix, self.lua_share_dir)): self.append_paths(lua_patterns, lua_cpatterns, p) @@ -156,6 +154,10 @@ class Lua(Package): return os.path.join('lib', 'lua', str(self.version.up_to(2))) @property + def lua_lib64_dir(self): + return os.path.join('lib64', 'lua', str(self.version.up_to(2))) + + @property def lua_share_dir(self): return os.path.join('share', 'lua', str(self.version.up_to(2))) |