* Re: [PATCH 3/5] gnu: Build lua-5.2 with a dynamic library
@ 2015-11-11 0:54 Leo Famulari
0 siblings, 0 replies; 3+ messages in thread
From: Leo Famulari @ 2015-11-11 0:54 UTC (permalink / raw)
To: guix-devel
Forgot to send this one to the list...
To: Ludovic Courtès <ludo@gnu.org>
Subject: Re: [PATCH 3/5] gnu: Build lua-5.2 with a dynamic library
Date: Mon, 09 Nov 2015 18:46:39 -0500
> This is not optimal though because:
>
> 1. We’re still providing liblua.a, but that archives actually contains
> PIC code.
>
> 2. The ‘lua’ and ‘luac’ executables are not linked against liblua.so.
Agreed. I will look into it.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 0/5] Lua: enable shared library loading, build liblua.so
@ 2015-11-02 17:46 Leo Famulari
2015-11-02 17:46 ` [PATCH 3/5] gnu: Build lua-5.2 with a dynamic library Leo Famulari
0 siblings, 1 reply; 3+ messages in thread
From: Leo Famulari @ 2015-11-02 17:46 UTC (permalink / raw)
To: guix-devel
These patches do 4 things:
1) Build lua-5.1 and lua-5.2 so that they can load shared libraries.
2) Make the build process for lua-5.1 and lua-5.2 emit liblua.so.
3) Rewrite the build arguments to lua-5.1 and lua-5.2 for clarity.
4) Replace some tabs with spaces in the luajit package definition.
Things that still need to be done for Lua:
* Make a pkg-config .pc file for lua-5.1, or figure out if lua-5.2's can
be re-used.
* Figure out the best way to find shared Lua libraries at runtime (nix
uses 'makeWrapper', which I think is like 'wrap-program'. See the
nixpkg for Prosody).
Details about changes:
1) Build lua-5.1 and lua-5.2 so that they can load shared libraries.
This involved making sure that the compiler gets some platform specific
instructions on how to load shared libraries. This wasn't happening
before.
2) Make the build process for lua-5.1 and lua-5.2 emit a working
liblua.so.
This involved adding the patch lua52-liblua-so.patch and applying it
from the lua-5.2 package definition. Lua-5.2's make-flags also had to be
altered to pass "-fPIC" to the linker.
For lua-5.1, I set the execute bit of liblua.so (it seems a convention
that Guix makes shared libraries executable). Also, I moved the
instruction that sets "-fPIC" from lua51-liblua-so.patch into the
package definition's make-flags. The lua-5.1 Makefile is not as general
as lua-5.2's and so the make-flags are a little messier.
Also, for lua-5.1, I regenerated lua51-liblua-so.patch rather than
patching the patch. A patched patch seems too difficult for humans to
understand.
3) Rewrite the build arguments to lua-5.1 and lua-5.2 to use
modify-phases and #:make-flags, which I think is much clearer than the
'alist-' procedures.
For lua-5.2, this change is separated into its own commit (49aea9d). I
didn't do this for lua-5.1 (3056c20) because I needed to alter
lua-5.1-liblua-so.patch, and git wouldn't separate those "hunks"
properly. If you want me to spend more time trying to split that commit
up, I will try.
4) Replace some tabs with spaces.
Leo Famulari (5):
gnu: Remove tabulation from luajit.
gnu: Build lua-5.2 with dynamic library support.
gnu: Build lua-5.2 with a dynamic library
gnu: Use make-flags and modify-phases for lua-5.2.
gnu: Build lua-5.1 with dynamic library support and a dynamic library.
gnu/packages/lua.scm | 46 ++++++++++--------
gnu/packages/patches/lua51-liblua-so.patch | 53 ++++++++++++--------
gnu/packages/patches/lua52-liblua-so.patch | 78 ++++++++++++++++++++++++++++++
3 files changed, 139 insertions(+), 38 deletions(-)
create mode 100644 gnu/packages/patches/lua52-liblua-so.patch
--
2.6.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 3/5] gnu: Build lua-5.2 with a dynamic library
2015-11-02 17:46 [PATCH 0/5] Lua: enable shared library loading, build liblua.so Leo Famulari
@ 2015-11-02 17:46 ` Leo Famulari
2015-11-08 21:12 ` Ludovic Courtès
0 siblings, 1 reply; 3+ messages in thread
From: Leo Famulari @ 2015-11-02 17:46 UTC (permalink / raw)
To: guix-devel
* gnu/packages/patches/lua52-liblua-so.patch: New file.
* gnu/packages/lua.scm (lua-5.2): Use lua52-liblua-so.patch.
---
gnu/packages/lua.scm | 3 +-
gnu/packages/patches/lua52-liblua-so.patch | 78 ++++++++++++++++++++++++++++++
2 files changed, 80 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/lua52-liblua-so.patch
diff --git a/gnu/packages/lua.scm b/gnu/packages/lua.scm
index bbb1b8c..bb65070 100644
--- a/gnu/packages/lua.scm
+++ b/gnu/packages/lua.scm
@@ -38,7 +38,8 @@
version ".tar.gz"))
(sha256
(base32 "0b8034v1s82n4dg5rzcn12067ha3nxaylp2vdp8gg08kjsbzphhk"))
- (patches (list (search-patch "lua-pkgconfig.patch")))))
+ (patches (list (search-patch "lua-pkgconfig.patch")
+ (search-patch "lua52-liblua-so.patch")))))
(build-system gnu-build-system)
(inputs `(("readline", readline)))
(arguments
diff --git a/gnu/packages/patches/lua52-liblua-so.patch b/gnu/packages/patches/lua52-liblua-so.patch
new file mode 100644
index 0000000..2e6b39a
--- /dev/null
+++ b/gnu/packages/patches/lua52-liblua-so.patch
@@ -0,0 +1,78 @@
+From 7a1b4e0829124976878ca2765a8e546667a92ceb Mon Sep 17 00:00:00 2001
+From: Leo Famulari <leo@famulari.name>
+Date: Fri, 30 Oct 2015 19:11:31 -0400
+Subject: [PATCH] apply existing non-executable library patch and install
+ libraries as executable
+
+---
+ Makefile | 6 +++---
+ src/Makefile | 8 +++++++-
+ 2 files changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 1aea8e6..bfcfed9 100644
+--- a/Makefile
++++ b/Makefile
+@@ -44,7 +44,7 @@ INTERPRETER= lua
+ COMPILER= luac
+ TO_BIN= $(INTERPRETER) $(COMPILER)
+ TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
+-TO_LIB= liblua.a
++TO_LIB= liblua.a liblua.so liblua.so.${V}
+ TO_PC= lua-$(V).pc
+ TO_MAN= lua.1 luac.1
+
+@@ -56,7 +56,7 @@ R= $V.3
+ all: $(PLAT)
+
+ $(PLATS):
+- cd src && $(MAKE) $@
++ cd src && $(MAKE) $@ V=$(V) R=$(R)
+
+ clean:
+ cd src && $(MAKE) $@
+@@ -69,7 +69,7 @@ install: dummy $(TO_PC)
+ cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_PC) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
+ cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
+ cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
+- cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
++ cd src && $(INSTALL_EXEC) $(TO_LIB) $(INSTALL_LIB)
+ cd src && $(INSTALL_DATA) ../$(TO_PC) $(INSTALL_PC)
+ cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
+
+diff --git a/src/Makefile b/src/Makefile
+index 7b4b2b7..c86476e 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -29,6 +29,7 @@ MYOBJS=
+ PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
+
+ LUA_A= liblua.a
++LUA_SO= liblua.so
+ 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 +44,7 @@ LUAC_T= luac
+ 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_SO)
+ ALL_A= $(LUA_A)
+
+ # Targets start here.
+@@ -55,6 +56,11 @@ o: $(ALL_O)
+
+ a: $(ALL_A)
+
++$(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)
++
+ $(LUA_A): $(BASE_O)
+ $(AR) $@ $(BASE_O)
+ $(RANLIB) $@
+--
+2.6.1
+
--
2.6.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 3/5] gnu: Build lua-5.2 with a dynamic library
2015-11-02 17:46 ` [PATCH 3/5] gnu: Build lua-5.2 with a dynamic library Leo Famulari
@ 2015-11-08 21:12 ` Ludovic Courtès
0 siblings, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2015-11-08 21:12 UTC (permalink / raw)
To: Leo Famulari; +Cc: guix-devel
Leo Famulari <leo@famulari.name> skribis:
> * gnu/packages/patches/lua52-liblua-so.patch: New file.
> * gnu/packages/lua.scm (lua-5.2): Use lua52-liblua-so.patch.
Applied, thanks.
This is not optimal though because:
1. We’re still providing liblua.a, but that archives actually contains
PIC code.
2. The ‘lua’ and ‘luac’ executables are not linked against liblua.so.
If you have time, it would be nice to discuss this with upstream; it’s
not something we should fix ourselves IMO.
Ludo’.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-11-11 0:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-11 0:54 [PATCH 3/5] gnu: Build lua-5.2 with a dynamic library Leo Famulari
-- strict thread matches above, loose matches on Subject: below --
2015-11-02 17:46 [PATCH 0/5] Lua: enable shared library loading, build liblua.so Leo Famulari
2015-11-02 17:46 ` [PATCH 3/5] gnu: Build lua-5.2 with a dynamic library Leo Famulari
2015-11-08 21:12 ` Ludovic Courtès
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).