File: make_linux_package.sh

package info (click to toggle)
nanopb 0.4.9.1-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,676 kB
  • sloc: ansic: 12,144; python: 2,795; cpp: 190; sh: 163; makefile: 85
file content (42 lines) | stat: -rwxr-xr-x 1,395 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash

# Run this script in the top nanopb directory to create a binary package
# for Linux users.

# Requires: protobuf, python-protobuf, pyinstaller

set -e
set -x

VERSION=`git describe --always`-linux-x86
DEST=dist/$VERSION

rm -rf $DEST
mkdir -p $DEST

# Export the files from newest commit
git archive HEAD | tar x -C $DEST

# Rebuild the Python .proto files and .pyc
( cd $DEST/generator; python3 nanopb_generator.py ||: )

# Package the Python libraries
( cd $DEST/generator; python3 -m PyInstaller --collect-all grpc_tools.grpc_version --strip nanopb_generator.py )
( cd $DEST/generator; python3 -m PyInstaller --collect-all grpc_tools.grpc_version --strip protoc  )
mv $DEST/generator/dist/nanopb_generator $DEST/generator-bin
cp $DEST/generator/dist/protoc/protoc $DEST/generator-bin

# Include Google's descriptor.proto and nanopb.proto
mkdir -p $DEST/generator-bin/grpc_tools/
cp -pr $(python3 -c 'import grpc_tools, os.path; print(os.path.dirname(grpc_tools.__file__))')/_proto $DEST/generator-bin/grpc_tools/
cp -pr $DEST/generator/proto $DEST/generator-bin/proto

# Remove temp files
rm -rf $DEST/generator/dist $DEST/generator/build $DEST/generator/nanopb_generator.spec

# Make the nanopb generator available as a protoc plugin
cp $DEST/generator-bin/nanopb_generator $DEST/generator-bin/protoc-gen-nanopb

# Tar it all up
( cd dist; tar -czf $VERSION.tar.gz $VERSION )