Fixed Remaining Shared Objects in Static Lua (#15787)

Fixed removal of remaining references and symlinks to so files when
building lua with static libraries
This commit is contained in:
Robert Pavel 2020-04-01 11:31:01 -06:00 committed by GitHub
parent 917c0a0efd
commit 6ad717cc9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,24 +69,25 @@ def install(self, spec, prefix):
# 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)))
if '+shared' in spec:
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)
# 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)
@ -96,7 +97,8 @@ def install(self, spec, prefix):
def append_paths(self, paths, cpaths, path):
paths.append(os.path.join(path, '?.lua'))
paths.append(os.path.join(path, '?', 'init.lua'))
cpaths.append(os.path.join(path, '?.so'))
if '+shared' in self.spec:
cpaths.append(os.path.join(path, '?.so'))
def _setup_dependent_env_helper(self, env, dependent_spec):
lua_paths = []
@ -126,7 +128,8 @@ def setup_dependent_build_environment(self, env, dependent_spec):
env, dependent_spec)
env.set('LUA_PATH', ';'.join(lua_patterns), separator=';')
env.set('LUA_CPATH', ';'.join(lua_cpatterns), separator=';')
if '+shared' in self.spec:
env.set('LUA_CPATH', ';'.join(lua_cpatterns), separator=';')
def setup_dependent_run_environment(self, env, dependent_spec):
# For run time environment set only the path for dependent_spec and
@ -136,8 +139,9 @@ def setup_dependent_run_environment(self, env, dependent_spec):
if dependent_spec.package.extends(self.spec):
env.prepend_path('LUA_PATH', ';'.join(lua_patterns), separator=';')
env.prepend_path('LUA_CPATH', ';'.join(lua_cpatterns),
separator=';')
if '+shared' in spec:
env.prepend_path('LUA_CPATH', ';'.join(lua_cpatterns),
separator=';')
def setup_run_environment(self, env):
env.prepend_path(
@ -156,10 +160,11 @@ def setup_run_environment(self, env):
'LUA_PATH',
os.path.join(self.spec.prefix, self.lua_lib_dir, '?', 'init.lua'),
separator=';')
env.prepend_path(
'LUA_CPATH',
os.path.join(self.spec.prefix, self.lua_lib_dir, '?.so'),
separator=';')
if '+shared' in self.spec:
env.prepend_path(
'LUA_CPATH',
os.path.join(self.spec.prefix, self.lua_lib_dir, '?.so'),
separator=';')
@property
def lua_lib_dir(self):