summaryrefslogtreecommitdiff
path: root/www/forgejo/Makefile
blob: 5ce85017635c634022a970468cd230bc12526eb7 (plain)
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
PORTNAME=	forgejo
DISTVERSIONPREFIX=	v
DISTVERSION=	1.21.10-0
PORTREVISION=	3
CATEGORIES=	www
MASTER_SITES=	https://codeberg.org/forgejo/forgejo/releases/download/${DISTVERSIONPREFIX}${DISTVERSION}/
DISTNAME=	forgejo-src-${DISTVERSION}

MAINTAINER=	stb@lassitu.de
COMMENT=	Compact self-hosted Git service
WWW=		https://forgejo.org/

LICENSE=	MIT
LICENSE_FILE=	${WRKSRC}/LICENSE

RUN_DEPENDS=	git:devel/git

USES=			cpe gmake go:1.21,no_targets
USE_RC_SUBR=	forgejo

EXTRACT_AFTER_ARGS=	--strip-components 1
SUB_FILES+=	app.ini.sample
SUB_LIST+=	GITUSER=${USERS}

NO_WRKSUBDIR=	yes

USERS=		git
GROUPS=		git

PORTDATA=	*

OPTIONS_DEFINE=		BINDATA GIT_LFS PAM SQLITE
OPTIONS_DEFAULT=	BINDATA GIT_LFS PAM SQLITE
OPTIONS_SUB=		yes

BINDATA_DESC=	Build a single monolithic binary, with all assets included
GIT_LFS_DESC=	Support for Git Large File Storage (LFS)
PAM_DESC=	Enable support for PAM

BINDATA_VARS=		GO_TAGS+=bindata
GIT_LFS_RUN_DEPENDS=	git-lfs:devel/git-lfs
PAM_VARS=		GO_TAGS+=pam
SQLITE_VARS=		GO_TAGS+="sqlite sqlite_unlock_notify"

.include <bsd.port.options.mk>

.if ${OPSYS} == FreeBSD
DAEMONARGS=	-S -l \$${forgejo_facility} -s \$${forgejo_priority} -T \
		\$${name}
.else
DAEMONARGS=	-f
.endif

SUB_LIST+=	DAEMONARGS="${DAEMONARGS}"

SSP_UNSAFE=	true
# Default LDFLAGS are incompatible with build
MAKE_ENV=	LDFLAGS="${LDFLAGS} ${EXTRA_LDFLAGS}"
MAKE_ARGS=	GOPATH=${WRKDIR} \
		TAGS="${GO_TAGS}"
ALL_TARGET=	backend
MAKE_JOBS_UNSAFE=	yes

post-patch:
	${ECHO_CMD} ${DISTVERSION} >${WRKSRC}/VERSION

# Too lazy to figure out why go install won't work.
do-install:
# Go binary is statically linked and cannot be stripped, so use
# INSTALL_SCRIPT.
	${INSTALL_SCRIPT} ${WRKSRC}/gitea \
		${STAGEDIR}${PREFIX}/sbin/forgejo
	@${MKDIR} ${STAGEDIR}${ETCDIR}/conf
	${INSTALL_DATA} ${WRKDIR}/app.ini.sample \
		${STAGEDIR}${ETCDIR}/conf/app.ini.sample
	${INSTALL_DATA} ${WRKSRC}/custom/conf/app.example.ini \
		${STAGEDIR}${ETCDIR}/conf/app.ini.defaults

do-install-BINDATA-off:
	cd ${WRKSRC} && \
		${COPYTREE_SHARE} "options public templates" ${STAGEDIR}${DATADIR}

.include <bsd.port.mk>