aboutsummaryrefslogtreecommitdiffstats
path: root/lang/go/Makefile
blob: 709e420cfd51c7733868e306c47bd0824d85caaf (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
# Created by: Devon H. O'Dell <devon.odell@gmail.com>
# $FreeBSD$

PORTNAME=   go
PORTVERSION=    1.7
PORTEPOCH=  1
CATEGORIES= lang
MASTER_SITES=   http://golang.org/dl/
DISTNAME=   go${PORTVERSION}.src

MAINTAINER= jlaffaye@FreeBSD.org
COMMENT=    Go programming language

LICENSE=    BSD3CLAUSE

BUILD_DEPENDS=  go14>=1.4:lang/go14

USES=       shebangfix
SHEBANG_LANG=   sh
SHEBANG_FILES=  ${WRKSRC}/src/*.bash \
        ${WRKSRC}/doc/articles/wiki/*.bash

sh_OLD_CMD= "/usr/bin/env bash"
sh_CMD=     ${SH}

WRKSRC=     ${WRKDIR}/go
ONLY_FOR_ARCHS= i386 amd64 armv6

.include <bsd.port.pre.mk>

.if ${ARCH} == "i386"
GOARCH=386
.elif ${ARCH} == "amd64"
GOARCH=amd64
.elif ${ARCH} == "armv6"
GOARCH=arm
.else
IGNORE=     unknown arch ${ARCH}
.endif

PLIST_SUB+= opsys_ARCH=${OPSYS:tl}_${GOARCH}

.if ${OPSYS} == FreeBSD && (${OSVERSION} >= 1100000)
EXTRA_PATCHES+= ${FILESDIR}/struct-if_data-patch
.endif

post-patch:
    @cd ${WRKSRC} && ${FIND} . -name '*.orig' -delete

do-build:
    cd ${WRKSRC}/src && \
        CC=${CC} \
        GOROOT=${WRKSRC} GOROOT_FINAL=${PREFIX}/go \
        GOROOT_BOOTSTRAP=${LOCALBASE}/go14 \
        GOBIN= GOARCH=${GOARCH} GOOS=${OPSYS:tl} \
        GO386=387 \
        ${SH} make.bash

do-install:
    @${CP} -a ${WRKSRC} ${STAGEDIR}${PREFIX}
.for f in go gofmt
    @${LN} -sf ../go/bin/${f} ${STAGEDIR}${PREFIX}/bin/${f}
.endfor

regression-test: build
    cd ${WRKSRC}/src && GOROOT=${WRKSRC} PATH=${WRKSRC}/bin:${PATH} ${SH} run.bash --no-rebuild --banner

.include <bsd.port.post.mk>