git: 0eb692f7d06a - main - security/lua-argon2: New port

From: Vanilla I. Shu <vanilla_at_FreeBSD.org>
Date: Mon, 09 Jan 2023 03:20:49 UTC
The branch main has been updated by vanilla:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0eb692f7d06a6bad5631620c543e1f13226f7079

commit 0eb692f7d06a6bad5631620c543e1f13226f7079
Author:     Vanilla I. Shu <vanilla@FreeBSD.org>
AuthorDate: 2023-01-09 03:19:20 +0000
Commit:     Vanilla I. Shu <vanilla@FreeBSD.org>
CommitDate: 2023-01-09 03:19:20 +0000

    security/lua-argon2: New port
    
    Lua C binding for the Argon2 password hashing function. Compatible with Lua 5.x and LuaJIT.
    
    PR:             268039
    Reported by:    Manuel Wiesinger <manuel at mmap.at>
---
 security/Makefile                            |  1 +
 security/lua-argon2/Makefile                 | 26 ++++++++++++++++++++++++++
 security/lua-argon2/distinfo                 |  3 +++
 security/lua-argon2/files/patch-Makefile     | 22 ++++++++++++++++++++++
 security/lua-argon2/files/patch-src_argon2.c | 10 ++++++++++
 security/lua-argon2/pkg-descr                |  2 ++
 6 files changed, 64 insertions(+)

diff --git a/security/Makefile b/security/Makefile
index 746fbf81f2ce..34524905156a 100644
--- a/security/Makefile
+++ b/security/Makefile
@@ -333,6 +333,7 @@
     SUBDIR += linux-c7-trousers
     SUBDIR += local-php-security-checker
     SUBDIR += logcheck
+    SUBDIR += lua-argon2
     SUBDIR += lua-bcrypt
     SUBDIR += luasec
     SUBDIR += lxqt-openssh-askpass
diff --git a/security/lua-argon2/Makefile b/security/lua-argon2/Makefile
new file mode 100644
index 000000000000..27a896d6399b
--- /dev/null
+++ b/security/lua-argon2/Makefile
@@ -0,0 +1,26 @@
+PORTNAME=	argon2
+DISTVERSION=	3.0.1
+CATEGORIES=	security
+PKGNAMEPREFIX=	${LUA_PKGNAMEPREFIX}
+
+MAINTAINER=	mdw@FreeBSD.org
+COMMENT=	Lua C binding for the Argon2 password hashing function
+WWW=		https://github.com/thibaultcha/lua-argon2
+
+LICENSE=	MIT
+
+LIB_DEPENDS+=	libargon2.so:security/libargon2
+
+USES=		compiler:c11 lua:module
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	thibaultcha
+GH_PROJECT=	lua-argon2
+
+PLIST_FILES=	${LUA_MODLIBDIR}/argon2.so
+
+do-install:
+	@${MKDIR} ${STAGEDIR}${LUA_MODLIBDIR}
+	${INSTALL_LIB} ${WRKSRC}/argon2.so ${STAGEDIR}${LUA_MODLIBDIR}
+
+.include <bsd.port.mk>
diff --git a/security/lua-argon2/distinfo b/security/lua-argon2/distinfo
new file mode 100644
index 000000000000..a16649e6c8df
--- /dev/null
+++ b/security/lua-argon2/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1664113729
+SHA256 (thibaultcha-lua-argon2-3.0.1_GH0.tar.gz) = d109c6e8e93cd9e27e8738567a998a2763d56252cc1abca1f0f2ac36ef8ce0f4
+SIZE (thibaultcha-lua-argon2-3.0.1_GH0.tar.gz) = 13836
diff --git a/security/lua-argon2/files/patch-Makefile b/security/lua-argon2/files/patch-Makefile
new file mode 100644
index 000000000000..afe585237143
--- /dev/null
+++ b/security/lua-argon2/files/patch-Makefile
@@ -0,0 +1,22 @@
+--- Makefile.orig	2018-06-11 02:10:23 UTC
++++ Makefile
+@@ -1,8 +1,7 @@
+ LIB_NAME = argon2
+
+-CC      ?= gcc
+-LDFLAGS ?= -shared
+-CFLAGS  ?= -O2 -fPIC -ansi -Wall -Werror -Wpedantic
++LDFLAGS += -shared
++CFLAGS  += -fPIC -std=c11 -Wall -Wpedantic
+
+ PREFIX        ?= /usr/local
+ ARGON2_INCDIR ?= $(PREFIX)/include
+@@ -17,7 +16,7 @@ BUILD_LDFLAGS = -L$(ARGON2_LIBDIR) -largon2
+ all: $(LIB_NAME).so
+
+ $(LIB_NAME).so: $(LIB_NAME).o
+-	$(CC) $(LDFLAGS) -o $@ $< $(BUILD_LDFLAGS)
++	$(CC) $(LDFLAGS) -o $@ $(LIB_NAME).o $(BUILD_LDFLAGS)
+
+ $(LIB_NAME).o: src/$(LIB_NAME).c
+	$(CC) $(CFLAGS) -c $< -o $@ $(BUILD_CFLAGS)
diff --git a/security/lua-argon2/files/patch-src_argon2.c b/security/lua-argon2/files/patch-src_argon2.c
new file mode 100644
index 000000000000..427a1d7e2247
--- /dev/null
+++ b/security/lua-argon2/files/patch-src_argon2.c
@@ -0,0 +1,10 @@
+--- src/argon2.c.orig	2022-09-25 20:11:00 UTC
++++ src/argon2.c
+@@ -486,7 +486,7 @@ static const luaL_Reg largon2[] = { { "verify", largon
+                                     { NULL, NULL } };
+
+-int
++LUALIB_API int
+ luaopen_argon2(lua_State *L)
+ {
+     lua_newtable(L);
diff --git a/security/lua-argon2/pkg-descr b/security/lua-argon2/pkg-descr
new file mode 100644
index 000000000000..9d546e70012c
--- /dev/null
+++ b/security/lua-argon2/pkg-descr
@@ -0,0 +1,2 @@
+Lua C binding for the Argon2 password hashing function. Compatible with Lua 5.x
+and LuaJIT.