Browse Source

package/lua-argon2: new package

Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Francois Perrad 3 năm trước cách đây
mục cha
commit
a15cb73b49

+ 1 - 0
package/Config.in

@@ -662,6 +662,7 @@ menu "Lua libraries/modules"
 	source "package/lpty/Config.in"
 	source "package/lrandom/Config.in"
 	source "package/lsqlite3/Config.in"
+	source "package/lua-argon2/Config.in"
 	source "package/lua-augeas/Config.in"
 	source "package/lua-basexx/Config.in"
 	source "package/lua-binaryheap/Config.in"

+ 13 - 0
package/lua-argon2/Config.in

@@ -0,0 +1,13 @@
+config BR2_PACKAGE_LUA_ARGON2
+	bool "lua-argon2"
+	depends on !BR2_STATIC_LIBS
+	depends on BR2_USE_MMU # libargon2
+	select BR2_PACKAGE_LIBARGON2
+	help
+	  Lua C binding for the Argon2 password hashing algorithm.
+
+	  https://github.com/thibaultcha/lua-argon2
+
+comment "lua-argon2 needs a toolchain w/ dynamic library"
+	depends on BR2_USE_MMU
+	depends on BR2_STATIC_LIBS

+ 2 - 0
package/lua-argon2/lua-argon2.hash

@@ -0,0 +1,2 @@
+# Locally calculated
+sha256  d109c6e8e93cd9e27e8738567a998a2763d56252cc1abca1f0f2ac36ef8ce0f4  lua-argon2-3.0.1.tar.gz

+ 23 - 0
package/lua-argon2/lua-argon2.mk

@@ -0,0 +1,23 @@
+################################################################################
+#
+# lua-argon2
+#
+################################################################################
+
+LUA_ARGON2_VERSION = 3.0.1
+LUA_ARGON2_SITE = $(call github,thibaultcha,lua-argon2,$(LUA_ARGON2_VERSION))
+LUA_ARGON2_LICENSE = MIT
+LUA_ARGON2_DEPENDENCIES = luainterpreter libargon2
+
+define LUA_ARGON2_BUILD_CMDS
+	$(MAKE) -C $(@D) \
+		CC=$(TARGET_CC) \
+		CFLAGS="$(TARGET_CFLAGS) -fPIC" \
+		PREFIX="$(STAGING_DIR)/usr"
+endef
+
+define LUA_ARGON2_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 755 -D $(@D)/argon2.so $(TARGET_DIR)/usr/lib/lua/$(LUAINTERPRETER_ABIVER)/argon2.so
+endef
+
+$(eval $(generic-package))

+ 25 - 0
support/testing/tests/package/test_lua_argon2.py

@@ -0,0 +1,25 @@
+from tests.package.test_lua import TestLuaBase
+
+
+class TestLuaLuaArgon2(TestLuaBase):
+    config = TestLuaBase.config + \
+        """
+        BR2_PACKAGE_LUA=y
+        BR2_PACKAGE_LUA_ARGON2=y
+        """
+
+    def test_run(self):
+        self.login()
+        self.module_test("argon2")
+
+
+class TestLuajitLuaArgon2(TestLuaBase):
+    config = TestLuaBase.config + \
+        """
+        BR2_PACKAGE_LUAJIT=y
+        BR2_PACKAGE_LUA_ARGON2=y
+        """
+
+    def test_run(self):
+        self.login()
+        self.module_test("argon2")