roc-streaming / roc-toolkit

Real-time audio streaming over the network.
https://roc-streaming.org
Mozilla Public License 2.0
1.06k stars 213 forks source link

Add git sha to version info #241

Closed gavv closed 5 years ago

gavv commented 5 years ago

Currently Roc tools (roc-recv, roc-send, roc-conv) can report version. The version is read from the version file during build time and passed to the tools using a preprocessor.

It would be very useful to report git commit sha as well. This is particularly useful when there are several boxes with binaries built from different commits yet from the same version.

The commit sha can be retrieved by:

git rev-parse HEAD

However, I think it would be better to avoid using git executable and retrieve it manually. Otherwise we will add build-time dependency on git, which is not really necessary and is inconvenient e.g. when building on an embedded host. Example:

cat .git/$(cat .git/HEAD | awk '{print $2}')

We should retrieve the sha SConstruct, add a preprocessor definition with the sha to the build, and report it in tools.

gavv commented 5 years ago

PR is merged into develop.