From 7f1364099ec272839d6b7370750b55988debb664 Mon Sep 17 00:00:00 2001 From: Vitaly Potyarkin Date: Thu, 27 Apr 2023 15:20:21 +0000 Subject: [PATCH] Use upstream compiler for linux/riscv64 and freebsd/riscv64 Close #149 --- Dockerfile.riscv | 23 ----------------------- test_crosscompile.sh | 9 ++------- ztypes_freebsd_riscv64.go | 13 +++++++++++++ 3 files changed, 15 insertions(+), 30 deletions(-) delete mode 100644 Dockerfile.riscv create mode 100644 ztypes_freebsd_riscv64.go diff --git a/Dockerfile.riscv b/Dockerfile.riscv deleted file mode 100644 index 7a30c94..0000000 --- a/Dockerfile.riscv +++ /dev/null @@ -1,23 +0,0 @@ -# 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 47e8b10..205020e 100755 --- a/test_crosscompile.sh +++ b/test_crosscompile.sh @@ -25,9 +25,9 @@ cross() { set -e -cross linux amd64 386 arm arm64 ppc64 ppc64le s390x mips mipsle mips64 mips64le +cross linux amd64 386 arm arm64 ppc64 ppc64le s390x mips mipsle mips64 mips64le riscv64 cross darwin amd64 arm64 -cross freebsd amd64 386 arm arm64 +cross freebsd amd64 386 arm arm64 riscv64 cross netbsd amd64 386 arm arm64 cross openbsd amd64 386 arm arm64 cross dragonfly amd64 @@ -45,10 +45,6 @@ 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" @@ -57,7 +53,6 @@ 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" diff --git a/ztypes_freebsd_riscv64.go b/ztypes_freebsd_riscv64.go new file mode 100644 index 0000000..b3c5440 --- /dev/null +++ b/ztypes_freebsd_riscv64.go @@ -0,0 +1,13 @@ +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs types_freebsd.go + +package pty + +const ( + _C_SPECNAMELEN = 0x3f +) + +type fiodgnameArg struct { + Len int32 + Buf *byte +}