write version file to source dir instead of binary.

This patch needs for correct work of out-of-source builds
from tarbals without .git repository within.