| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 | #!/bin/bash# Run this script in the top nanopb directory to create a binary package# for Linux users.set -eset -xVERSION=`git describe --always`-linux-x86DEST=dist/$VERSIONrm -rf $DESTmkdir -p $DEST# Export the files from newest commitgit archive HEAD | tar x -C $DEST# Rebuild the Python .proto filesmake -BC $DEST/generator/proto# Make the nanopb generator available as a protoc plugincp $DEST/generator/nanopb_generator.py $DEST/generator/protoc-gen-nanopb.py# Package the Python libraries( cd $DEST/generator; bbfreeze nanopb_generator.py protoc-gen-nanopb.py )mv $DEST/generator/dist $DEST/generator-bin# Remove temp filerm $DEST/generator/protoc-gen-nanopb.py# Package the protoc compilercp `which protoc` $DEST/generator-bin/protoc.binLIBPROTOC=$(ldd `which protoc` | grep -o '/.*libprotoc[^ ]*')LIBPROTOBUF=$(ldd `which protoc` | grep -o '/.*libprotobuf[^ ]*')cp $LIBPROTOC $LIBPROTOBUF $DEST/generator-bin/cat > $DEST/generator-bin/protoc << EOF#!/bin/bashSCRIPTDIR=\$(dirname "\$0")export LD_LIBRARY_PATH=\$SCRIPTDIRexport PATH=\$SCRIPTDIR:\$PATHexec "\$SCRIPTDIR/protoc.bin" "\$@"EOFchmod +x $DEST/generator-bin/protoc# Tar it all up( cd dist; tar -czf $VERSION.tar.gz $VERSION )
 |