summaryrefslogtreecommitdiff
path: root/net-p2p/bitmark/Makefile
blob: 757b746e5b614540ae06a50692e00b6e83a72350 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157

PORTNAME=	bitmark
DISTVERSIONPREFIX=	v
DISTVERSION=	0.13.2
CATEGORIES=	net-p2p

MAINTAINER=	hsw@bitmark.com
COMMENT?=	Bitmark distributed property system programs

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

CONFLICTS?=	bitmark-{daemon,cli,recorder,dumper}
SLAVE_PORT?=	no

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

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

.include <bsd.port.options.mk>

USE_GITHUB=	yes
GH_ACCOUNT=	bitmark-inc:DEFAULT
GH_PROJECT=	bitmarkd
GH_TUPLE=	bitmark-inc:certgen:v0.1.1:bitmark_inc_certgen/vendor/github.com/bitmark-inc/certgen \
		bitmark-inc:exitwithstatus:v0.1.2:bitmark_inc_exitwithstatus/vendor/github.com/bitmark-inc/exitwithstatus \
		bitmark-inc:getoptions:v0.1.1:bitmark_inc_getoptions/vendor/github.com/bitmark-inc/getoptions \
		bitmark-inc:go-argon2:v0.1.5:bitmark_inc_go_argon2/vendor/github.com/bitmark-inc/go-argon2 \
		bitmark-inc:logger:v0.3.5:bitmark_inc_logger/vendor/github.com/bitmark-inc/logger \
		bitmark-inc:btcd:16c0ce95d92a:btcsuite_btcd/vendor/github.com/btcsuite/btcd \
		btcsuite:btclog:84c8d2346e9f:btcsuite_btclog/vendor/github.com/btcsuite/btclog \
		btcsuite:btcutil:9e5f4b9a998d:btcsuite_btcutil/vendor/github.com/btcsuite/btcutil \
		btcsuite:go-socks:4720035b7bfd:btcsuite_go_socks/vendor/github.com/btcsuite/go-socks \
		cihub:seelog:f561c5e57575:cihub_seelog/vendor/github.com/cihub/seelog \
		cpuguy83:go-md2man:v2.0.0:cpuguy83_go_md2man/vendor/github.com/cpuguy83/go-md2man/v2 \
		davecgh:go-spew:v1.1.0:davecgh_go_spew/vendor/github.com/davecgh/go-spew \
		fsnotify:fsnotify:v1.4.9:fsnotify_fsnotify/vendor/github.com/fsnotify/fsnotify \
		go-yaml:yaml:v2.2.2:go_yaml_yaml/vendor/gopkg.in/yaml.v2 \
		golang:crypto:f7b00557c8c4:golang_crypto/vendor/golang.org/x/crypto \
		golang:net:aa69164e4478:golang_net/vendor/golang.org/x/net \
		golang:snappy:2e65f85255db:golang_snappy/vendor/github.com/golang/snappy \
		golang:sync:112230192c58:golang_sync/vendor/golang.org/x/sync \
		golang:sys:aed5e4c7ecf9:golang_sys/vendor/golang.org/x/sys \
		golang:time:555d28b269f0:golang_time/vendor/golang.org/x/time \
		miekg:dns:v1.1.28:miekg_dns/vendor/github.com/miekg/dns \
		mitchellh:mapstructure:v1.1.2:mitchellh_mapstructure/vendor/github.com/mitchellh/mapstructure \
		patrickmn:go-cache:v2.1.0:patrickmn_go_cache/vendor/github.com/patrickmn/go-cache \
		pebbe:zmq4:v1.2.0:pebbe_zmq4/vendor/github.com/pebbe/zmq4 \
		russross:blackfriday:v2.0.1:russross_blackfriday/vendor/github.com/russross/blackfriday/v2 \
		shurcooL:sanitized_anchor_name:v1.0.0:shurcool_sanitized_anchor_name/vendor/github.com/shurcooL/sanitized_anchor_name \
		syndtr:goleveldb:v1.0.0:syndtr_goleveldb/vendor/github.com/syndtr/goleveldb \
		urfave:cli:v1.22.3:urfave_cli/vendor/github.com/urfave/cli \
		yuin:gluamapper:d836955830e7:yuin_gluamapper/vendor/github.com/yuin/gluamapper \
		yuin:gopher-lua:ab39c6098bdb:yuin_gopher_lua/vendor/github.com/yuin/gopher-lua

SLAVE_PORT?=	NO

VAR_DIR=	/var

.if ${PORT_OPTIONS:MDAEMON}
USERS+=		bitmark
GROUPS+=	bitmark
BITMARKD_RUN=	${VAR_DIR}/run/bitmarkd
BITMARKD_DATA=	${VAR_DIR}/lib/bitmarkd
SERVER_LIST+=	bitmarkd
USE_RC_SUBR+=	bitmarkd
SUB_LIST+=	BITMARKD_DATA=${BITMARKD_DATA} \
		BITMARKD_GROUP=bitmark \
		BITMARKD_RUN=${BITMARKD_RUN} \
		BITMARKD_USER=bitmark
PLIST_FILES+=	"etc/bitmarkd.conf.sub"
.endif

.if ${PORT_OPTIONS:MRECORDER}
USERS+=		bitmark-recorder
GROUPS+=	bitmark-recorder
RECORDERD_RUN=	${VAR_DIR}/run/recorderd
RECORDERD_DATA=	${VAR_DIR}/lib/recorderd
SERVER_LIST+=	recorderd
USE_RC_SUBR+=	recorderd
SUB_LIST+=	RECORDERD_DATA=${RECORDERD_DATA} \
		RECORDERD_GROUP=bitmark-recorder \
		RECORDERD_RUN=${RECORDERD_RUN} \
		RECORDERD_USER=bitmark-recorder
.endif

.if ${PORT_OPTIONS:MCLI}
COMMAND_LIST+=	bitmark-cli
.endif
.if ${PORT_OPTIONS:MDUMPER}
COMMAND_LIST+=	bitmark-dumpdb
.endif

.for command in ${SERVER_LIST}
PLIST_FILES+=	"@sample etc/${command}.conf.sample" \
		etc/newsyslog.conf.d/${command}.conf \
		etc/syslog.d/${command}.conf \
		sbin/${command}
.endfor
.for command in ${COMMAND_LIST}
PLIST_FILES+=	bin/${command}
.endfor
.if ${PORT_OPTIONS:MDAEMON}
PLIST_FILES+=	"@dir(bitmark,bitmark,) ${BITMARKD_DATA}" \
		"@dir(bitmark,bitmark,) ${BITMARKD_RUN}"
.endif
.if ${PORT_OPTIONS:MRECORDER}
PLIST_FILES+=	"@dir(bitmark-recorder,bitmark-recorder,) ${RECORDERD_DATA}" \
		"@dir(bitmark-recorder,bitmark-recorder,) ${RECORDERD_RUN}"
.endif
.if ${PORT_OPTIONS:MDAEMON} || ${PORT_OPTIONS:MRECORDER}
PLIST_FILES+=	"@dir ${VAR_DIR}/lib"
.endif

GO_BUILDFLAGS+=	-ldflags="-X main.version=${DISTVERSION}"

.for command in ${SERVER_LIST} ${COMMAND_LIST}
GO_TARGET+=	./command/${command}
.endfor

do-install:
.for command in ${SERVER_LIST}
	${INSTALL_PROGRAM} ${WRKDIR}/bin/${command} ${STAGEDIR}${PREFIX}/sbin
	${INSTALL_DATA} ${WRKSRC}/command/${command}/${command}.conf.sample ${STAGEDIR}${PREFIX}/etc/${command}.conf.sample
	${MKDIR} ${STAGEDIR}${PREFIX}/etc/syslog.d
	${MKDIR} ${STAGEDIR}${PREFIX}/etc/newsyslog.conf.d
	${INSTALL_DATA} ${FILESDIR}/${command}.syslog ${STAGEDIR}${PREFIX}/etc/syslog.d/${command}.conf
	${INSTALL_DATA} ${FILESDIR}/${command}.newsyslog ${STAGEDIR}${PREFIX}/etc/newsyslog.conf.d/${command}.conf
.endfor
.for command in ${COMMAND_LIST}
	${INSTALL_PROGRAM} ${WRKDIR}/bin/${command} ${STAGEDIR}${PREFIX}/bin
.endfor
.if ${PORT_OPTIONS:MDAEMON}
	${INSTALL_DATA} ${WRKSRC}/command/bitmarkd/bitmarkd.conf.sub ${STAGEDIR}${PREFIX}/etc/bitmarkd.conf.sub
	${MKDIR} ${STAGEDIR}${BITMARKD_RUN}
	${MKDIR} ${STAGEDIR}${BITMARKD_DATA}
.endif
.if ${PORT_OPTIONS:MRECORDER}
	${MKDIR} ${STAGEDIR}${RECORDERD_RUN}
	${MKDIR} ${STAGEDIR}${RECORDERD_DATA}
.endif

.include <bsd.port.mk>