From ca73103dac47dc2cdfff51c146205611a72bb401 Mon Sep 17 00:00:00 2001 From: Michael Kuhn Date: Tue, 7 Nov 2017 01:21:46 +0100 Subject: Introduce static_to_shared_library function (#6092) The static_to_shared_library function takes an existing static library and produces a shared library based on it. --- .../repos/builtin/packages/lua/liblua-shared.patch | 64 ---------------------- var/spack/repos/builtin/packages/lua/package.py | 13 ++--- 2 files changed, 4 insertions(+), 73 deletions(-) delete mode 100644 var/spack/repos/builtin/packages/lua/liblua-shared.patch (limited to 'var') diff --git a/var/spack/repos/builtin/packages/lua/liblua-shared.patch b/var/spack/repos/builtin/packages/lua/liblua-shared.patch deleted file mode 100644 index 31d21cca09..0000000000 --- a/var/spack/repos/builtin/packages/lua/liblua-shared.patch +++ /dev/null @@ -1,64 +0,0 @@ -diff -ru a/Makefile b/Makefile ---- a/Makefile 2017-10-27 23:49:02.821830453 +0200 -+++ b/Makefile 2017-10-27 23:50:45.697634413 +0200 -@@ -41,7 +41,7 @@ - # What to install. - TO_BIN= lua luac - TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp --TO_LIB= liblua.a -+TO_LIB= liblua.a $(LUA_DSO).$(R) - TO_MAN= lua.1 luac.1 - - # Lua version and release. -@@ -52,7 +52,7 @@ - all: $(PLAT) - - $(PLATS) clean: -- cd src && $(MAKE) $@ -+ cd src && $(MAKE) $@ V=$(V) R=$(R) - - test: dummy - src/lua -v -@@ -63,6 +63,8 @@ - cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC) - cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB) - cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN) -+ ln -sf $(LUA_DSO).$(R) $(INSTALL_LIB)/$(LUA_DSO).$(V) -+ ln -sf $(LUA_DSO).$(R) $(INSTALL_LIB)/$(LUA_DSO) - - uninstall: - cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN) -diff -ru a/src/Makefile b/src/Makefile ---- a/src/Makefile 2017-10-27 23:49:02.823830467 +0200 -+++ b/src/Makefile 2017-10-27 23:50:01.923284014 +0200 -@@ -29,6 +29,8 @@ - PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris - - LUA_A= liblua.a -+LUA_SO= liblua.so -+LUA_DYLIB= liblua.dylib - CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \ - lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \ - ltm.o lundump.o lvm.o lzio.o -@@ -43,7 +45,7 @@ - LUAC_O= luac.o - - ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O) --ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) -+ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_DSO) - ALL_A= $(LUA_A) - - # Targets start here. -@@ -59,6 +61,12 @@ - $(AR) $@ $(BASE_O) - $(RANLIB) $@ - -+$(LUA_SO): $(CORE_O) $(LIB_O) -+ $(CC) -shared -ldl -Wl,-soname,$(LUA_SO).$(V) -o $@.$(R) $^ -lm $(MYLDFLAGS) -+ -+$(LUA_DYLIB): $(CORE_O) $(LIB_O) -+ $(CC) -dynamiclib -install_name @LUA_PREFIX@/lib/$(LUA_DYLIB).$(V) -compatibility_version $(V) -current_version $(R) -o $@.$(R) $^ -+ - $(LUA_T): $(LUA_O) $(LUA_A) - $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) - diff --git a/var/spack/repos/builtin/packages/lua/package.py b/var/spack/repos/builtin/packages/lua/package.py index 0fb54af839..46d1e5c094 100644 --- a/var/spack/repos/builtin/packages/lua/package.py +++ b/var/spack/repos/builtin/packages/lua/package.py @@ -58,11 +58,6 @@ class Lua(Package): destination="luarocks", placement='luarocks') - # Based on patches from Arch Linux and Homebrew: - # https://git.archlinux.org/svntogit/packages.git/tree/trunk/liblua.so.patch?h=packages/lua - # https://github.com/Homebrew/homebrew-core/blob/master/Formula/lua.rb - patch('liblua-shared.patch') - def install(self, spec, prefix): if spec.satisfies("platform=darwin"): target = 'macosx' @@ -76,8 +71,6 @@ class Lua(Package): spec['ncurses'].prefix.lib), 'MYLIBS=-lncursesw', 'CC=%s -std=gnu99' % spack_cc, - 'LUA_DSO=liblua.%s' % ( - dso_suffix), target) make('INSTALL_TOP=%s' % prefix, 'MYCFLAGS=%s' % ( @@ -87,10 +80,12 @@ class Lua(Package): spec['ncurses'].prefix.lib), 'MYLIBS=-lncursesw', 'CC=%s -std=gnu99' % spack_cc, - 'LUA_DSO=liblua.%s' % ( - dso_suffix), 'install') + static_to_shared_library(join_path(prefix.lib, 'liblua.a'), + arguments=['-lm'], version=self.version, + compat_version=self.version.up_to(2)) + with working_dir(os.path.join('luarocks', 'luarocks')): configure('--prefix=' + prefix, '--with-lua=' + prefix) make('build') -- cgit v1.2.3-70-g09d2