luajit: complete replacement for lua v2
PATCH 1/4 luajit: complete replacement for lua v2
the mutual exclusion is done by a choice
--- Makefile | 6 ++++++ package/Config.in | 1 - package/copas/copas.mk | 2 +- package/coxpcall/coxpcall.mk | 1 - package/lua/Config.in | 25 +++++++++++++++++++++++ package/luacjson/luacjson.mk | 2 +- package/luaexpat/luaexpat.mk | 2 +- package/luafilesystem/luafilesystem.mk | 2 +- package/luajit/Config.in | 12 ----------- package/luajit/luajit-05-install-like-lua.patch | 17 +++++++++++++++ package/luasocket/luasocket.mk | 2 +- package/rings/rings.mk | 2 +- package/xavante/xavante.mk | 2 +- 13 files changed, 55 insertions(+), 21 deletions(-) delete mode 100644 package/luajit/Config.in create mode 100644 package/luajit/luajit-05-install-like-lua.patch
Makefile +6 -0
@@ -283,6 +283,12 @@ HOSTCC := $(CCACHE) $(HOSTCC) HOSTCXX := $(CCACHE) $(HOSTCXX) endif +ifeq ($(BR2_PACKAGE_LUA),y) + LUA_INTERPRETER = lua +else ifeq ($(BR2_PACKAGE_LUAJIT),y) + LUA_INTERPRETER = luajit +endif + ############################################################# # # You should probably leave this stuff alone unless you know
package/Config.in +0 -1
@@ -246,7 +246,6 @@ endmenu menu "Interpreter languages and scripting" source "package/haserl/Config.in" source "package/lua/Config.in" -source "package/luajit/Config.in" if BR2_PACKAGE_LUA || BR2_PACKAGE_LUAJIT menu "LUA libraries/modules" source "package/cgilua/Config.in"
package/copas/copas.mk +1 -1
@@ -6,7 +6,7 @@ COPAS_VERSION = 1.1.6 COPAS_SITE = http://github.com/downloads/keplerproject/copas -COPAS_DEPENDENCIES = lua coxpcall luasocket +COPAS_DEPENDENCIES = coxpcall luasocket define COPAS_INSTALL_TARGET_CMDS $(INSTALL) -m 0644 -D $(@D)/src/copas/copas.lua \
package/coxpcall/coxpcall.mk +0 -1
@@ -6,7 +6,6 @@ COXPCALL_VERSION = 1.13.0 COXPCALL_SITE = http://luaforge.net/frs/download.php/3406 -COXPCALL_DEPENDENCIES = lua define COXPCALL_INSTALL_TARGET_CMDS $(INSTALL) -m 0644 -D $(@D)/src/coxpcall.lua \
package/lua/Config.in +25 -0
@@ -1,3 +1,13 @@ + +choice + prompt "Lua Interpreter" + default BR2_PACKAGE_LUA_NONE + +config BR2_PACKAGE_LUA_NONE + bool "none" + help + Do not compress the tarball. + config BR2_PACKAGE_LUA bool "lua" help
@@ -5,6 +15,21 @@ config BR2_PACKAGE_LUA http://www.lua.org/ +config BR2_PACKAGE_LUAJIT + bool "luajit" + # Luajit is only available for some target architectures, and + # has some complexity wrt 32/64. See luajit.mk for details. + depends on BR2_i386 || (BR2_x86_64 && BR2_HOSTARCH='x86_64') || BR2_powerpc || BR2_arm || BR2_armeb + help + LuaJIT implements the full set of language features defined + by Lua 5.1. The virtual machine (VM) is API- and + ABI-compatible to the standard Lua interpreter and can be + deployed as a drop-in replacement. + + http://luajit.org/ + +endchoice + if BR2_PACKAGE_LUA config BR2_PACKAGE_LUA_COMPILER
package/luacjson/luacjson.mk +1 -1
@@ -6,7 +6,7 @@ LUACJSON_VERSION = 2.1.0 LUACJSON_SOURCE = lua-cjson-$(LUACJSON_VERSION).tar.gz LUACJSON_SITE = http://www.kyne.com.au/~mark/software/download -LUACJSON_DEPENDENCIES = lua +LUACJSON_DEPENDENCIES = $(LUA_INTERPRETER) define LUACJSON_BUILD_CMDS $(MAKE) -C $(@D) \
package/luaexpat/luaexpat.mk +1 -1
@@ -6,7 +6,7 @@ LUAEXPAT_VERSION = 1.2.0 LUAEXPAT_SITE = http://matthewwild.co.uk/projects/luaexpat -LUAEXPAT_DEPENDENCIES = lua expat +LUAEXPAT_DEPENDENCIES = $(LUA_INTERPRETER) expat LUAEXPAT_MFLAGS += LUA_VERSION_NUM=501
package/luafilesystem/luafilesystem.mk +1 -1
@@ -6,7 +6,7 @@ LUAFILESYSTEM_VERSION = 1.5.0 LUAFILESYSTEM_SITE = http://github.com/downloads/keplerproject/luafilesystem -LUAFILESYSTEM_DEPENDENCIES = lua +LUAFILESYSTEM_DEPENDENCIES = $(LUA_INTERPRETER) ifeq ($(BR2_LARGEFILE),y) LFS_CFLAGS = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
package/luajit/Config.in deleted +0 -12
@@ -1,12 +0,0 @@ -config BR2_PACKAGE_LUAJIT - bool "luajit" - # Luajit is only available for some target architectures, and - # has some complexity wrt 32/64. See luajit.mk for details. - depends on BR2_i386 || (BR2_x86_64 && BR2_HOSTARCH='x86_64') || BR2_powerpc || BR2_arm || BR2_armeb - help - LuaJIT implements the full set of language features defined - by Lua 5.1. The virtual machine (VM) is API- and - ABI-compatible to the standard Lua interpreter and can be - deployed as a drop-in replacement. - - http://luajit.org/
package/luajit/luajit-05-install-like-lua.patch new file +17 -0
@@ -0,0 +1,17 @@ +Install includes in /usr/include + +Signed-off-by: Francois Perrad <[email protected]> + +Index: b/Makefile +=================================================================== +--- a/Makefile ++++ b/Makefile +@@ -33,7 +33,7 @@ + INSTALL_BIN= $(DPREFIX)/bin + INSTALL_LIB= $(DPREFIX)/lib + INSTALL_SHARE= $(DPREFIX)/share +-INSTALL_INC= $(DPREFIX)/include/luajit-$(MAJVER).$(MINVER) ++INSTALL_INC= $(DPREFIX)/include + + INSTALL_JITLIB= $(INSTALL_SHARE)/luajit-$(VERSION)/jit + INSTALL_LMOD= $(INSTALL_SHARE)/lua/$(ABIVER)
package/luasocket/luasocket.mk +1 -1
@@ -6,7 +6,7 @@ LUASOCKET_VERSION = 2.0.2 LUASOCKET_SITE = http://luaforge.net/frs/download.php/2664 -LUASOCKET_DEPENDENCIES = lua +LUASOCKET_DEPENDENCIES = $(LUA_INTERPRETER) define LUASOCKET_BUILD_CMDS $(MAKE) -C $(@D) -f makefile \
package/rings/rings.mk +1 -1
@@ -6,7 +6,7 @@ RINGS_VERSION = 1.2.3 RINGS_SITE = http://github.com/downloads/keplerproject/rings -RINGS_DEPENDENCIES = lua +RINGS_DEPENDENCIES = $(LUA_INTERPRETER) define RINGS_BUILD_CMDS $(MAKE) -C $(@D) CC="$(TARGET_CC)" CFLAGS="$(TARGET_CFLAGS) -fPIC"
package/xavante/xavante.mk +1 -1
@@ -6,7 +6,7 @@ XAVANTE_VERSION = 2.2.1 XAVANTE_SITE = http://github.com/downloads/keplerproject/xavante -XAVANTE_DEPENDENCIES = cgilua copas coxpcall lua luafilesystem luasocket wsapi +XAVANTE_DEPENDENCIES = cgilua copas coxpcall luafilesystem luasocket wsapi define XAVANTE_INSTALL_TARGET_CMDS $(MAKE) -C $(@D) PREFIX=/usr \
Signature · 1 line
1.7.9.5
PATCH 2/4 luajit: allow building for the host
--- package/luajit/luajit.mk | 10 ++++++++++ 1 file changed, 10 insertions(+)
package/luajit/luajit.mk +10 -0
@@ -48,6 +48,11 @@ define LUAJIT_BUILD_CMDS -C $(@D) amalg endef +define HOST_LUAJIT_BUILD_CMDS + $(MAKE) PREFIX="/usr" \ + -C $(@D) amalg +endef + define LUAJIT_INSTALL_STAGING_CMDS $(MAKE) PREFIX="/usr" DESTDIR="$(STAGING_DIR)" -C $(@D) install endef
@@ -56,8 +61,13 @@ define LUAJIT_INSTALL_TARGET_CMDS $(MAKE) PREFIX="/usr" DESTDIR="$(TARGET_DIR)" -C $(@D) install endef +define HOST_LUAJIT_INSTALL_CMDS + $(MAKE) PREFIX="/usr" DESTDIR="$(HOST_DIR)" -C $(@D) install +endef + define LUAJIT_CLEAN_CMDS -$(MAKE) -C $(@D) clean endef $(eval $(generic-package)) +$(eval $(host-generic-package))
Signature · 1 line
1.7.9.5
PATCH 2/4 luajit: allow building for the host
Hello,
Le Mon, 30 Jul 2012 08:31:28 +0200,
Francois Perrad <[email protected]> a ?crit :
Quoted 20 lines
package/luajit/luajit.mk +5
-0@@ -48,6 +48,11 @@ define LUAJIT_BUILD_CMDS -C $(@D) amalg endef +define HOST_LUAJIT_BUILD_CMDS + $(MAKE) PREFIX="/usr" \ + -C $(@D) amalg +endef + define LUAJIT_INSTALL_STAGING_CMDS $(MAKE) PREFIX="/usr" DESTDIR="$(STAGING_DIR)" -C $(@D) install endef@@ -56,8 +61,13 @@ define LUAJIT_INSTALL_TARGET_CMDS $(MAKE) PREFIX="/usr" DESTDIR="$(TARGET_DIR)" -C $(@D) install endef
package/luajit/luajit.mk define LUAJIT_INSTALL_TARGET_CMDS · line 73
Quoted 10 lines
package/luajit/luajit.mk +5
-0+define HOST_LUAJIT_INSTALL_CMDS + $(MAKE) PREFIX="/usr" DESTDIR="$(HOST_DIR)" -C $(@D) install +endef + define LUAJIT_CLEAN_CMDS -$(MAKE) -C $(@D) clean endef $(eval $(generic-package)) +$(eval $(host-generic-package))
What is the use case for building luajit on the host?
Thanks!
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 3/4 lua: remove 3 sub-options, always install all
In reply to Francois Perrad--- package/lua/Config.in | 18 ------------------ package/lua/lua.mk | 17 +---------------- 2 files changed, 1 insertion(+), 34 deletions(-)
package/lua/Config.in +0 -18
@@ -32,29 +32,11 @@ endchoice if BR2_PACKAGE_LUA -config BR2_PACKAGE_LUA_COMPILER - bool "lua compiler" - select BR2_PACKAGE_LUA_SHARED_LIBRARY - help - Install luac binary - -config BR2_PACKAGE_LUA_INTERPRETER - bool "lua interpreter" - select BR2_PACKAGE_LUA_SHARED_LIBRARY - help - Install lua binary - config BR2_PACKAGE_LUA_INTERPRETER_READLINE bool "readline support" - depends on BR2_PACKAGE_LUA_INTERPRETER select BR2_PACKAGE_READLINE select BR2_PACKAGE_NCURSES help Enables command-line editing in the lua interpreter. -config BR2_PACKAGE_LUA_SHARED_LIBRARY - bool "shared library" - help - Install shared liblua.so - endif
package/lua/lua.mk +1 -16
@@ -8,10 +8,7 @@ LUA_VERSION = 5.1.5 LUA_SITE = http://www.lua.org/ftp LUA_INSTALL_STAGING = YES -LUA_CFLAGS = -Wall -ifeq ($(BR2_PACKAGE_LUA_SHARED_LIBRARY),y) - LUA_CFLAGS += -fPIC -endif +LUA_CFLAGS = -Wall -fPIC LUA_MYLIBS += -ldl
@@ -44,13 +41,11 @@ define HOST_LUA_BUILD_CMDS PKG_VERSION=$(LUA_VERSION) -C $(@D)/src all endef -ifeq ($(BR2_PACKAGE_LUA_SHARED_LIBRARY),y) define LUA_INSTALL_STAGING_SHARED_LIB $(INSTALL) -m 0755 -D $(@D)/src/liblua.so.$(LUA_VERSION) \ $(STAGING_DIR)/usr/lib/liblua.so.$(LUA_VERSION) ln -sf liblua.so.$(LUA_VERSION) $(STAGING_DIR)/usr/lib/liblua.so endef -endif define LUA_INSTALL_STAGING_CMDS $(INSTALL) -m 0644 -D $(@D)/etc/lua.pc \
@@ -64,29 +59,19 @@ define LUA_INSTALL_STAGING_CMDS $(INSTALL) -m 0644 -D $(@D)/src/lauxlib.h $(STAGING_DIR)/usr/include/lauxlib.h endef -ifeq ($(BR2_PACKAGE_LUA_INTERPRETER),y) define LUA_INSTALL_INTERPRETER $(INSTALL) -m 0755 -D $(@D)/src/lua $(TARGET_DIR)/usr/bin/lua endef -endif -ifeq ($(BR2_PACKAGE_LUA_COMPILER),y) define LUA_INSTALL_COMPILER $(INSTALL) -m 0755 -D $(@D)/src/luac $(TARGET_DIR)/usr/bin/luac endef -endif -ifeq ($(BR2_PACKAGE_LUA_SHARED_LIBRARY),y) define LUA_INSTALL_LIBRARY $(INSTALL) -m 0755 -D $(@D)/src/liblua.so.$(LUA_VERSION) \ $(TARGET_DIR)/usr/lib/liblua.so.$(LUA_VERSION) ln -sf liblua.so.$(LUA_VERSION) $(TARGET_DIR)/usr/lib/liblua.so $(INSTALL) -m 0644 -D $(@D)/src/liblua.a $(TARGET_DIR)/usr/lib/liblua.a -endef -else -define LUA_INSTALL_LIBRARY - $(INSTALL) -m 0644 -D $(@D)/src/liblua.a $(TARGET_DIR)/usr/lib/liblua.a -endef endif ifeq ($(BR2_HAVE_DEVFILES),y)
Signature · 1 line
1.7.9.5
PATCH 3/4 lua: remove 3 sub-options, always install all
Le Mon, 30 Jul 2012 08:31:29 +0200,
Francois Perrad <[email protected]> a ?crit :
Quoted 14 lines
--- package/lua/Config.in | 18 ------------------ package/lua/lua.mk | 17 +---------------- 2 files changed, 1 insertion(+), 34 deletions(-)package/lua/Config.in +0
-1@@ -32,29 +32,11 @@ endchoice if BR2_PACKAGE_LUA -config BR2_PACKAGE_LUA_COMPILER
package/lua/Config.in endchoice · line 45
Quoted 10 lines
package/lua/Config.in +0
-10- bool "lua compiler" - select BR2_PACKAGE_LUA_SHARED_LIBRARY - help - Install luac binary - -config BR2_PACKAGE_LUA_INTERPRETER - bool "lua interpreter" - select BR2_PACKAGE_LUA_SHARED_LIBRARY - help - Install lua binary
Wouldn't it make sense to keep options for the compiler and interpreter? I presume using the compiler on the target is fairly uncommon (you would rather do the compilation at build time, no?).
And Lua can be used as a library without the separate /usr/bin/lua interpreter, no?
But maybe this last option (the interpreter) is more complicated to handle with the choice between lua and luajit.
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 3/4 lua: remove 3 sub-options, always install all
2012/7/30 Thomas Petazzoni <[email protected]>:
Quoted 16 lines
Le Mon, 30 Jul 2012 08:31:29 +0200,
Francois Perrad <[email protected]> a ?crit :Quoted 13 lines
--- package/lua/Config.in | 18 ------------------ package/lua/lua.mk | 17 +---------------- 2 files changed, 1 insertion(+), 34 deletions(-)package/lua/Config.in +0
-0@@ -32,29 +32,11 @@ endchoice if BR2_PACKAGE_LUA
Quoted 16 lines
package/lua/Config.in endchoice · line 45
Quoted 11 lines
package/lua/Config.in +0
-11-config BR2_PACKAGE_LUA_COMPILER - bool "lua compiler" - select BR2_PACKAGE_LUA_SHARED_LIBRARY - help - Install luac binary - -config BR2_PACKAGE_LUA_INTERPRETER - bool "lua interpreter" - select BR2_PACKAGE_LUA_SHARED_LIBRARY - help - Install lua binaryWouldn't it make sense to keep options for the compiler and interpreter? I presume using the compiler on the target is fairly uncommon (you would rather do the compilation at build time, no?).
The lua bytecode is platform dependent (the header contains the endianness and the size of some types : int, size_t, Instruction & lua_Number).
So, the Lua code cannot be compiled on the host and interpreted on target.
Quoted 6 lines
And Lua can be used as a library without the separate
/usr/bin/luainterpreter, no?But maybe this last option (the interpreter) is more complicated to handle with the choice between lua and luajit.
Since lua & luac are linked against the shared library, there are small (< 10KB).
And the post-build script (BR2_ROOTFS_POST_BUILD_SCRIPT) could remove them if needed.
So, I think that the 3 sub-options could be removed.
Fran?ois
Quoted 10 lines
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
PATCH 4/4 lua: refactor without useless define's
In reply to Francois Perrad--- package/lua/lua.mk | 36 +++++++++++------------------------- 1 file changed, 11 insertions(+), 25 deletions(-)
package/lua/lua.mk +11 -25
@@ -41,39 +41,21 @@ define HOST_LUA_BUILD_CMDS PKG_VERSION=$(LUA_VERSION) -C $(@D)/src all endef -define LUA_INSTALL_STAGING_SHARED_LIB - $(INSTALL) -m 0755 -D $(@D)/src/liblua.so.$(LUA_VERSION) \ - $(STAGING_DIR)/usr/lib/liblua.so.$(LUA_VERSION) - ln -sf liblua.so.$(LUA_VERSION) $(STAGING_DIR)/usr/lib/liblua.so -endef - define LUA_INSTALL_STAGING_CMDS $(INSTALL) -m 0644 -D $(@D)/etc/lua.pc \ $(STAGING_DIR)/usr/lib/pkgconfig/lua.pc - $(INSTALL) -m 0644 -D $(@D)/src/liblua.a $(STAGING_DIR)/usr/lib/liblua.a $(INSTALL) -m 0755 -D $(@D)/src/lua $(STAGING_DIR)/usr/bin/lua $(INSTALL) -m 0755 -D $(@D)/src/luac $(STAGING_DIR)/usr/bin/luac + $(INSTALL) -m 0755 -D $(@D)/src/liblua.so.$(LUA_VERSION) \ + $(STAGING_DIR)/usr/lib/liblua.so.$(LUA_VERSION) + ln -sf liblua.so.$(LUA_VERSION) $(STAGING_DIR)/usr/lib/liblua.so + $(INSTALL) -m 0644 -D $(@D)/src/liblua.a $(STAGING_DIR)/usr/lib/liblua.a $(INSTALL) -m 0644 -D $(@D)/src/lua.h $(STAGING_DIR)/usr/include/lua.h $(INSTALL) -m 0644 -D $(@D)/src/luaconf.h $(STAGING_DIR)/usr/include/luaconf.h $(INSTALL) -m 0644 -D $(@D)/src/lualib.h $(STAGING_DIR)/usr/include/lualib.h $(INSTALL) -m 0644 -D $(@D)/src/lauxlib.h $(STAGING_DIR)/usr/include/lauxlib.h endef -define LUA_INSTALL_INTERPRETER - $(INSTALL) -m 0755 -D $(@D)/src/lua $(TARGET_DIR)/usr/bin/lua -endef - -define LUA_INSTALL_COMPILER - $(INSTALL) -m 0755 -D $(@D)/src/luac $(TARGET_DIR)/usr/bin/luac -endef - -define LUA_INSTALL_LIBRARY - $(INSTALL) -m 0755 -D $(@D)/src/liblua.so.$(LUA_VERSION) \ - $(TARGET_DIR)/usr/lib/liblua.so.$(LUA_VERSION) - ln -sf liblua.so.$(LUA_VERSION) $(TARGET_DIR)/usr/lib/liblua.so - $(INSTALL) -m 0644 -D $(@D)/src/liblua.a $(TARGET_DIR)/usr/lib/liblua.a -endif - ifeq ($(BR2_HAVE_DEVFILES),y) define LUA_INSTALL_DEVFILES $(INSTALL) -m 0644 -D $(@D)/etc/lua.pc \
@@ -85,10 +67,14 @@ define LUA_INSTALL_DEVFILES endef endif + define LUA_INSTALL_TARGET_CMDS - $(LUA_INSTALL_INTERPRETER) - $(LUA_INSTALL_COMPILER) - $(LUA_INSTALL_LIBRARY) + $(INSTALL) -m 0755 -D $(@D)/src/lua $(TARGET_DIR)/usr/bin/lua + $(INSTALL) -m 0755 -D $(@D)/src/luac $(TARGET_DIR)/usr/bin/luac + $(INSTALL) -m 0755 -D $(@D)/src/liblua.so.$(LUA_VERSION) \ + $(TARGET_DIR)/usr/lib/liblua.so.$(LUA_VERSION) + ln -sf liblua.so.$(LUA_VERSION) $(TARGET_DIR)/usr/lib/liblua.so + $(INSTALL) -m 0644 -D $(@D)/src/liblua.a $(TARGET_DIR)/usr/lib/liblua.a $(LUA_INSTALL_DEVFILES) endef
Signature · 1 line
1.7.9.5