-
Notifications
You must be signed in to change notification settings - Fork 161
/
Makefile
98 lines (78 loc) · 3.7 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# $NetBSD: Makefile,v 1.38 2024/06/16 16:52:43 nikita Exp $
GOTOVER= 0.16.0
DISTNAME= gotosocial-${GOTOVER}-source-code
PKGNAME= ${DISTNAME:S/-source-code//}
CATEGORIES= www
MAINTAINER= [email protected]
HOMEPAGE= https://github.com/superseriousbusiness/gotosocial/
COMMENT= Fediverse server written in Go
LICENSE= gnu-agpl-v3
USE_TOOLS+= pax tar
DISTFILES= gotosocial-${GOTOVER}-source-code.tar.gz
DISTFILES+= gotosocial_${GOTOVER}_web-assets.tar.gz
SITES.gotosocial-${GOTOVER}-source-code.tar.gz= \
-https://github.com/superseriousbusiness/gotosocial/releases/download/v${GOTOVER}/gotosocial-${GOTOVER}-source-code.tar.gz
SITES.gotosocial_${GOTOVER}_web-assets.tar.gz= \
-https://github.com/superseriousbusiness/gotosocial/releases/download/v${GOTOVER}/gotosocial_${GOTOVER}_web-assets.tar.gz
# release archive has no toplevel folder.
EXTRACT_DIR= ${WRKDIR}/${PKGNAME}
WRKSRC= ${EXTRACT_DIR}
MAKE_ENV+= VERSION=${PKGVERSION_NOREV}
BUILD_DEFS+= VARBASE
.include "../../mk/bsd.prefs.mk"
GOTOSOCIAL_USER?= gotosocial
GOTOSOCIAL_GROUP?= gotosocial
GOTOSOCIAL_CHROOT?= ${VARBASE}/chroot/gotosocial
GOTOSOCIAL_DATA?= ${VARBASE}/www/gotosocial
GOTOSOCIAL_DB?= ${VARBASE}/db/gotosocial
PKG_GROUPS+= ${GOTOSOCIAL_GROUP}
PKG_USERS+= ${GOTOSOCIAL_USER}:${GOTOSOCIAL_GROUP}
EGDIR= ${PREFIX}/share/examples/${PKGBASE}
PKG_SYSCONFSUBDIR= ${PKGBASE}
RCD_SCRIPTS= gotosocial
FILES_SUBST+= GOTOSOCIAL_CHROOT=${GOTOSOCIAL_CHROOT}
FILES_SUBST+= GOTOSOCIAL_DATA=${GOTOSOCIAL_DATA}
FILES_SUBST+= GOTOSOCIAL_DB=${GOTOSOCIAL_DB}
FILES_SUBST+= GOTOSOCIAL_GROUP=${GOTOSOCIAL_GROUP}
FILES_SUBST+= GOTOSOCIAL_USER=${GOTOSOCIAL_USER}
FILES_SUBST+= EGDIR=${EGDIR}
CONF_FILES+= ${EGDIR}/config.yaml ${PKG_SYSCONFDIR}/config.yaml
SUBST_CLASSES+= cfg
SUBST_MESSAGE.cfg= Fixing default paths in config
SUBST_STAGE.cfg= post-configure
SUBST_FILES.cfg= example/config.yaml
SUBST_SED.cfg= -e "s,\./web/template/,${GOTOSOCIAL_DATA}/template/,g"
SUBST_SED.cfg+= -e "s,\./web/assets/,${GOTOSOCIAL_DATA}/assets/,g"
SUBST_SED.cfg+= -e "s,/gotosocial/storage,${GOTOSOCIAL_DB}/storage,g"
SUBST_CLASSES+= systemdpaths
SUBST_MESSAGE.systemdpaths= Fixing paths in systemd file
SUBST_STAGE.systemdpaths= post-configure
SUBST_FILES.systemdpaths= example/gotosocial.service
SUBST_SED.systemdpaths= -e 's,/gotosocial/gotosocial,${PREFIX}/bin/gotosocial,g'
SUBST_SED.systemdpaths+= -e 's,config.yaml,${PKG_SYSCONFDIR}/config.yaml,g'
# restricted to amd64:
# https://gitlab.com/cznic/libc/-/issues/15
# https://gitlab.com/cznic/libc/-/issues/12
# https://gitlab.com/cznic/libc/-/issues/11
# https://github.com/superseriousbusiness/gotosocial/issues/1753
# on FreeBSD, the modernc.org/* packages do not work on arm64:
# "imports modernc.org/libc/errno: build constraints exclude all Go files in /usr/ports/net-im/gotosocial/work/gotosocial-0.5.2/vendor/modernc.org/libc/errno"
# BUG: does not build on Sun
# to unblock: https://github.com/ncruces/go-sqlite3/issues/85
ONLY_FOR_PLATFORM= *-*-x86_64
do-build:
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} scripts/build.sh
# cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} && \
# go build -o gotosocial ./cmd/gotosocial
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/gotosocial ${DESTDIR}/${PREFIX}/bin/
${MKDIR} ${DESTDIR}/${EGDIR}
${INSTALL_DATA} ${WRKSRC}/example/config.yaml ${DESTDIR}/${EGDIR}/config.yaml
${INSTALL_DATA} ${WRKSRC}/example/docker-compose/docker-compose.yaml ${DESTDIR}/${EGDIR}/docker-compose.yaml
${INSTALL_DATA} ${WRKSRC}/example/gotosocial.service ${DESTDIR}/${EGDIR}/gotosocial.service
cd ${WRKSRC} && ${TAR} -xzf ${DISTDIR}/gotosocial_0.15.0_web-assets.tar.gz
cd ${WRKSRC} && ${PAX} -rw web ${DESTDIR}/${EGDIR}
do-test:
cd ${WRKSRC} && ./gotosocial --version
.include "../../lang/go/go-module.mk"
.include "../../mk/bsd.pkg.mk"