git: 181bdf41a334 - main - devel/laminar: New port

From: Joel Bodenmann <jbo_at_FreeBSD.org>
Date: Wed, 20 Dec 2023 13:12:02 UTC
The branch main has been updated by jbo:

URL: https://cgit.FreeBSD.org/ports/commit/?id=181bdf41a334781d1a858ec8f26d679ec9871374

commit 181bdf41a334781d1a858ec8f26d679ec9871374
Author:     Marian Cingel <cingel.marian@gmail.com>
AuthorDate: 2023-09-15 12:27:40 +0000
Commit:     Joel Bodenmann <jbo@FreeBSD.org>
CommitDate: 2023-12-20 12:54:26 +0000

    devel/laminar: New port
    
    Laminar is a lightweight client-server CI service written in C++ and
    configured by environment variables. It comes with a built-in webserver
    and uses simple .run shell scripts as jobs.
    
    PR:                     273827
    Approved by:            tcberner (mentor)
    Differential Revision:  https://reviews.freebsd.org/D42877
---
 devel/Makefile                      |  1 +
 devel/laminar/Makefile              | 72 +++++++++++++++++++++++++++++++++++++
 devel/laminar/distinfo              |  9 +++++
 devel/laminar/files/laminard.env.in | 64 +++++++++++++++++++++++++++++++++
 devel/laminar/files/laminard.in     | 32 +++++++++++++++++
 devel/laminar/pkg-descr             |  5 +++
 devel/laminar/pkg-plist             | 10 ++++++
 7 files changed, 193 insertions(+)

diff --git a/devel/Makefile b/devel/Makefile
index 0c6f1a0aea7e..5d9c76e0a56f 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -1129,6 +1129,7 @@
     SUBDIR += kyua
     SUBDIR += lab
     SUBDIR += lager
+    SUBDIR += laminar
     SUBDIR += lasi
     SUBDIR += lattice-ice40-examples-hx1k
     SUBDIR += lattice-ice40-examples-hx8k
diff --git a/devel/laminar/Makefile b/devel/laminar/Makefile
new file mode 100644
index 000000000000..e6fbee3ddb28
--- /dev/null
+++ b/devel/laminar/Makefile
@@ -0,0 +1,72 @@
+PORTNAME=	laminar
+DISTVERSION=	1.3
+CATEGORIES=	devel
+MASTER_SITES=	GH \
+		https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.12/:vue \
+		https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.9.1/:chart \
+		https://raw.githubusercontent.com/drudru/ansi_up/v4.0.4/:ansi
+DISTFILES=	ansi_up.js:ansi \
+		vue.min.js:vue \
+		chart.min.js:chart
+DIST_SUBDIR=	${PORTNAME}
+EXTRACT_ONLY=	${GH_ACCOUNT}-${PORTNAME}-${DISTVERSION}-${GH_TAGNAME}_GH0${EXTRACT_SUFX}
+
+MAINTAINER=	cingel.marian@gmail.com
+COMMENT=	Lightweight CI service
+WWW=		https://laminar.ohwg.net/
+
+LICENSE=	GPLv3
+LICENSE_FILE=	${WRKSRC}/COPYING
+
+ONLY_FOR_ARCHS=	aarch64 amd64 armv7 powerpc64 powerpc64le
+ONLY_FOR_ARCHS_REASON=	"Requires to translate 'uname -m' to linker '-m' flag in CMakeLists.txt"
+
+BUILD_DEPENDS=	${LOCALBASE}/include/boost/multi_index_container.hpp:devel/boost-libs \
+		${LOCALBASE}/include/rapidjson/rapidjson.h:devel/rapidjson
+LIB_DEPENDS=	libcapnp.so:devel/capnproto \
+		libinotify.so:devel/libinotify
+
+USES=		cmake pkgconfig sqlite
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	ohwgiles
+GH_TAGNAME=	277a59f1cba75fa763e5838b3443f11686dd5ebb
+
+USERS=		${WWWOWN}
+GROUPS=		${WWWGRP}
+HOMEDIR=	/var/db/${PORTNAME}
+LAMINARD=	laminard
+
+USE_RC_SUBR=	laminard
+SUB_FILES=	laminard.env
+
+SUB_LIST=	HOMEDIR=${HOMEDIR} \
+		LAMINARD=${LAMINARD} \
+		PORTNAME=${PORTNAME} \
+		USERS=${USERS}
+
+PLIST_SUB=	GROUPS=${GROUPS} \
+		HOMEDIR=${HOMEDIR} \
+		LAMINARD=${LAMINARD} \
+		PORTNAME=${PORTNAME} \
+		USERS=${USERS}
+
+post-extract:
+	${CP} ${DISTDIR}/${DIST_SUBDIR}/ansi_up.js ${WRKDIR}/
+	${CP} ${DISTDIR}/${DIST_SUBDIR}/vue.min.js ${WRKDIR}/
+	${CP} ${DISTDIR}/${DIST_SUBDIR}/chart.min.js ${WRKDIR}/Chart.min.js
+
+pre-configure:
+	${MKDIR} ${CONFIGURE_WRKSRC}/js
+	${CP} ${WRKDIR}/ansi_up.js ${CONFIGURE_WRKSRC}/js/
+	${CP} ${WRKDIR}/Chart.min.js ${CONFIGURE_WRKSRC}/js/
+	${CP} ${WRKDIR}/vue.min.js ${CONFIGURE_WRKSRC}/js/
+
+post-install:
+	${MKDIR} ${STAGEDIR}${HOMEDIR} \
+		 ${STAGEDIR}${HOMEDIR}/cfg \
+		 ${STAGEDIR}${HOMEDIR}/cfg/jobs \
+		 ${STAGEDIR}${PREFIX}/etc/${PORTNAME}
+	${INSTALL_DATA} ${WRKDIR}/laminard.env ${STAGEDIR}${ETCDIR}/${LAMINARD}.env.sample
+
+.include <bsd.port.mk>
diff --git a/devel/laminar/distinfo b/devel/laminar/distinfo
new file mode 100644
index 000000000000..842b5bb4e0c4
--- /dev/null
+++ b/devel/laminar/distinfo
@@ -0,0 +1,9 @@
+TIMESTAMP = 1699395718
+SHA256 (laminar/ansi_up.js) = 996608ae1a80c64fb2b41e07f3ef1c4fc7ec437746c03867000de98686e5a8b7
+SIZE (laminar/ansi_up.js) = 22159
+SHA256 (laminar/vue.min.js) = 29296ccacaa9ed35ed168fc51e36f54fd6f8db9c7786bbf38cc59a27229ba5c2
+SIZE (laminar/vue.min.js) = 93670
+SHA256 (laminar/chart.min.js) = fbc45926e6b46845a0f905552a0e0b1331049bff1115ecf94dbe0904d895e710
+SIZE (laminar/chart.min.js) = 199560
+SHA256 (laminar/ohwgiles-laminar-1.3-277a59f1cba75fa763e5838b3443f11686dd5ebb_GH0.tar.gz) = 61fa0b17e2515aace7e98ed1f020314163cbbc6212a1fa94437229a78fcaa62f
+SIZE (laminar/ohwgiles-laminar-1.3-277a59f1cba75fa763e5838b3443f11686dd5ebb_GH0.tar.gz) = 104295
diff --git a/devel/laminar/files/laminard.env.in b/devel/laminar/files/laminard.env.in
new file mode 100644
index 000000000000..ecab24e71f8c
--- /dev/null
+++ b/devel/laminar/files/laminard.env.in
@@ -0,0 +1,64 @@
+###
+### LAMINAR_HOME
+###
+### Root location containing laminar configuration, database,
+### build workspaces and archive.
+###
+### Default: /var/lib/laminar
+###
+LAMINAR_HOME=%%HOMEDIR%%
+
+### LAMINAR_BIND_HTTP
+###
+### Interface on which laminard will bind to serve the Web UI.
+### May be of the form IP:PORT, unix:PATH/TO/SOCKET or unix-abstract:NAME
+###
+### Default: *:8080
+###
+LAMINAR_BIND_HTTP="*:8080"
+
+### LAMINAR_BIND_RPC
+###
+### Interface on which laminard will bind to accept RPC from laminarc.
+### May be of the form IP:PORT, unix:PATH/TO/SOCKET or unix-abstract:NAME
+###
+### Default: unix-abstract:laminar
+LAMINAR_BIND_RPC="*:8081"
+
+###
+### LAMINAR_TITLE
+###
+### Page title to show in web frontend
+###
+# LAMINAR_TITLE=""
+
+###
+### LAMINAR_KEEP_RUNDIRS
+###
+### Setting this prevents the immediate deletion of job rundirs
+### $LAMINAR_HOME/run/$JOB/$RUN. Value should be an integer represeting
+### the number of rundirs to keep.
+###
+### Default: 0
+###
+# LAMINAR_KEEP_RUNDIRS=0
+
+###
+### LAMINAR_BASE_URL
+###
+### Base url for the frontend. This affects the <base href> tag and needs
+### to be set if Laminar runs behind a reverse-proxy that hosts Laminar
+### within a subfolder (rather than at a subdomain root)
+###
+# LAMINAR_BASE_URL="/""
+
+###
+### LAMINAR_ARCHIVE_URL
+###
+### Base url used to request artifacts. Laminar can serve build
+### artifacts (and it will if you leave this unset), but it
+### uses a very naive and inefficient method. Best to let a real
+### webserver handle serving those requests.
+###
+# LAMINAR_ARCHIVE_URL="http://backbone.example.com/ci/archive/"
+
diff --git a/devel/laminar/files/laminard.in b/devel/laminar/files/laminard.in
new file mode 100755
index 000000000000..83905a227efe
--- /dev/null
+++ b/devel/laminar/files/laminard.in
@@ -0,0 +1,32 @@
+#! /bin/sh
+
+# PROVIDE: %%LAMINARD%%
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable git_daemon:
+#
+#laminard_enable="YES"
+
+. /etc/rc.subr
+
+name="%%LAMINARD%%"
+rcvar="%%LAMINARD%%_enable"
+
+pidfile="/var/run/${name}.pid"
+logfile="/var/log/${name}.log"
+
+load_rc_config $name
+
+: ${%%PORTNAME%%d_enable:=NO}
+: ${%%PORTNAME%%d_env_file:=%%ETCDIR%%/%%LAMINARD%%.env}
+
+laminard_cmd=%%PREFIX%%/sbin/${name}
+procname=${laminard_cmd}
+#laminard_args="-v"
+command=/usr/sbin/daemon
+command_args="-f -o ${logfile} -p ${pidfile} -u %%USERS%% ${laminard_cmd} ${laminard_args}"
+
+run_rc_command "$1"
+
diff --git a/devel/laminar/pkg-descr b/devel/laminar/pkg-descr
new file mode 100644
index 000000000000..30a8f2633a39
--- /dev/null
+++ b/devel/laminar/pkg-descr
@@ -0,0 +1,5 @@
+Laminar is a lightweight client-server CI service written in C++ and
+configured by environment variables. It comes with a built-in webserver
+and uses simple .run shell scripts as jobs.
+
+The client-server communication uses the Cap'n Proto format over sockets.
diff --git a/devel/laminar/pkg-plist b/devel/laminar/pkg-plist
new file mode 100644
index 000000000000..7b865e524010
--- /dev/null
+++ b/devel/laminar/pkg-plist
@@ -0,0 +1,10 @@
+bin/laminarc
+@sample %%ETCDIR%%/%%LAMINARD%%.env.sample
+sbin/laminard
+share/man/man1/laminarc.1.gz
+share/man/man8/laminard.8.gz
+usr/share/bash-completion/completions/laminarc
+usr/share/zsh/site-functions/_laminarc
+@dir(%%USERS%%,%%GROUPS%%) %%HOMEDIR%%/cfg/jobs
+@dir(%%USERS%%,%%GROUPS%%) %%HOMEDIR%%/cfg
+@dir(%%USERS%%,%%GROUPS%%) %%HOMEDIR%%