Merging build-fixes branch to trunk. Fixes problems and simplifies build system. Reviewed by: Dr. Vigmond