summaryrefslogtreecommitdiff
path: root/net/librespeed-go/Makefile
blob: b54a6d275650aa152e236b18cd6c7ca5aac3900c (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

PORTNAME=	librespeed-go
DISTVERSIONPREFIX=	v
DISTVERSION=	1.1.3
CATEGORIES=	net www

MAINTAINER=	driesm.michiels@gmail.com
COMMENT=	GO backend for LibreSpeed

LICENSE=	LGPL3
LICENSE_FILE=	${WRKSRC}/LICENSE

USES=		go:modules
USE_RC_SUBR=	librespeed-go

GO_MODULE=	github.com/librespeed/speedtest-go

SUB_FILES=	pkg-message
SUB_LIST=	LIBRESPEED_USER=${USERS} LIBRESPEED_GROUP=${GROUPS} PORTNAME=${PORTNAME}

USERS=		librespeed
GROUPS=		librespeed

PLIST_SUB=	LIBRESPEED_USER=${USERS} LIBRESPEED_GROUP=${GROUPS}

OPTIONS_DEFINE=	EXAMPLES

post-patch:
	${REINPLACE_CMD} -e 's|"."|"${ETCDIR}"|g' ${WRKSRC}/config/config.go
	${REINPLACE_CMD} -e 's|"./assets"|"${WWWDIR}"|g' ${WRKSRC}/config/config.go

pre-install:
	${REINPLACE_CMD} -e 's|"./assets"|"${WWWDIR}"|g' ${WRKSRC}/settings.toml
	${REINPLACE_CMD} -e 's|"speedtest.db"|"/var/db/${PORTNAME}/speedtest.db"|g' ${WRKSRC}/settings.toml

post-install:
	${MKDIR} ${STAGEDIR}${WWWDIR}
	${CP} -a ${WRKSRC}/assets/*.js ${STAGEDIR}${WWWDIR}
	${CP} -a ${WRKSRC}/assets/*.ttf ${STAGEDIR}${WWWDIR}
	${MKDIR} ${STAGEDIR}${ETCDIR}
	${INSTALL_DATA} ${WRKSRC}/settings.toml ${STAGEDIR}${ETCDIR}/settings.toml.sample
	${MKDIR} ${STAGEDIR}/var/db/${PORTNAME}
	${MKDIR} ${STAGEDIR}/var/run/${PORTNAME}

post-install-EXAMPLES-on:
	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
	${CP} -a ${WRKSRC}/assets/*.html ${STAGEDIR}${EXAMPLESDIR}

.include <bsd.port.mk>