Patchwork [v2] luajit: new package

login
register
mail settings
Submitter Francois Perrad
Date June 2, 2012, 8:41 a.m.
Message ID <CAB0FRssEphNA-jeUDk9X0XcA24YQooE5zkY2ZtvT=Vhc+r29DQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/162403/
State Superseded
Headers show

Comments

Francois Perrad - June 2, 2012, 8:41 a.m.
Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
---
 package/Config.in                     |    3 ++-
 package/luajit/Config.in              |    9 +++++++
 package/luajit/luajit-root-path.patch |   16 ++++++++++++
 package/luajit/luajit.mk              |   44 +++++++++++++++++++++++++++++++++
 4 files changed, 71 insertions(+), 1 deletion(-)
 create mode 100644 package/luajit/Config.in
 create mode 100644 package/luajit/luajit-root-path.patch
 create mode 100644 package/luajit/luajit.mk

+
+$(eval $(call GENTARGETS,package,luajit))

Patch

diff --git a/package/Config.in b/package/Config.in
index fb1b08f..fde30b0 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -237,7 +237,8 @@  endmenu
 menu "Interpreter languages and scripting"
 source "package/haserl/Config.in"
 source "package/lua/Config.in"
-if BR2_PACKAGE_LUA
+source "package/luajit/Config.in"
+if BR2_PACKAGE_LUA || BR2_PACKAGE_LUAJIT
 menu "LUA libraries/modules"
 source "package/cgilua/Config.in"
 source "package/copas/Config.in"
diff --git a/package/luajit/Config.in b/package/luajit/Config.in
new file mode 100644
index 0000000..c665b28
--- /dev/null
+++ b/package/luajit/Config.in
@@ -0,0 +1,9 @@ 
+config BR2_PACKAGE_LUAJIT
+	bool "luajit"
+	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/
+
diff --git a/package/luajit/luajit-root-path.patch
b/package/luajit/luajit-root-path.patch
new file mode 100644
index 0000000..2eb037c
--- /dev/null
+++ b/package/luajit/luajit-root-path.patch
@@ -0,0 +1,16 @@ 
+diff -Naur LuaJIT-2.0.0-beta10.orig/src/luaconf.h
LuaJIT-2.0.0-beta10/src/luaconf.h
+--- LuaJIT-2.0.0-beta10.orig/src/luaconf.h	2012-05-30 20:33:27.989333819 +0200
++++ LuaJIT-2.0.0-beta10/src/luaconf.h	2012-05-30 20:46:30.581354777 +0200
+@@ -22,9 +22,9 @@
+ #define LUA_CPATH_DEFAULT \
+   ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
+ #else
+-#define LUA_ROOT	"/usr/local/"
+-#define LUA_LDIR	LUA_ROOT "share/lua/5.1/"
+-#define LUA_CDIR	LUA_ROOT "lib/lua/5.1/"
++#define LUA_ROOT	"/usr/"
++#define LUA_LDIR	LUA_ROOT "share/lua/"
++#define LUA_CDIR	LUA_ROOT "lib/lua/"
+ #ifdef LUA_XROOT
+ #define LUA_JDIR	LUA_XROOT "share/luajit-2.0.0-beta10/"
+ #define LUA_XPATH \
diff --git a/package/luajit/luajit.mk b/package/luajit/luajit.mk
new file mode 100644
index 0000000..b91ddbc
--- /dev/null
+++ b/package/luajit/luajit.mk
@@ -0,0 +1,44 @@ 
+#############################################################
+#
+# luajit
+#
+#############################################################
+
+LUAJIT_VERSION = 2.0.0-beta10
+LUAJIT_SOURCE:=LuaJIT-$(LUAJIT_VERSION).tar.gz
+LUAJIT_SITE = http://luajit.org/download
+LUAJIT_INSTALL_STAGING = YES
+
+define LUAJIT_INSTALL_BETA_FIX_MAKEFILE
+	$(SED) 's/@echo "  $$(SYMLINK) $$(INSTALL_TNAME)
$$(INSTALL_TSYM)"/$$(SYMLINK) $$(INSTALL_TNAME) $$(INSTALL_TSYM)/'
$(@D)/Makefile
+endef
+
+ifeq ($(findstring beta,$(LUAJIT_VERSION)),beta)
+LUAJIT_POST_PATCH_HOOKS += LUAJIT_INSTALL_BETA_FIX_MAKEFILE
+endif
+
+define LUAJIT_NOLARGEFILE_FIX_MAKEFILE
+	$(SED) 's/TARGET_XCFLAGS= -D_FILE_OFFSET_BITS=64
-D_LARGEFILE_SOURCE/TARGET_XCFLAGS=/' $(@D)/src/Makefile
+endef
+
+ifneq ($(BR2_LARGEFILE),y)
+LUAJIT_POST_PATCH_HOOKS += LUAJIT_NOLARGEFILE_FIX_MAKEFILE
+endif
+
+define LUAJIT_BUILD_CMDS
+	$(MAKE) PREFIX="/usr" CROSS="$(TARGET_CROSS)" -C $(@D) amalg
+endef
+
+define LUAJIT_INSTALL_STAGING_CMDS
+	$(MAKE) PREFIX="/usr" DESTDIR="$(STAGING_DIR)" -C $(@D) install
+endef
+
+define LUAJIT_INSTALL_TARGET_CMDS
+	$(MAKE) PREFIX="/usr" DESTDIR="$(TARGET_DIR)" -C $(@D) install
+endef
+
+define LUAJIT_CLEAN_CMDS
+	-$(MAKE) -C $(@D) clean
+endef