3 # Run this script in the top nanopb directory to create a binary package
9 VERSION=`git describe --always`-linux-x86
15 # Export the files from newest commit
16 git archive HEAD | tar x -C $DEST
18 # Rebuild the Python .proto files
19 make -BC $DEST/generator/proto
21 # Make the nanopb generator available as a protoc plugin
22 cp $DEST/generator/nanopb_generator.py $DEST/generator/protoc-gen-nanopb.py
24 # Package the Python libraries
25 ( cd $DEST/generator; bbfreeze nanopb_generator.py protoc-gen-nanopb.py )
26 mv $DEST/generator/dist $DEST/generator-bin
29 rm $DEST/generator/protoc-gen-nanopb.py
31 # Package the protoc compiler
32 cp `which protoc` $DEST/generator-bin/protoc.bin
33 LIBPROTOC=$(ldd `which protoc` | grep -o '/.*libprotoc[^ ]*')
34 LIBPROTOBUF=$(ldd `which protoc` | grep -o '/.*libprotobuf[^ ]*')
35 cp $LIBPROTOC $LIBPROTOBUF $DEST/generator-bin/
36 cat > $DEST/generator-bin/protoc << EOF
38 SCRIPTDIR=\$(dirname "\$0")
39 export LD_LIBRARY_PATH=\$SCRIPTDIR
40 export PATH=\$SCRIPTDIR:\$PATH
41 exec "\$SCRIPTDIR/protoc.bin" "\$@"
43 chmod +x $DEST/generator-bin/protoc
46 ( cd dist; tar -czf $VERSION.tar.gz $VERSION )