Add build script for windows package
[apps/agl-service-can-low-level.git] / tools / make_windows_package.sh
1 #!/bin/bash
2
3 # Run this script in the top nanopb directory to create a binary package
4 # for Windows users. This script is designed to run under MingW/MSYS bash
5
6 set -e
7 set -x
8
9 VERSION=`git describe --always`
10 DEST=dist/$VERSION
11
12 rm -rf $DEST
13 mkdir -p $DEST
14
15 # Export the files from newest commit
16 git archive HEAD | tar x -C $DEST
17
18 # Rebuild the Python .proto files
19 make -BC $DEST/generator/proto
20
21 # Make the nanopb generator available as a protoc plugin
22 cp $DEST/generator/nanopb_generator.py $DEST/generator/protoc-gen-nanopb.py
23
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
27
28 # Remove temp file
29 rm $DEST/generator/protoc-gen-nanopb.py
30
31 # Package the protoc compiler
32 cp `which protoc`.exe $DEST/generator-bin/
33