Skip to contentSkip to conversation

package/middleclass: new package

PATCH New Marcin Niestroj 2 participants 4 messages Jun 6, 2016 – Jun 7, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/middleclass: new package

---
 package/Config.in                    |  1 +
 package/middleclass/Config.in        |  9 +++++++++
 package/middleclass/middleclass.hash |  2 ++
 package/middleclass/middleclass.mk   | 18 ++++++++++++++++++
 4 files changed, 30 insertions(+)
 create mode 100644 package/middleclass/Config.in
 create mode 100644 package/middleclass/middleclass.hash
 create mode 100644 package/middleclass/middleclass.mk
package/Config.in +1 -0
index 9f6e0d9..b48948e 100644
@@ -544,6 +544,7 @@ menu "Lua libraries/modules"
 	source "package/luv/Config.in"
 	source "package/luvi/Config.in"
 	source "package/lzlib/Config.in"
+	source "package/middleclass/Config.in"
 	source "package/orbit/Config.in"
 	source "package/rings/Config.in"
 	source "package/turbolua/Config.in"
package/middleclass/Config.in new file +9 -0
new file mode 100644
index 0000000..712064a
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_MIDDLECLASS
+	bool "middleclass"
+	depends on BR2_PACKAGE_HAS_LUAINTERPRETER
+	help
+	  middleclass is a simple OOP library for Lua. It has
+	  inheritance, metamethods (operators), class variables
+	  and weak mixin support.
+
+	  https://github.com/kikito/middleclass
package/middleclass/middleclass.hash new file +2 -0
new file mode 100644
index 0000000..3fc794a
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256	fc7f3e79a77d4733fd80b2e310f7f34092bdb5888549f304a24efd624c56482e  middleclass-v4.0.0.tar.gz
package/middleclass/middleclass.mk new file +18 -0
new file mode 100644
index 0000000..3e21452
@@ -0,0 +1,18 @@
+################################################################################
+#
+# middleclass
+#
+################################################################################
+
+MIDDLECLASS_VERSION = v4.0.0
+MIDDLECLASS_SITE = $(call github,kikito,middleclass,$(MIDDLECLASS_VERSION))
+MIDDLECLASS_DEPENDENCIES = luainterpreter
+MIDDLECLASS_LICENSE = MIT
+MIDDLECLASS_LICENSE_FILES = MIT-LICENSE.txt
+
+define MIDDLECLASS_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 0644 -D $(@D)/middleclass.lua \
+		$(TARGET_DIR)/usr/share/lua/$(LUAINTERPRETER_ABIVER)/middleclass.lua
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.8.3
#1 lore raw

PATCH 1/1 package/middleclass: new package

Hello,

Quoted 1 line · Marcin Niestroj

Thanks for this contribution! However I have a few comments, see below.

package/middleclass/Config.in line 3

Quoted 9 lines
package/middleclass/Config.in new file +3 -0
new file mode 100644
index 0000000..712064a
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_MIDDLECLASS
+	bool "middleclass"
+	depends on BR2_PACKAGE_HAS_LUAINTERPRETER

This dependency is not necessary, since you're already including package/middleclass/Config.in within the following condition:

if BR2_PACKAGE_HAS_LUAINTERPRETER && !BR2_STATIC_LIBS

Quoted 14 lines
package/middleclass/middleclass.mk new file +8 -0
new file mode 100644
index 0000000..3e21452
@@ -0,0 +1,18 @@
+################################################################################
+#
+# middleclass
+#
+################################################################################
+
+MIDDLECLASS_VERSION = v4.0.0
+MIDDLECLASS_SITE = $(call github,kikito,middleclass,$(MIDDLECLASS_VERSION))

package/middleclass/middleclass.mk line 18

Quoted 10 lines
package/middleclass/middleclass.mk new file +10 -0
+MIDDLECLASS_DEPENDENCIES = luainterpreter
+MIDDLECLASS_LICENSE = MIT
+MIDDLECLASS_LICENSE_FILES = MIT-LICENSE.txt
+
+define MIDDLECLASS_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 0644 -D $(@D)/middleclass.lua \
+		$(TARGET_DIR)/usr/share/lua/$(LUAINTERPRETER_ABIVER)/middleclass.lua
+endef
+
+$(eval $(generic-package))

Could you use the luarocks package infrastructure instead? The middleclass package is available in luarocks, and it greatly simplifies the Lua packages. See the luaexpat package for an example. The Buildroot manual also has extensive documentation about the luarocks package infrastructure.

Thanks a lot!

Thomas

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

PATCH 1/1 package/middleclass: new package

Hi,

Quoted 20 lines · Thomas Petazzoni

Hello,

Quoted 1 line · Marcin Niestroj

Thanks for this contribution! However I have a few comments, see below.

package/middleclass/Config.in line 3

Quoted 9 lines
package/middleclass/Config.in new file +3 -0
new file mode 100644
index 0000000..712064a
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_MIDDLECLASS
+	bool "middleclass"
+	depends on BR2_PACKAGE_HAS_LUAINTERPRETER

This dependency is not necessary, since you're already including package/middleclass/Config.in within the following condition:

Quoted 1 line

if BR2_PACKAGE_HAS_LUAINTERPRETER && !BR2_STATIC_LIBS

Thanks for pointing it. I used some other package as reference, so I missed that.

Quoted 23 lines
Quoted 23 lines
package/middleclass/middleclass.mk new file +16 -0
new file mode 100644
index 0000000..3e21452
@@ -0,0 +1,18 @@
+################################################################################
+#
+# middleclass
+#
+################################################################################
+
+MIDDLECLASS_VERSION = v4.0.0
+MIDDLECLASS_SITE = $(call github,kikito,middleclass,$(MIDDLECLASS_VERSION))
+MIDDLECLASS_DEPENDENCIES = luainterpreter
+MIDDLECLASS_LICENSE = MIT
+MIDDLECLASS_LICENSE_FILES = MIT-LICENSE.txt
+
+define MIDDLECLASS_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 0644 -D $(@D)/middleclass.lua \
+		$(TARGET_DIR)/usr/share/lua/$(LUAINTERPRETER_ABIVER)/middleclass.lua
+endef
Quoted 8 lines

package/middleclass/middleclass.mk line 18

Quoted 2 lines
package/middleclass/middleclass.mk new file +2 -0
+
+$(eval $(generic-package))

Could you use the luarocks package infrastructure instead? The middleclass package is available in luarocks, and it greatly simplifies the Lua packages. See the luaexpat package for an example. The Buildroot manual also has extensive documentation about the luarocks package infrastructure.

I tried to use luarocks for that package. However I encountered two issues with that approach:

1) middleclass is not consistent with it's version. In most places it is 4.0.0. However in rockspec [1] it defines it's version as 4.0-0. I guess it should be 4.0.0-0 instead. This inconsistency needs some tweaks in Buildroot package makefile.

2) When middleclass is installed with luarocks on my host, it downloads *.rockspec directly instead of *.src.rock. I think that Buildroot is not supporting that case, but please correct me if I am wrong. It was not straightforward to make it work for me.

Above issues made me unable to add support for middleclass using luarocks in a reasonable time. It was much simpler with current approach.

[1]
https://github.com/kikito/middleclass/blob/master/rockspecs/middleclass-4.0-0.rockspec

Quoted 5 lines

Thanks a lot!

Thomas

Signature · 1 line
Marcin Niestroj
#3 lore raw

PATCH 1/1 package/middleclass: new package

Hello,

Quoted 4 lines · Marcin Niestroj
Quoted 1 line

if BR2_PACKAGE_HAS_LUAINTERPRETER && !BR2_STATIC_LIBS

Thanks for pointing it. I used some other package as reference, so I missed that.

Other packages might be wrong, do not hesitate to send patches to fix them if you find such issues.

Quoted 8 lines
Quoted 5 lines

Could you use the luarocks package infrastructure instead? The middleclass package is available in luarocks, and it greatly simplifies the Lua packages. See the luaexpat package for an example. The Buildroot manual also has extensive documentation about the luarocks package infrastructure.

I tried to use luarocks for that package. However I encountered two issues with that approach:

OK. Fran?ois Perrad, who wrote the luarocks package infrastructure, is in Cc of the discussion. Hopefully he can participate to the discussion and give some feedback.

Quoted 4 lines

1) middleclass is not consistent with it's version. In most places it is 4.0.0. However in rockspec [1] it defines it's version as 4.0-0. I guess it should be 4.0.0-0 instead. This inconsistency needs some tweaks in Buildroot package makefile.

Hm, I'm not sure here, Fran?ois can comment I guess.

Quoted 5 lines

2) When middleclass is installed with luarocks on my host, it downloads *.rockspec directly instead of *.src.rock. I think that Buildroot is not supporting that case, but please correct me if I am wrong. It was not straightforward to make it work for me.

Hum, Buildroot does download the .src.rock, since the luarocks package infrastructure defines:

$(2)_SOURCE ?= $(1)-$$($(3)_VERSION).src.rock

Quoted 3 lines

Above issues made me unable to add support for middleclass using luarocks in a reasonable time. It was much simpler with current approach.

Right, but not the most appropriate approach. If the package is on luarocks.org, it should work with our infrastructure. Let's see what Fran?ois can say about this.

Thanks!

Thomas

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