summaryrefslogblamecommitdiffstats
path: root/scripts/qemu-version.sh
blob: 3f6e7e6d41d87b026a7a40681e2530e7c04bfc8a (plain) (tree)
1
2
3
4
5
6
7
8
9







               
                             

                        
                                                            












                                        
#!/bin/sh

set -eu

dir="$1"
pkgversion="$2"
version="$3"

if [ -z "$pkgversion" ]; then
    cd "$dir"
    if [ -e .git ]; then
        pkgversion=$(git describe --match 'v*' --dirty) || :
    fi
fi

if [ -n "$pkgversion" ]; then
    fullversion="$version ($pkgversion)"
else
    fullversion="$version"
fi

cat <<EOF
#define QEMU_PKGVERSION "$pkgversion"
#define QEMU_FULL_VERSION "$fullversion"
EOF