3 # Run this script in the top nanopb directory to create a binary package
9 VERSION=`git describe --always`
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 # Package the Python libraries
22 ( cd $DEST/generator; bbfreeze nanopb_generator.py )
23 mv $DEST/generator/dist $DEST/generator-bin
25 # Package the protoc compiler
26 cp `which protoc` $DEST/generator-bin/protoc.bin
27 LIBPROTOC=$(ldd `which protoc` | grep -o '/.*libprotoc[^ ]*')
28 cp $LIBPROTOC $DEST/generator-bin/
29 cat > $DEST/generator-bin/protoc << EOF
31 SCRIPTDIR=\$(dirname \$(readlink -f \$0))
32 export LD_LIBRARY_PATH=\$SCRIPTDIR
33 export PATH=\$SCRIPTDIR:\$PATH
34 exec \$SCRIPTDIR/protoc.bin "\$@"
36 chmod +x $DEST/generator-bin/protoc
38 # Make the nanopb generator available as a protoc plugin
39 ln -s nanopb-generator $DEST/generator-bin/protoc-gen-nanopb
42 ( cd dist; tar -czf $VERSION.tar.gz $VERSION )