summary refs log tree commit diff
diff options
context:
space:
mode:
authorKevin Lemonnier <lemonnierk@ulrar.net>2014-09-11 03:12:39 +0200
committerLudovic Courtès <ludo@gnu.org>2014-09-11 11:59:15 +0200
commitc361d075d34afe4260267b3608861b4360a49447 (patch)
tree136dcdafc6b351fd115a0cd52ac6c92543ff4b71
parent00d908db1eac4c87734af36bd5e14bfd3d32f702 (diff)
downloadguix-c361d075d34afe4260267b3608861b4360a49447.tar.gz
gnu: Have lua-5.1 compile a .so
* gnu/packages/patches/lua51-liblua-so.patch: New file
* gnu/packages/lua.scm: Use of lua51-liblua-so.patch in lua-5.1

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r--gnu/packages/lua.scm3
-rw-r--r--gnu/packages/patches/lua51-liblua-so.patch65
2 files changed, 67 insertions, 1 deletions
diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm
index a85c120469..92ffc22c14 100644
--- a/gnu/packages/lua.scm
+++ b/gnu/packages/lua.scm
@@ -75,7 +75,8 @@ for configuration, scripting, and rapid prototyping.")
              (uri (string-append "http://www.lua.org/ftp/lua-"
                                  version ".tar.gz"))
              (sha256
-              (base32 "0cskd4w0g6rdm2q8q3i4n1h3j8kylhs3rq8mxwl9vwlmlxbgqh16"))))))
+              (base32 "0cskd4w0g6rdm2q8q3i4n1h3j8kylhs3rq8mxwl9vwlmlxbgqh16"))
+             (patches (list (search-patch "lua51-liblua-so.patch")))))))
 
 (define-public luajit
   (package
diff --git a/gnu/packages/patches/lua51-liblua-so.patch b/gnu/packages/patches/lua51-liblua-so.patch
new file mode 100644
index 0000000000..6795f10ac7
--- /dev/null
+++ b/gnu/packages/patches/lua51-liblua-so.patch
@@ -0,0 +1,65 @@
+
+Patch the two Makefile to also create liblua.so
+Original patch by Allan McRae <allan@archlinux.org>
+for Archlinux
+
+
+diff -ruN lua-5.1.5/Makefile lua-5.1.5-new/Makefile
+--- lua-5.1.5/Makefile	2012-02-10 10:50:23.000000000 +0100
++++ lua-5.1.5-new/Makefile	2014-09-10 20:17:28.913951433 +0200
+@@ -43,7 +43,7 @@
+ # What to install.
+ TO_BIN= lua luac
+ TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
+-TO_LIB= liblua.a
++TO_LIB= liblua.a liblua.so liblua.so.${V}
+ TO_MAN= lua.1 luac.1
+ 
+ # Lua version and release.
+@@ -53,7 +53,7 @@
+ all:	$(PLAT)
+ 
+ $(PLATS) clean:
+-	cd src && $(MAKE) $@
++	cd src && $(MAKE) $@ V=$(V) R=$(R)
+ 
+ test:	dummy
+ 	src/lua test/hello.lua
+diff -ruN lua-5.1.5/src/Makefile lua-5.1.5-new/src/Makefile
+--- lua-5.1.5/src/Makefile	2012-02-13 21:41:22.000000000 +0100
++++ lua-5.1.5-new/src/Makefile	2014-09-10 20:16:09.982952152 +0200
+@@ -8,7 +8,7 @@
+ PLAT= none
+ 
+ CC= gcc
+-CFLAGS= -O2 -Wall $(MYCFLAGS)
++CFLAGS= -O2 -Wall $(MYCFLAGS) -fPIC
+ AR= ar rcu
+ RANLIB= ranlib
+ RM= rm -f
+@@ -34,9 +34,10 @@
+ 
+ LUAC_T=	luac
+ LUAC_O=	luac.o print.o
++LUA_SO= liblua.so
+ 
+ ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
+-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
++ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO)
+ ALL_A= $(LUA_A)
+ 
+ default: $(PLAT)
+@@ -57,6 +58,13 @@
+ $(LUAC_T): $(LUAC_O) $(LUA_A)
+ 	$(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
+ 
++$(LUA_SO): $(CORE_O) $(LIB_O)
++	$(CC) -shared -ldl -Wl,-soname,$(LUA_SO).$(V) -o $@.$(R) $? -lm $(MYLDFLAGS)
++	ln -sf $(LUA_SO).$(R) $(LUA_SO).$(V)
++	ln -sf $(LUA_SO).$(R) $(LUA_SO)
++
++
++
+ clean:
+ 	$(RM) $(ALL_T) $(ALL_O)
+