aboutsummaryrefslogtreecommitdiff
path: root/net/concourse-fly/Makefile
blob: 7cf0bfb5a5e0a6c703a1fa920b158f9ec47d1397 (plain) (blame)
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
PORTNAME=	concourse
PORTVERSION=	6.7.1
PORTREVISION=	9
CATEGORIES=	net sysutils
MASTER_SITES=	LOCAL/dumbbell/concourse/
PKGNAMESUFFIX=	-fly

MAINTAINER=	dumbbell@FreeBSD.org
COMMENT=	CLI for Concourse
WWW=		https://concourse-ci.org/

LICENSE=	APACHE20

USES=		cpe go:modules tar:xz

CPE_VENDOR=	pivotal_software

GO_TARGET=	./cmd/concourse:fly
GO_BUILDFLAGS=	-ldflags="-s -w -X github.com/concourse/concourse.Version=${PORTVERSION}"
CGO_CFLAGS=	-I.

CONFLICTS_INSTALL=	concourse fly # bin/fly

PLIST_FILES=	bin/fly

# The build instructions for `fly` suggest to clone the global Concourse
# repository, which contains many Git submodules, including fly, and
# build from there. So basically:
#
#     git clone --recursive https://github.com/concourse/concourse.git
#     cd concourse/fly
#     go build
#
# Unfortunately, this is difficult to integrate as is with the Ports framework:
#   * Some submodules are hosted on services other than GitHub
#   * Third-party Go dependencies are not Git submodules
#
# We created the `create-src-archive` to create a self-contained
# source archive because the Concourse does not provide one. This
# source archive contains the Git submodules and the third-party Go
# dependencies, fetched using `go mod vendor`.
#
# It is created using the `create-src-archive` target below:
#
#     make create-src-archive
#
# `fly` version is set by default to "0.0.0-dev" in version/Version.go.
# Instead of patching the file, we use a linker flag to set the variable
# to the port's version.

.PHONY: create-src-archive
ARCHIVE_DIR=	${DISTDIR}/concourse-${PORTVERSION}
create-src-archive:
	${RM} -rf ${ARCHIVE_DIR}
	git clone --recursive -b v${PORTVERSION} \
		https://github.com/concourse/concourse.git \
		${ARCHIVE_DIR}
	GOPATH=$$(mktemp concourse-gopath.XXXX) && \
	(cd ${ARCHIVE_DIR} && \
	 ${GO_CMD} mod vendor) && \
	${FIND} "$$GOPATH" -exec ${CHMOD} u+w {} \; && \
	${RM} -rf "$$GOPATH"
	${FIND} ${ARCHIVE_DIR} \( -name ".git*" -o -name "testdata" \) -depth -exec ${RM} -rf {} \;
	${TAR} -cf - -C ${ARCHIVE_DIR:H} ${ARCHIVE_DIR:T} | ${XZ_CMD} > ${ARCHIVE_DIR}.tar.xz
	${RM} -rf ${ARCHIVE_DIR}
	${MAKE} makesum

.include <bsd.port.mk>