build: Enable detailed version information when built from shallow clone or tarball

Change-Id: Ie2cc05687f4bce136451d316f32e9bab3e82844a
Refs: #1915