librespot/protocol/build.sh
Paul Lietar c6327af2f3 Include pre-generated protocol files.
A build script is used to ensure the source files haven’t been modified.
2016-12-30 12:02:00 +01:00

29 lines
544 B
Bash

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