Changeset View
Changeset View
Standalone View
Standalone View
lang/go/Makefile
# Created by: Devon H. O'Dell <devon.odell@gmail.com> | # Created by: Devon H. O'Dell <devon.odell@gmail.com> | ||||
# $FreeBSD$ | # $FreeBSD$ | ||||
PORTNAME= go | PORTNAME= go | ||||
PORTVERSION= 1.14 | PORTVERSION= 1.14 | ||||
PORTEPOCH= 1 | PORTEPOCH= 1 | ||||
CATEGORIES= lang | CATEGORIES= lang | ||||
MASTER_SITES= https://golang.org/dl/ | MASTER_SITES= https://golang.org/dl/ \ | ||||
DISTNAME= go${PORTVERSION}.src | https://github.com/dmgk/go-bootstrap/releases/download/${BOOTSTRAP_TAG}/:bootstrap \ | ||||
LOCAL/dmgk:bootstrap | |||||
DISTFILES= go${PORTVERSION}.src.tar.gz \ | |||||
go-${OPSYS:tl}-${GOARCH_${ARCH}}${GOARM_${ARCH}}-${BOOTSTRAP_TAG}.tar.xz:bootstrap | |||||
MAINTAINER= jlaffaye@FreeBSD.org | MAINTAINER= jlaffaye@FreeBSD.org | ||||
COMMENT= Go programming language | COMMENT= Go programming language | ||||
LICENSE= BSD3CLAUSE | LICENSE= BSD3CLAUSE | ||||
LICENSE_FILE= ${WRKSRC}/LICENSE | |||||
BUILD_DEPENDS= go14>=1.4:lang/go14 | .ifdef QEMU_EMULATING | ||||
IGNORE= fails to build with qemu-user-static | |||||
.endif | |||||
ONLY_FOR_ARCHS= aarch64 amd64 armv6 armv7 i386 | |||||
RUN_DEPENDS= ${RUN_DEPENDS_${ARCH}} | |||||
# ld.bfd from devel/binutils is needed for working cgo on aarch64 | |||||
RUN_DEPENDS_aarch64= binutils>0:devel/binutils | |||||
TEST_DEPENDS= ${TEST_DEPENDS_${ARCH}} | |||||
TEST_DEPENDS_aarch64= binutils>0:devel/binutils | |||||
USES= shebangfix | USES= shebangfix | ||||
SHEBANG_LANG= sh perl | |||||
SHEBANG_FILES= misc/wasm/go_js_wasm_exec \ | SHEBANG_FILES= misc/wasm/go_js_wasm_exec \ | ||||
src/net/http/cgi/testdata/test.cgi | src/net/http/cgi/testdata/test.cgi | ||||
SHEBANG_GLOB= *.bash *.pl *.sh | SHEBANG_GLOB= *.bash *.pl *.sh | ||||
sh_OLD_CMD= /bin/bash "/usr/bin/env bash" | sh_OLD_CMD= /bin/bash "/usr/bin/env bash" | ||||
sh_CMD= ${SH} | sh_CMD= ${SH} | ||||
WRKSRC= ${WRKDIR}/go | |||||
ONLY_FOR_ARCHS= i386 amd64 armv6 armv7 | |||||
CONFLICTS_INSTALL= go-devel | CONFLICTS_INSTALL= go-devel | ||||
# Upstream archive contains files with UTF-8 names | |||||
EXTRACT_CMD= ${SETENV} LC_ALL=en_US.UTF-8 ${TAR} | |||||
WRKSRC= ${WRKDIR}/go | |||||
OPTIONS_DEFINE_i386= GO387 | OPTIONS_DEFINE_i386= GO387 | ||||
GO387_DESC= Do not generate code with SSE2 (for old x86 CPU) | GO387_DESC= Do not generate code with SSE2 (for old x86 CPU) | ||||
.include <bsd.port.pre.mk> | GO387_VARS= GO386=387 | ||||
.if ${ARCH} == i386 | BINARIES= go gofmt | ||||
GOARCH=386 | BOOTSTRAP_TAG= go1.14beta1 | ||||
mikael: Do you plan to regenerate the bootstrap based on a release version? | |||||
Done Inline ActionsYes, but I'd like to get this committed first. After that, I'll update both Go ports, and there's also https://reviews.freebsd.org/D23063 that was waiting for go1.14 dmgk: Yes, but I'd like to get this committed first. After that, I'll update both Go ports, and… | |||||
.elif ${ARCH} == "amd64" | |||||
GOARCH=amd64 | |||||
.elif ${ARCH} == armv6 || ${ARCH} == armv7 | |||||
GOARCH=arm | |||||
GOARM=${ARCH:C/armv//} | |||||
.else | |||||
IGNORE= unknown arch ${ARCH} | |||||
.endif | |||||
.ifdef QEMU_EMULATING | GOARCH_aarch64= arm64 | ||||
IGNORE= fails to build with qemu-user-static | GOARCH_amd64= amd64 | ||||
.endif | GOARCH_armv6= arm | ||||
GOARCH_armv7= arm | |||||
GOARCH_i386= 386 | |||||
.if ${PORT_OPTIONS:MGO387} | GOARM_armv6= 6 | ||||
GO386=387 | GOARM_armv7= 7 | ||||
.endif | |||||
PLIST_SUB+= opsys_ARCH=${OPSYS:tl}_${GOARCH} | .include <bsd.port.pre.mk> | ||||
.if ${ARCH} == aarch64 && ${OSVERSION} < 1200000 | |||||
Not Done Inline ActionsThis should be 1200086 You can even put 12.1 since 12.0 is EOL on February 29, 2020 mikael: This should be 1200086
https://github.com/freebsd/freebsd/blob/releng/12.0/sys/sys/param.h#L63… | |||||
IGNORE= aarch64 support requires FreeBSD 12.0 or newer | |||||
.endif | |||||
post-patch: | post-patch: | ||||
@cd ${WRKSRC} && ${FIND} . -name '*.orig' -delete | |||||
@${REINPLACE_CMD} -e 's|^if ulimit -T|false \&\& &|' ${WRKSRC}/src/run.bash | @${REINPLACE_CMD} -e 's|^if ulimit -T|false \&\& &|' ${WRKSRC}/src/run.bash | ||||
pre-build: | |||||
# Check that the running kernel has COMPAT_FREEBSD11 required by lang/go{,-devel} post-ino64 | |||||
@${SETENV} CC="${CC}" OPSYS="${OPSYS}" OSVERSION="${OSVERSION}" WRKDIR="${WRKDIR}" \ | |||||
${SH} ${SCRIPTSDIR}/rust-compat11-canary.sh | |||||
do-build: | do-build: | ||||
cd ${WRKSRC}/src && \ | cd ${WRKSRC}/src ; ${SETENV} \ | ||||
GOROOT=${WRKSRC} GOROOT_FINAL=${PREFIX}/go \ | XDG_CACHE_HOME=${WRKDIR} \ | ||||
GOROOT_BOOTSTRAP=${LOCALBASE}/go14 \ | GOROOT_BOOTSTRAP=${WRKDIR}/go-${OPSYS:tl}-${GOARCH_${ARCH}}${GOARM_${ARCH}}-bootstrap \ | ||||
GOBIN= GOARCH=${GOARCH} GOOS=${OPSYS:tl} \ | GOROOT=${WRKSRC} \ | ||||
GO386=${GO386} GOARM=${GOARM} CGO_ENABLED=1 \ | GOROOT_FINAL=${PREFIX}/go \ | ||||
GOBIN= \ | |||||
GOOS=${OPSYS:tl} \ | |||||
GOARCH=${GOARCH_${ARCH}} \ | |||||
GO386=${GO386} \ | |||||
GOARM=${GOARM_${ARCH}} \ | |||||
${SH} make.bash -v | ${SH} make.bash -v | ||||
${RM} -r ${WRKSRC}/pkg/obj \ | |||||
${WRKSRC}/pkg/bootstrap \ | |||||
${WRKSRC}/pkg/${OPSYS:tl}_${GOARCH}/cmd | |||||
do-install: | do-install: | ||||
@${CP} -a ${WRKSRC} ${STAGEDIR}${PREFIX} | @cd ${WRKSRC} ; \ | ||||
.for f in go gofmt | ${RM} -r .gitattributes .gitignore .github favicon.ico robots.txt \ | ||||
@${LN} -sf ../go/bin/${f} ${STAGEDIR}${PREFIX}/bin/${f} | pkg/obj pkg/bootstrap pkg/${OPSYS:tl}_${GOARCH_${ARCH}}/cmd | ||||
@${MKDIR} ${STAGEDIR}${PREFIX}/go | |||||
@${CP} -a ${WRKSRC}/* ${STAGEDIR}${PREFIX}/go | |||||
.for file in ${BINARIES} | |||||
@${LN} -sf ../go/bin/${file} ${STAGEDIR}${PREFIX}/bin/${file} | |||||
@${ECHO_CMD} bin/${file} >> ${TMPPLIST} | |||||
.endfor | .endfor | ||||
@cd ${STAGEDIR}${PREFIX} && ${FIND} go -type f >> ${TMPPLIST} | |||||
do-test: | do-test: | ||||
cd ${WRKSRC}/src && GOROOT=${WRKSRC} PATH=${WRKSRC}/bin:${PATH} ${SH} run.bash -no-rebuild -banner "" | cd ${WRKSRC}/src && ${SETENV} \ | ||||
Done Inline Actionsdo-install, post-install could be merged and the two .for loops too. tobik: do-install, post-install could be merged and the two `.for` loops too. | |||||
GOROOT=${WRKSRC} \ | |||||
PATH=${WRKSRC}/bin:${PATH} \ | |||||
GOOS=${OPSYS:tl} \ | |||||
GOARCH=${GOARCH_${ARCH}} \ | |||||
GO386=${GO386} \ | |||||
GOARM=${GOARM_${ARCH}} \ | |||||
${SH} run.bash -no-rebuild | |||||
pkg-plist: stage | .if !defined(_GO_MAKESUM_GUARD) | ||||
${RM} ${WRKDIR}/pkg-plist | makesum: | ||||
.for command in go gofmt | ${MAKE} -D_GO_MAKESUM_GUARD makesum ARCH=${ONLY_FOR_ARCHS:O:[1]} DISTINFO_FILE=${DISTINFO_FILE}.tmp | ||||
${ECHO_CMD} bin/${command} >> ${WRKDIR}/pkg-plist | .for arch in ${ONLY_FOR_ARCHS:O:[2..-1]} | ||||
${MAKE} -D_GO_MAKESUM_GUARD makesum ARCH=${arch} DISTINFO_FILE=${DISTINFO_FILE}.${arch} | |||||
${SED} 1d ${DISTINFO_FILE}.${arch} >> ${DISTINFO_FILE}.tmp | |||||
${RM} ${DISTINFO_FILE}.${arch} | |||||
.endfor | .endfor | ||||
cd ${WRKDIR} && ${FIND} go -type f | \ | ${AWK} '!seen[$$0]++' ${DISTINFO_FILE}.tmp > ${DISTINFO_FILE} | ||||
${SED} -e "s/\/${OPSYS:tl}_${GOARCH}\//\/%%opsys_ARCH%%\//g" | \ | ${RM} ${DISTINFO_FILE}.tmp | ||||
${SORT} >> ${WRKDIR}/pkg-plist | .endif | ||||
${CP} ${WRKDIR}/pkg-plist ${.CURDIR}/pkg-plist | |||||
Done Inline ActionsSimilar to rP523409 in lang/rust, ${GREP} ${GOARCH_${arch}:U${arch}} ${DISTINFO_FILE}.${arch} >> ${DISTINFO_FILE}.tmp can be simplified to ${SED} 1d ${DISTINFO_FILE}.${arch} >> ${DISTINFO_FILE}.tmp. The awk command below takes care of removing duplicate lines afterwards. tobik: Similar to rP523409 in lang/rust, `${GREP} ${GOARCH_${arch}:U${arch}} ${DISTINFO_FILE}.${arch}… | |||||
Done Inline ActionsI've fixed this in lang/go-devel, will update this review when go1.14 is out. dmgk: I've fixed this in lang/go-devel, will update this review when go1.14 is out. | |||||
.include <bsd.port.post.mk> | .include <bsd.port.post.mk> |
Do you plan to regenerate the bootstrap based on a release version?