Skip to contentSkip to conversation

ljsyscall: new package

PATCH Superseded Danomi Manchego 2 participants 3 messages Sep 26, 2013 – Oct 27, 2013

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ljsyscall: new package

An FFI implementation of the Linux and NetBSD kernel ABIs for LuaJIT.

---

Note: this package requires LuaJIT specifically, so there is a depends-on in the ljsyscall/Config.in, even though though it is included from a menu with a "if BR2_PACKAGE_LUA || BR2_PACKAGE_LUAJIT" test around it.

v1 -> v2:
Removed unnecessary build time dependency on LuaJIT.
Specify -m 0644 during installation, since .lua files need not be executable.

---
 package/Config.in              |    1 +
 package/ljsyscall/Config.in    |    8 ++++++++
 package/ljsyscall/ljsyscall.mk |   35 +++++++++++++++++++++++++++++++++++
 3 files changed, 44 insertions(+)
 create mode 100644 package/ljsyscall/Config.in
 create mode 100644 package/ljsyscall/ljsyscall.mk
package/Config.in +1 -0
index 1dd60d1..457e5ad 100644
@@ -355,6 +355,7 @@ source "package/cgilua/Config.in"
 source "package/copas/Config.in"
 source "package/coxpcall/Config.in"
 source "package/lbase64/Config.in"
+source "package/ljsyscall/Config.in"
 source "package/luabitop/Config.in"
 source "package/luacjson/Config.in"
 source "package/luacrypto/Config.in"
package/ljsyscall/Config.in new file +8 -0
new file mode 100644
index 0000000..0bed738
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_LJSYSCALL
+	bool "ljsyscall"
+	# ljsyscall is specifically for LuaJIT, not Lua.
+	depends on BR2_PACKAGE_LUAJIT
+	help
+	  An FFI implementation of the Linux and NetBSD kernel ABIs for LuaJIT.
+
+	  http://github.com/justincormack/ljsyscall
package/ljsyscall/ljsyscall.mk new file +35 -0
new file mode 100644
index 0000000..9223890
@@ -0,0 +1,35 @@
+################################################################################
+#
+# ljsyscall
+#
+################################################################################
+
+LJSYSCALL_VERSION = v0.8
+LJSYSCALL_SITE = http://github.com/justincormack/ljsyscall/tarball/$(LJSYSCALL_VERSION)
+LJSYSCALL_LICENSE = MIT
+LJSYSCALL_LICENSE_FILES = COPYRIGHT
+
+ifeq ($(BR2_i386),y)
+LJSYSCALL_ARCH = x86
+endif
+ifeq ($(BR2_x86_64),y)
+LJSYSCALL_ARCH = x64
+endif
+ifeq ($(BR2_powerpc),y)
+LJSYSCALL_ARCH = ppc
+endif
+ifeq ($(LJSYSCALL_ARCH),)
+LJSYSCALL_ARCH = $(BR2_ARCH)
+endif
+
+define LJSYSCALL_INSTALL_TARGET_CMDS
+	$(INSTALL) -d $(TARGET_DIR)/usr/share/luajit-$(LUAJIT_VERSION)/syscall
+	$(INSTALL) -m 0644 -t $(TARGET_DIR)/usr/share/luajit-$(LUAJIT_VERSION)/ $(@D)/syscall.lua
+	$(INSTALL) -m 0644 -t $(TARGET_DIR)/usr/share/luajit-$(LUAJIT_VERSION)/syscall $(@D)/syscall/*.lua
+
+	$(INSTALL) -d $(TARGET_DIR)/usr/share/luajit-$(LUAJIT_VERSION)/syscall/linux/$(LJSYSCALL_ARCH)
+	$(INSTALL) -m 0644 -t $(TARGET_DIR)/usr/share/luajit-$(LUAJIT_VERSION)/syscall/linux/ $(@D)/syscall/linux/*.lua
+	$(INSTALL) -m 0644 -t $(TARGET_DIR)/usr/share/luajit-$(LUAJIT_VERSION)/syscall/linux/$(LJSYSCALL_ARCH) $(@D)/syscall/linux/$(LJSYSCALL_ARCH)/*.lua
+endef
+
+$(eval $(generic-package))
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 1/1 ljsyscall: new package

Dear Danomi Manchego,

Quoted 6 lines · Danomi Manchego
package/ljsyscall/Config.in new file +0 -0
new file mode 100644
index 0000000..0bed738

package/ljsyscall/Config.in line 8

Quoted 8 lines
package/ljsyscall/Config.in new file +8 -0
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_LJSYSCALL
+	bool "ljsyscall"
+	# ljsyscall is specifically for LuaJIT, not Lua.
+	depends on BR2_PACKAGE_LUAJIT
+	help
+	  An FFI implementation of the Linux and NetBSD kernel ABIs for LuaJIT.
+
+	  http://github.com/justincormack/ljsyscall

Could you add a comment that says:

comment "ljsyscall needs LuaJIT"
depends on !BR2_PACKAGE_LUAJIT

Quoted 19 lines
package/ljsyscall/ljsyscall.mk new file +13 -0
new file mode 100644
index 0000000..9223890
@@ -0,0 +1,35 @@
+################################################################################
+#
+# ljsyscall
+#
+################################################################################
+
+LJSYSCALL_VERSION = v0.8
+LJSYSCALL_SITE = http://github.com/justincormack/ljsyscall/tarball/$(LJSYSCALL_VERSION)
+LJSYSCALL_LICENSE = MIT
+LJSYSCALL_LICENSE_FILES = COPYRIGHT
+
+ifeq ($(BR2_i386),y)
+LJSYSCALL_ARCH = x86

package/ljsyscall/ljsyscall.mk line 23

Quoted 10 lines
package/ljsyscall/ljsyscall.mk new file +10 -0
+endif
+ifeq ($(BR2_x86_64),y)
+LJSYSCALL_ARCH = x64
+endif
+ifeq ($(BR2_powerpc),y)
+LJSYSCALL_ARCH = ppc
+endif
+ifeq ($(LJSYSCALL_ARCH),)
+LJSYSCALL_ARCH = $(BR2_ARCH)
+endif

It seems like ljsyscall does not have support for all the architectures supported in Buildroot. It would therefore be good to add the relevant architecture dependencies in Config.in, and probably only the ones you actually tested. For example, it's not necessarily clear if the MIPS support covers MIPS 32 bits only, or also MIPS 64 bits, and if it covers MIPS 64 bits, which MIPS ABIs are supported.

Also, that's a minor nit, but you could use some 'else' instructions, like:

ifeq (...)
...
else ifeq (...)
...
else ifeq (...)
...
endif

package/ljsyscall/ljsyscall.mk line 33

Quoted 9 lines
package/ljsyscall/ljsyscall.mk new file +9 -0
+define LJSYSCALL_INSTALL_TARGET_CMDS
+	$(INSTALL) -d $(TARGET_DIR)/usr/share/luajit-$(LUAJIT_VERSION)/syscall
+	$(INSTALL) -m 0644 -t $(TARGET_DIR)/usr/share/luajit-$(LUAJIT_VERSION)/ $(@D)/syscall.lua
+	$(INSTALL) -m 0644 -t $(TARGET_DIR)/usr/share/luajit-$(LUAJIT_VERSION)/syscall $(@D)/syscall/*.lua
+
+	$(INSTALL) -d $(TARGET_DIR)/usr/share/luajit-$(LUAJIT_VERSION)/syscall/linux/$(LJSYSCALL_ARCH)
+	$(INSTALL) -m 0644 -t $(TARGET_DIR)/usr/share/luajit-$(LUAJIT_VERSION)/syscall/linux/ $(@D)/syscall/linux/*.lua
+	$(INSTALL) -m 0644 -t $(TARGET_DIR)/usr/share/luajit-$(LUAJIT_VERSION)/syscall/linux/$(LJSYSCALL_ARCH) $(@D)/syscall/linux/$(LJSYSCALL_ARCH)/*.lua
+endef

Maybe you could define:

LJSYSCALL_TARGET_DIR = $(TARGET_DIR)/usr/share/luajit-$(LUAJIT_VERSION)

and use that in your install target commands to save a bit of space.

Could you fix these and resend an updated version?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH v2 1/1 ljsyscall: new package

Thomas,

Quoted 20 lines · Thomas Petazzoni

Dear Danomi Manchego,

Quoted 6 lines · Danomi Manchego
package/ljsyscall/Config.in new file +0 -0
new file mode 100644
index 0000000..0bed738

package/ljsyscall/Config.in line 8

Quoted 8 lines
package/ljsyscall/Config.in new file +8 -0
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_LJSYSCALL
+     bool "ljsyscall"
+     # ljsyscall is specifically for LuaJIT, not Lua.
+     depends on BR2_PACKAGE_LUAJIT
+     help
+       An FFI implementation of the Linux and NetBSD kernel ABIs for LuaJIT.
+
+       http://github.com/justincormack/ljsyscall

Could you add a comment that says:

Quoted 2 lines

comment "ljsyscall needs LuaJIT"
depends on !BR2_PACKAGE_LUAJIT

okay

Quoted 28 lines
Quoted 28 lines
package/ljsyscall/ljsyscall.mk new file +22 -0
new file mode 100644
index 0000000..9223890
@@ -0,0 +1,35 @@
+################################################################################
+#
+# ljsyscall
+#
+################################################################################
+
+LJSYSCALL_VERSION = v0.8
+LJSYSCALL_SITE = http://github.com/justincormack/ljsyscall/tarball/$(LJSYSCALL_VERSION)
+LJSYSCALL_LICENSE = MIT
+LJSYSCALL_LICENSE_FILES = COPYRIGHT
+
+ifeq ($(BR2_i386),y)
+LJSYSCALL_ARCH = x86
+endif
+ifeq ($(BR2_x86_64),y)
+LJSYSCALL_ARCH = x64
+endif
+ifeq ($(BR2_powerpc),y)
+LJSYSCALL_ARCH = ppc
+endif
+ifeq ($(LJSYSCALL_ARCH),)
+LJSYSCALL_ARCH = $(BR2_ARCH)
Quoted 8 lines

package/ljsyscall/ljsyscall.mk line 23

Quoted 1 line
package/ljsyscall/ljsyscall.mk new file +1 -0
+endif

It seems like ljsyscall does not have support for all the architectures supported in Buildroot. It would therefore be good to add the relevant architecture dependencies in Config.in, and probably only the ones you actually tested. For example, it's not necessarily clear if the MIPS support covers MIPS 32 bits only, or also MIPS 64 bits, and if it covers MIPS 64 bits, which MIPS ABIs are supported.

It's true, and this was also suggested by Fran?ois. However, the limitations are already in LuaJIT, except even more restrictive, so he relented on the suggestion. But i can certainly do that.

I'm not sure about the MIPS cases either, and I notice that LuaJIT avoids MIPS altogether. So I'll follow that example.

Quoted 10 lines

Also, that's a minor nit, but you could use some 'else' instructions, like:

ifeq (...)
...
else ifeq (...)
...
else ifeq (...)
...
endif

Wow, I didn't know that Make could do that. Will do.

Quoted 12 lines

package/ljsyscall/ljsyscall.mk line 33

Quoted 9 lines
package/ljsyscall/ljsyscall.mk new file +9 -0
+define LJSYSCALL_INSTALL_TARGET_CMDS
+     $(INSTALL) -d $(TARGET_DIR)/usr/share/luajit-$(LUAJIT_VERSION)/syscall
+     $(INSTALL) -m 0644 -t $(TARGET_DIR)/usr/share/luajit-$(LUAJIT_VERSION)/ $(@D)/syscall.lua
+     $(INSTALL) -m 0644 -t $(TARGET_DIR)/usr/share/luajit-$(LUAJIT_VERSION)/syscall $(@D)/syscall/*.lua
+
+     $(INSTALL) -d $(TARGET_DIR)/usr/share/luajit-$(LUAJIT_VERSION)/syscall/linux/$(LJSYSCALL_ARCH)
+     $(INSTALL) -m 0644 -t $(TARGET_DIR)/usr/share/luajit-$(LUAJIT_VERSION)/syscall/linux/ $(@D)/syscall/linux/*.lua
+     $(INSTALL) -m 0644 -t $(TARGET_DIR)/usr/share/luajit-$(LUAJIT_VERSION)/syscall/linux/$(LJSYSCALL_ARCH) $(@D)/syscall/linux/$(LJSYSCALL_ARCH)/*.lua
+endef

Maybe you could define:

Quoted 3 lines

LJSYSCALL_TARGET_DIR = $(TARGET_DIR)/usr/share/luajit-$(LUAJIT_VERSION)

and use that in your install target commands to save a bit of space.

Will do.

Quoted 1 line

Could you fix these and resend an updated version?

Will do.

Danomi -