From 44a60d62de06772112140d0643355054020e3a31 Mon Sep 17 00:00:00 2001 From: nia Date: Sun, 6 Mar 2022 08:58:20 +0000 Subject: add time/lua-chronos High resolution monotonic timers for Lua --- time/Makefile | 3 ++- time/lua-chronos/DESCR | 1 + time/lua-chronos/Makefile | 31 +++++++++++++++++++++++++++++++ time/lua-chronos/PLIST | 2 ++ time/lua-chronos/distinfo | 5 +++++ time/lua-chronos/files/Makefile | 9 +++++++++ time/lua-chronos/files/test.lua | 8 ++++++++ 7 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 time/lua-chronos/DESCR create mode 100644 time/lua-chronos/Makefile create mode 100644 time/lua-chronos/PLIST create mode 100644 time/lua-chronos/distinfo create mode 100644 time/lua-chronos/files/Makefile create mode 100644 time/lua-chronos/files/test.lua (limited to 'time') diff --git a/time/Makefile b/time/Makefile index 1877ccb465e..7d35c2f1472 100644 --- a/time/Makefile +++ b/time/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.228 2021/12/24 16:08:52 wiz Exp $ +# $NetBSD: Makefile,v 1.229 2022/03/06 08:58:20 nia Exp $ # COMMENT= Clocks, calendars, daily planners and other time related applications @@ -57,6 +57,7 @@ SUBDIR+= leapsunpack SUBDIR+= libical SUBDIR+= lmclock SUBDIR+= logtime +SUBDIR+= lua-chronos SUBDIR+= lua-date SUBDIR+= lua-tz SUBDIR+= memo diff --git a/time/lua-chronos/DESCR b/time/lua-chronos/DESCR new file mode 100644 index 00000000000..25478780bae --- /dev/null +++ b/time/lua-chronos/DESCR @@ -0,0 +1 @@ +High resolution monotonic timers for Lua diff --git a/time/lua-chronos/Makefile b/time/lua-chronos/Makefile new file mode 100644 index 00000000000..c629e7eb8bc --- /dev/null +++ b/time/lua-chronos/Makefile @@ -0,0 +1,31 @@ +# $NetBSD: Makefile,v 1.1 2022/03/06 08:58:21 nia Exp $ + +DISTNAME= chronos-0.2.4 +PKGNAME= ${LUA_PKGPREFIX}-${DISTNAME} +CATEGORIES= time lua +MASTER_SITES= ${MASTER_SITE_GITHUB:=ldrumm/} +GITHUB_PROJECT= chronos +GITHUB_TAG= v0.2-4 + +MAINTAINER= pkgsrc-users@NetBSD.org +HOMEPAGE= https://github.com/ldrumm/chronos +COMMENT= High resolution monotonic timers for Lua +LICENSE= mit + +INSTALLATION_DIRS+= ${LUA_CDIR} + +BUILD_DIRS+= src + +pre-build: + ${CP} -f ${FILESDIR}/Makefile ${WRKSRC}/src/Makefile + +do-install: + ${INSTALL_LIB} ${WRKSRC}/src/chronos.so \ + ${DESTDIR}${PREFIX}/${LUA_CDIR}/chronos.so + +do-test: + LUA_CPATH=${WRKSRC}/src/?.so \ + ${LUA_INTERPRETER} ${FILESDIR}/test.lua + +.include "../../lang/lua/module.mk" +.include "../../mk/bsd.pkg.mk" diff --git a/time/lua-chronos/PLIST b/time/lua-chronos/PLIST new file mode 100644 index 00000000000..904774cfc82 --- /dev/null +++ b/time/lua-chronos/PLIST @@ -0,0 +1,2 @@ +@comment $NetBSD: PLIST,v 1.1 2022/03/06 08:58:21 nia Exp $ +${LUA_CDIR}/chronos.so diff --git a/time/lua-chronos/distinfo b/time/lua-chronos/distinfo new file mode 100644 index 00000000000..e158ad1b6aa --- /dev/null +++ b/time/lua-chronos/distinfo @@ -0,0 +1,5 @@ +$NetBSD: distinfo,v 1.1 2022/03/06 08:58:21 nia Exp $ + +BLAKE2s (chronos-0.2.4.tar.gz) = 3e1bf2b49d1ceb18a47a0f665ac7914b5e5c634263f743a64d31aeb3e0a7a12d +SHA512 (chronos-0.2.4.tar.gz) = b7d88351ce3bac20ef4b5cbaffcee281cbfc8cdb2210c7e9076fc36bfa69a5d81d68da89704c6103bc94e90e591d36b6a1f4fba199da69f03fc26cb5a3f49c6f +Size (chronos-0.2.4.tar.gz) = 4807 bytes diff --git a/time/lua-chronos/files/Makefile b/time/lua-chronos/files/Makefile new file mode 100644 index 00000000000..a084d40bd8e --- /dev/null +++ b/time/lua-chronos/files/Makefile @@ -0,0 +1,9 @@ +# $NetBSD: Makefile,v 1.1 2022/03/06 08:58:21 nia Exp $ + +all: chronos.so + +.c.o: + $(CC) $(CFLAGS) -fPIC -c $< + +chronos.so: chronos.o + $(CC) $(LDFLAGS) -shared -o $@ chronos.o diff --git a/time/lua-chronos/files/test.lua b/time/lua-chronos/files/test.lua new file mode 100644 index 00000000000..1709fd5a980 --- /dev/null +++ b/time/lua-chronos/files/test.lua @@ -0,0 +1,8 @@ +local chronos = require("chronos") + + +local start = chronos.nanotime() +os.execute("sleep 1") +local stop = chronos.nanotime() + +print(("sleep took %s seconds"):format(stop - start)) -- cgit v1.2.3