#!/bin/sh

packages="$(readlink -f $(dirname $0)/../../packages/packages.current)"

claws_type=$(grep -E "^claws_mail," ${packages} | cut -f 3 -d ,)
if [ "x${claws_type}" != "xgit" ]; then
	exit 0
fi

# The claws-mail autogen.sh script expects the 'version' file to contain
# the output from 'git describe --abbrev=6' when building a git snapshot

claws_full_ver=$(grep -E "^claws_mail," ${packages} | cut -f 2 -d ,)
if [ -z "$claws_full_ver" ]; then
	printf "Failed to read claws package version from packages file\n"
	exit 1
fi

echo "echo ${claws_full_ver}" > version

NOCONFIGURE=1 ./autogen.sh

