#!/bin/sh
# Ship a .version in the tarball, so that a build from it does not need
# git.  A checkout without reachable tags has no .version to copy, so
# fall back to the version meson resolved for this dist run.
set -eu

if [ -f "$MESON_SOURCE_ROOT/.version" ]; then
  cp "$MESON_SOURCE_ROOT/.version" "$MESON_DIST_ROOT/.version"
else
  echo "$MESON_PROJECT_VERSION" > "$MESON_DIST_ROOT/.version"
fi
