Commit 34af8260 authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

Make go bootstrap within building VM to avoid issues with the host

parent b09bf6d1
current_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
temporary: temporary:
dd if=/dev/zero of=swap bs=1048576 count=1024 dd if=/dev/zero of=swap bs=1048576 count=1024
chmod 600 swap chmod 600 swap
...@@ -8,22 +6,44 @@ temporary: ...@@ -8,22 +6,44 @@ temporary:
mkdir tmp mkdir tmp
mount --bind tmp /tmp mount --bind tmp /tmp
mkdir -p /tmp/gocache mkdir -p /tmp/gocache
tar xf go1.4-bootstrap-20171003.tar.gz
patch -Np1 -d go < go1.4-aarch64.patch
cd go/src && ./make.bash
mv go go1.4
tar xf go1.17.7.src.tar.gz
if [ "$(HOSTTYPE)" = "aarch64" ]; then \
cd go/src && GOROOT_BOOTSTRAP=$(CURDIR)/go1.4 GOCACHE=/tmp/gocache GOOS=linux GOARCH=arm64 GOPATH=$(CURDIR)/go ./bootstrap.bash ; \
rm -rf $(CURDIR)/go-linux-arm64-bootstrap ; \
elif [ "$(HOSTTYPE)" = "x86_64" ]; then \
ln -s /lib /lib64 ; \
cd go/src && GOROOT_BOOTSTRAP=$(CURDIR)/go1.4 GOCACHE=/tmp/gocache GOOS=linux GOARCH=amd64 GOPATH=$(CURDIR)/go CGO_CFLAGS=-mno-adx ./bootstrap.bash ; \
rm -rf /lib64 ; \
rm -rf $(CURDIR)/go-linux-amd64-bootstrap ; \
else \
cd go/src && GOROOT_BOOTSTRAP=$(CURDIR)/go1.4 GOCACHE=/tmp/gocache GOOS=linux GOARCH=arm GOPATH=$(CURDIR)/go ./bootstrap.bash ; \
rm -rf $(CURDIR)/go-linux-arm-bootstrap ; \
fi
rm -rf go1.4
rm -rf go
tar xf go1.17.7.src.tar.gz tar xf go1.17.7.src.tar.gz
if [ "$(HOSTTYPE)" = "aarch64" ]; then \ if [ "$(HOSTTYPE)" = "aarch64" ]; then \
tar xf go-linux-arm64-bootstrap.tbz ; \ tar xf go-linux-arm64-bootstrap.tbz ; \
cd go/src && GOROOT_BOOTSTRAP=$(current_dir)go-linux-arm64-bootstrap GOCACHE=/tmp/gocache ./all.bash ; \ cd go/src && GOROOT_BOOTSTRAP=$(CURDIR)/go-linux-arm64-bootstrap GOCACHE=/tmp/gocache ./all.bash ; \
rm -rf $(current_dir)go-linux-arm64-bootstrap ; \ rm -rf $(CURDIR)/go-linux-arm64-bootstrap ; \
elif [ "$(HOSTTYPE)" = "x86_64" ]; then \ elif [ "$(HOSTTYPE)" = "x86_64" ]; then \
tar xf go-linux-amd64-bootstrap.tbz ; \ tar xf go-linux-amd64-bootstrap.tbz ; \
ln -s /lib /lib64 ; \ ln -s /lib /lib64 ; \
cd go/src && GOROOT_BOOTSTRAP=$(current_dir)go-linux-amd64-bootstrap GOCACHE=/tmp/gocache ./all.bash ; \ cd go/src && GOROOT_BOOTSTRAP=$(CURDIR)/go-linux-amd64-bootstrap GOCACHE=/tmp/gocache ./all.bash ; \
rm -rf /lib64 ; \ rm -rf /lib64 ; \
rm -rf $(current_dir)go-linux-amd64-bootstrap ; \ rm -rf $(CURDIR)/go-linux-amd64-bootstrap ; \
else \ else \
tar xf go-linux-arm-bootstrap.tbz ; \ tar xf go-linux-arm-bootstrap.tbz ; \
cd go/src && GOROOT_BOOTSTRAP=$(current_dir)go-linux-arm-bootstrap GOCACHE=/tmp/gocache ./all.bash ; \ cd go/src && GOROOT_BOOTSTRAP=$(CURDIR)/go-linux-arm-bootstrap GOCACHE=/tmp/gocache ./all.bash ; \
rm -rf $(current_dir)go-linux-arm-bootstrap ; \ rm -rf $(CURDIR)/go-linux-arm-bootstrap ; \
fi fi
rm -rf /tmp/gocache rm -rf /tmp/gocache
umount /tmp umount /tmp
rm -rf tmp rm -rf tmp
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment