2015-08-14 22:29:47 +02:00
|
|
|
TERMUX_PKG_HOMEPAGE=https://golang.org/
|
|
|
|
TERMUX_PKG_DESCRIPTION="Go programming language compiler"
|
2019-01-21 13:53:58 +01:00
|
|
|
TERMUX_PKG_LICENSE="BSD 3-Clause"
|
2020-12-20 14:16:34 +01:00
|
|
|
TERMUX_PKG_MAINTAINER="@termux"
|
2022-04-13 06:26:04 +02:00
|
|
|
_MAJOR_VERSION=1.18.1
|
2016-02-18 04:41:22 +01:00
|
|
|
# Use the ~ deb versioning construct in the future:
|
2021-08-21 15:58:27 +02:00
|
|
|
TERMUX_PKG_VERSION=3:${_MAJOR_VERSION}
|
2016-08-16 12:53:19 +02:00
|
|
|
TERMUX_PKG_SRCURL=https://storage.googleapis.com/golang/go${_MAJOR_VERSION}.src.tar.gz
|
2022-04-13 06:26:04 +02:00
|
|
|
TERMUX_PKG_SHA256=efd43e0f1402e083b73a03d444b7b6576bb4c539ac46208b63a916b69aca4088
|
2016-08-19 00:25:00 +02:00
|
|
|
TERMUX_PKG_DEPENDS="clang"
|
2019-08-12 17:28:41 +02:00
|
|
|
TERMUX_PKG_NO_STATICSPLIT=true
|
2015-08-14 22:29:47 +02:00
|
|
|
|
2022-03-31 21:02:16 +02:00
|
|
|
termux_step_post_get_source() {
|
|
|
|
. $TERMUX_PKG_BUILDER_DIR/fix-hardcoded-etc-resolv-conf.sh
|
|
|
|
}
|
|
|
|
|
2019-02-08 10:37:29 +01:00
|
|
|
termux_step_make_install() {
|
2016-01-11 01:45:41 +01:00
|
|
|
termux_setup_golang
|
2015-08-14 22:29:47 +02:00
|
|
|
|
2015-08-17 22:58:29 +02:00
|
|
|
TERMUX_GOLANG_DIRNAME=${GOOS}_$GOARCH
|
2015-08-14 22:29:47 +02:00
|
|
|
TERMUX_GODIR=$TERMUX_PREFIX/lib/go
|
2021-09-21 08:38:49 +02:00
|
|
|
local LINKER=/system/bin/linker
|
|
|
|
if [ "${TERMUX_ARCH}" == "x86_64" ] || [ "${TERMUX_ARCH}" == "aarch64" ]; then
|
|
|
|
LINKER+=64
|
|
|
|
fi
|
2015-08-14 22:29:47 +02:00
|
|
|
cd $TERMUX_PKG_SRCDIR/src
|
2019-03-13 21:43:09 +01:00
|
|
|
# Unset PKG_CONFIG to avoid the path being hardcoded into src/cmd/cgo/zdefaultcc.go,
|
|
|
|
# see https://github.com/termux/termux-packages/issues/3505.
|
2015-08-17 22:58:29 +02:00
|
|
|
env CC_FOR_TARGET=$CC \
|
|
|
|
CXX_FOR_TARGET=$CXX \
|
2017-11-24 12:21:01 +01:00
|
|
|
CC=gcc \
|
2015-08-17 22:58:29 +02:00
|
|
|
GO_LDFLAGS="-extldflags=-pie" \
|
2021-09-21 08:38:49 +02:00
|
|
|
GO_LDSO="$LINKER" \
|
2015-12-20 18:02:59 +01:00
|
|
|
GOROOT_BOOTSTRAP=$GOROOT \
|
2016-09-09 15:36:53 +02:00
|
|
|
GOROOT_FINAL=$TERMUX_GODIR \
|
2019-03-13 21:43:09 +01:00
|
|
|
PKG_CONFIG= \
|
2015-08-17 22:58:29 +02:00
|
|
|
./make.bash
|
2015-08-14 22:29:47 +02:00
|
|
|
|
|
|
|
cd ..
|
2019-08-19 01:37:06 +02:00
|
|
|
rm -Rf $TERMUX_GODIR
|
|
|
|
mkdir -p $TERMUX_GODIR/{bin,src,doc,lib,pkg/tool/$TERMUX_GOLANG_DIRNAME,pkg/include,pkg/${TERMUX_GOLANG_DIRNAME}}
|
|
|
|
cp bin/$TERMUX_GOLANG_DIRNAME/{go,gofmt} $TERMUX_GODIR/bin/
|
|
|
|
ln -sfr $TERMUX_GODIR/bin/go $TERMUX_PREFIX/bin/go
|
|
|
|
ln -sfr $TERMUX_GODIR/bin/gofmt $TERMUX_PREFIX/bin/gofmt
|
2015-08-14 22:29:47 +02:00
|
|
|
cp VERSION $TERMUX_GODIR/
|
|
|
|
cp pkg/tool/$TERMUX_GOLANG_DIRNAME/* $TERMUX_GODIR/pkg/tool/$TERMUX_GOLANG_DIRNAME/
|
|
|
|
cp -Rf src/* $TERMUX_GODIR/src/
|
2018-02-11 22:00:30 +01:00
|
|
|
cp -Rf doc/* $TERMUX_GODIR/doc/
|
2015-08-14 22:29:47 +02:00
|
|
|
cp pkg/include/* $TERMUX_GODIR/pkg/include/
|
2016-08-19 00:25:00 +02:00
|
|
|
cp -Rf lib/* $TERMUX_GODIR/lib
|
2017-02-17 20:09:31 +01:00
|
|
|
cp -Rf pkg/${TERMUX_GOLANG_DIRNAME}/* $TERMUX_GODIR/pkg/${TERMUX_GOLANG_DIRNAME}/
|
2020-09-04 10:18:23 +02:00
|
|
|
cp -Rf misc/ $TERMUX_GODIR/
|
2015-08-14 22:29:47 +02:00
|
|
|
}
|
2015-08-19 13:50:30 +02:00
|
|
|
|
2019-02-08 10:37:29 +01:00
|
|
|
termux_step_post_massage() {
|
2015-08-19 13:50:30 +02:00
|
|
|
find . -path '*/testdata*' -delete
|
|
|
|
}
|