git: e7995bf16df3 - main - sysutils/go-ntfy: New port: Send push notifications to your phone or desktop using PUT/POST

From: Jesús Daniel Colmenares Oviedo <dtxdf_at_FreeBSD.org>
Date: Thu, 26 Jun 2025 21:37:08 UTC
The branch main has been updated by dtxdf:

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

commit e7995bf16df36b310b07374045921c1062c2fa32
Author:     Jesús Daniel Colmenares Oviedo <dtxdf@FreeBSD.org>
AuthorDate: 2025-06-26 21:26:37 +0000
Commit:     Jesús Daniel Colmenares Oviedo <dtxdf@FreeBSD.org>
CommitDate: 2025-06-26 21:36:53 +0000

    sysutils/go-ntfy: New port: Send push notifications to your phone or desktop using PUT/POST
    
    ntfy (pronounced "notify") is a simple HTTP-based pub-sub notification
    service. With ntfy, you can send notifications to your phone or
    desktop via scripts from any computer, without having to sign up
    or pay any fees. If you'd like to run your own instance of the
    service, you can easily do so since ntfy is open source.
    
    Approved by:    acm (mentor)
---
 sysutils/Makefile              |  1 +
 sysutils/go-ntfy/Makefile      | 66 ++++++++++++++++++++++++++++++++++++++++++
 sysutils/go-ntfy/distinfo      |  7 +++++
 sysutils/go-ntfy/files/ntfy.in | 32 ++++++++++++++++++++
 sysutils/go-ntfy/pkg-descr     |  5 ++++
 sysutils/ntfy/Makefile         |  2 ++
 6 files changed, 113 insertions(+)

diff --git a/sysutils/Makefile b/sysutils/Makefile
index ae05c95773c3..bfe64a59ea3e 100644
--- a/sysutils/Makefile
+++ b/sysutils/Makefile
@@ -462,6 +462,7 @@
     SUBDIR += gnome-settings-daemon
     SUBDIR += gnome-system-monitor
     SUBDIR += gnome_subr
+    SUBDIR += go-ntfy
     SUBDIR += go-wtf
     SUBDIR += goaccess
     SUBDIR += goawk
diff --git a/sysutils/go-ntfy/Makefile b/sysutils/go-ntfy/Makefile
new file mode 100644
index 000000000000..fb8db411df89
--- /dev/null
+++ b/sysutils/go-ntfy/Makefile
@@ -0,0 +1,66 @@
+PORTNAME=	ntfy
+DISTVERSIONPREFIX=	v
+DISTVERSION=	2.12.0
+CATEGORIES=	sysutils
+MASTER_SITES=	LOCAL/dtxdf/${PORTNAME}/
+PKGNAMEPREFIX=	go-
+DISTFILES=	${PORTNAME}-${DISTVERSION}.frontend${EXTRACT_SUFX}
+
+MAINTAINER=	dtxdf@FreeBSD.org
+COMMENT=	Send push notifications to your phone or desktop using PUT/POST
+WWW=		https://ntfy.sh
+
+LICENSE=	APACHE20
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+USES=		go:modules
+USE_GITHUB=	yes
+GH_ACCOUNT=	binwiederhier
+
+USE_RC_SUBR=	${PORTNAME}
+
+GO_MOD_DIST=	github
+GO_MODULE=	github.com/binwiederhier/${PORTNAME}
+GO_BUILDFLAGS=	-ldflags "\
+			-X 'main.version=${DISTVERSION}' \
+			-X 'main.commit=${GITID}' \
+			-X 'main.date=${BUILD_DATE}'"
+
+CONFLICTS_INSTALL=	sysutils/ntfy
+
+PLIST_FILES=	"@sample ${ETCDIR}/client.yml.sample" \
+		"@sample ${ETCDIR}/server.yml.sample" \
+		bin/${PORTNAME}
+
+OPTIONS_DEFINE=	DOCS
+
+DOCS_BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}mkdocs-material>=0:textproc/py-mkdocs-material@${PY_FLAVOR} \
+			${PYTHON_PKGNAMEPREFIX}mkdocs-minify-plugin>=0:textproc/py-mkdocs-minify-plugin@${PY_FLAVOR}
+DOCS_USES=		python
+
+# Run 'git checkout ${DISTVERSIONPREFIX}${DISTVERSION} && git rev-parse --short HEAD'
+# in the ntfy repository to get the value of GITID.
+GITID=		061677a7
+
+BUILD_DATE=	$$(date -u "+%Y-%m-%dT%H:%M:%SZ")
+
+post-patch:
+	@${GREP} -rl "/etc/${PORTNAME}" ${WRKSRC}/cmd \
+		| ${XARGS} ${REINPLACE_CMD} -e 's#/etc/${PORTNAME}#${ETCDIR}#g'
+
+pre-build:
+	@${MKDIR} ${WRKSRC}/server/docs
+	${TOUCH} ${WRKSRC}/server/docs/index.html
+	${RM} -r ${WRKSRC}/server/site
+	@${MKDIR} ${WRKSRC}/server/site
+	@cd ${WRKDIR}/ntfy-frontend && ${COPYTREE_SHARE} . ${WRKSRC}/server/site
+
+pre-build-DOCS-on:
+	@cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} mkdocs build
+
+post-install:
+	@${MKDIR} ${STAGEDIR}${ETCDIR}
+	${INSTALL_DATA} ${WRKSRC}/server/server.yml ${STAGEDIR}${ETCDIR}/server.yml.sample
+	${INSTALL_DATA} ${WRKSRC}/client/client.yml ${STAGEDIR}${ETCDIR}/client.yml.sample
+
+.include <bsd.port.mk>
diff --git a/sysutils/go-ntfy/distinfo b/sysutils/go-ntfy/distinfo
new file mode 100644
index 000000000000..3ed506c03a3d
--- /dev/null
+++ b/sysutils/go-ntfy/distinfo
@@ -0,0 +1,7 @@
+TIMESTAMP = 1750965231
+SHA256 (go/sysutils_go-ntfy/binwiederhier-ntfy-v2.12.0_GH0/ntfy-2.12.0.frontend.tar.gz) = 8b777d3618b2dde7095be53b09cb220e50a7e52af2a4211d074c5796151e5d4f
+SIZE (go/sysutils_go-ntfy/binwiederhier-ntfy-v2.12.0_GH0/ntfy-2.12.0.frontend.tar.gz) = 2297703
+SHA256 (go/sysutils_go-ntfy/binwiederhier-ntfy-v2.12.0_GH0/go.mod) = f88dd70c2bc8386f38d575e2c424cfb729a6c36a0c6299449df3cac40d289a7d
+SIZE (go/sysutils_go-ntfy/binwiederhier-ntfy-v2.12.0_GH0/go.mod) = 4705
+SHA256 (go/sysutils_go-ntfy/binwiederhier-ntfy-v2.12.0_GH0/binwiederhier-ntfy-v2.12.0_GH0.tar.gz) = 210b7409894aa51719077da6a771c82d460bd710a52a527cf52694166f6103d0
+SIZE (go/sysutils_go-ntfy/binwiederhier-ntfy-v2.12.0_GH0/binwiederhier-ntfy-v2.12.0_GH0.tar.gz) = 13608026
diff --git a/sysutils/go-ntfy/files/ntfy.in b/sysutils/go-ntfy/files/ntfy.in
new file mode 100644
index 000000000000..f681ce0b5c1b
--- /dev/null
+++ b/sysutils/go-ntfy/files/ntfy.in
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# PROVIDE: ntfy
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Configuration settings for ntfy in /etc/rc.conf
+#
+# ntfy_enable (bool):    Enable ntfy. (default=NO)
+# ntfy_log (str):        Log output. (default=/var/log/ntfy.log)
+# ntfy_runas (str):      User to run ntfy as. (default=www)
+#
+
+. /etc/rc.subr
+
+name="ntfy"
+desc="Send push notifications to your phone or desktop using PUT/POST"
+rcvar="${name}_enable"
+
+load_rc_config $name
+
+: ${ntfy_enable:="NO"}
+: ${ntfy_log:="/var/log/ntfy.log"}
+: ${ntfy_runas:="www"}
+: ${ntfy_args="--listen-http :8080"}
+
+pidfile="/var/run/${name}.pid"
+procname="%%LOCALBASE%%/bin/${name}"
+command="/usr/sbin/daemon"
+command_args="-c -u '${ntfy_runas}' -p '${pidfile}' -t '${desc}' -o '${ntfy_log}' '${procname}' serve ${ntfy_args}"
+
+run_rc_command "$1"
diff --git a/sysutils/go-ntfy/pkg-descr b/sysutils/go-ntfy/pkg-descr
new file mode 100644
index 000000000000..279182934b82
--- /dev/null
+++ b/sysutils/go-ntfy/pkg-descr
@@ -0,0 +1,5 @@
+ntfy (pronounced "notify") is a simple HTTP-based pub-sub notification
+service. With ntfy, you can send notifications to your phone or
+desktop via scripts from any computer, without having to sign up
+or pay any fees. If you'd like to run your own instance of the
+service, you can easily do so since ntfy is open source.
diff --git a/sysutils/ntfy/Makefile b/sysutils/ntfy/Makefile
index 4afd571ed885..d196cb578b94 100644
--- a/sysutils/ntfy/Makefile
+++ b/sysutils/ntfy/Makefile
@@ -21,6 +21,8 @@ USE_GITHUB=	yes
 GH_ACCOUNT=	dschep
 USE_PYTHON=	distutils noflavors autoplist
 
+CONFLICTS_INSTALL=	sysutils/go-ntfy
+
 NO_ARCH=	yes
 
 post-patch: