summaryrefslogtreecommitdiff
path: root/net-p2p/bitmark/Makefile
blob: 548aa05bbe72803c285cd1c9e5dbfde9d35351a1 (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
PORTNAME=	bitmark
DISTVERSIONPREFIX=	v
DISTVERSION=	0.15.6
PORTREVISION=	5
CATEGORIES=	net-p2p

MAINTAINER=	hsw@bitmark.com
COMMENT?=	Bitmark distributed property system programs
WWW=		https://github.com/bitmark-inc/bitmarkd

LICENSE=	ISCL
LICENSE_FILE=	${WRKSRC}/LICENSE

ONLY_FOR_ARCHS=	aarch64 amd64 armv6 armv7 i386
ONLY_FOR_ARCHS_REASON=	depends on go which is not supported in this architecture

LIB_DEPENDS=	libargon2.so:security/libargon2 \
		libzmq.so:net/libzmq4

USES=		go:modules pkgconfig cpe
CPE_VENDOR=	bitmark-inc
CPE_PRODUCT=	bitmarkd
CONFLICTS?=	bitmark-cli bitmark-daemon bitmark-recorder

GO_MODULE=	github.com/bitmark-inc/bitmarkd
GO_BUILDFLAGS+=	-ldflags="-X main.version=${DISTVERSION}"

OPTIONS_DEFINE=		CLI DAEMON DUMPER RECORDER
OPTIONS_DEFAULT?=	CLI DAEMON RECORDER
OPTIONS_SUB=		yes

CLI_DESC=	Command line program to access bitmarks
DAEMON_DESC=	Main bitmarkd node server
DUMPER_DESC=	Utility to dump bitmarkd levelDB
RECORDER_DESC=	Hashing program

CLI_VARS=		GO_TARGET+=./command/bitmark-cli
DAEMON_USE=		RC_SUBR=bitmarkd
DAEMON_SUB_LIST=	BITMARKD_DATA=/var/lib/bitmarkd \
			BITMARKD_GROUP=bitmark \
			BITMARKD_RUN=/var/run/bitmarkd \
			BITMARKD_USER=bitmark
DAEMON_VARS=		GO_TARGET+=./command/bitmarkd \
			GROUPS+=bitmark \
			USERS+=bitmark
DUMPER_VARS=		GO_TARGET+=./command/bitmark-dumpdb
RECORDER_USE=		RC_SUBR=recorderd
RECORDER_SUB_LIST=	RECORDERD_DATA=/var/lib/recorderd \
			RECORDERD_GROUP=bitmark-recorder \
			RECORDERD_RUN=/var/run/recorderd \
			RECORDERD_USER=bitmark-recorder
RECORDER_VARS=		GO_TARGET+=./command/recorderd \
			GROUPS+=bitmark-recorder \
			RECORDERD_DATA=/var/lib/recorderd \
			RECORDERD_RUN=/var/run/recorderd \
			USERS+=bitmark-recorder

.include <bsd.port.options.mk>

.if empty(PORT_OPTIONS)
IGNORE=		at least one option must be enabled
.endif

.if ${PORT_OPTIONS:MDAEMON} || ${PORT_OPTIONS:MRECORDER}
PLIST_SUB+=	DAEMONRECORDER=""
.else
PLIST_SUB+=	DAEMONRECORDER="@comment "
.endif

do-install:

do-install-CLI-on:
	${INSTALL_PROGRAM} ${WRKDIR}/bin/bitmark-cli ${STAGEDIR}${PREFIX}/bin

do-install-DAEMON-on:
	@${MKDIR} ${STAGEDIR}/var/lib/bitmarkd
	@${MKDIR} ${STAGEDIR}/var/run/bitmarkd
	@${MKDIR} ${STAGEDIR}${PREFIX}/etc/newsyslog.conf.d
	@${MKDIR} ${STAGEDIR}${PREFIX}/etc/syslog.d
	${INSTALL_DATA} ${FILESDIR}/bitmarkd.newsyslog ${STAGEDIR}${PREFIX}/etc/newsyslog.conf.d/bitmarkd.conf
	${INSTALL_DATA} ${FILESDIR}/bitmarkd.syslog ${STAGEDIR}${PREFIX}/etc/syslog.d/bitmarkd.conf
	${INSTALL_DATA} ${WRKSRC}/command/bitmarkd/bitmarkd.conf.sample ${STAGEDIR}${PREFIX}/etc/bitmarkd.conf.sample
	${INSTALL_DATA} ${WRKSRC}/command/bitmarkd/bitmarkd.conf.sub ${STAGEDIR}${PREFIX}/etc/bitmarkd.conf.sub
	${INSTALL_PROGRAM} ${WRKDIR}/bin/bitmarkd ${STAGEDIR}${PREFIX}/sbin

do-install-DUMPER-on:
	${INSTALL_PROGRAM} ${WRKDIR}/bin/bitmark-dumpdb ${STAGEDIR}${PREFIX}/bin

do-install-RECORDER-on:
	@${MKDIR} ${STAGEDIR}${RECORDERD_DATA}
	@${MKDIR} ${STAGEDIR}${RECORDERD_RUN}
	@${MKDIR} ${STAGEDIR}${PREFIX}/etc/newsyslog.conf.d
	@${MKDIR} ${STAGEDIR}${PREFIX}/etc/syslog.d
	${INSTALL_DATA} ${FILESDIR}/recorderd.newsyslog ${STAGEDIR}${PREFIX}/etc/newsyslog.conf.d/recorderd.conf
	${INSTALL_DATA} ${FILESDIR}/recorderd.syslog ${STAGEDIR}${PREFIX}/etc/syslog.d/recorderd.conf
	${INSTALL_DATA} ${WRKSRC}/command/recorderd/recorderd.conf.sample ${STAGEDIR}${PREFIX}/etc/recorderd.conf.sample
	${INSTALL_PROGRAM} ${WRKDIR}/bin/recorderd ${STAGEDIR}${PREFIX}/sbin

.include <bsd.port.mk>