I tried all different kinds of modifications to PKGBUILD but with no success. I later realized that if I unpacked manually and tried to compile it worked, even giving a functional executable. Then I tried forcing a manual extraction of the sources in PKBUILD and I still got the same error. The only way it would compile without the error is if the sources remained outside of makepkg's default 'src' folder. Nothing else worked.
Why is this? Is this a bug in makepkg? Is there something wrong with my installation?
Here is the original PKBUILD: http://aur.archlinux.org/packages/kvpm/kvpm/PKGBUILD
and the PKBUILD that worked for me: http://aur.pastebin.com/VFXr8RJB