xref: /openbmc/qemu/scripts/qemu-version.sh (revision f6476697)
1#!/bin/sh
2
3set -eu
4
5dir="$1"
6pkgversion="$2"
7version="$3"
8
9if [ -z "$pkgversion" ]; then
10    cd "$dir"
11    if [ -e .git ]; then
12        pkgversion=$(git describe --match 'v*' --dirty) || :
13    fi
14fi
15
16if [ -n "$pkgversion" ]; then
17    fullversion="$version ($pkgversion)"
18else
19    fullversion="$version"
20fi
21
22cat <<EOF
23#define QEMU_PKGVERSION "$pkgversion"
24#define QEMU_FULL_VERSION "$fullversion"
25EOF
26