build.sh 544 B

1234567891011121314151617181920212223242526272829
  1. set -eu
  2. SRC="authentication keyexchange mercury
  3. metadata pubsub spirc"
  4. cat > src/lib.rs <<EOF
  5. // Autogenerated by build.sh
  6. extern crate protobuf;
  7. EOF
  8. cat > files.rs <<EOF
  9. // Autogenerated by build.sh
  10. pub const FILES : &'static [(&'static str, u32)] = &[
  11. EOF
  12. for name in $SRC; do
  13. src=proto/$name.proto
  14. out=src/$name.rs
  15. checksum=$(cksum $src | cut -f 1 -d' ')
  16. protoc --rust_out src/ -I proto/ proto/$name.proto
  17. echo "pub mod $name;" >> src/lib.rs
  18. echo " (\"$src\", $checksum)," >> files.rs
  19. done
  20. echo "];" >> files.rs