git: 73ee63cede81 - main - net-im/gotosocial: new port

From: Dave Cottlehuber <dch_at_FreeBSD.org>
Date: Mon, 04 Apr 2022 12:51:14 UTC
The branch main has been updated by dch:

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

commit 73ee63cede813ed4e756c1880648649fa4f1b5f6
Author:     Mina Galić <me+freebsd@igalic.co>
AuthorDate: 2022-04-04 12:50:50 +0000
Commit:     Dave Cottlehuber <dch@FreeBSD.org>
CommitDate: 2022-04-04 12:50:50 +0000

    net-im/gotosocial: new port
    
    With GoToSocial, you can keep in touch with your friends, post, read,
    and share images and articles. All without being tracked or advertised
    to!
    
    GoToSocial provides a lightweight, customizable, and safety-focused
    entryway into the Fediverse, and is comparable to (but distinct from)
    existing projects such as Mastodon, Pleroma, Friendica, and PixelFed.
    
    WWW: https://docs.gotosocial.org/en/latest/
---
 GIDs                                              |  1 +
 UIDs                                              |  1 +
 net-im/Makefile                                   |  1 +
 net-im/gotosocial/Makefile                        | 58 +++++++++++++++++++++++
 net-im/gotosocial/distinfo                        |  3 ++
 net-im/gotosocial/files/gotosocial.in             | 49 +++++++++++++++++++
 net-im/gotosocial/files/patch-example_config.yaml | 35 ++++++++++++++
 net-im/gotosocial/pkg-descr                       | 11 +++++
 net-im/gotosocial/pkg-plist                       | 36 ++++++++++++++
 9 files changed, 195 insertions(+)

diff --git a/GIDs b/GIDs
index f4ed4eb473b6..120c8a098fe0 100644
--- a/GIDs
+++ b/GIDs
@@ -149,6 +149,7 @@ gnugk:*:205:
 gini:*:206:
 _mixminion:*:207:
 _dnsdist:*:208:
+gotosocial:*:209:
 shoutcast:*:210:
 git:*:211:
 hg:*:212:
diff --git a/UIDs b/UIDs
index 8aec0c1580f9..e6fe80da3c93 100644
--- a/UIDs
+++ b/UIDs
@@ -154,6 +154,7 @@ gnugk:*:205:205::0:0:GNU GateKeeper pseudo-user:/nonexistent:/usr/sbin/nologin
 gini:*:206:206::0:0:& streaming server:/var/log/gini:/usr/sbin/nologin
 _mixminion:*:207:207::0:0:Mixminion server:/nonexistent:/usr/sbin/nologin
 _dnsdist:*:208:208::0:0:dnsdist user:/nonexistent:/usr/sbin/nologin
+gotosocial:*:209:209::0:0:Gotosocial user:/nonexistent:/usr/sbin/nologin
 shoutcast:*:210:210::0:0:Shoutcast sandbox:/nonexistent:/bin/sh
 git:*:211:211::0:0:git user:/usr/local/git:/bin/sh
 hg:*:212:212::0:0:mercurial-server user:/usr/local/hg:/bin/sh
diff --git a/net-im/Makefile b/net-im/Makefile
index 8c3bdeaebefa..def6a62fbcfe 100644
--- a/net-im/Makefile
+++ b/net-im/Makefile
@@ -25,6 +25,7 @@
     SUBDIR += gitterdone
     SUBDIR += gloox
     SUBDIR += gomuks
+    SUBDIR += gotosocial
     SUBDIR += icmpchat
     SUBDIR += icqlib
     SUBDIR += jabber.el
diff --git a/net-im/gotosocial/Makefile b/net-im/gotosocial/Makefile
new file mode 100644
index 000000000000..bf4341b2f800
--- /dev/null
+++ b/net-im/gotosocial/Makefile
@@ -0,0 +1,58 @@
+PORTNAME=	gotosocial
+DISTVERSIONPREFIX=	v
+DISTVERSION=	0.2.0
+CATEGORIES=	net-im
+
+MAINTAINER=	me+freebsd@igalic.co
+COMMENT=	Golang fediverse server
+
+LICENSE=	AGPLv3
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+ONLY_FOR_ARCHS=	amd64
+
+# Note: we don't use go:modules, because this project vendors all deps
+USES=		go
+USE_RC_SUBR=	${PORTNAME}
+USE_GITHUB=	yes
+GH_ACCOUNT=	superseriousbusiness
+# When rebuilding yourself, please set this:
+#GH_TAGNAME=	40be88ec609c9b5352cbb7d38fd70ff7c6a233a5
+
+USERS=		gotosocial
+GROUPS=		gotosocial
+
+DBDIR=		/var/db/${PORTNAME}
+
+SUB_LIST=	DBDIR="${DBDIR}" \
+		GROUP="${GROUPS}" \
+		USER="${USERS}" \
+		WWWDIR="${WWWDIR}"
+PLIST_SUB=	WWWDIR="${WWWDIR}"
+
+# patch sample config for people who set a custom prefix
+.if "${PREFIX}" != "${LOCALBASE}"
+post-patch:
+	@${REINPLACE_CMD} -e 's|/usr/local|${PREFIX}|g' \
+		${WRKSRC}/example/config.yaml
+.endif
+
+do-build:
+	@(cd ${WRKSRC} && ${SETENV} \
+		VERSION=${DISTVERSION} COMMIT=${GH_TAGNAME} scripts/build.sh )
+
+do-install:
+	${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} \
+		${STAGEDIR}${PREFIX}/bin/
+	${MKDIR} ${STAGEDIR}${DOCSDIR}
+.for x in LICENSE README.md
+	${INSTALL_DATA} ${WRKSRC}/${x} \
+		${STAGEDIR}${DOCSDIR}
+.endfor
+	${MKDIR} ${STAGEDIR}${ETCDIR}
+	${INSTALL_DATA} ${WRKSRC}/example/config.yaml \
+		${STAGEDIR}${ETCDIR}/config.yaml.sample
+	(cd ${WRKSRC}/web && ${COPYTREE_SHARE} . ${STAGEDIR}${WWWDIR}/ \
+		"! ( -path */gotosocial-styling* )")
+
+.include <bsd.port.mk>
diff --git a/net-im/gotosocial/distinfo b/net-im/gotosocial/distinfo
new file mode 100644
index 000000000000..45d441d62ca1
--- /dev/null
+++ b/net-im/gotosocial/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1644694134
+SHA256 (superseriousbusiness-gotosocial-v0.2.0_GH0.tar.gz) = 0e0ddd2e98cf7b9246200e9c86b5d6b1b777b386e0bbd460ea0fe412a6f2d679
+SIZE (superseriousbusiness-gotosocial-v0.2.0_GH0.tar.gz) = 36850939
diff --git a/net-im/gotosocial/files/gotosocial.in b/net-im/gotosocial/files/gotosocial.in
new file mode 100755
index 000000000000..8e768672c3d3
--- /dev/null
+++ b/net-im/gotosocial/files/gotosocial.in
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+# PROVIDE: gotosocial
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable GotoSocial
+#
+# gotosocial_enable (bool): Set it to YES to enable gotosocial.
+#                           Default is "NO".
+# gotosocial_user   (user): Set user to run gotosocial.
+#                           Default is "gotosocial".
+# gotosocial_group (group): Set group to run gotosocial.
+#                           Default is "gotosocial".
+# gotosocial_config (file): Set gotosocial config file.
+#                           Default is "%%PREFIX%%/etc/gotosocial/config.yaml".
+# gotosocial_dir    (dir):  Set DB and certificate storage dir
+#                           Default is "/var/db/gotosocial/".
+
+. /etc/rc.subr
+
+name=gotosocial
+rcvar=gotosocial_enable
+desc="Golang fediverse server"
+
+load_rc_config "$name"
+
+: ${gotosocial_enable:=NO}
+: ${gotosocial_config:=%%PREFIX%%/etc/gotosocial/config.yaml}
+: ${gotosocial_user=%%USER%%}
+: ${gotosocial_group=%%GROUP%%}
+: ${gotosocial_dir=%%DBDIR%%}
+
+procname="%%PREFIX%%/bin/${name}"
+command=/usr/sbin/daemon
+command_args="-c -T ${name} ${procname} --config-path ${gotosocial_config} server start"
+
+start_precmd="${name}_prestart"
+
+gotosocial_prestart()
+{
+    if [ ! -d ${gotosocial_dir} ]; then
+        install -d -m 0750 -o ${gotosocial_user} -g ${gotosocial_group} \
+            ${gotosocial_dir} ${gotosocial_dir}/certs
+    fi
+}
+
+run_rc_command "$1"
diff --git a/net-im/gotosocial/files/patch-example_config.yaml b/net-im/gotosocial/files/patch-example_config.yaml
new file mode 100644
index 000000000000..c82827ad9d16
--- /dev/null
+++ b/net-im/gotosocial/files/patch-example_config.yaml
@@ -0,0 +1,35 @@
+--- example/config.yaml.orig	2022-02-03 11:30:06 UTC
++++ example/config.yaml
+@@ -151,12 +151,12 @@ db-tls-ca-cert: ""
+ # String. Directory from which gotosocial will attempt to load html templates (.tmpl files).
+ # Examples: ["/some/absolute/path/", "./relative/path/", "../../some/weird/path/"]
+ # Default: "./web/template/"
+-web-template-base-dir: "./web/template/"
++web-template-base-dir: "/usr/local/www/gotosocial/template/"
+ 
+ # String. Directory from which gotosocial will attempt to serve static web assets (images, scripts).
+ # Examples: ["/some/absolute/path/", "./relative/path/", "../../some/weird/path/"]
+ # Default: "./web/assets/"
+-web-asset-base-dir: "./web/assets/"
++web-asset-base-dir: "/usr/local/www/gotosocial/assets/"
+ 
+ ###########################
+ ##### ACCOUNTS CONFIG #####
+@@ -222,7 +222,7 @@ storage-backend: "local"
+ # this directory, and create new subdirectories and files within it.
+ # Examples: ["/home/gotosocial/storage", "/opt/gotosocial/datastorage"]
+ # Default: "/gotosocial/storage"
+-storage-local-base-path: "/gotosocial/storage"
++storage-local-base-path: "/var/db/gotosocial/storage"
+ 
+ ###########################
+ ##### STATUSES CONFIG #####
+@@ -288,7 +288,7 @@ letsencrypt-port: 80
+ # In any case, make sure GoToSocial has permissions to write to / read from this directory.
+ # Examples: ["/home/gotosocial/storage/certs", "/acmecerts"]
+ # Default: "/gotosocial/storage/certs"
+-letsencrypt-cert-dir: "/gotosocial/storage/certs"
++letsencrypt-cert-dir: "/var/db/gotosocial/storage/certs"
+ 
+ # String. Email address to use when registering LetsEncrypt certs.
+ # Most likely, this will be the email address of the instance administrator.
diff --git a/net-im/gotosocial/pkg-descr b/net-im/gotosocial/pkg-descr
new file mode 100644
index 000000000000..85703284c629
--- /dev/null
+++ b/net-im/gotosocial/pkg-descr
@@ -0,0 +1,11 @@
+GoToSocial is an ActivityPub social network server, written in Golang.
+
+With GoToSocial, you can keep in touch with your friends, post, read,
+and share images and articles. All without being tracked or advertised
+to!
+
+GoToSocial provides a lightweight, customizable, and safety-focused
+entryway into the Fediverse, and is comparable to (but distinct from)
+existing projects such as Mastodon, Pleroma, Friendica, and PixelFed.
+
+WWW: https://docs.gotosocial.org/en/latest/
diff --git a/net-im/gotosocial/pkg-plist b/net-im/gotosocial/pkg-plist
new file mode 100644
index 000000000000..1196663d0ef5
--- /dev/null
+++ b/net-im/gotosocial/pkg-plist
@@ -0,0 +1,36 @@
+@sample etc/gotosocial/config.yaml.sample
+%%WWWDIR%%/assets/base.css
+%%WWWDIR%%/assets/colors.css
+%%WWWDIR%%/assets/Fork-Awesome/CONTRIBUTORS.md
+%%WWWDIR%%/assets/Fork-Awesome/css/fork-awesome.css
+%%WWWDIR%%/assets/Fork-Awesome/css/fork-awesome.min.css
+%%WWWDIR%%/assets/Fork-Awesome/css/fork-awesome.min.css.map
+%%WWWDIR%%/assets/Fork-Awesome/css/v5-compat.css
+%%WWWDIR%%/assets/Fork-Awesome/css/v5-compat.min.css
+%%WWWDIR%%/assets/Fork-Awesome/css/v5-compat.min.css.map
+%%WWWDIR%%/assets/Fork-Awesome/fonts/forkawesome-webfont.eot
+%%WWWDIR%%/assets/Fork-Awesome/fonts/forkawesome-webfont.svg
+%%WWWDIR%%/assets/Fork-Awesome/fonts/forkawesome-webfont.ttf
+%%WWWDIR%%/assets/Fork-Awesome/fonts/forkawesome-webfont.woff
+%%WWWDIR%%/assets/Fork-Awesome/fonts/forkawesome-webfont.woff2
+%%WWWDIR%%/assets/Fork-Awesome/LICENSES
+%%WWWDIR%%/assets/logo.png
+%%WWWDIR%%/assets/status.css
+%%WWWDIR%%/assets/tusky.svg
+%%WWWDIR%%/template/404.tmpl
+%%WWWDIR%%/template/authorize.tmpl
+%%WWWDIR%%/template/confirmed.tmpl
+%%WWWDIR%%/template/email_confirm_html.tmpl
+%%WWWDIR%%/template/email_confirm_text.tmpl
+%%WWWDIR%%/template/email_reset_html.tmpl
+%%WWWDIR%%/template/email_reset_text.tmpl
+%%WWWDIR%%/template/error.tmpl
+%%WWWDIR%%/template/footer.tmpl
+%%WWWDIR%%/template/header.tmpl
+%%WWWDIR%%/template/index.tmpl
+%%WWWDIR%%/template/sign-in.tmpl
+%%WWWDIR%%/template/status.tmpl
+%%WWWDIR%%/template/thread.tmpl
+bin/gotosocial
+share/doc/gotosocial/LICENSE
+share/doc/gotosocial/README.md