(locfile): Fix it for building with sourcedir==builddir and for static only