summaryrefslogtreecommitdiff
path: root/www/rustypaste/Makefile
blob: 08d9fa422989a8c90d84464645af820705d7e712 (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
PORTNAME=	rustypaste
DISTVERSIONPREFIX=	v
DISTVERSION=	0.11.1
CATEGORIES=	www

MAINTAINER=	DtxdF@disroot.org
COMMENT=	Minimal file upload/pastebin service
WWW=		https://blog.orhun.dev/blazingly-fast-file-sharing/

LICENSE=	MIT
LICENSE_FILE=	${WRKSRC}/LICENSE

LIB_DEPENDS=	libzstd.so:archivers/zstd

USES=		cargo
USE_GITHUB=	yes
GH_ACCOUNT=	orhun
USE_RC_SUBR=	${PORTNAME}

CARGO_FEATURES=	--no-default-features

SUB_LIST+=	USER="${USERS:[0]}"

USERS=		${PORTNAME}
GROUPS=		${PORTNAME}

PLIST_SUB+=	GROUP="${GROUPS:[0]}" \
		USER="${USERS:[0]}"

OPTIONS_DEFINE=		SHUTTLE
OPTIONS_DEFAULT=	OPENSSL
OPTIONS_RADIO=		TLS
OPTIONS_RADIO_TLS=	OPENSSL RUSTLS

OPENSSL_DESC=	Use distro OpenSSL (binary size is reduced ~20%)
RUSTLS_DESC=	Use modern TLS library in Rust
SHUTTLE_DESC=	Enable an entry point for deploying on Shuttle

OPENSSL_USES=	ssl

OPENSSL_VARS=		CARGO_FEATURES+=openssl
RUSTLS_VARS=		CARGO_FEATURES+=rustls
SHUTTLE_BUILD_DEPENDS=	protoc:devel/protobuf
SHUTTLE_VARS=		CARGO_FEATURES+=shuttle

UPLOAD_PATH=	/var/db/${PORTNAME}

post-patch:
	@${REINPLACE_CMD} -e '/^upload_path[[:space:]]*=/s#=.*#= "${UPLOAD_PATH}"#' ${WRKSRC}/config.toml

post-install:
	${MKDIR} ${STAGEDIR}${ETCDIR}
	${MKDIR} ${STAGEDIR}/${UPLOAD_PATH}
	${ECHO_CMD} 'CONFIG="${ETCDIR}/${PORTNAME}.toml"' > ${STAGEDIR}${ETCDIR}/${PORTNAME}.env.sample
	${CP} ${WRKSRC}/config.toml ${STAGEDIR}${ETCDIR}/${PORTNAME}.toml.sample
	${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/${PORTNAME}

.include <bsd.port.mk>