summaryrefslogtreecommitdiff
path: root/sysutils/amazon-ssm-plugin/Makefile
blob: 21b252ef1eef5300c5471db7ececce9eb55dd1a4 (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=	amazon-ssm-plugin
DISTVERSION=	1.2.398.0
PORTREVISION=	3
CATEGORIES=	sysutils

MAINTAINER=	nork@FreeBSD.org
COMMENT=	Amazon AWS Manages shell experience using SSM APIs
WWW=		https://github.com/aws/session-manager-plugin/

LICENSE=	APACHE20
LICENSE_FILE=	${WRKSRC}/LICENSE

RUN_DEPENDS=	aws:devel/py-awscli@${PY_FLAVOR}

USES=		go python:env
GO_BUILDFLAGS=	-ldflags "-s -w"
GO_TARGET=	src/sessionmanagerplugin-main/main.go:${PREFIX}/bin/session-manager-plugin \
		src/ssmcli-main/main.go:${PREFIX}/bin/ssmcli

USE_GITHUB=	yes
GH_ACCOUNT=	aws
GH_PROJECT=	session-manager-plugin
GH_TAGNAME=	${DISTVERSION}
GH_SUBDIR=	${GH_PROJECT}

PORTDOCS=	NOTICE README.md RELEASENOTES.md THIRD-PARTY VERSION
PLIST_FILES=	${ETCDIR}/sessionmanagerplugin/seelog.xml.template \
		${ETCDIR}/SSMCLI/seelog.xml.template \
		bin/session-manager-plugin \
		bin/ssmcli \
		'@dir /var/log/amazon-ssm-plugin'

LOGDIR=		${DESTDIR}/var/log/${PORTNAME}

OPTIONS_DEFINE=	DOCS

post-extract:
	${MKDIR} ${WRKDIR}/src
	${LN} -s ${WRKSRC} ${GO_WRKSRC}
	${MKDIR} ${WRKSRC}/vendor/src/github.com/aws/session-manager-plugin
	${LN} -s ${WRKSRC}/vendor/src/* ${GO_WRKSRC}/vendor/
	${LN} -s ${WRKSRC}/src          ${GO_WRKSRC}/vendor/github.com/aws/session-manager-plugin/

post-patch:
	${REINPLACE_CMD} -e 's|%%VERSION%%|${DISTVERSION}|' ${WRKSRC}/src/version/version.go
	${REINPLACE_CMD} -e 's|%%ETCDIR%%|${ETCDIR}|g; s|%%LOGDIR%%|${LOGDIR}|g' ${WRKSRC}/seelog_unix.xml
	${REINPLACE_CMD} -e 's|%%ETCDIR%%|${ETCDIR}|g; s|%%LOGDIR%%|${LOGDIR}|g' ${WRKSRC}/src/log/log_unix.go

post-install:
	@${MKDIR} ${STAGEDIR}${LOGDIR} ${STAGEDIR}${ETCDIR}/SSMCLI ${STAGEDIR}${ETCDIR}/sessionmanagerplugin
	${INSTALL_DATA} ${WRKSRC}/seelog_unix.xml ${STAGEDIR}${ETCDIR}/SSMCLI/seelog.xml.template
	${INSTALL_DATA} ${WRKSRC}/seelog_unix.xml ${STAGEDIR}${ETCDIR}/sessionmanagerplugin/seelog.xml.template

post-install-DOCS-on:
	@${MKDIR} ${STAGEDIR}${DOCSDIR}
	cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${STAGEDIR}${DOCSDIR}

.include <bsd.port.mk>