Skip to content

meson: use project version for build version instead of git describe

Philip Sequeira requested to merge qmega/libplacebo:custom_build_version into master

I was confused when my git master build of libplacebo identified itself as "v6.338.0-70-gc320f61e". It seems git describe doesn't come up with a very accurate version string anymore. This change uses the project version from meson, then adds a commit count, hash, and -dirty if applicable. Format matches git describe except that the commit count is absolute rather than relative to a tag. Example: v7.342.0-3499-gfd0ac5b5

This feels a little bit over-engineered, but I couldn't see a way to get vcs_tag or a single git command to spit out something reasonable. Note that this would be slightly pickier than the previous implementation in the face of errors running git: While vcs_tag will use the fallback version if anything at all goes wrong running the command, this script will fallback if git isn't found or returns non-zero for any reason on the first call, but if the first call to git works, subsequent calls failing will fail the build.

Edited by Philip Sequeira

Merge request reports