git: aa7046e119ae - main - net/syncthing1: Add new port, which is an old port

From: Dan Langille <dvl_at_FreeBSD.org>
Date: Sat, 16 Aug 2025 20:50:26 UTC
The branch main has been updated by dvl:

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

commit aa7046e119ae049aef6bed8e37b5860548895d27
Author:     Dan Langille <dvl@FreeBSD.org>
AuthorDate: 2025-08-16 20:47:46 +0000
Commit:     Dan Langille <dvl@FreeBSD.org>
CommitDate: 2025-08-16 20:50:22 +0000

    net/syncthing1: Add new port, which is an old port
    
    Provide syncthing-1.x to cater for sites hitting issues with 2.x
    PR:             288903
---
 net/Makefile                                       |  1 +
 net/syncthing1/Makefile                            | 67 ++++++++++++++++++++++
 net/syncthing1/distinfo                            |  3 +
 .../files/patch-syncthing_lib_beacon_multicast.go  | 12 ++++
 net/syncthing1/files/syncthing-discosrv.in         | 66 +++++++++++++++++++++
 net/syncthing1/files/syncthing-relaypoolsrv.in     | 59 +++++++++++++++++++
 net/syncthing1/files/syncthing-relaysrv.in         | 63 ++++++++++++++++++++
 net/syncthing1/files/syncthing.in                  | 57 ++++++++++++++++++
 net/syncthing1/pkg-descr                           |  4 ++
 9 files changed, 332 insertions(+)

diff --git a/net/Makefile b/net/Makefile
index b103441bea97..4b809548529a 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -1560,6 +1560,7 @@
     SUBDIR += sup
     SUBDIR += svnup
     SUBDIR += syncthing
+    SUBDIR += syncthing1
     SUBDIR += tableutil
     SUBDIR += tac_plus4
     SUBDIR += tacacs
diff --git a/net/syncthing1/Makefile b/net/syncthing1/Makefile
new file mode 100644
index 000000000000..2d562963f6b7
--- /dev/null
+++ b/net/syncthing1/Makefile
@@ -0,0 +1,67 @@
+PORTNAME=	syncthing
+DISTVERSIONPREFIX=	v
+DISTVERSION=	1.30.0
+PORTREVISION=	4
+CATEGORIES=	net
+MASTER_SITES=	https://github.com/${PORTNAME}/${PORTNAME}/releases/download/v${DISTVERSION}/
+PKGNAMESUFFIX=	1
+DISTNAME=	${PORTNAME}-source-${DISTVERSIONFULL}
+
+MAINTAINER=	dvl@FreeBSD.org
+COMMENT=	Encrypted file sync tool
+WWW=		https://syncthing.net/
+
+LICENSE=	MPL20
+LICENSE_FILE=	${WRKSRC}/${PORTNAME}/LICENSE
+
+USES=		cpe go:modules
+
+USE_RC_SUBR=	syncthing syncthing-discosrv syncthing-relaysrv \
+		syncthing-relaypoolsrv
+
+BINS=		syncthing stdiscosrv strelaysrv strelaypoolsrv
+
+# Anonymize
+MAKE_ENV+=	BUILD_HOST=freebsd \
+		BUILD_USER=ports
+
+NO_CCACHE=	yes
+NO_WRKSUBDIR=	yes
+
+USERS=		syncthing
+GROUPS=		syncthing
+
+CONFLICTS=	syncthing
+
+.for x in ${BINS}
+PLIST_FILES+=	bin/${x}
+.endfor
+
+PORTDOCS=	*
+
+OPTIONS_DEFINE=	DOCS
+
+do-build:
+	@( cd ${WRKSRC}/${PORTNAME} ; \
+		${SETENV} ${MAKE_ENV} ${GO_ENV} GOPROXY=off ${GO_CMD} run build.go -version v${DISTVERSION} -no-upgrade build ; \
+		${SETENV} ${MAKE_ENV} ${GO_ENV} GOPROXY=off ${GO_CMD} run build.go -version v${DISTVERSION} -no-upgrade build stdiscosrv; \
+		${SETENV} ${MAKE_ENV} ${GO_ENV} GOPROXY=off ${GO_CMD} run build.go -version v${DISTVERSION} -no-upgrade build strelaysrv; \
+		${SETENV} ${MAKE_ENV} ${GO_ENV} GOPROXY=off ${GO_CMD} run build.go -version v${DISTVERSION} -no-upgrade build strelaypoolsrv; \
+		)
+
+do-install:
+.for x in ${BINS}
+	${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME}/${x} \
+		${STAGEDIR}${PREFIX}/bin/
+.endfor
+	${MKDIR} ${STAGEDIR}${DOCSDIR}
+.for x in AUTHORS LICENSE README.md
+	${INSTALL_DATA} ${WRKSRC}/${PORTNAME}/${x} \
+		${STAGEDIR}${DOCSDIR}
+.endfor
+
+do-test:
+	@( cd ${WRKSRC}/${PORTNAME} ; \
+		${SETENV} ${MAKE_ENV} ${GO_ENV} GOPROXY=off ${GO_CMD} run build.go -version v${DISTVERSION} -no-upgrade test ; \
+		)
+.include <bsd.port.mk>
diff --git a/net/syncthing1/distinfo b/net/syncthing1/distinfo
new file mode 100644
index 000000000000..b4dcc70d7506
--- /dev/null
+++ b/net/syncthing1/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1751369794
+SHA256 (syncthing-source-v1.30.0.tar.gz) = ef1be71c66753c04212ab1c9c548e678d468bad98dc5461e83540a4ef5c2fcba
+SIZE (syncthing-source-v1.30.0.tar.gz) = 16142834
diff --git a/net/syncthing1/files/patch-syncthing_lib_beacon_multicast.go b/net/syncthing1/files/patch-syncthing_lib_beacon_multicast.go
new file mode 100644
index 000000000000..2b817687cf6e
--- /dev/null
+++ b/net/syncthing1/files/patch-syncthing_lib_beacon_multicast.go
@@ -0,0 +1,12 @@
+--- syncthing/lib/beacon/multicast.go.orig	2021-07-06 12:51:32 UTC
++++ syncthing/lib/beacon/multicast.go
+@@ -126,6 +126,9 @@ func readMulticasts(ctx context.Context, outbox chan<-
+ 	pconn := ipv6.NewPacketConn(conn)
+ 	joined := 0
+ 	for _, intf := range intfs {
++		if intf.Flags&net.FlagUp == 0 || intf.Flags&net.FlagMulticast == 0 || intf.Name == "ipfw0" {
++			continue
++		}
+ 		err := pconn.JoinGroup(&intf, &net.UDPAddr{IP: gaddr.IP})
+ 		if err != nil {
+ 			l.Debugln("IPv6 join", intf.Name, "failed:", err)
diff --git a/net/syncthing1/files/syncthing-discosrv.in b/net/syncthing1/files/syncthing-discosrv.in
new file mode 100644
index 000000000000..fb0d32006395
--- /dev/null
+++ b/net/syncthing1/files/syncthing-discosrv.in
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+# PROVIDE: syncthingdiscosrv
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# syncthingdiscosrv_enable (bool):      Set to NO by default.
+#                                       Set it to YES to enable syncthing-discosrv.
+# syncthingdiscosrv_user (user):        Set user to run syncthing-discosrv.
+#                                       Default is "syncthing".
+# syncthingdiscosrv_group (group):      Set group to run syncthing-discosrv.
+#                                       Default is "syncthing".
+# syncthingdiscosrv_dir (dir):          Set dir to run syncthing-discosrv in.
+#                                       Default is "/var/db/syncthing-discosrv".
+# syncthingdiscosrv_log_file (path):    Syncthing log file
+#                                       Default: /var/log/syncthing-discosrv.log
+# syncthingdiscosrv_key (file):         Set key file to use
+#                                       Default is "${syncthingdiscosrv_dir}/syncthing.key".
+# syncthingdiscosrv_cert (file):        Set cert file to use
+#                                       Default is "${syncthingdiscosrv_dir}/syncthing.cert".
+# syncthingdiscosrv_args (string):      Extra args to pass to syncthing-discosrv
+#                                       Default is ""
+
+. /etc/rc.subr
+
+name=syncthingdiscosrv
+rcvar=syncthingdiscosrv_enable
+
+load_rc_config $name
+
+: ${syncthingdiscosrv_enable:="NO"}
+: ${syncthingdiscosrv_user:="syncthing"}
+: ${syncthingdiscosrv_group:="syncthing"}
+: ${syncthingdiscosrv_dir:="/var/db/syncthing-discosrv"}
+: ${syncthingdiscosrv_log_file=/var/log/syncthing-discosrv.log}
+: ${syncthingdiscosrv_key:="${syncthingdiscosrv_dir}/syncthing.key"}
+: ${syncthingdiscosrv_cert:="${syncthingdiscosrv_dir}/syncthing.cert"}
+
+export STNORESTART=true
+
+pidfile=/var/run/syncthingdiscosrv.pid
+procname="%%PREFIX%%/bin/stdiscosrv"
+command="/usr/sbin/daemon"
+command_args="-p ${pidfile} ${procname} --key ${syncthingdiscosrv_key} --cert ${syncthingdiscosrv_cert} ${syncthingdiscosrv_args} >> ${syncthingdiscosrv_log_file}"
+syncthingdiscosrv_chdir=${syncthingdiscosrv_dir}
+
+start_precmd=syncthingdiscosrv_startprecmd
+
+syncthingdiscosrv_startprecmd()
+{
+        if [ ! -e ${pidfile} ]; then
+                install -o ${syncthingdiscosrv_user} -g ${syncthingdiscosrv_group} /dev/null ${pidfile};
+        fi
+
+        if [ ! -d ${syncthingdiscosrv_dir} ]; then
+                install -d -o ${syncthingdiscosrv_user} -g ${syncthingdiscosrv_group} ${syncthingdiscosrv_dir}
+        fi
+        if [ ! -e ${syncthingdiscosrv_log_file} ]; then
+                install -o ${syncthingdiscosrv_user} -g ${syncthingdiscosrv_group} /dev/null ${syncthingdiscosrv_log_file};
+        fi
+}
+
+run_rc_command "$1"
diff --git a/net/syncthing1/files/syncthing-relaypoolsrv.in b/net/syncthing1/files/syncthing-relaypoolsrv.in
new file mode 100644
index 000000000000..bbee2d783b40
--- /dev/null
+++ b/net/syncthing1/files/syncthing-relaypoolsrv.in
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+# PROVIDE: syncthingrelaypoolsrv
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# syncthingrelaypoolsrv_enable (bool):      Set to NO by default.
+#                                           Set it to YES to enable syncthing-relaypoolsrv.
+# syncthingrelaypoolsrv_user (user):        Set user to run syncthing-relaypoolsrv.
+#                                           Default is "syncthing".
+# syncthingrelaypoolsrv_group (group):      Set group to run syncthing-relaypoolsrv.
+#                                           Default is "syncthing".
+# syncthingrelaypoolsrv_dir (dir):          Set dir to run syncthing-relaypoolsrv in.
+#                                           Default is "/var/db/syncthing-relaypoolsrv".
+# syncthingrelaypoolsrv_log_file (path):    Syncthing log file
+#                                           Default: /var/log/syncthing-relaypoolsrv.log
+# syncthingrelaypoolsrv_args (string):      Extra args to pass to syncthing-relaypoolsrv
+#                                           Default is ""
+
+. /etc/rc.subr
+
+name=syncthingrelaypoolsrv
+rcvar=syncthingrelaypoolsrv_enable
+
+load_rc_config $name
+
+: ${syncthingrelaypoolsrv_enable:="NO"}
+: ${syncthingrelaypoolsrv_user:="syncthing"}
+: ${syncthingrelaypoolsrv_group:="syncthing"}
+: ${syncthingrelaypoolsrv_dir:="/var/db/syncthing-relaypoolsrv"}
+: ${syncthingrelaypoolsrv_log_file=/var/log/syncthing-relaypoolsrv.log}
+
+export STNORESTART=true
+
+pidfile=/var/run/syncthingrelaypoolsrv.pid
+procname="%%PREFIX%%/bin/strelaypoolsrv"
+command="/usr/sbin/daemon"
+command_args="-c -p ${pidfile} ${procname} -keys ${syncthingrelaypoolsrv_dir} ${syncthingrelaypoolsrv_args} >> ${syncthingrelaypoolsrv_log_file} 2>&1"
+
+start_precmd=syncthingrelaypoolsrv_startprecmd
+
+syncthingrelaypoolsrv_startprecmd()
+{
+        if [ ! -e ${pidfile} ]; then
+                install -o ${syncthingrelaypoolsrv_user} -g ${syncthingrelaypoolsrv_group} /dev/null ${pidfile};
+        fi
+
+        if [ ! -d ${syncthingrelaypoolsrv_dir} ]; then
+                install -d -o ${syncthingrelaypoolsrv_user} -g ${syncthingrelaypoolsrv_group} ${syncthingrelaypoolsrv_dir}
+        fi
+        if [ ! -e ${syncthingrelaypoolsrv_log_file} ]; then
+                install -o ${syncthingrelaypoolsrv_user} -g ${syncthingrelaypoolsrv_group} /dev/null ${syncthingrelaypoolsrv_log_file};
+        fi
+}
+
+run_rc_command "$1"
diff --git a/net/syncthing1/files/syncthing-relaysrv.in b/net/syncthing1/files/syncthing-relaysrv.in
new file mode 100644
index 000000000000..1d5411dea8eb
--- /dev/null
+++ b/net/syncthing1/files/syncthing-relaysrv.in
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+# PROVIDE: syncthingrelaysrv
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# syncthingrelaysrv_enable (bool):      Set to NO by default.
+#                                       Set it to YES to enable syncthing-relaysrv.
+# syncthingrelaysrv_user (user):        Set user to run syncthing-relaysrv.
+#                                       Default is "syncthing".
+# syncthingrelaysrv_group (group):      Set group to run syncthing-relaysrv.
+#                                       Default is "syncthing".
+# syncthingrelaysrv_dir (dir):          Set dir to run syncthing-relaysrv in.
+#                                       Default is "/var/db/syncthing-relaysrv".
+# syncthingrelaysrv_log_file (path):    Syncthing log file
+#                                       Default: /var/log/syncthing-relaysrv.log
+# syncthingrelaysrv_key (file):         Set key file to use
+#                                       Default is "${syncthingrelaysrv_dir}/syncthing.key".
+# syncthingrelaysrv_cert (file):        Set cert file to use
+#                                       Default is "${syncthingrelaysrv_dir}/syncthing.cert".
+# syncthingrelaysrv_args (string):      Extra args to pass to syncthing-relaysrv
+#                                       Default is ""
+
+. /etc/rc.subr
+
+name=syncthingrelaysrv
+rcvar=syncthingrelaysrv_enable
+
+load_rc_config $name
+
+: ${syncthingrelaysrv_enable:="NO"}
+: ${syncthingrelaysrv_user:="syncthing"}
+: ${syncthingrelaysrv_group:="syncthing"}
+: ${syncthingrelaysrv_dir:="/var/db/syncthing-relaysrv"}
+: ${syncthingrelaysrv_log_file=/var/log/syncthing-relaysrv.log}
+
+export STNORESTART=true
+
+pidfile=/var/run/syncthingrelaysrv.pid
+procname="%%PREFIX%%/bin/strelaysrv"
+command="/usr/sbin/daemon"
+command_args="-c -p ${pidfile} ${procname} -keys ${syncthingrelaysrv_dir} ${syncthingrelaysrv_args} >> ${syncthingrelaysrv_log_file} 2>&1"
+
+start_precmd=syncthingrelaysrv_startprecmd
+
+syncthingrelaysrv_startprecmd()
+{
+        if [ ! -e ${pidfile} ]; then
+                install -o ${syncthingrelaysrv_user} -g ${syncthingrelaysrv_group} /dev/null ${pidfile};
+        fi
+
+        if [ ! -d ${syncthingrelaysrv_dir} ]; then
+                install -d -o ${syncthingrelaysrv_user} -g ${syncthingrelaysrv_group} ${syncthingrelaysrv_dir}
+        fi
+        if [ ! -e ${syncthingrelaysrv_log_file} ]; then
+                install -o ${syncthingrelaysrv_user} -g ${syncthingrelaysrv_group} /dev/null ${syncthingrelaysrv_log_file};
+        fi
+}
+
+run_rc_command "$1"
diff --git a/net/syncthing1/files/syncthing.in b/net/syncthing1/files/syncthing.in
new file mode 100644
index 000000000000..8b96017031aa
--- /dev/null
+++ b/net/syncthing1/files/syncthing.in
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+# PROVIDE: syncthing
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# syncthing_enable (bool):	Set to NO by default.
+#				Set it to YES to enable syncthing.
+# syncthing_home (path):        Directory where syncthing configuration
+#                               data is stored.
+#                               Default: %%PREFIX%%/etc/syncthing
+# syncthing_log_file (path):    Syncthing log file
+#                               Default: /var/log/syncthing.log
+# syncthing_user (user):        Set user to run syncthing.
+#                               Default is "syncthing".
+# syncthing_group (group):      Set group to run syncthing.
+#                               Default is "syncthing".
+
+. /etc/rc.subr
+
+name=syncthing
+rcvar=syncthing_enable
+
+load_rc_config $name
+
+: ${syncthing_enable:="NO"}
+: ${syncthing_home=%%PREFIX%%/etc/syncthing}
+: ${syncthing_log_file=/var/log/syncthing.log}
+: ${syncthing_user:="syncthing"}
+: ${syncthing_group=${syncthing_group:-$syncthing_user}}
+
+pidfile=/var/run/syncthing.pid
+procname="%%PREFIX%%/bin/syncthing"
+command="/usr/sbin/daemon"
+command_args="-cf -p ${pidfile} ${procname} ${syncthing_home:+-home=${syncthing_home}} ${syncthing_log_file:+-logfile=${syncthing_log_file}} -no-browser ${syncthing_args}"
+
+start_precmd=syncthing_startprecmd
+
+syncthing_startprecmd()
+{
+        if [ ! -e ${pidfile} ]; then
+                install -o ${syncthing_user} -g ${syncthing_group} /dev/null ${pidfile};
+        fi
+
+        if [ ! -d ${syncthing_home} ]; then
+                install -d -o ${syncthing_user} -g ${syncthing_group} ${syncthing_home}
+        fi
+
+        if [ ! -e ${syncthing_log_file} ]; then
+                install -o ${syncthing_user} -g ${syncthing_group} /dev/null ${syncthing_log_file};
+        fi
+}
+
+run_rc_command "$1"
diff --git a/net/syncthing1/pkg-descr b/net/syncthing1/pkg-descr
new file mode 100644
index 000000000000..09edbf379d10
--- /dev/null
+++ b/net/syncthing1/pkg-descr
@@ -0,0 +1,4 @@
+Syncthing replaces proprietary sync and cloud services with something open,
+trustworthy and decentralized. Your data is your data alone and you deserve to
+choose where it is stored, if it is shared with some third party and how it's
+transmitted over the Internet.