From 8042b227ecab217df70cd53d5acb05d894485102 Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Thu, 26 Oct 2023 11:23:10 -0400 Subject: [PATCH] Revert riscv removal. --- Dockerfile.riscv | 23 +++++++++++++++++++++++ test_crosscompile.sh | 5 +++++ 2 files changed, 28 insertions(+) create mode 100644 Dockerfile.riscv diff --git a/Dockerfile.riscv b/Dockerfile.riscv new file mode 100644 index 0000000..7a30c94 --- /dev/null +++ b/Dockerfile.riscv @@ -0,0 +1,23 @@ +# NOTE: Using 1.13 as a base to build the RISCV compiler, the resulting version is based on go1.6. +FROM golang:1.13 + +# Clone and complie a riscv compatible version of the go compiler. +RUN git clone https://review.gerrithub.io/riscv/riscv-go /riscv-go +# riscvdev branch HEAD as of 2019-06-29. +RUN cd /riscv-go && git checkout 04885fddd096d09d4450726064d06dd107e374bf +ENV PATH=/riscv-go/misc/riscv:/riscv-go/bin:$PATH +RUN cd /riscv-go/src && GOROOT_BOOTSTRAP=$(go env GOROOT) ./make.bash +ENV GOROOT=/riscv-go + +# Set the base env. +ENV GOOS=linux GOARCH=riscv CGO_ENABLED=0 GOFLAGS='-v -ldflags=-s -ldflags=-w' + +# Pre compile the stdlib. +RUN go build -a std + +# Add the code to the image. +WORKDIR pty +ADD . . + +# Build the lib. +RUN go build diff --git a/test_crosscompile.sh b/test_crosscompile.sh index 205020e..cff1b7c 100755 --- a/test_crosscompile.sh +++ b/test_crosscompile.sh @@ -45,6 +45,10 @@ if ! hash docker; then return fi +echo2 "Build for linux." +echo2 " - linux/riscv" +docker build -t creack-pty-test -f Dockerfile.riscv . + # Golang dropped support for darwin 32bits since go1.15. Make sure the lib still compile with go1.14 on those archs. echo2 "Build for darwin (32bits)." echo2 " - darwin/386" @@ -53,6 +57,7 @@ echo2 " - darwin/arm" docker build -t creack-pty-test -f Dockerfile.golang --build-arg=GOVERSION=1.14 --build-arg=GOOS=darwin --build-arg=GOARCH=arm . # Run a single test for an old go version. Would be best with go1.0, but not available on Dockerhub. +# Using 1.6 as it is the base version for the RISCV compiler. # Would also be better to run all the tests, not just one, need to refactor this file to allow for specifc archs per version. echo2 "Build for linux - go1.6." echo2 " - linux/amd64"