Add crosscopile test script.

Signed-off-by: Guillaume J. Charmes <guillaume@charmes.net>
diff --git a/Dockerfile.riscv b/Dockerfile.riscv
new file mode 100644
index 0000000..476d8f1
--- /dev/null
+++ b/Dockerfile.riscv
@@ -0,0 +1,14 @@
+FROM golang:1.12
+
+# 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
+
+# Make sure we compile.
+WORKDIR pty
+ADD . .
+RUN GOOS=linux GOARCH=riscv go build
diff --git a/test_crosscompile.sh b/test_crosscompile.sh
new file mode 100755
index 0000000..dc32c0f
--- /dev/null
+++ b/test_crosscompile.sh
@@ -0,0 +1,51 @@
+#!/usr/bin/env sh
+
+# Test script checking that all expected os/arch compile properly.
+# Does not actually test the logic, just the compilation so we make sure we don't break code depending on the lib.
+
+echo2() {
+    echo $@ >&2
+}
+
+trap end 0
+end() {
+    [ "$?" = 0 ] && echo2 "Pass." || (echo2 "Fail."; exit 1)
+}
+
+cross() {
+    os=$1
+    shift
+    echo2 "Build for $os."
+    for arch in $@; do
+	echo2 "  - $os/$arch"
+	GOOS=$os GOARCH=$arch go build
+    done
+    echo2
+}
+
+set -e
+
+cross linux     amd64 386 arm arm64 ppc64 ppc64le s390x mips mipsle mips64 mips64le
+cross darwin    amd64 386 arm arm64
+cross freebsd   amd64 386 arm
+cross netbsd    amd64 386 arm
+cross openbsd   amd64 386
+cross dragonfly amd64
+#cross solaris   amd64 # Should work once we merge in #64.
+
+# Not expected to work but should still compile.
+cross windows amd64 386 arm
+
+# TODO: Fix compilation error on openbsd/arm.
+# TODO: Merge the solaris PR.
+
+# Some os/arch require a different compiler. Run in docker.
+if ! hash docker; then
+    # If docker is not present, stop here.
+    return
+fi
+
+#linux/riscv # Should work once we merge #81.
+#echo2 "Build for linux."
+#echo2 "  - linux/riscv"
+#docker build -t test -f Dockerfile.riscv .