Files
webrtc/compile.sh
2023-02-13 21:50:17 -08:00

30 lines
665 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -euo pipefail
# Capn Proto
pushd cereal
git checkout *.capnp
rm -rf gen/go
for f in *.capnp; do
name=$(echo $f | sed 's/.capnp//')
mv $f $f.bak
echo "using Go = import \"/go.capnp\";" > $name.capnp
echo "\$Go.package(\"cereal\");" >> $name.capnp
echo "\$Go.import(\"cereal\");" >> $name.capnp
cat $f.bak >> $name.capnp
rm $f.bak
done
mkdir gen/go
go install capnproto.org/go/capnp/v3/capnpc-go@latest
capnp compile -I$(go env GOPATH)/src/capnproto.org/go/capnp/std -o go:gen/go *.capnp
git checkout *.capnp
cat <<EOF > gen/go/go.mod
module github.com/commaai/cereal
go 1.19
EOF
popd
# Go program
go build -o webrtc-body main.go