Build amazon-ssm-agent directly from the port Makefile rather than recursing

into the makefile distributed with the source code.  In particular, this
should fix the build on i386, where it is currently broken due to amd64
being hard-coded as the build architecture.  Numerous other cleanups to the
build. [1]

Change LICENSE and remove subsidiary variables, as Amazon has relicensed
this from the "Amazon" license to Apache 2.0.

Submitted by:	swills [1]
This commit is contained in:
Colin Percival 2017-05-30 07:34:06 +00:00
parent 8b1d897ff6
commit a078c4603b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=442051
2 changed files with 15 additions and 43 deletions

View File

@ -2,29 +2,21 @@
PORTNAME= amazon-ssm-agent
PORTVERSION= 2.0.790.0
PORTREVISION= 1
CATEGORIES= sysutils
MAINTAINER= cperciva@FreeBSD.org
COMMENT= Amazon Simple Systems Manager Agent
LICENSE= Amazon
LICENSE_NAME= Amazon Software License
LICENSE= APACHE20
LICENSE_FILE= ${WRKSRC}/LICENSE
LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
BUILD_DEPENDS= bash:shells/bash \
go:lang/go
BUILD_DEPENDS= go:lang/go
RUN_DEPENDS= ${LOCALBASE}/share/certs/ca-root-nss.crt:security/ca_root_nss
USE_GITHUB= yes
GH_ACCOUNT= aws
WRKSRC= ${WRKDIR}/src/github.com/aws/amazon-ssm-agent
USES= gmake
MAKEFILE= makefile
ALL_TARGET= build-freebsd
INSTALL_TARGET= install-freebsd
MAKE_ARGS= SKIP_CHECKSTYLE="YES" DESTDIR=${STAGEDIR}${PREFIX}
GH_SUBDIR= src/github.com/aws/amazon-ssm-agent
PLIST_FILES= etc/amazon/ssm/amazon-ssm-agent.json.template \
etc/amazon/ssm/seelog_unix.xml.template \
@ -32,8 +24,16 @@ PLIST_FILES= etc/amazon/ssm/amazon-ssm-agent.json.template \
USE_RC_SUBR= amazon-ssm-agent
post-extract:
${MKDIR} ${WRKDIR}/src/github.com/aws
${MV} ${WRKDIR}/${PORTNAME}-${PORTVERSION:S/v//} ${WRKSRC}
do-build:
@cd ${WRKSRC}; \
${SETENV} GOPATH=${WRKSRC}:${WRKSRC}/vendor CGO_ENABLED=0 \
go build -ldflags "-s -w" -o amazon-ssm-agent \
agent/agent.go agent/agent_unix.go agent/agent_parser.go
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/amazon-ssm-agent ${STAGEDIR}${PREFIX}/sbin
${MKDIR} ${STAGEDIR}${PREFIX}/etc/amazon/ssm
${INSTALL_DATA} ${WRKSRC}/amazon-ssm-agent.json.template ${STAGEDIR}${PREFIX}/etc/amazon/ssm
${INSTALL_DATA} ${WRKSRC}/seelog_unix.xml ${STAGEDIR}${PREFIX}/etc/amazon/ssm/seelog_unix.xml.template
.include <bsd.port.mk>

View File

@ -1,28 +0,0 @@
--- makefile.orig 2017-05-22 17:12:08.000000000 +0000
+++ makefile 2017-05-28 06:54:07.291237000 +0000
@@ -35,8 +35,10 @@
export BRAZIL_BUILD
checkstyle::
+ifndef SKIP_CHECKSTYLE
# Run checkstyle script
$(BGO_SPACE)/Tools/src/checkstyle.sh
+endif
coverage:: build-linux
$(BGO_SPACE)/Tools/src/coverage.sh github.com/aws/amazon-ssm-agent/agent/...
@@ -121,6 +123,14 @@
GOOS=freebsd GOARCH=amd64 $(GO_BUILD) -ldflags "-s -w" -o $(BGO_SPACE)/bin/freebsd_amd64/ssm-cli -v \
$(BGO_SPACE)/agent/cli-main/cli-main.go
+.PHONY: install-freebsd
+install-freebsd:
+ @echo "Install for freebsd agent"
+ install -m 555 $(BGO_SPACE)/bin/freebsd_amd64/amazon-ssm-agent $(DESTDIR)$(PREFIX)/sbin/
+ mkdir -p $(DESTDIR)$(PREFIX)/etc/amazon/ssm
+ install -m 644 $(BGO_SPACE)/bin/amazon-ssm-agent.json.template $(DESTDIR)$(PREFIX)/etc/amazon/ssm
+ install -m 644 $(BGO_SPACE)/bin/seelog_unix.xml $(DESTDIR)$(PREFIX)/etc/amazon/ssm/seelog_unix.xml.template
+
.PHONY: build-darwin
build-darwin: checkstyle copy-src pre-build
@echo "Rebuild for darwin agent"