diff mbox

[v2] ljsyscall: new package

Message ID 1380157817-1893-1-git-send-email-danomimanchego123@gmail.com
State Superseded
Headers show

Commit Message

Danomi Manchego Sept. 26, 2013, 1:10 a.m. UTC
An FFI implementation of the Linux and NetBSD kernel ABIs for LuaJIT.

Signed-off-by: Danomi Manchego <danomimanchego123@gmail.com>

---

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

Comments

Thomas Petazzoni Oct. 27, 2013, 10:45 a.m. UTC | #1
Dear Danomi Manchego,

On Wed, 25 Sep 2013 21:10:17 -0400, Danomi Manchego wrote:
> diff --git a/package/ljsyscall/Config.in b/package/ljsyscall/Config.in
> new file mode 100644
> index 0000000..0bed738
> --- /dev/null
> +++ b/package/ljsyscall/Config.in
> @@ -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

> diff --git a/package/ljsyscall/ljsyscall.mk b/package/ljsyscall/ljsyscall.mk
> new file mode 100644
> index 0000000..9223890
> --- /dev/null
> +++ b/package/ljsyscall/ljsyscall.mk
> @@ -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

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

> +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
Danomi Manchego Oct. 27, 2013, 1:20 p.m. UTC | #2
Thomas,

On Sun, Oct 27, 2013 at 6:45 AM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Dear Danomi Manchego,
>
> On Wed, 25 Sep 2013 21:10:17 -0400, Danomi Manchego wrote:
>> diff --git a/package/ljsyscall/Config.in b/package/ljsyscall/Config.in
>> new file mode 100644
>> index 0000000..0bed738
>> --- /dev/null
>> +++ b/package/ljsyscall/Config.in
>> @@ -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

okay

>> diff --git a/package/ljsyscall/ljsyscall.mk b/package/ljsyscall/ljsyscall.mk
>> new file mode 100644
>> index 0000000..9223890
>> --- /dev/null
>> +++ b/package/ljsyscall/ljsyscall.mk
>> @@ -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
>
> 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.

> 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.

>> +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.

Will do.

> Could you fix these and resend an updated version?

Will do.

Danomi -
diff mbox

Patch

diff --git a/package/Config.in b/package/Config.in
index 1dd60d1..457e5ad 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -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"
diff --git a/package/ljsyscall/Config.in b/package/ljsyscall/Config.in
new file mode 100644
index 0000000..0bed738
--- /dev/null
+++ b/package/ljsyscall/Config.in
@@ -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
diff --git a/package/ljsyscall/ljsyscall.mk b/package/ljsyscall/ljsyscall.mk
new file mode 100644
index 0000000..9223890
--- /dev/null
+++ b/package/ljsyscall/ljsyscall.mk
@@ -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))