Fix major build issues

Hello, this request fixes severe issues preventing RPM package build for openSUSE. Lots of minor issues still remain, but they cause no build abort.