summaryrefslogtreecommitdiff
path: root/sysutils/nerdctl/Makefile
blob: e7178a5bead556e8a079915792887c10db43f93e (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
PORTNAME=	nerdctl
DISTVERSIONPREFIX=v
DISTVERSION=	2.1.3
CATEGORIES=	sysutils

MAINTAINER=	laurent.chardon@gmail.com
COMMENT=	Docker-compatible CLI for containerd
WWW=		https://github.com/containerd/nerdctl

LICENSE=	APACHE20
LICENSE_FILE=	${WRKSRC}/LICENSE

USES=		go:1.23,modules

USE_GITHUB=	yes
GH_ACCOUNT=	containerd
GH_PROJECT=	${PORTNAME}
GO_MOD_DIST=	github

GO_MODULE=	github.com/containerd/nerdctl/v2
GO_TARGET=	./cmd/${PORTNAME}
GO_BUILDFLAGS=	-ldflags "-s -w -X ${GO_MODULE}/pkg/version.Version=${DISTVERSIONFULL}"

PLIST_FILES=	bin/containerd-rootless.sh \
		bin/containerd-rootless-setuptool.sh \
		bin/nerdctl \
		etc/bash_completion.d/${PORTNAME} \
		share/fish/vendor_completions.d/${PORTNAME}.fish \
		share/zsh/site-functions/_${PORTNAME}

pre-fetch:
	@${MKDIR} ${DISTDIR}/${DIST_SUBDIR}
	[ -e ${DISTDIR}/${DIST_SUBDIR}/go.mod ] || \
		(${FETCH_CMD} ${FETCH_BEFORE_ARGS} \
			https://raw.githubusercontent.com/containerd/nerdctl/v2.1.3/go.mod \
			-o ${DISTDIR}/${DIST_SUBDIR}/go.mod; \
		${REINPLACE_CMD} '/tigron/d' ${DISTDIR}/${DIST_SUBDIR}/go.mod)

post-install:
	${INSTALL_SCRIPT} ${WRKSRC}/extras/rootless/* ${STAGEDIR}${PREFIX}/bin
	@${MKDIR} ${STAGEDIR}${PREFIX}/etc/bash_completion.d
	@${MKDIR} ${STAGEDIR}${PREFIX}/share/fish/vendor_completions.d
	@${MKDIR} ${STAGEDIR}${PREFIX}/share/zsh/site-functions
	@${MKDIR} ${WRKDIR}/tmp
	${STAGEDIR}${PREFIX}/bin/${PORTNAME} --data-root=${WRKDIR}/tmp completion bash > ${STAGEDIR}${PREFIX}/etc/bash_completion.d/${PORTNAME}
	${STAGEDIR}${PREFIX}/bin/${PORTNAME} --data-root=${WRKDIR}/tmp completion fish > ${STAGEDIR}${PREFIX}/share/fish/vendor_completions.d/${PORTNAME}.fish
	${STAGEDIR}${PREFIX}/bin/${PORTNAME} --data-root=${WRKDIR}/tmp completion zsh  > ${STAGEDIR}${PREFIX}/share/zsh/site-functions/_${PORTNAME}

.include <bsd.port.mk>