librespot/protocol/build.sh

30 lines
544 B
Bash
Raw Normal View History

set -eu
SRC="authentication keyexchange mercury
metadata pubsub spirc"
cat > src/lib.rs <<EOF
// Autogenerated by build.sh
extern crate protobuf;
EOF
cat > files.rs <<EOF
// Autogenerated by build.sh
pub const FILES : &'static [(&'static str, u32)] = &[
EOF
for name in $SRC; do
src=proto/$name.proto
out=src/$name.rs
checksum=$(cksum $src | cut -f 1 -d' ')
protoc --rust_out src/ -I proto/ proto/$name.proto
echo "pub mod $name;" >> src/lib.rs
echo " (\"$src\", $checksum)," >> files.rs
done
echo "];" >> files.rs